@@ -48,6 +49,10 @@ const Settings = () => {
+
+
+
+
diff --git a/src/store/settings-store.ts b/src/store/settings-store.ts
index 685ad075..10de0759 100644
--- a/src/store/settings-store.ts
+++ b/src/store/settings-store.ts
@@ -2,7 +2,7 @@ import { BsDatabaseFillGear, BsDatabaseLock } from "solid-icons/bs";
import { HiSolidCog8Tooth } from "solid-icons/hi";
import { RiDeviceKeyboardFill } from "solid-icons/ri";
import { TbResize } from "solid-icons/tb";
-import { VsHistory } from "solid-icons/vs";
+import { VsHistory, VsReplaceAll } from "solid-icons/vs";
import { createRoot, createSignal } from "solid-js";
import { invokeCommand } from "../lib/tauri";
import { Settings, SettingsTab } from "../types";
@@ -32,6 +32,11 @@ function createSettingsStore() {
},
{
name: SETTINGS_TAB[5],
+ Icon: VsReplaceAll,
+ current: false,
+ },
+ {
+ name: SETTINGS_TAB[6],
Icon: TbResize,
current: false,
},
diff --git a/src/types/index.ts b/src/types/index.ts
index d8b29063..9a0ca621 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -119,6 +119,7 @@ export type Hotkey = {
export type Settings = {
id: number;
language: Language;
+ text_matchers: TextMatcher[];
startup: boolean;
sync: boolean;
sync_limit: number;
@@ -134,3 +135,9 @@ export type Settings = {
max_rtf_size: number;
max_html_size: number;
};
+
+export type TextMatcher = {
+ match_expression: string;
+ substitution: string;
+ enabled: boolean;
+};
diff --git a/src/types/tauri-invoke.ts b/src/types/tauri-invoke.ts
index 85725f09..dab4b28f 100644
--- a/src/types/tauri-invoke.ts
+++ b/src/types/tauri-invoke.ts
@@ -1,4 +1,4 @@
-import { ClipboardResponse, ClipboardWhere, DatabaseInfo, Hotkey, Settings } from ".";
+import { ClipboardResponse, ClipboardWhere, DatabaseInfo, Hotkey, Settings, TextMatcher } from ".";
import { ClipboardType, FolderLocation, PasswordAction, WebWindow } from "./enums";
export enum InvokeCommand {
@@ -18,6 +18,7 @@ export enum InvokeCommand {
// Settings commands
GetSettings = "get_settings",
UpdateSettings = "update_settings",
+ ChangeSettingsTextMatchers = "change_settings_text_matchers",
ToggleAutostart = "toggle_autostart",
ChangeClipboardDbLocation = "change_clipboard_db_location",
ResetClipboardDbLocation = "reset_clipboard_db_location",
@@ -94,6 +95,10 @@ export interface TauriInvokeCommands {
args: { settings: Settings };
return: void;
};
+ [InvokeCommand.ChangeSettingsTextMatchers]: {
+ args: { textMatchers: TextMatcher[] };
+ return: TextMatcher[];
+ };
[InvokeCommand.ToggleAutostart]: {
args: undefined;
return: void;
@@ -145,7 +150,7 @@ export interface TauriInvokeCommands {
return: void;
};
[InvokeCommand.PasswordUnlock]: {
- args: { password: string, action: PasswordAction };
+ args: { password: string; action: PasswordAction };
return: void;
};
diff --git a/src/utils/constants.ts b/src/utils/constants.ts
index 5575d1c1..340077b4 100644
--- a/src/utils/constants.ts
+++ b/src/utils/constants.ts
@@ -7,6 +7,10 @@ export const DEFAULT_SIZE = 10_485_760;
export const MIN_PASSWORD_LENGTH = 1;
export const MAX_PASSWORD_LENGTH = 128;
+export const MIN_PATTERN_LENGTH = 1;
+export const MAX_PATTERN_LENGTH = 128;
+export const MIN_DESCRIPTION_LENGTH = 1;
+export const MAX_DESCRIPTION_LENGTH = 128;
export const MAX_SYNC_LIMIT = 250;
@@ -16,6 +20,7 @@ export const SETTINGS_TAB = [
"SETTINGS.TAB.ENCRYPTION",
"SETTINGS.TAB.HISTORY",
"SETTINGS.TAB.HOTKEYS",
+ "SETTINGS.TAB.PATTERNS",
"SETTINGS.TAB.LIMITS",
] as const satisfies readonly DictionaryKey[];