Skip to content

Commit

Permalink
Merge pull request #214 from PasteBar/feature/clip-auto-trim-spaces
Browse files Browse the repository at this point in the history
Add new option for the Clip - Trim Spaces
  • Loading branch information
kurdin authored Jan 18, 2025
2 parents 2e1bb6a + d37055c commit 90e36f1
Show file tree
Hide file tree
Showing 32 changed files with 218 additions and 106 deletions.
6 changes: 6 additions & 0 deletions .changeset/auto-trim-spaces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'pastebar-app-ui': patch
---

Added Trim Spaces option for the Clip
Added Auto Trim Spaces option for the History Capture
3 changes: 3 additions & 0 deletions migrations/2023-08-05-230732_seeds/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions packages/pastebar-app-ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions packages/pastebar-app-ui/src/QuickPasteApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -118,6 +120,8 @@ function QuickPasteApp() {
isShowDisabledCollectionsOnNavBarMenu:
settings.isShowDisabledCollectionsOnNavBarMenu?.valueBool,
userSelectedLanguage: settings.userSelectedLanguage?.valueText,
clipTextMinLength: settings.clipTextMinLength?.valueInt,
clipTextMaxLength: settings.clipTextMaxLength?.valueInt,
isAppReady: true,
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ interface CardValueViewerProps {
isExpanded: boolean
searchTerm: string
isDark: boolean
trimmedValue: string
textValue: string
}

export const CardValueViewer: FC<CardValueViewerProps> = ({
Expand All @@ -133,7 +133,7 @@ export const CardValueViewer: FC<CardValueViewerProps> = ({
isVideo,
isMasked,
isLargeView,
trimmedValue,
textValue,
hasLinkCard,
metadataLinkByItemId,
metadataLinkImageWidth = 24,
Expand Down Expand Up @@ -161,12 +161,12 @@ export const CardValueViewer: FC<CardValueViewerProps> = ({
}, [valuePreview])

const valueParsed = useMemo(() => {
if (!isImageData && !isCode && !isImage && trimmedValue) {
if (!isImageData && !isCode && !isImage && textValue) {
return isMasked
? maskValue(bbCode.remove(trimmedValue))
: bbCode.parse(trimmedValue)
? maskValue(bbCode.remove(textValue))
: bbCode.parse(textValue)
}
}, [trimmedValue])
}, [textValue])

const highlightedContent = useMemo(() => {
if (searchTerm.length > 1) {
Expand Down Expand Up @@ -222,7 +222,7 @@ export const CardValueViewer: FC<CardValueViewerProps> = ({
<Box className="self-start mt-1 mb-1 text-xs w-full select-none overflow-hidden">
<LinkCard
isDisabled={
ensureUrlPrefix(trimmedValue) !== metadataLinkByItemId?.linkUrl &&
ensureUrlPrefix(textValue) !== metadataLinkByItemId?.linkUrl &&
!Boolean(metadataLinkByItemId?.linkIsTrack)
}
title={metadataLinkByItemId?.linkTitle}
Expand Down
1 change: 1 addition & 0 deletions packages/pastebar-app-ui/src/locales/lang/en/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ Type:
Run Auto Fill: Run Auto Fill
Scraper: Scraper
Secret: Secret
Trim: Trim Spaces
Shell Command: Shell Command
Submenu: Submenu
Template: Template
Expand Down
2 changes: 2 additions & 0 deletions packages/pastebar-app-ui/src/locales/lang/en/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/pastebar-app-ui/src/locales/lang/esES/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ Type:
Run Auto Fill: Ejecutar Autocompletar
Scraper: Extractor
Secret: Secreto
Trim: Recortar Espacios
Shell Command: Comando Shell
Submenu: Submenú
Template: Plantilla
Expand Down
2 changes: 2 additions & 0 deletions packages/pastebar-app-ui/src/locales/lang/esES/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/pastebar-app-ui/src/locales/lang/fr/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ Type:
Run Auto Fill: Exécuter le remplissage automatique
Scraper: Extracteur
Secret: Secret
Trim: Supprimer les espaces
Shell Command: Commande Shell
Submenu: Sous-menu
Template: Modèle
Expand Down
2 changes: 2 additions & 0 deletions packages/pastebar-app-ui/src/locales/lang/fr/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/pastebar-app-ui/src/locales/lang/it/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ Type:
Run Auto Fill: Esegui Compilazione Automatica
Scraper: Scraper
Secret: Segreto
Trim: Rimuovi Spazi
Shell Command: Comando Shell
Template: Modello
Template Fill: Compilazione Modello
Expand Down
2 changes: 2 additions & 0 deletions packages/pastebar-app-ui/src/locales/lang/it/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/pastebar-app-ui/src/locales/lang/ru/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ Type:
Run Auto Fill: Запустить автозаполнение
Scraper: Скрапер
Secret: Секрет
Trim: Обрезать пробелы
Shell Command: Команда оболочки
Template: Шаблон
Template Fill: Заполнение шаблона
Expand Down
2 changes: 2 additions & 0 deletions packages/pastebar-app-ui/src/locales/lang/ru/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.: Включить требование разблокировки экрана при запуске приложения для повышения безопасности, защиты данных от несанкционированного доступа.
Expand Down
1 change: 1 addition & 0 deletions packages/pastebar-app-ui/src/locales/lang/tr/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ Type:
Run Auto Fill: Otomatik Doldurmayı Çalıştır
Scraper: Kazıyıcı
Secret: Gizli
Trim: Boşlukları Kırp
Shell Command: Kabuk Komutu
Submenu: Alt menü
Template: Şablon
Expand Down
2 changes: 2 additions & 0 deletions packages/pastebar-app-ui/src/locales/lang/tr/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions packages/pastebar-app-ui/src/locales/lang/uk/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ Type:
Run Auto Fill: Запустити автозаповнення
Scraper: Скрапер
Secret: Секрет
Trim: Обрізати пробіли
Shell Command: Команда оболонки
Template: Шаблон
Template Fill: Заповнення шаблону
Expand Down
2 changes: 2 additions & 0 deletions packages/pastebar-app-ui/src/locales/lang/uk/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.: Увімкнути вимогу розблокування екрану при запуску додатку для підвищення безпеки, захисту даних від несанкціонованого доступу.
Expand Down
1 change: 1 addition & 0 deletions packages/pastebar-app-ui/src/locales/lang/zhCN/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ Type:
Run Auto Fill: 运行自动填充
Scraper: 抓取器
Secret: 密钥
Trim: 修剪空格
Shell Command: Shell 命令
Submenu: 子菜单
Template: 模板
Expand Down
Loading

0 comments on commit 90e36f1

Please sign in to comment.