From 07665a81a543822528262504d0e933fdbc104951 Mon Sep 17 00:00:00 2001 From: Sergey Kurdin Date: Sat, 18 Jan 2025 18:32:05 -0500 Subject: [PATCH] update to add an option to trim spaces on history capture --- migrations/2023-08-05-230732_seeds/up.sql | 3 ++ packages/pastebar-app-ui/src/App.tsx | 2 + .../pastebar-app-ui/src/QuickPasteApp.tsx | 4 ++ .../src/locales/lang/en/settings.yaml | 2 + .../src/locales/lang/esES/settings.yaml | 2 + .../src/locales/lang/fr/settings.yaml | 2 + .../src/locales/lang/it/settings.yaml | 2 + .../src/locales/lang/ru/settings.yaml | 2 + .../src/locales/lang/tr/settings.yaml | 2 + .../src/locales/lang/uk/settings.yaml | 2 + .../src/locales/lang/zhCN/settings.yaml | 2 + .../settings/ClipboardHistorySettings.tsx | 43 +++++++++++++++++-- .../src/store/settingsStore.ts | 14 ++++++ src-tauri/src/clipboard/mod.rs | 8 ++++ 14 files changed, 86 insertions(+), 4 deletions(-) diff --git a/migrations/2023-08-05-230732_seeds/up.sql b/migrations/2023-08-05-230732_seeds/up.sql index 8a1c1809..aaa83dd5 100644 --- a/migrations/2023-08-05-230732_seeds/up.sql +++ b/migrations/2023-08-05-230732_seeds/up.sql @@ -30,6 +30,9 @@ VALUES ('isHistoryEnabled', NULL, true, NULL); INSERT INTO settings (name, value_text, value_bool, value_int) VALUES ('isHistoryAutoUpdateOnCaputureEnabled', NULL, true, NULL); +INSERT INTO settings (name, value_text, value_bool, value_int) +VALUES ('isHistoryAutoTrimOnCaputureEnabled', NULL, true, NULL); + INSERT INTO settings (name, value_text, value_bool, value_int) VALUES ('isHistoryDetectLanguageEnabled', NULL, true, NULL); diff --git a/packages/pastebar-app-ui/src/App.tsx b/packages/pastebar-app-ui/src/App.tsx index 5ac5e5c1..25c6bb17 100644 --- a/packages/pastebar-app-ui/src/App.tsx +++ b/packages/pastebar-app-ui/src/App.tsx @@ -132,6 +132,8 @@ function App() { settings.historyDetectLanguagesEnabledList?.valueText.split(','), appToursCompletedList: settings.appToursCompletedList?.valueText.split(','), appToursSkippedList: settings.appToursSkippedList?.valueText.split(','), + isHistoryAutoTrimOnCaputureEnabled: + settings.isHistoryAutoTrimOnCaputureEnabled?.valueBool, isHistoryAutoUpdateOnCaputureEnabled: settings.isHistoryAutoUpdateOnCaputureEnabled?.valueBool, isHistoryEnabled: settings.isHistoryEnabled?.valueBool, diff --git a/packages/pastebar-app-ui/src/QuickPasteApp.tsx b/packages/pastebar-app-ui/src/QuickPasteApp.tsx index ad815867..4cacbb19 100644 --- a/packages/pastebar-app-ui/src/QuickPasteApp.tsx +++ b/packages/pastebar-app-ui/src/QuickPasteApp.tsx @@ -72,6 +72,8 @@ function QuickPasteApp() { settings.historyDetectLanguagesEnabledList?.valueText.split(','), appToursCompletedList: settings.appToursCompletedList?.valueText.split(','), appToursSkippedList: settings.appToursSkippedList?.valueText.split(','), + isHistoryAutoTrimOnCaputureEnabled: + settings.isHistoryAutoTrimOnCaputureEnabled?.valueBool, isHistoryAutoUpdateOnCaputureEnabled: settings.isHistoryAutoUpdateOnCaputureEnabled?.valueBool, isHistoryEnabled: settings.isHistoryEnabled?.valueBool, @@ -118,6 +120,8 @@ function QuickPasteApp() { isShowDisabledCollectionsOnNavBarMenu: settings.isShowDisabledCollectionsOnNavBarMenu?.valueBool, userSelectedLanguage: settings.userSelectedLanguage?.valueText, + clipTextMinLength: settings.clipTextMinLength?.valueInt, + clipTextMaxLength: settings.clipTextMaxLength?.valueInt, isAppReady: true, }) diff --git a/packages/pastebar-app-ui/src/locales/lang/en/settings.yaml b/packages/pastebar-app-ui/src/locales/lang/en/settings.yaml index 9358160f..f28bc7c7 100644 --- a/packages/pastebar-app-ui/src/locales/lang/en/settings.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/en/settings.yaml @@ -22,6 +22,7 @@ Auto-Clear Settings: Auto-Clear Settings Auto-Generate Link Card Preview: Auto-Generate Link Card Preview Auto-Preview Link on Hover: Auto-Preview Link on Hover Auto-Star on Double Copy: Auto-Star on Double Copy +Auto-Trim Spaces on Capture: Auto-Trim Spaces on Capture Auto-Update on Capture: Auto-Update on Capture Auto-delete clipboard history after: Auto-delete clipboard history after ? Automatically create link card preview in the clipboard history. This allows to quickly view website details without opening or pasting the link. @@ -58,6 +59,7 @@ Enable Clip Title Hover Show with Delay: Enable Clip Title Hover Show with Delay Enable application auto start on system boot: Enable application auto start on system boot Enable auto lock the application screen after a certain period of inactivity, to prevent unauthorized access to your data.: Enable auto lock the application screen after a certain period of inactivity, to prevent unauthorized access to your data. Enable auto lock the application screen when user not active: Enable auto lock the application screen when user not active +Enable auto trim spaces on history capture: Enable auto trim spaces on history capture Enable auto update on capture: Enable auto update on capture Enable history capture: Enable history capture Enable programming language detection: Enable programming language detection diff --git a/packages/pastebar-app-ui/src/locales/lang/esES/settings.yaml b/packages/pastebar-app-ui/src/locales/lang/esES/settings.yaml index 7e69157a..b0535957 100644 --- a/packages/pastebar-app-ui/src/locales/lang/esES/settings.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/esES/settings.yaml @@ -22,6 +22,7 @@ Auto-Clear Settings: Ajustes de Borrado Automático Auto-Generate Link Card Preview: Generar Auto Vista Previa de Tarjeta de Enlace Auto-Preview Link on Hover: Vista Previa Auto de Enlace al Pasar Auto-Star on Double Copy: Estrella Auto al Copiar Dos Veces +Auto-Trim Spaces on Capture: Recortar espacios automáticamente al capturar Auto-Update on Capture: Actualización Auto al Capturar Auto-delete clipboard history after: Borrar auto el historial después de ? Automatically create link card preview in the clipboard history. This allows to quickly view website details without opening or pasting the link. @@ -58,6 +59,7 @@ Enable Clip Title Hover Show with Delay: Habilitar Mostrar Título del Clip al P Enable application auto start on system boot: Habilitar inicio automático de la aplicación al arrancar el sistema Enable auto lock the application screen after a certain period of inactivity, to prevent unauthorized access to your data.: Habilita el bloqueo automático de la pantalla después de un período de inactividad para prevenir acceso no autorizado a tus datos. Enable auto lock the application screen when user not active: Habilitar bloqueo automático de la pantalla cuando el usuario no está activo +Enable auto trim spaces on history capture: Activar recorte automático de espacios al capturar el historial Enable auto update on capture: Habilitar actualización automática al capturar Enable history capture: Habilitar captura de historial Enable programming language detection: Habilitar detección de lenguaje de programación diff --git a/packages/pastebar-app-ui/src/locales/lang/fr/settings.yaml b/packages/pastebar-app-ui/src/locales/lang/fr/settings.yaml index 9720a7db..e01c6fa7 100644 --- a/packages/pastebar-app-ui/src/locales/lang/fr/settings.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/fr/settings.yaml @@ -22,6 +22,7 @@ Auto-Clear Settings: Paramètres d'auto-nettoyage Auto-Generate Link Card Preview: Génération automatique d'un aperçu de la carte de lien Auto-Preview Link on Hover: Lien de prévisualisation automatique au survol Auto-Star on Double Copy: Étoile automatique en cas double copie +Auto-Trim Spaces on Capture: Suppression automatique des espaces à la capture Auto-Update on Capture: Mise à jour automatique à la capture Auto-delete clipboard history after: Suppression automatique de l'historique du presse-papiers après ? Automatically create link card preview in the clipboard history. This allows to quickly view website details without opening or pasting the link. @@ -58,6 +59,7 @@ Enable Clip Title Hover Show with Delay: Activer l'affichage du titre du clip au Enable application auto start on system boot: Activer démarrage auto de l'app au démarrage système Enable auto lock the application screen after a certain period of inactivity, to prevent unauthorized access to your data.: Activez le verrouillage automatique de l'écran de l'application après une certaine période d'inactivité, afin d'empêcher tout accès non autorisé à vos données. Enable auto lock the application screen when user not active: Activer le verrouillage automatique de l'écran de l'application lorsque l'utilisateur n'est pas actif +Enable auto trim spaces on history capture: Activer la suppression automatique des espaces lors de la capture de l'historique Enable auto update on capture: Activer la mise à jour automatique lors de la capture Enable history capture: Activer la capture de l'historique Enable programming language detection: Activer la détection du langage de programmation diff --git a/packages/pastebar-app-ui/src/locales/lang/it/settings.yaml b/packages/pastebar-app-ui/src/locales/lang/it/settings.yaml index d00d8da6..5b11033c 100644 --- a/packages/pastebar-app-ui/src/locales/lang/it/settings.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/it/settings.yaml @@ -22,6 +22,7 @@ Auto-Generate Link Card Preview: Genera Automaticamente l'Anteprima della Scheda Auto-Preview Link on Hover: Anteprima Automatica del Link al Passaggio del Mouse Auto-Star on Double Copy: Stella Automatica al Doppio Copia Auto-Update on Capture: Aggiornamento Automatico alla Cattura +Auto-Trim Spaces on Capture: Rimozione automatica degli spazi alla cattura Auto-delete clipboard history after: Elimina automaticamente la cronologia degli appunti dopo ? Automatically create link card preview in the clipboard history. This allows to quickly view website details without opening or pasting the link. : Crea automaticamente l'anteprima della scheda link nella cronologia degli appunti. Questo permette di visualizzare rapidamente i dettagli del sito web senza aprire o incollare il link. @@ -57,6 +58,7 @@ Enable Clip Title Hover Show with Delay: Abilita Visualizzazione del Titolo del Enable application auto start on system boot: Abilita l'avvio automatico dell'applicazione all'avvio del sistema Enable auto lock the application screen after a certain period of inactivity, to prevent unauthorized access to your data.: Abilita il blocco automatico dello schermo dell'applicazione dopo un certo periodo di inattività, per prevenire l'accesso non autorizzato ai tuoi dati. Enable auto lock the application screen when user not active: Abilita il blocco automatico dello schermo dell'applicazione quando l'utente non è attivo +Enable auto trim spaces on history capture: Attiva la rimozione automatica degli spazi durante la cattura della cronologia Enable auto update on capture: Abilita l'aggiornamento automatico alla cattura Enable history capture: Abilita la cattura della cronologia Enable programming language detection: Abilita il rilevamento del linguaggio di programmazione diff --git a/packages/pastebar-app-ui/src/locales/lang/ru/settings.yaml b/packages/pastebar-app-ui/src/locales/lang/ru/settings.yaml index 4c6baf68..477894a4 100644 --- a/packages/pastebar-app-ui/src/locales/lang/ru/settings.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/ru/settings.yaml @@ -22,6 +22,7 @@ Auto-Preview Link on Hover: Автоматический предварител Auto-Star on Double Copy: Автоматическое добавление в избранное при двойном копировании Auto-Update on Capture: Автоматическое обновление при захвате Auto-delete clipboard history after: Автоматическое удаление истории буфера обмена после +Auto-Trim Spaces on Capture: Автоматическое удаление пробелов при захвате ? Automatically create link card preview in the clipboard history. This allows to quickly view website details without opening or pasting the link. : Автоматически создавать предварительный просмотр ссылок в истории буфера обмена. Это позволяет быстро просматривать детали веб-сайтов без открытия или вставки ссылки. ? Automatically create link preview in the clipboard history. This allows to quickly view website details without opening or pasting the link. @@ -58,6 +59,7 @@ Enable Clip Title Hover Show with Delay: Включить задержку по Enable application auto start on system boot: Включить автозапуск приложения при загрузке системы Enable auto lock the application screen after a certain period of inactivity, to prevent unauthorized access to your data.: Включить автоматическую блокировку экрана приложения после определенного периода бездействия, чтобы предотвратить несанкционированный доступ к вашим данным. Enable auto update on capture: Включить автоматическое обновление при захвате +Enable auto trim spaces on history capture: Включить автоматическое удаление пробелов при захвате истории буфера Enable history capture: Включить захват истории буфера Enable programming language detection: Включить определение языка программирования Enable screen unlock requirement on app launch for enhanced security, safeguarding data from unauthorized access.: Включить требование разблокировки экрана при запуске приложения для повышения безопасности, защиты данных от несанкционированного доступа. diff --git a/packages/pastebar-app-ui/src/locales/lang/tr/settings.yaml b/packages/pastebar-app-ui/src/locales/lang/tr/settings.yaml index d5eea1be..f37eb147 100644 --- a/packages/pastebar-app-ui/src/locales/lang/tr/settings.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/tr/settings.yaml @@ -23,6 +23,7 @@ Auto-Generate Link Card Preview: Otomatik Bağlantı Kartı Önizlemesi Oluştur Auto-Preview Link on Hover: Üzerine gelindiğinde Bağlantıyı Otomatik Önizleme Auto-Star on Double Copy: Çift Kopyalamada Otomatik Favorile Auto-Update on Capture: Yakalamada Otomatik Güncelleme +Auto-Trim Spaces on Capture: Yakalamada Otomatik Boşluk Kaldırma Auto-delete clipboard history after: Panonun geçmişini otomatik olarak sil ? Automatically create link card preview in the clipboard history. This allows to quickly view website details without opening or pasting the link. : Bağlantı kartı önizlemesini pano geçmişinde otomatik olarak oluşturun. Bu, bağlantıyı açmadan veya yapıştırmadan web sitesi ayrıntılarını hızlı bir şekilde görüntülemenizi sağlar. @@ -59,6 +60,7 @@ Enable application auto start on system boot: Sistem açıldığında uygulaman Enable auto lock the application screen after a certain period of inactivity, to prevent unauthorized access to your data.: Verilerinize yetkisiz erişimi önlemek için, belirli bir süre hareketsizlikten sonra uygulama ekranının otomatik olarak kilitlenmesini etkinleştirin. Enable auto lock the application screen when user not active: Kullanıcı aktif olmadığında uygulama ekranının otomatik olarak kilitlenmesini etkinleştirin Enable auto update on capture: Yakalama sırasında otomatik güncellemeyi etkinleştir +Enable auto trim spaces on history capture: Geçmiş yakalamada otomatik boşluk kırpmayı etkinleştir Enable history capture: Geçmiş yakalamayı etkinleştir Enable programming language detection: Programlama dili algılamayı etkinleştir Enable screen unlock requirement on app launch for enhanced security, safeguarding data from unauthorized access.: Gelişmiş güvenlik için uygulama başlatıldığında ekran kilidi açma gereksinimini etkinleştirin ve verileri yetkisiz erişime karşı koruyun. diff --git a/packages/pastebar-app-ui/src/locales/lang/uk/settings.yaml b/packages/pastebar-app-ui/src/locales/lang/uk/settings.yaml index 213d2abe..1b1abd21 100644 --- a/packages/pastebar-app-ui/src/locales/lang/uk/settings.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/uk/settings.yaml @@ -22,6 +22,7 @@ Auto-Preview Link on Hover: Автоматичний попередній пер Auto-Star on Double Copy: Автоматичне додавання до вибраного при подвійному копіюванні Auto-Update on Capture: Автоматичне оновлення при захопленні Auto-delete clipboard history after: Автоматичне видалення історії буфера обміну після +Auto-Trim Spaces on Capture: Автоматичне видалення пробілів при захопленні ? Automatically create link card preview in the clipboard history. This allows to quickly view website details without opening or pasting the link. : Автоматично створювати попередній перегляд посилань в історії буфера обміну. Це дозволяє швидко переглядати деталі веб-сайтів без відкриття або вставки посилання. ? Automatically create link preview in the clipboard history. This allows to quickly view website details without opening or pasting the link. @@ -58,6 +59,7 @@ Enable Clip Title Hover Show with Delay: Увімкнути затримку п Enable application auto start on system boot: Увімкнути автозапуск додатку при завантаженні системи Enable auto lock the application screen after a certain period of inactivity, to prevent unauthorized access to your data.: Увімкнути автоматичне блокування екрану додатку після певного періоду бездіяльності, щоб запобігти несанкціонованому доступу до ваших даних. Enable auto update on capture: Увімкнути автоматичне оновлення при захопленні +Enable auto trim spaces on history capture: Увімкнути автоматичне видалення пробілів при захопленні історії буфера Enable history capture: Увімкнути захоплення історії буфера Enable programming language detection: Увімкнути визначення мови програмування Enable screen unlock requirement on app launch for enhanced security, safeguarding data from unauthorized access.: Увімкнути вимогу розблокування екрану при запуску додатку для підвищення безпеки, захисту даних від несанкціонованого доступу. diff --git a/packages/pastebar-app-ui/src/locales/lang/zhCN/settings.yaml b/packages/pastebar-app-ui/src/locales/lang/zhCN/settings.yaml index 2d6396ae..297eb6a3 100644 --- a/packages/pastebar-app-ui/src/locales/lang/zhCN/settings.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/zhCN/settings.yaml @@ -23,6 +23,7 @@ Auto-Generate Link Card Preview: 自动生成链接卡片预览 Auto-Preview Link on Hover: 悬停时自动预览链接 Auto-Star on Double Copy: 双重复制时自动星标 Auto-Update on Capture: 捕获时自动更新 +Auto-Trim Spaces on Capture: 捕获时自动删除空格 Auto-delete clipboard history after: 自动删除剪贴板历史时间 ? Automatically create link card preview in the clipboard history. This allows to quickly view website details without opening or pasting the link. : 在剪贴板历史中自动创建链接卡片预览。这允许快速查看网站详情,无需打开或粘贴链接。 @@ -59,6 +60,7 @@ Enable application auto start on system boot: 启用系统启动时应用程序 Enable auto lock the application screen after a certain period of inactivity, to prevent unauthorized access to your data.: 启用在一定时间不活动后自动锁定应用程序屏幕,以防止未经授权访问您的数据。 Enable auto lock the application screen when user not active: 用户不活动时启用自动锁定应用程序屏幕 Enable auto update on capture: 启用捕获时自动更新 +Enable auto trim spaces on history capture: 启用历史记录捕获时自动修剪空格 Enable history capture: 启用历史捕获 Enable programming language detection: 启用编程语言检测 Enable screen unlock requirement on app launch for enhanced security, safeguarding data from unauthorized access.: 启用应用启动时的屏幕解锁要求,以增强安全性,保护数据免受未授权访问。 diff --git a/packages/pastebar-app-ui/src/pages/settings/ClipboardHistorySettings.tsx b/packages/pastebar-app-ui/src/pages/settings/ClipboardHistorySettings.tsx index eb2f20e1..2d52c6d8 100644 --- a/packages/pastebar-app-ui/src/pages/settings/ClipboardHistorySettings.tsx +++ b/packages/pastebar-app-ui/src/pages/settings/ClipboardHistorySettings.tsx @@ -88,6 +88,8 @@ export default function ClipboardHistorySettings() { setClipTextMaxLength, setIsHistoryEnabled, isHistoryAutoUpdateOnCaputureEnabled, + setIsHistoryAutoTrimOnCaputureEnabled, + isHistoryAutoTrimOnCaputureEnabled, setIsHistoryAutoUpdateOnCaputureEnabled, setIsExclusionListEnabled, setIsExclusionAppListEnabled, @@ -300,11 +302,10 @@ export default function ClipboardHistorySettings() { onChange={e => { const value = e.target.value if (value === '') { - setClipTextMinLength(0); + setClipTextMinLength(0) } else { const number = parseInt(value) setClipTextMinLength(number) - } }} /> @@ -324,7 +325,7 @@ export default function ClipboardHistorySettings() { onChange={e => { const value = e.target.value if (value === '') { - setClipTextMaxLength(0); + setClipTextMaxLength(0) } else { const number = parseInt(value) setClipTextMaxLength(number) @@ -335,7 +336,9 @@ export default function ClipboardHistorySettings() {