From b0555fe648f0e404ab07a450e37e927671b94798 Mon Sep 17 00:00:00 2001 From: Yuri Karamian Date: Sat, 8 Aug 2026 23:53:27 +0200 Subject: [PATCH] Add Clear Formatting action to editor context menu --- src/lib/components/Editor.svelte | 10 ++++ src/lib/editor/clearFormatting.ts | 81 +++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 src/lib/editor/clearFormatting.ts diff --git a/src/lib/components/Editor.svelte b/src/lib/components/Editor.svelte index 26337e4..abf9d77 100644 --- a/src/lib/components/Editor.svelte +++ b/src/lib/components/Editor.svelte @@ -52,6 +52,7 @@ import { calloutGroup, calloutIcon, calloutLabel, CALLOUT_MENU, transformCalloutBlockquotes, serializeCallout } from '$lib/editor/callouts'; import { wrapTextareaSelection } from '$lib/editor/source/selectionPairs'; import { convertListNode, type MixedListName } from '$lib/editor/mixedLists'; + import { clearFormatting } from '$lib/editor/clearFormatting'; import { serializeInlineMarkdown } from '$lib/editor/markdown'; import { relativePath } from '$lib/utils/paths'; import GraphView from './GraphView.svelte'; @@ -5079,6 +5080,11 @@ closeTextContextMenu(); } + function ctxClearFormatting() { + if (editor) clearFormatting(editor); + closeTextContextMenu(); + } + function ctxCode() { editor?.chain().focus().toggleCode().run(); closeTextContextMenu(); @@ -7201,6 +7207,10 @@ Highlight +