From 70bbc9bfc248174f9b0b6d8c9bb99803db35c070 Mon Sep 17 00:00:00 2001 From: Sergey Kurdin Date: Sat, 20 Jul 2024 13:45:54 -0400 Subject: [PATCH 1/3] added clip option to press keys after paste --- package-lock.json | 422 +++++++++--------- package.json | 2 +- .../src/assets/icons/keyboard-off.tsx | 29 ++ .../Dashboard/components/ClipCard.tsx | 1 + .../Dashboard/components/ClipEditContent.tsx | 97 +++- .../Dashboard/components/ClipEditForm.tsx | 9 +- src-tauri/src/commands/clipboard_commands.rs | 68 ++- 7 files changed, 413 insertions(+), 215 deletions(-) create mode 100644 packages/pastebar-app-ui/src/assets/icons/keyboard-off.tsx diff --git a/package-lock.json b/package-lock.json index 609fe30c..4a3a1b1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,14 @@ { "name": "pastebar-app", - "version": "0.3.0", + "version": "0.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pastebar-app", - "version": "0.3.0", + "version": "0.5.0", "workspaces": [ - "packages/*" + "packages/pastebar-app-ui" ], "dependencies": { "@codastic/react-positioning-portal": "^0.7.0", @@ -86,7 +86,7 @@ "js-yaml": "^4.1.0", "linkify-it": "^5.0.0", "lodash-es": "^4.17.21", - "lucide-react": "0.363.0", + "lucide-react": "0.411.0", "marked": "^12.0.0", "marked-terminal": "^7.0.0", "next-themes": "^0.2.1", @@ -4340,10 +4340,6 @@ "node": "^16.13.0 || >=18.0.0" } }, - "node_modules/@pastebar/ui": { - "resolved": "packages/pastebar-app-ui", - "link": true - }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -12363,11 +12359,11 @@ } }, "node_modules/lucide-react": { - "version": "0.363.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.363.0.tgz", - "integrity": "sha512-AlsfPCsXQyQx7wwsIgzcKOL9LwC498LIMAo+c0Es5PkHJa33xwmYAkkSoKoJWWWSYQEStqu58/jT4tL2gi32uQ==", + "version": "0.411.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.411.0.tgz", + "integrity": "sha512-bDRvLt/jIIjsq4JVYB3EjyOtLHu8uQGzv7usri2DnVpOtfIRuLln96srS+d8WJsmJ52LBwDnYx7me/TSjZ6AcA==", "peerDependencies": { - "react": "^16.5.1 || ^17.0.0 || ^18.0.0" + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "node_modules/magic-string": { @@ -13768,6 +13764,10 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" }, + "node_modules/pastebar-app-ui": { + "resolved": "packages/pastebar-app-ui", + "link": true + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -18295,8 +18295,7 @@ } }, "packages/pastebar-app-ui": { - "name": "@pastebar/ui", - "version": "0.3.1", + "version": "0.5.0", "dependencies": { "@codastic/react-positioning-portal": "^0.7.0", "@dnd-kit/core": "^6.1.0", @@ -18498,6 +18497,14 @@ "linux" ] }, + "packages/pastebar-app-ui/node_modules/lucide-react": { + "version": "0.363.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.363.0.tgz", + "integrity": "sha512-AlsfPCsXQyQx7wwsIgzcKOL9LwC498LIMAo+c0Es5PkHJa33xwmYAkkSoKoJWWWSYQEStqu58/jT4tL2gi32uQ==", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0" + } + }, "packages/pastebar-app-ui/scripts/react-compiler-runtime": { "version": "0.0.1", "license": "MIT", @@ -21575,194 +21582,6 @@ } } }, - "@pastebar/ui": { - "version": "file:packages/pastebar-app-ui", - "requires": { - "@changesets/cli": "^2.27.1", - "@codastic/react-positioning-portal": "^0.7.0", - "@dnd-kit/core": "^6.1.0", - "@dnd-kit/modifiers": "^7.0.0", - "@dnd-kit/sortable": "^8.0.0", - "@emotion/css": "^11.11.2", - "@ianvs/prettier-plugin-sort-imports": "^4.1.1", - "@preact/signals-react": "^2.0.1", - "@preact/signals-react-transform": "^0.3.1", - "@radix-ui/react-accessible-icon": "^1.0.3", - "@radix-ui/react-accordion": "^1.1.2", - "@radix-ui/react-alert-dialog": "^1.0.5", - "@radix-ui/react-aspect-ratio": "^1.0.3", - "@radix-ui/react-avatar": "^1.0.4", - "@radix-ui/react-checkbox": "^1.0.4", - "@radix-ui/react-collapsible": "^1.0.3", - "@radix-ui/react-context-menu": "^2.1.5", - "@radix-ui/react-dialog": "^1.0.5", - "@radix-ui/react-dropdown-menu": "^2.0.6", - "@radix-ui/react-hover-card": "^1.0.7", - "@radix-ui/react-label": "^2.0.2", - "@radix-ui/react-menubar": "^1.0.4", - "@radix-ui/react-navigation-menu": "^1.1.4", - "@radix-ui/react-popover": "^1.0.7", - "@radix-ui/react-progress": "^1.0.3", - "@radix-ui/react-radio-group": "^1.1.3", - "@radix-ui/react-scroll-area": "^1.0.5", - "@radix-ui/react-select": "^2.0.0", - "@radix-ui/react-separator": "^1.0.3", - "@radix-ui/react-slider": "^1.1.2", - "@radix-ui/react-slot": "^1.0.2", - "@radix-ui/react-switch": "^1.0.3", - "@radix-ui/react-tabs": "^1.0.4", - "@radix-ui/react-toast": "^1.1.5", - "@radix-ui/react-toggle": "^1.0.3", - "@radix-ui/react-toggle-group": "^1.0.4", - "@radix-ui/react-tooltip": "^1.0.7", - "@react-aria/i18n": "^3.9.0", - "@react-aria/utils": "^3.22.0", - "@react-stately/utils": "^3.9.0", - "@rollup/plugin-commonjs": "^25.0.7", - "@rollup/rollup-linux-x64-gnu": "4.14.1", - "@svgr/webpack": "^8.1.0", - "@tailwindcss/line-clamp": "^0.4.4", - "@tanstack/react-query": "5.25.0", - "@tanstack/react-query-devtools": "5.25.0", - "@tanstack/react-query-persist-client": "5.25.0", - "@tauri-apps/api": "^1.5.3", - "@tauri-apps/cli": "^1.5.6", - "@trivago/prettier-plugin-sort-imports": "^4.3.0", - "@types/bcryptjs": "^2.4.6", - "@types/codemirror": "^5.60.15", - "@types/dompurify": "^3.0.5", - "@types/events": "^3.0.3", - "@types/js-yaml": "^4.0.9", - "@types/linkify-it": "^3.0.5", - "@types/lodash-es": "^4.17.12", - "@types/marked-terminal": "^6.1.1", - "@types/node": "^20.10.0", - "@types/prismjs": "^1.26.3", - "@types/react": "^18.3.3", - "@types/react-dom": "^18.3.0", - "@types/react-window": "^1.8.8", - "@types/react-window-infinite-loader": "^1.0.9", - "@types/url-parse": "^1.4.11", - "@types/use-sync-external-store": "^0.0.6", - "@uiw/codemirror-extensions-langs": "^4.21.21", - "@uiw/codemirror-theme-github": "^4.21.21", - "@uiw/codemirror-theme-vscode": "^4.21.21", - "@vitejs/plugin-react": "^4.2.0", - "@vitejs/plugin-react-swc": "^3.5.0", - "autoprefixer": "^10.4.16", - "babel-plugin-react-compiler": "^0.0.0-experimental-696af53-20240625", - "class-variance-authority": "^0.7.0", - "classnames": "^2.5.1", - "clsx": "^2.0.0", - "cmdk": "^0.2.0", - "codemirror": "^5.65.16", - "date-fns": "^2.30.0", - "dayjs": "^1.11.10", - "dompurify": "^3.1.3", - "dot-prop": "^8.0.2", - "dotenv": "^16.4.5", - "emery": "^1.4.2", - "emoji-picker-react": "^4.5.16", - "eslint-config-prettier": "^9.0.0", - "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-import": "^2.29.0", - "eslint-plugin-prettier": "^5.0.1", - "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-compiler": "^0.0.0-experimental-51a85ea-20240601", - "eslint-plugin-sonarjs": "^0.23.0", - "events": "^3.3.0", - "facepaint": "^1.2.1", - "framer-motion": "^10.16.5", - "garbados-crypt": "^3.0.0-beta", - "glob-all": "^3.3.1", - "i18next": "^23.10.0", - "i18next-browser-languagedetector": "^7.2.0", - "idb-keyval": "^6.2.1", - "javascript-time-ago": "^2.5.9", - "jotai": "^2.6.0", - "jotai-zustand": "^0.3.0", - "js-yaml": "^4.1.0", - "linkify-it": "^5.0.0", - "lodash-es": "^4.17.21", - "lucide-react": "0.363.0", - "markdown-wasm": "^1.2.0", - "marked": "^12.0.0", - "marked-terminal": "^7.0.0", - "next-themes": "^0.2.1", - "overlayscrollbars": "^2.4.5", - "overlayscrollbars-react": "^0.5.3", - "postcss": "^8.4.31", - "prettier": "^3.1.0", - "prettier-plugin-tailwindcss": "^0.5.7", - "prism-react-renderer": "^2.3.1", - "prismjs": "^1.29.0", - "react": "^18.3.1", - "react-canvas-confetti": "^2.0.7", - "react-compiler-runtime": "file:scripts/react-compiler-runtime", - "react-complex-tree": "^2.2.3", - "react-day-picker": "^8.9.1", - "react-dnd": "^16.0.1", - "react-dnd-html5-backend": "^16.0.1", - "react-dom": "^18.3.1", - "react-error-boundary": "^4.0.13", - "react-hotkeys-hook": "^4.4.1", - "react-html-props": "^2.0.9", - "react-i18next": "^14.0.5", - "react-router-dom": "^6.20.0", - "react-sub-unsub": "^2.2.7", - "react-textarea-autosize": "^8.5.3", - "react-time-ago": "^7.2.1", - "react-twitter-embed": "^4.0.4", - "react-use-hoverintent": "^1.3.0", - "react-virtualized-auto-sizer": "^1.0.20", - "react-virtuoso": "^4.6.2", - "react-window": "^1.8.10", - "react-window-infinite-loader": "^1.0.9", - "recharts": "^2.10.1", - "resize-observer-polyfill": "^1.5.1", - "rimraf": "^5.0.5", - "rollup": "^4.10.0", - "scriptjs": "^2.5.9", - "short-unique-id": "^5.0.3", - "tailwind-merge": "^2.0.0", - "tailwind-scrollbar": "^3.0.5", - "tailwindcss": "^3.3.5", - "tailwindcss-animate": "^1.0.7", - "tauri-plugin-clipboard-api": "^0.5.5", - "tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log", - "tauri-plugin-positioner-api": "github:tauri-apps/tauri-plugin-positioner", - "taze": "^0.12.2", - "ts-deepmerge": "^7.0.0", - "typescript": "^5.3.2", - "url-parse": "^1.5.10", - "use-resize-observer": "^9.1.0", - "vite": "^5.0.11", - "vite-plugin-babel": "^1.2.0", - "vite-plugin-dynamic-import": "^1.5.0", - "vite-plugin-static-copy": "^1.0.2", - "vite-plugin-tauri": "^3.3.0", - "zod": "^3.22.2", - "zustand": "^4.4.6", - "zustand-logger-middleware": "^1.0.9" - }, - "dependencies": { - "@preact/signals-react": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@preact/signals-react/-/signals-react-2.1.0.tgz", - "integrity": "sha512-jWq2ldDWXdbKpg+aMGuOZfj9tS5JkVlGJ5hGNzNe1Zfe7RLFfvldBEfNe6ZT7KZddecAxKhyoxSsEypgbfx/Gw==", - "requires": { - "@preact/signals-core": "^1.7.0", - "use-sync-external-store": "^1.2.0" - } - }, - "@rollup/rollup-linux-x64-gnu": { - "version": "4.14.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.14.1.tgz", - "integrity": "sha512-9Q7DGjZN+hTdJomaQ3Iub4m6VPu1r94bmK2z3UeWP3dGUecRC54tmVu9vKHTm1bOt3ASoYtEz6JSRLFzrysKlA==", - "optional": true - } - } - }, "@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -27144,9 +26963,9 @@ } }, "lucide-react": { - "version": "0.363.0", - "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.363.0.tgz", - "integrity": "sha512-AlsfPCsXQyQx7wwsIgzcKOL9LwC498LIMAo+c0Es5PkHJa33xwmYAkkSoKoJWWWSYQEStqu58/jT4tL2gi32uQ==" + "version": "0.411.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.411.0.tgz", + "integrity": "sha512-bDRvLt/jIIjsq4JVYB3EjyOtLHu8uQGzv7usri2DnVpOtfIRuLln96srS+d8WJsmJ52LBwDnYx7me/TSjZ6AcA==" }, "magic-string": { "version": "0.30.5", @@ -28223,6 +28042,199 @@ } } }, + "pastebar-app-ui": { + "version": "file:packages/pastebar-app-ui", + "requires": { + "@changesets/cli": "^2.27.1", + "@codastic/react-positioning-portal": "^0.7.0", + "@dnd-kit/core": "^6.1.0", + "@dnd-kit/modifiers": "^7.0.0", + "@dnd-kit/sortable": "^8.0.0", + "@emotion/css": "^11.11.2", + "@ianvs/prettier-plugin-sort-imports": "^4.1.1", + "@preact/signals-react": "^2.0.1", + "@preact/signals-react-transform": "^0.3.1", + "@radix-ui/react-accessible-icon": "^1.0.3", + "@radix-ui/react-accordion": "^1.1.2", + "@radix-ui/react-alert-dialog": "^1.0.5", + "@radix-ui/react-aspect-ratio": "^1.0.3", + "@radix-ui/react-avatar": "^1.0.4", + "@radix-ui/react-checkbox": "^1.0.4", + "@radix-ui/react-collapsible": "^1.0.3", + "@radix-ui/react-context-menu": "^2.1.5", + "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-dropdown-menu": "^2.0.6", + "@radix-ui/react-hover-card": "^1.0.7", + "@radix-ui/react-label": "^2.0.2", + "@radix-ui/react-menubar": "^1.0.4", + "@radix-ui/react-navigation-menu": "^1.1.4", + "@radix-ui/react-popover": "^1.0.7", + "@radix-ui/react-progress": "^1.0.3", + "@radix-ui/react-radio-group": "^1.1.3", + "@radix-ui/react-scroll-area": "^1.0.5", + "@radix-ui/react-select": "^2.0.0", + "@radix-ui/react-separator": "^1.0.3", + "@radix-ui/react-slider": "^1.1.2", + "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-switch": "^1.0.3", + "@radix-ui/react-tabs": "^1.0.4", + "@radix-ui/react-toast": "^1.1.5", + "@radix-ui/react-toggle": "^1.0.3", + "@radix-ui/react-toggle-group": "^1.0.4", + "@radix-ui/react-tooltip": "^1.0.7", + "@react-aria/i18n": "^3.9.0", + "@react-aria/utils": "^3.22.0", + "@react-stately/utils": "^3.9.0", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/rollup-linux-x64-gnu": "4.14.1", + "@svgr/webpack": "^8.1.0", + "@tailwindcss/line-clamp": "^0.4.4", + "@tanstack/react-query": "5.25.0", + "@tanstack/react-query-devtools": "5.25.0", + "@tanstack/react-query-persist-client": "5.25.0", + "@tauri-apps/api": "^1.5.3", + "@tauri-apps/cli": "^1.5.6", + "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "@types/bcryptjs": "^2.4.6", + "@types/codemirror": "^5.60.15", + "@types/dompurify": "^3.0.5", + "@types/events": "^3.0.3", + "@types/js-yaml": "^4.0.9", + "@types/linkify-it": "^3.0.5", + "@types/lodash-es": "^4.17.12", + "@types/marked-terminal": "^6.1.1", + "@types/node": "^20.10.0", + "@types/prismjs": "^1.26.3", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@types/react-window": "^1.8.8", + "@types/react-window-infinite-loader": "^1.0.9", + "@types/url-parse": "^1.4.11", + "@types/use-sync-external-store": "^0.0.6", + "@uiw/codemirror-extensions-langs": "^4.21.21", + "@uiw/codemirror-theme-github": "^4.21.21", + "@uiw/codemirror-theme-vscode": "^4.21.21", + "@vitejs/plugin-react": "^4.2.0", + "@vitejs/plugin-react-swc": "^3.5.0", + "autoprefixer": "^10.4.16", + "babel-plugin-react-compiler": "^0.0.0-experimental-696af53-20240625", + "class-variance-authority": "^0.7.0", + "classnames": "^2.5.1", + "clsx": "^2.0.0", + "cmdk": "^0.2.0", + "codemirror": "^5.65.16", + "date-fns": "^2.30.0", + "dayjs": "^1.11.10", + "dompurify": "^3.1.3", + "dot-prop": "^8.0.2", + "dotenv": "^16.4.5", + "emery": "^1.4.2", + "emoji-picker-react": "^4.5.16", + "eslint-config-prettier": "^9.0.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-prettier": "^5.0.1", + "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-compiler": "^0.0.0-experimental-51a85ea-20240601", + "eslint-plugin-sonarjs": "^0.23.0", + "events": "^3.3.0", + "facepaint": "^1.2.1", + "framer-motion": "^10.16.5", + "garbados-crypt": "^3.0.0-beta", + "glob-all": "^3.3.1", + "i18next": "^23.10.0", + "i18next-browser-languagedetector": "^7.2.0", + "idb-keyval": "^6.2.1", + "javascript-time-ago": "^2.5.9", + "jotai": "^2.6.0", + "jotai-zustand": "^0.3.0", + "js-yaml": "^4.1.0", + "linkify-it": "^5.0.0", + "lodash-es": "^4.17.21", + "lucide-react": "0.363.0", + "markdown-wasm": "^1.2.0", + "marked": "^12.0.0", + "marked-terminal": "^7.0.0", + "next-themes": "^0.2.1", + "overlayscrollbars": "^2.4.5", + "overlayscrollbars-react": "^0.5.3", + "postcss": "^8.4.31", + "prettier": "^3.1.0", + "prettier-plugin-tailwindcss": "^0.5.7", + "prism-react-renderer": "^2.3.1", + "prismjs": "^1.29.0", + "react": "^18.3.1", + "react-canvas-confetti": "^2.0.7", + "react-compiler-runtime": "file:scripts/react-compiler-runtime", + "react-complex-tree": "^2.2.3", + "react-day-picker": "^8.9.1", + "react-dnd": "^16.0.1", + "react-dnd-html5-backend": "^16.0.1", + "react-dom": "^18.3.1", + "react-error-boundary": "^4.0.13", + "react-hotkeys-hook": "^4.4.1", + "react-html-props": "^2.0.9", + "react-i18next": "^14.0.5", + "react-router-dom": "^6.20.0", + "react-sub-unsub": "^2.2.7", + "react-textarea-autosize": "^8.5.3", + "react-time-ago": "^7.2.1", + "react-twitter-embed": "^4.0.4", + "react-use-hoverintent": "^1.3.0", + "react-virtualized-auto-sizer": "^1.0.20", + "react-virtuoso": "^4.6.2", + "react-window": "^1.8.10", + "react-window-infinite-loader": "^1.0.9", + "recharts": "^2.10.1", + "resize-observer-polyfill": "^1.5.1", + "rimraf": "^5.0.5", + "rollup": "^4.10.0", + "scriptjs": "^2.5.9", + "short-unique-id": "^5.0.3", + "tailwind-merge": "^2.0.0", + "tailwind-scrollbar": "^3.0.5", + "tailwindcss": "^3.3.5", + "tailwindcss-animate": "^1.0.7", + "tauri-plugin-clipboard-api": "^0.5.5", + "tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log", + "tauri-plugin-positioner-api": "github:tauri-apps/tauri-plugin-positioner", + "taze": "^0.12.2", + "ts-deepmerge": "^7.0.0", + "typescript": "^5.3.2", + "url-parse": "^1.5.10", + "use-resize-observer": "^9.1.0", + "vite": "^5.0.11", + "vite-plugin-babel": "^1.2.0", + "vite-plugin-dynamic-import": "^1.5.0", + "vite-plugin-static-copy": "^1.0.2", + "vite-plugin-tauri": "^3.3.0", + "zod": "^3.22.2", + "zustand": "^4.4.6", + "zustand-logger-middleware": "^1.0.9" + }, + "dependencies": { + "@preact/signals-react": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@preact/signals-react/-/signals-react-2.1.0.tgz", + "integrity": "sha512-jWq2ldDWXdbKpg+aMGuOZfj9tS5JkVlGJ5hGNzNe1Zfe7RLFfvldBEfNe6ZT7KZddecAxKhyoxSsEypgbfx/Gw==", + "requires": { + "@preact/signals-core": "^1.7.0", + "use-sync-external-store": "^1.2.0" + } + }, + "@rollup/rollup-linux-x64-gnu": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.14.1.tgz", + "integrity": "sha512-9Q7DGjZN+hTdJomaQ3Iub4m6VPu1r94bmK2z3UeWP3dGUecRC54tmVu9vKHTm1bOt3ASoYtEz6JSRLFzrysKlA==", + "optional": true + }, + "lucide-react": { + "version": "0.363.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.363.0.tgz", + "integrity": "sha512-AlsfPCsXQyQx7wwsIgzcKOL9LwC498LIMAo+c0Es5PkHJa33xwmYAkkSoKoJWWWSYQEStqu58/jT4tL2gi32uQ==" + } + } + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", diff --git a/package.json b/package.json index 6fa790eb..c3327dcb 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "js-yaml": "^4.1.0", "linkify-it": "^5.0.0", "lodash-es": "^4.17.21", - "lucide-react": "0.363.0", + "lucide-react": "0.411.0", "marked": "^12.0.0", "marked-terminal": "^7.0.0", "next-themes": "^0.2.1", diff --git a/packages/pastebar-app-ui/src/assets/icons/keyboard-off.tsx b/packages/pastebar-app-ui/src/assets/icons/keyboard-off.tsx new file mode 100644 index 00000000..f6e97b09 --- /dev/null +++ b/packages/pastebar-app-ui/src/assets/icons/keyboard-off.tsx @@ -0,0 +1,29 @@ +import { SVGProps } from 'react' + +export default function KeyboardOff(props: SVGProps) { + return ( + + + + + + + + + + + + + ) +} diff --git a/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipCard.tsx b/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipCard.tsx index ffc84231..fd33927c 100644 --- a/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipCard.tsx +++ b/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipCard.tsx @@ -95,6 +95,7 @@ export const ClipFormKeyPress = [ 'Enter', 'TabTab', 'TabTabTab', + 'EnterEnter', 'TabEnter', 'TabTabEnter', ] as const diff --git a/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipEditContent.tsx b/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipEditContent.tsx index 31dd37af..4b2ead02 100644 --- a/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipEditContent.tsx +++ b/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipEditContent.tsx @@ -33,6 +33,7 @@ import { Heading, Image, Italic, + Keyboard, Pin, PinOff, PlayCircle, @@ -67,6 +68,7 @@ import { Box, Button, DropdownMenu, + DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, @@ -93,7 +95,11 @@ import { ClipFormTemplateOptions, ClipWebRequestOptions } from './ClipCard' import { ClipCardTypeMenu } from './ClipCardTypeMenu' import { ClipDelete } from './ClipDelete' import { ClipDropZone } from './ClipDropZone' -import { ClipEditForm } from './ClipEditForm' +import { + ClipEditForm, + ClipFormAfterInputKeyPress, + ClipFormKeyPressDisplayValueMap, +} from './ClipEditForm' import { ClipEditTemplate } from './ClipEditTemplate' import { ClipEditWebRequest } from './ClipEditWebRequest' import { ClipEditWebScraping } from './ClipEditWebScraping' @@ -168,6 +174,7 @@ export function ClipEditContent({ const clipValue = useSignal('') const itemLocalOptions = useSignal<{ noLinkCard?: boolean | undefined + pressKeysAfterPaste?: string | undefined }>({}) const webrequestLocalOptions = useSignal({ method: 'GET', @@ -639,13 +646,12 @@ export function ClipEditContent({ }) } - // check if itemLocalOptions is empty - // if not, update itemLocalOptions - if (Object.keys(itemLocalOptions.value).length > 0) { itemOptions = JSON.stringify(itemLocalOptions.value) } + console.log('itemOptions', itemOptions) + await updateItemById({ updatedItem: { value: saveValue, @@ -1957,6 +1963,89 @@ export function ClipEditContent({ + {!isCommand && + !isTemplate && + !isForm && + !isWebRequest && + !isWebScraping && ( + + + + + + + + + + + {t('Key Press After Paste', { ns: 'dashboard' })} + + + { + itemLocalOptions.value.pressKeysAfterPaste = undefined + }} + className={ + !itemLocalOptions.value.pressKeysAfterPaste + ? 'font-semibold' + : '' + } + > + {t('No Key Press', { ns: 'common' })} + + {ClipFormAfterInputKeyPress.map(type => { + return ( + { + itemLocalOptions.value.pressKeysAfterPaste = type + } + } + key={type} + className={ + itemLocalOptions.value.pressKeysAfterPaste === type + ? 'font-semibold' + : '' + } + > + {ClipFormKeyPressDisplayValueMap[type]} + + ) + })} + + + )} , + pub no_link_card: Option, +} + #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct FormField { @@ -444,7 +452,7 @@ pub async fn copy_clip_item( pub async fn copy_paste_clip_item_from_menu( app_handle: AppHandle, item_id: String, - _delay: i32, + delay: i32, ) -> String { let is_link_or_app = copy_clip_item(app_handle, item_id.clone(), true).await; @@ -453,10 +461,34 @@ pub async fn copy_paste_clip_item_from_menu( } if is_link_or_app == "ok".to_string() { - println!("before delay"); + let item = match get_item_by_id(item_id.clone()) { + Ok(i) => i, + Err(e) => { + eprintln!("Failed to find item: {}", e); + return "Item not found".to_string(); + } + }; - if _delay > 0 { - tokio::time::sleep(tokio::time::Duration::from_secs(_delay as u64)).await; + if let Some(item_options) = item.item_options { + if let Ok(item_field) = serde_json::from_str::(&item_options) { + if let Some(key_press) = item_field.press_keys_after_paste { + if delay > 0 { + tokio::time::sleep(tokio::time::Duration::from_secs(delay as u64)).await; + } + + paste_clipboard(0); + + tokio::time::sleep(tokio::time::Duration::from_millis(300)).await; + + simulate_key_press(&key_press).await; + + return "ok".to_string(); + } + } + } + + if delay > 0 { + tokio::time::sleep(tokio::time::Duration::from_secs(delay as u64)).await; } return paste_clipboard(0); @@ -476,6 +508,30 @@ pub async fn copy_paste_clip_item( if is_copy_only { return "ok".to_string(); } + // Get the item by id + let item = match get_item_by_id(item_id.clone()) { + Ok(i) => i, + Err(e) => { + eprintln!("Failed to find item: {}", e); + return "Item not found".to_string(); + } + }; + + if let Some(item_options) = item.item_options { + if let Ok(item_field) = serde_json::from_str::(&item_options) { + if let Some(key_press) = item_field.press_keys_after_paste { + paste_clipboard(delay); + + tokio::time::sleep(tokio::time::Duration::from_millis(300)).await; + + // Simulate the key press + simulate_key_press(&key_press).await; + + return "ok".to_string(); + } + } + } + paste_clipboard(delay) } @@ -652,6 +708,10 @@ async fn simulate_key_press(key_press: &ClipFormKeyPress) { VKey.press_tab(); VKey.press_tab(); } + ClipFormKeyPress::EnterEnter => { + VKey.press_enter(); + VKey.press_enter(); + } ClipFormKeyPress::TabTabTab => { VKey.press_tab(); VKey.press_tab(); From c06b404c0b2ad2b74625b418adf40284933a773d Mon Sep 17 00:00:00 2001 From: Sergey Kurdin Date: Sat, 20 Jul 2024 13:57:07 -0400 Subject: [PATCH 2/3] update to translations --- .changeset/tall-seas-notice.md | 5 +++++ .env | 2 +- packages/pastebar-app-ui/src/locales/lang/en/common.yaml | 3 ++- .../pastebar-app-ui/src/locales/lang/en/dashboard.yaml | 7 +++++-- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 .changeset/tall-seas-notice.md diff --git a/.changeset/tall-seas-notice.md b/.changeset/tall-seas-notice.md new file mode 100644 index 00000000..bd52578a --- /dev/null +++ b/.changeset/tall-seas-notice.md @@ -0,0 +1,5 @@ +--- +'pastebar-app-ui': patch +--- + +After paste press keys option added for clips diff --git a/.env b/.env index d0a5ce7d..a5afa57c 100644 --- a/.env +++ b/.env @@ -2,4 +2,4 @@ DATABASE_URL=sqlite://local.pastebar-db.data VITE_ENABLE_REACT_QUERY_DEVTOOLS= VITE_DISABLE_SAVE_TRANSLATIONS= VITE_DISABLE_LANGUAGE_FALLBACK= -MISSING_TRANSLATION_SAVE_PATH=../../pastebar-app-ui/src/locales/lang +MISSING_TRANSLATION_SAVE_PATH=../packages/pastebar-app-ui/src/locales/lang diff --git a/packages/pastebar-app-ui/src/locales/lang/en/common.yaml b/packages/pastebar-app-ui/src/locales/lang/en/common.yaml index 90364773..4126e0de 100644 --- a/packages/pastebar-app-ui/src/locales/lang/en/common.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/en/common.yaml @@ -36,11 +36,11 @@ Clear Tracks: Clear Tracks Clear found results and filters: Clear found results and filters Click to Confirm: Click to Confirm Clip: Clip +Clip Boards: Clip Boards Clipboard: Clipboard Clipboard History: Clipboard History Clipboard History Only: Clipboard History Only Clipboard History Settings: Clipboard History Settings -Clip Boards: Clip Boards Close: Close Close Edit: Close Edit Close Expand Edit: Close Expand Edit @@ -143,6 +143,7 @@ Multi Select: Multi Select Next Delay: Next Delay Next Track: Next Track No: No +No Key Press: No Key Press No Wrap: No Wrap Not Now: Not Now Not found in the template: Not found in the template diff --git a/packages/pastebar-app-ui/src/locales/lang/en/dashboard.yaml b/packages/pastebar-app-ui/src/locales/lang/en/dashboard.yaml index ad91df2d..c9399fe7 100644 --- a/packages/pastebar-app-ui/src/locales/lang/en/dashboard.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/en/dashboard.yaml @@ -9,6 +9,7 @@ Add First Board: Add First Board Add Form Field: Add Form Field Add Header: Add Header Add Key Press: Add Key Press +Add Key Press After Paste: Add Key Press After Paste Add Link Card: Add Link Card Add Open URL: Add Open URL Add Output Template: Add Output Template @@ -93,7 +94,6 @@ Drop image file here, or use a separate window for drag and drop.: Drop image fi Drop to Pin: Drop to Pin Edit Note: Edit Note Edit Template: Edit Template -Rename: Rename Edit subtitle: Edit subtitle Edit tab name: Edit tab name Enable / Disable: Enable / Disable @@ -155,6 +155,8 @@ Hide Label: Hide Label History capture is off: History capture is off Key Press: Key Press Key Press After: Key Press After +Key Press After Paste: Key Press After Paste +'Key Press After Paste: {{keyPress}}': 'Key Press After Paste: {{keyPress}}' Label Left: Label Left Label Top: Label Top Label on Left: Label on Left @@ -195,6 +197,7 @@ Regex Match Group Filter: Regex Match Group Filter Remove Open URL: Remove Open URL Remove headers: Remove headers Remove image: Remove image +Rename: Rename Reset to Defaults: Reset to Defaults Response Filters: Response Filters Result: Result @@ -235,8 +238,8 @@ Type: Request: Request Scraper: Scraper URL: URL -Unsaved note: Unsaved note Unsaved name: Unsaved name +Unsaved note: Unsaved note Unsaved subtitle: Unsaved subtitle Unsaved title: Unsaved title Update Link Card: Update Link Card From b371b4a403914d07e3b288f6997f41c80e638b65 Mon Sep 17 00:00:00 2001 From: Sergey Kurdin Date: Sat, 20 Jul 2024 14:09:42 -0400 Subject: [PATCH 3/3] added translations --- .changeset/tall-seas-notice.md | 2 +- packages/pastebar-app-ui/src/locales/lang/ru/common.yaml | 1 + .../pastebar-app-ui/src/locales/lang/ru/dashboard.yaml | 8 +++++--- packages/pastebar-app-ui/src/locales/lang/ru/help.yaml | 1 + .../components/Dashboard/components/ClipEditContent.tsx | 2 -- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.changeset/tall-seas-notice.md b/.changeset/tall-seas-notice.md index bd52578a..b1f3ac61 100644 --- a/.changeset/tall-seas-notice.md +++ b/.changeset/tall-seas-notice.md @@ -2,4 +2,4 @@ 'pastebar-app-ui': patch --- -After paste press keys option added for clips +New clip option: After paste key press diff --git a/packages/pastebar-app-ui/src/locales/lang/ru/common.yaml b/packages/pastebar-app-ui/src/locales/lang/ru/common.yaml index b95b093e..8fe7cffb 100644 --- a/packages/pastebar-app-ui/src/locales/lang/ru/common.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/ru/common.yaml @@ -135,6 +135,7 @@ Multi Select: Множественный выбор Next Delay: Следующая задержка Next Track: Следующий трек No: Нет +No Key Press: No Key Press No Wrap: Без переноса Not Now: Не сейчас Not found in the template: Не найдено в шаблоне diff --git a/packages/pastebar-app-ui/src/locales/lang/ru/dashboard.yaml b/packages/pastebar-app-ui/src/locales/lang/ru/dashboard.yaml index 1e747d7a..4c3c8c24 100644 --- a/packages/pastebar-app-ui/src/locales/lang/ru/dashboard.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/ru/dashboard.yaml @@ -9,6 +9,7 @@ Add First Board: Добавить первую доску Add Form Field: Добавить поле формы Add Header: Добавить заголовок Add Key Press: Добавить нажатие клавиши +Add Key Press After Paste: Добавить нажатие клавиш после вставки Add Link Card: Добавить карточку ссылки Add Open URL: Добавить открытие URL Add Output Template: Добавить шаблон вывода @@ -155,13 +156,14 @@ HTML: HTML Headers: Заголовки Hide Label: Скрыть метку History capture is off: Запись истории выключена -Key Press: Нажатие клавиши -Key Press After: Нажатие клавиши после +Key Press: Нажатие клавиш +Key Press After: Нажатие клавиш после +Key Press After Paste: Нажатие клавиш после вставки +'Key Press After Paste: {{keyPress}}': 'Нажатие клавиш после вставки: {{keyPress}}' Label Left: Метка слева Label Top: Метка сверху Label on Left: Метка слева Labels: Поля -Last Only: Last Only Last run: Последний запуск Last update: Последнее обновление Layout Max Width: Максимальная ширина макета diff --git a/packages/pastebar-app-ui/src/locales/lang/ru/help.yaml b/packages/pastebar-app-ui/src/locales/lang/ru/help.yaml index 5fa6e210..55def110 100644 --- a/packages/pastebar-app-ui/src/locales/lang/ru/help.yaml +++ b/packages/pastebar-app-ui/src/locales/lang/ru/help.yaml @@ -38,6 +38,7 @@ Manage Collections Settings: Настройки управления колле Manage Paste Menu Panel: Панель управления меню вставки Mark All Completed: Отметить как просмотренные Menu Item: Пункт меню +Menu Item Tree: Дерево пунктов меню Navigation Bar: Панель навигации Navigation Bar Menu: Меню панели навигации Navigation Bar Tour: Панель навигации тур diff --git a/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipEditContent.tsx b/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipEditContent.tsx index 4b2ead02..3ecdbfb3 100644 --- a/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipEditContent.tsx +++ b/packages/pastebar-app-ui/src/pages/components/Dashboard/components/ClipEditContent.tsx @@ -650,8 +650,6 @@ export function ClipEditContent({ itemOptions = JSON.stringify(itemLocalOptions.value) } - console.log('itemOptions', itemOptions) - await updateItemById({ updatedItem: { value: saveValue,