diff --git a/package-lock.json b/package-lock.json index 4a52c2a..f9e5acb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,8 @@ "@tiptap/extension-paragraph": "^3.23.6", "@tiptap/extension-placeholder": "^3.23.6", "@tiptap/extension-strike": "^3.23.6", + "@tiptap/extension-subscript": "^3.23.6", + "@tiptap/extension-superscript": "^3.23.6", "@tiptap/extension-table": "3.23.6", "@tiptap/extension-text": "^3.23.6", "@tiptap/extension-text-align": "^3.23.6", @@ -643,6 +645,34 @@ "@tiptap/core": "3.23.6" } }, + "node_modules/@tiptap/extension-subscript": { + "version": "3.23.6", + "resolved": "https://registry.npmjs.org/@tiptap/extension-subscript/-/extension-subscript-3.23.6.tgz", + "integrity": "sha512-K9NP2sAjoQ0EKnPVw96864aMXZlK5r3cTaybg7vQ6kKIM9OEOB+36F4VHQgQdpYUMk94gxSP/ixBB8bTVN8lPA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.23.6", + "@tiptap/pm": "3.23.6" + } + }, + "node_modules/@tiptap/extension-superscript": { + "version": "3.23.6", + "resolved": "https://registry.npmjs.org/@tiptap/extension-superscript/-/extension-superscript-3.23.6.tgz", + "integrity": "sha512-GTVHfik32a6m4q8rU3nl0mUKUfz3kTd+qIxUCGvoS/1Adb9M5Q0i5bfLk5jDOW896iCn00hPW7GbkP7WRd2Mhg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ueberdosis" + }, + "peerDependencies": { + "@tiptap/core": "3.23.6", + "@tiptap/pm": "3.23.6" + } + }, "node_modules/@tiptap/extension-table": { "version": "3.23.6", "resolved": "https://registry.npmjs.org/@tiptap/extension-table/-/extension-table-3.23.6.tgz", diff --git a/package.json b/package.json index d1af54c..36062dc 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,8 @@ "@tiptap/extension-paragraph": "^3.23.6", "@tiptap/extension-placeholder": "^3.23.6", "@tiptap/extension-strike": "^3.23.6", + "@tiptap/extension-subscript": "^3.23.6", + "@tiptap/extension-superscript": "^3.23.6", "@tiptap/extension-table": "3.23.6", "@tiptap/extension-text": "^3.23.6", "@tiptap/extension-text-align": "^3.23.6", diff --git a/src/lib/editor/ToolbarExpanded.svelte b/src/lib/editor/ToolbarExpanded.svelte index 9fa3afb..6e41229 100644 --- a/src/lib/editor/ToolbarExpanded.svelte +++ b/src/lib/editor/ToolbarExpanded.svelte @@ -270,6 +270,19 @@ let currentFontColor = $derived(uniformMarkColor('textStyle')); let currentHighlightColor = $derived(uniformMarkColor('highlight')); + // Sub/superscript are mutually exclusive (Word-style): toggling one clears the + // other. odf-kit maps these marks to text:position (round-trips with LibreOffice + // and Word). See export/odt.ts applyRuns for the custom-attr-paragraph path. + let isSuperscript = $derived(tick >= 0 && !!editor?.isActive('superscript')); + let isSubscript = $derived(tick >= 0 && !!editor?.isActive('subscript')); + + function toggleSuperscript() { + editor?.chain().focus().unsetSubscript().toggleSuperscript().run(); + } + function toggleSubscript() { + editor?.chain().focus().unsetSuperscript().toggleSubscript().run(); + } + let fontOpen = $state(false); let sizeOpen = $state(false); let lineHeightOpen = $state(false); @@ -777,6 +790,33 @@
+
+ + +
+ +
+