From e6f0ca3cde47626b9c55871d4e008b37366dbc74 Mon Sep 17 00:00:00 2001 From: Alexis Gousseau Date: Thu, 5 Feb 2026 11:10:03 +0100 Subject: [PATCH] fix: :children_crossing: add a shortcut limit to prevent events from propagating in the wysiwyg editor --- .../Extensions/ShortCuts/ShortcutBoundary.tsx | 24 +++++++++++++++++++ .../Inputs/Wysiwyg/SimpleWysiwyg.tsx | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 resources/ts/back/Components/Inputs/Wysiwyg/Extensions/ShortCuts/ShortcutBoundary.tsx diff --git a/resources/ts/back/Components/Inputs/Wysiwyg/Extensions/ShortCuts/ShortcutBoundary.tsx b/resources/ts/back/Components/Inputs/Wysiwyg/Extensions/ShortCuts/ShortcutBoundary.tsx new file mode 100644 index 00000000..b737a342 --- /dev/null +++ b/resources/ts/back/Components/Inputs/Wysiwyg/Extensions/ShortCuts/ShortcutBoundary.tsx @@ -0,0 +1,24 @@ +// * Packages +import { Extension } from "@tiptap/core"; +import { Plugin } from "prosemirror-state"; + +export const ShortcutBoundary = Extension.create({ + addProseMirrorPlugins() { + return [ + new Plugin({ + props: { + // Set new event on key down. + handleKeyDown(view, event) { + if (!(event.ctrlKey || event.metaKey)) return false; + + // Stop the propagation event to the app. + event.stopPropagation(); + + // Keep @tiptap editor manage the shortcut. + return false; + }, + }, + }), + ]; + }, +}); diff --git a/resources/ts/back/Components/Inputs/Wysiwyg/SimpleWysiwyg.tsx b/resources/ts/back/Components/Inputs/Wysiwyg/SimpleWysiwyg.tsx index c389e0d6..d1b84570 100644 --- a/resources/ts/back/Components/Inputs/Wysiwyg/SimpleWysiwyg.tsx +++ b/resources/ts/back/Components/Inputs/Wysiwyg/SimpleWysiwyg.tsx @@ -17,6 +17,7 @@ import TextAlign from "@tiptap/extension-text-align"; // * Components shadcn import { Label } from "@/components/ui/label"; // * Other +import { ShortcutBoundary } from "@/back/Components/Inputs/Wysiwyg/Extensions/ShortCuts/ShortcutBoundary"; import { Link } from "@/back/Components/Inputs/Wysiwyg/Extensions/Link/Link"; import { Image } from "@/back/Components/Inputs/Wysiwyg/Extensions/Image/Image"; import InputError from "@/back/Components/InputError"; @@ -92,6 +93,7 @@ export default function SimpleWysiwyg({ link: false, // Custom link extension. }), // Specific extensions. + ShortcutBoundary, TaskList, TaskItem.configure({ nested: true,