diff --git a/docs/changelog.md b/docs/changelog.md index 57faa619..c5c8f6fb 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -6,6 +6,12 @@ Consider giving a star ⭐ on [Github](https://github.com/pnd280/complexity). 💖 Support the development via [Ko-fi](https://ko-fi.com/pnd280) or [Paypal](https://paypal.me/pnd280). +## v0.0.3.11 + +_Release date: 8th Oct, 2024_ + +- **IMPROVE**: `Ctrl (Cmd) + Shift + V` to bypass file creation on long text paste. Normal paste will still create a file. + ## v0.0.3.6 _Release date: 23rd Sep, 2024_ diff --git a/package.json b/package.json index 9d243486..eb95c864 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "complexity", "displayName": "Complexity - Perplexity.ai supercharged", - "version": "0.0.3.10", + "version": "0.0.3.11", "author": "pnd280", "description": "⚡ Supercharge your Perplexity.ai", "type": "module", diff --git a/src/content-script/hooks/useQueryBoxObserver.ts b/src/content-script/hooks/useQueryBoxObserver.ts index 5e8c98f8..67405c03 100644 --- a/src/content-script/hooks/useQueryBoxObserver.ts +++ b/src/content-script/hooks/useQueryBoxObserver.ts @@ -201,10 +201,25 @@ function interceptPasteEvent() { $textarea.attr("data-paste-event-intercepted", "true"); + $(document).off("keydown.interceptPasteEvent keyup.interceptPasteEvent"); + + let isShiftKeyPressed = false; + + const handleKeyDown = (e: JQuery.TriggeredEvent) => { + if (e.key === "Shift") isShiftKeyPressed = true; + }; + + const handleKeyUp = (e: JQuery.TriggeredEvent) => { + if (e.key === "Shift") isShiftKeyPressed = false; + }; + + $(document).on("keydown.interceptPasteEvent", handleKeyDown); + $(document).on("keyup.interceptPasteEvent", handleKeyUp); + $textarea.on("paste", (e) => { const clipboardEvent = e.originalEvent as ClipboardEvent; - if (clipboardEvent.clipboardData) { + if (clipboardEvent.clipboardData && isShiftKeyPressed) { if (clipboardEvent.clipboardData.types.includes("text/plain")) { e.stopImmediatePropagation(); } diff --git a/src/content-script/index.ts b/src/content-script/index.ts index e2909653..f729d563 100644 --- a/src/content-script/index.ts +++ b/src/content-script/index.ts @@ -42,7 +42,6 @@ function initUiUxTweaks() { UiTweaks.correctColorScheme(); UxTweaks.restoreLogoContextMenu(); - UxTweaks.removeConflictedMobileOverlay(); const observe = (url: string) => { const location = whereAmI(url); diff --git a/src/cplx-user-settings/GeneralSettings.ts b/src/cplx-user-settings/GeneralSettings.tsx similarity index 89% rename from src/cplx-user-settings/GeneralSettings.ts rename to src/cplx-user-settings/GeneralSettings.tsx index 8b1836dd..a0966540 100644 --- a/src/cplx-user-settings/GeneralSettings.ts +++ b/src/cplx-user-settings/GeneralSettings.tsx @@ -1,9 +1,12 @@ +import { ReactNode } from "react"; + import { CplxUserSettings } from "@/cplx-user-settings/types/cplx-user-settings.types"; +import KeyCombo from "@/shared/components/KeyCombo"; export type PopupSetting = { id: string; label: string; - description?: string; + description?: ReactNode; settingKey?: T; versionRelease?: string; experimental?: boolean; @@ -63,7 +66,7 @@ export default class GeneralSettings { id: "custom-markdown-block", label: "Custom markdown block", description: - "Precisely display the language of your code and enable syntax highlighting for natively unsupported languages. e.g. `gdscript`, `blade`, etc.", + "Precisely display the language of your code and enable syntax highlighting for natively unsupported languages. e.g. `vue`, `gdscript`, `blade`, etc.", settingKey: "customMarkdownBlock", }, { @@ -93,7 +96,15 @@ export default class GeneralSettings { id: "no-file-creation-on-paste", label: "No file creation on long text paste", settingKey: "noFileCreationOnPaste", - description: "Pasting long text no longer creates a file.", + description: ( + + {" "} + to paste long text without creating a file. + + ), versionRelease: "0.0.1.0", }, { diff --git a/src/cplx-user-settings/components/GeneralSettings.tsx b/src/cplx-user-settings/components/GeneralSettings.tsx index 9911bb6a..cbd61367 100644 --- a/src/cplx-user-settings/components/GeneralSettings.tsx +++ b/src/cplx-user-settings/components/GeneralSettings.tsx @@ -173,7 +173,7 @@ function SettingGroup< key={id} id={id} className={cn({ - "tw-items-start": !!description, + "tw-items-start": description != null, })} textLabel={
@@ -194,7 +194,7 @@ function SettingGroup< {label}
- {description && ( + {description != null && (
{description}
diff --git a/src/shared/components/KeyCombo.tsx b/src/shared/components/KeyCombo.tsx index a14d859f..ae8ef312 100644 --- a/src/shared/components/KeyCombo.tsx +++ b/src/shared/components/KeyCombo.tsx @@ -1,6 +1,11 @@ -export default function KeyCombo({ keys }: { keys: string[] }) { +import { HTMLProps } from "react"; + +export default function KeyCombo({ + keys, + ...props +}: HTMLProps & { keys: string[] }) { return ( - + {keys.map((key) => ( { - handler(); - $(window).on("resize", handler); - }); - } }