@notectl/core 1.0.9 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AttrRegistry-D-przlzb.mjs → AttrRegistry-I-VdmRnN.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-D-przlzb.mjs.map → AttrRegistry-I-VdmRnN.mjs.map} +1 -1
- package/dist/chunks/CaretNavigation-CAJXoaae.mjs +311 -0
- package/dist/chunks/CaretNavigation-CAJXoaae.mjs.map +1 -0
- package/dist/chunks/ColorNames-BdsHwA2f.mjs +59 -0
- package/dist/chunks/ColorNames-BdsHwA2f.mjs.map +1 -0
- package/dist/chunks/ColorPickerPopup-xL8ZUfpB.mjs +125 -0
- package/dist/chunks/ColorPickerPopup-xL8ZUfpB.mjs.map +1 -0
- package/dist/chunks/Commands-CicwYoTQ.mjs +286 -0
- package/dist/chunks/Commands-CicwYoTQ.mjs.map +1 -0
- package/dist/chunks/{Document-CI3iCwEP.mjs → Document-CuwE73FF.mjs} +35 -22
- package/dist/chunks/{Document-CI3iCwEP.mjs.map → Document-CuwE73FF.mjs.map} +1 -1
- package/dist/chunks/HTMLUtils-DTqQzcKR.mjs +35 -0
- package/dist/chunks/HTMLUtils-DTqQzcKR.mjs.map +1 -0
- package/dist/chunks/MarkCommands-CC37WA7Z.mjs +94 -0
- package/dist/chunks/MarkCommands-CC37WA7Z.mjs.map +1 -0
- package/dist/chunks/NavigationUtils-CyW0Vo8A.mjs +47 -0
- package/dist/chunks/NavigationUtils-CyW0Vo8A.mjs.map +1 -0
- package/dist/chunks/{NodeResolver-D68ZLXti.mjs → NodeResolver-B-wzthAQ.mjs} +2 -2
- package/dist/chunks/{NodeResolver-D68ZLXti.mjs.map → NodeResolver-B-wzthAQ.mjs.map} +1 -1
- package/dist/chunks/Platform-S_xqIqcM.mjs +26 -0
- package/dist/chunks/Platform-S_xqIqcM.mjs.map +1 -0
- package/dist/chunks/Selection-DmFDwiPJ.mjs +52 -0
- package/dist/chunks/Selection-DmFDwiPJ.mjs.map +1 -0
- package/dist/chunks/ToolbarItem-BpZggUGo.mjs +8 -0
- package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +1 -0
- package/dist/chunks/{ToolbarPlugin-DFkl1uYO.mjs → ToolbarPlugin-B6JETWaw.mjs} +3 -3
- package/dist/chunks/{ToolbarPlugin-DFkl1uYO.mjs.map → ToolbarPlugin-B6JETWaw.mjs.map} +1 -1
- package/dist/chunks/index--z_Txzej.mjs +467 -0
- package/dist/chunks/index--z_Txzej.mjs.map +1 -0
- package/dist/chunks/{index-uTnc9y7M.mjs → index-B-NSeaM4.mjs} +28 -28
- package/dist/chunks/index-B-NSeaM4.mjs.map +1 -0
- package/dist/chunks/{index-BTJfyJlJ.mjs → index-B9GkDVsx.mjs} +104 -104
- package/dist/chunks/index-B9GkDVsx.mjs.map +1 -0
- package/dist/chunks/{index-BRYzYOYC.mjs → index-C0cEs7Jc.mjs} +29 -29
- package/dist/chunks/index-C0cEs7Jc.mjs.map +1 -0
- package/dist/chunks/{index-BFsYGsBR.mjs → index-C9gc3Bws.mjs} +42 -42
- package/dist/chunks/{index-BFsYGsBR.mjs.map → index-C9gc3Bws.mjs.map} +1 -1
- package/dist/chunks/{index-DGrRWMlW.mjs → index-CAV2N-fF.mjs} +105 -105
- package/dist/chunks/index-CAV2N-fF.mjs.map +1 -0
- package/dist/chunks/{index-BQ8iIYLn.mjs → index-CKPrAOr6.mjs} +54 -54
- package/dist/chunks/index-CKPrAOr6.mjs.map +1 -0
- package/dist/chunks/{index-Bsp4LC5t.mjs → index-CNs4QQ8l.mjs} +36 -36
- package/dist/chunks/index-CNs4QQ8l.mjs.map +1 -0
- package/dist/chunks/{index-DC1EK22F.mjs → index-CflvcXSd.mjs} +24 -19
- package/dist/chunks/index-CflvcXSd.mjs.map +1 -0
- package/dist/chunks/{index-o6hDR07y.mjs → index-CoeD4T9-.mjs} +25 -20
- package/dist/chunks/index-CoeD4T9-.mjs.map +1 -0
- package/dist/chunks/{index-DA8TG2S8.mjs → index-D0s0Q8Wc.mjs} +56 -56
- package/dist/chunks/index-D0s0Q8Wc.mjs.map +1 -0
- package/dist/chunks/{index-BIL37LSL.mjs → index-D8tbbW97.mjs} +18 -18
- package/dist/chunks/{index-BIL37LSL.mjs.map → index-D8tbbW97.mjs.map} +1 -1
- package/dist/chunks/{index-DfO_fKw6.mjs → index-DMt3ojrY.mjs} +15 -15
- package/dist/chunks/{index-DfO_fKw6.mjs.map → index-DMt3ojrY.mjs.map} +1 -1
- package/dist/chunks/{index-BCvuDpVr.mjs → index-DfzCof6H.mjs} +31 -31
- package/dist/chunks/index-DfzCof6H.mjs.map +1 -0
- package/dist/chunks/{index-BL56fbXt.mjs → index-DyIwN_67.mjs} +89 -87
- package/dist/chunks/index-DyIwN_67.mjs.map +1 -0
- package/dist/chunks/{index-BSFLNveF.mjs → index-FlTg80Pk.mjs} +352 -341
- package/dist/chunks/index-FlTg80Pk.mjs.map +1 -0
- package/dist/chunks/{index-DAFCISBN.mjs → index-pxbbDHVH.mjs} +8 -8
- package/dist/chunks/{index-DAFCISBN.mjs.map → index-pxbbDHVH.mjs.map} +1 -1
- package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs.map +1 -1
- package/dist/commands/Commands.d.ts +13 -45
- package/dist/commands/Commands.d.ts.map +1 -1
- package/dist/commands/DeleteCommands.d.ts +15 -0
- package/dist/commands/DeleteCommands.d.ts.map +1 -0
- package/dist/commands/GapCursorCommands.d.ts +24 -0
- package/dist/commands/GapCursorCommands.d.ts.map +1 -0
- package/dist/commands/MarkCommands.d.ts +19 -0
- package/dist/commands/MarkCommands.d.ts.map +1 -0
- package/dist/commands/MovementCommands.d.ts +27 -0
- package/dist/commands/MovementCommands.d.ts.map +1 -0
- package/dist/commands/NodeSelectionCommands.d.ts +24 -0
- package/dist/commands/NodeSelectionCommands.d.ts.map +1 -0
- package/dist/commands/PasteCommand.d.ts.map +1 -1
- package/dist/commands/WordBoundary.d.ts +12 -0
- package/dist/commands/WordBoundary.d.ts.map +1 -0
- package/dist/editor/DocumentSerializer.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +7 -1
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/index.d.ts +28 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/input/ClipboardHandler.d.ts.map +1 -1
- package/dist/input/CompositionTracker.d.ts +14 -0
- package/dist/input/CompositionTracker.d.ts.map +1 -0
- package/dist/input/FileHandlerRegistry.d.ts +16 -0
- package/dist/input/FileHandlerRegistry.d.ts.map +1 -0
- package/dist/input/InputHandler.d.ts +6 -4
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/InputRuleRegistry.d.ts +9 -0
- package/dist/input/InputRuleRegistry.d.ts.map +1 -0
- package/dist/input/KeyboardHandler.d.ts +20 -5
- package/dist/input/KeyboardHandler.d.ts.map +1 -1
- package/dist/input/Keymap.d.ts +11 -0
- package/dist/input/Keymap.d.ts.map +1 -1
- package/dist/input/KeymapRegistry.d.ts +19 -0
- package/dist/input/KeymapRegistry.d.ts.map +1 -0
- package/dist/input/PasteHandler.d.ts +3 -0
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/model/Document.d.ts +8 -0
- package/dist/model/Document.d.ts.map +1 -1
- package/dist/model/GraphemeUtils.d.ts +20 -0
- package/dist/model/GraphemeUtils.d.ts.map +1 -0
- package/dist/model/HTMLUtils.d.ts +6 -1
- package/dist/model/HTMLUtils.d.ts.map +1 -1
- package/dist/model/NavigationUtils.d.ts +16 -0
- package/dist/model/NavigationUtils.d.ts.map +1 -0
- package/dist/model/SchemaRegistry.d.ts +0 -39
- package/dist/model/SchemaRegistry.d.ts.map +1 -1
- package/dist/model/Selection.d.ts +14 -3
- package/dist/model/Selection.d.ts.map +1 -1
- package/dist/notectl-core.mjs +2797 -2515
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +5869 -4844
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/Plugin.d.ts +17 -3
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginManager.d.ts +14 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +3 -3
- package/dist/plugins/blockquote.mjs +2 -2
- package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts +35 -0
- package/dist/plugins/caret-navigation/CaretNavigationPlugin.d.ts.map +1 -0
- package/dist/plugins/caret-navigation/index.d.ts +2 -0
- package/dist/plugins/caret-navigation/index.d.ts.map +1 -0
- package/dist/plugins/caret-navigation.mjs +5 -0
- package/dist/plugins/caret-navigation.mjs.map +1 -0
- package/dist/plugins/code-block/CodeBlockKeyboardHandlers.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +3 -3
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +2 -2
- package/dist/plugins/font.mjs +2 -2
- package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts +15 -0
- package/dist/plugins/gap-cursor/GapCursorPlugin.d.ts.map +1 -0
- package/dist/plugins/gap-cursor/index.d.ts +2 -0
- package/dist/plugins/gap-cursor/index.d.ts.map +1 -0
- package/dist/plugins/gap-cursor.mjs +65 -0
- package/dist/plugins/gap-cursor.mjs.map +1 -0
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading/BlockTypePickerRegistry.d.ts +9 -0
- package/dist/plugins/heading/BlockTypePickerRegistry.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingInputRules.d.ts.map +1 -1
- package/dist/plugins/heading/HeadingKeyboardHandlers.d.ts.map +1 -1
- package/dist/plugins/heading.mjs +2 -2
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +2 -2
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule.mjs +2 -2
- package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
- package/dist/plugins/image.mjs +3 -3
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link.mjs +2 -2
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +2 -2
- package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
- package/dist/plugins/print/PrintTypes.d.ts +5 -1
- package/dist/plugins/print/PrintTypes.d.ts.map +1 -1
- package/dist/plugins/shared/ColorMarkOperations.d.ts.map +1 -1
- package/dist/plugins/shared/ColorValidation.d.ts +7 -0
- package/dist/plugins/shared/ColorValidation.d.ts.map +1 -1
- package/dist/plugins/strikethrough.mjs +2 -2
- package/dist/plugins/super-sub.mjs +2 -2
- package/dist/plugins/table/TableCommands.d.ts.map +1 -1
- package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
- package/dist/plugins/table.mjs +10 -10
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color.mjs +2 -2
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarRegistry.d.ts +12 -0
- package/dist/plugins/toolbar/ToolbarRegistry.d.ts.map +1 -0
- package/dist/plugins/toolbar.mjs +2 -2
- package/dist/presets/FullPreset.d.ts +16 -0
- package/dist/presets/FullPreset.d.ts.map +1 -0
- package/dist/presets/MinimalPreset.d.ts +7 -0
- package/dist/presets/MinimalPreset.d.ts.map +1 -0
- package/dist/presets/PresetTypes.d.ts +50 -0
- package/dist/presets/PresetTypes.d.ts.map +1 -0
- package/dist/state/EditorState.d.ts.map +1 -1
- package/dist/state/History.d.ts.map +1 -1
- package/dist/state/SelectionTransactions.d.ts +10 -0
- package/dist/state/SelectionTransactions.d.ts.map +1 -0
- package/dist/test/TestUtils.d.ts +23 -0
- package/dist/test/TestUtils.d.ts.map +1 -1
- package/dist/view/CaretNavigation.d.ts +48 -0
- package/dist/view/CaretNavigation.d.ts.map +1 -0
- package/dist/view/CursorWrapper.d.ts +19 -0
- package/dist/view/CursorWrapper.d.ts.map +1 -0
- package/dist/view/DomPointUtils.d.ts +20 -0
- package/dist/view/DomPointUtils.d.ts.map +1 -0
- package/dist/view/EditorView.d.ts +43 -0
- package/dist/view/EditorView.d.ts.map +1 -1
- package/dist/view/MarkRendering.d.ts +7 -0
- package/dist/view/MarkRendering.d.ts.map +1 -0
- package/dist/view/NodeViewRegistry.d.ts +9 -0
- package/dist/view/NodeViewRegistry.d.ts.map +1 -0
- package/dist/view/Platform.d.ts +29 -0
- package/dist/view/Platform.d.ts.map +1 -0
- package/dist/view/Reconciler.d.ts +4 -0
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/dist/view/SelectionSync.d.ts +2 -0
- package/dist/view/SelectionSync.d.ts.map +1 -1
- package/dist/view/ViewMovementCommands.d.ts +40 -0
- package/dist/view/ViewMovementCommands.d.ts.map +1 -0
- package/package.json +10 -2
- package/dist/chunks/ColorNames-iaWsSZx1.mjs +0 -35
- package/dist/chunks/ColorNames-iaWsSZx1.mjs.map +0 -1
- package/dist/chunks/ColorValidation-Dyy4Bye8.mjs +0 -140
- package/dist/chunks/ColorValidation-Dyy4Bye8.mjs.map +0 -1
- package/dist/chunks/Commands-CSpSwGXv.mjs +0 -461
- package/dist/chunks/Commands-CSpSwGXv.mjs.map +0 -1
- package/dist/chunks/HTMLUtils-0wvCRvJc.mjs +0 -7
- package/dist/chunks/HTMLUtils-0wvCRvJc.mjs.map +0 -1
- package/dist/chunks/Selection-D5ZjXoB7.mjs +0 -44
- package/dist/chunks/Selection-D5ZjXoB7.mjs.map +0 -1
- package/dist/chunks/ToolbarItem-ugDymuXi.mjs +0 -7
- package/dist/chunks/ToolbarItem-ugDymuXi.mjs.map +0 -1
- package/dist/chunks/index-BCvuDpVr.mjs.map +0 -1
- package/dist/chunks/index-BL56fbXt.mjs.map +0 -1
- package/dist/chunks/index-BQ8iIYLn.mjs.map +0 -1
- package/dist/chunks/index-BRYzYOYC.mjs.map +0 -1
- package/dist/chunks/index-BSFLNveF.mjs.map +0 -1
- package/dist/chunks/index-BTJfyJlJ.mjs.map +0 -1
- package/dist/chunks/index-Bsp4LC5t.mjs.map +0 -1
- package/dist/chunks/index-DA8TG2S8.mjs.map +0 -1
- package/dist/chunks/index-DC1EK22F.mjs.map +0 -1
- package/dist/chunks/index-DGrRWMlW.mjs.map +0 -1
- package/dist/chunks/index-o6hDR07y.mjs.map +0 -1
- package/dist/chunks/index-uTnc9y7M.mjs.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { r as e } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { f as t } from "./Document-CuwE73FF.mjs";
|
|
3
3
|
import { c as o } from "./NodeSpec-NZVvcCuH.mjs";
|
|
4
|
-
import { i as r, a as i,
|
|
5
|
-
import { n } from "./TypeBrands-C09nE2qO.mjs";
|
|
6
|
-
import { f as
|
|
7
|
-
const
|
|
4
|
+
import { i as r, a as i, b as l, c as n } from "./Selection-DmFDwiPJ.mjs";
|
|
5
|
+
import { n as a } from "./TypeBrands-C09nE2qO.mjs";
|
|
6
|
+
import { f as s } from "./ToolbarItem-BpZggUGo.mjs";
|
|
7
|
+
const c = { label: "Horizontal Rule", tooltip: (e2) => `Horizontal Rule (${e2})` }, p = { en: c, de: { label: "Trennlinie", tooltip: (e2) => `Trennlinie (${e2})` }, es: { label: "Línea horizontal", tooltip: (e2) => `Línea horizontal (${e2})` }, fr: { label: "Ligne horizontale", tooltip: (e2) => `Ligne horizontale (${e2})` }, zh: { label: "分隔线", tooltip: (e2) => `分隔线 (${e2})` }, ru: { label: "Горизонтальная линия", tooltip: (e2) => `Горизонтальная линия (${e2})` }, ar: { label: "خط أفقي", tooltip: (e2) => `خط أفقي (${e2})` }, hi: { label: "क्षैतिज रेखा", tooltip: (e2) => `क्षैतिज रेखा (${e2})` } }, h = {};
|
|
8
8
|
function u(e2) {
|
|
9
9
|
const t2 = e2.selection;
|
|
10
|
-
return r(t2) ? -1 : e2.doc.children.findIndex((e3) => e3.id === t2.anchor.blockId);
|
|
10
|
+
return r(t2) || i(t2) ? -1 : e2.doc.children.findIndex((e3) => e3.id === t2.anchor.blockId);
|
|
11
11
|
}
|
|
12
|
-
class
|
|
12
|
+
class m {
|
|
13
13
|
id = "horizontal-rule";
|
|
14
14
|
name = "Horizontal Rule";
|
|
15
15
|
priority = 40;
|
|
16
16
|
config;
|
|
17
17
|
locale;
|
|
18
18
|
constructor(e2) {
|
|
19
|
-
this.config = { ...
|
|
19
|
+
this.config = { ...h, ...e2 };
|
|
20
20
|
}
|
|
21
21
|
init(t2) {
|
|
22
|
-
this.locale = e(
|
|
22
|
+
this.locale = e(p, t2, this.config.locale), this.registerNodeSpec(t2), this.registerCommands(t2), this.registerKeymap(t2), this.registerInputRule(t2), this.registerToolbarItem(t2);
|
|
23
23
|
}
|
|
24
24
|
registerNodeSpec(e2) {
|
|
25
25
|
e2.registerNodeSpec({ type: "horizontal_rule", group: "block", isVoid: true, toDOM: (e3) => o("hr", e3.id), toHTML: () => "<hr>", parseHTML: [{ tag: "hr" }], sanitize: { tags: ["hr"] } });
|
|
@@ -31,33 +31,33 @@ class h {
|
|
|
31
31
|
e2.registerKeymap({ "Mod-Shift-H": () => e2.executeCommand("insertHorizontalRule") });
|
|
32
32
|
}
|
|
33
33
|
registerInputRule(e2) {
|
|
34
|
-
e2.registerInputRule({ pattern: /^-{3,} $/, handler(e3, o2,
|
|
35
|
-
const
|
|
36
|
-
if (r(
|
|
37
|
-
if (!
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
40
|
-
const
|
|
41
|
-
if (-1 ===
|
|
42
|
-
const
|
|
43
|
-
return e3.transaction("input").deleteTextAt(
|
|
34
|
+
e2.registerInputRule({ pattern: /^-{3,} $/, handler(e3, o2, s2, c2) {
|
|
35
|
+
const p2 = e3.selection;
|
|
36
|
+
if (r(p2) || i(p2)) return null;
|
|
37
|
+
if (!l(p2)) return null;
|
|
38
|
+
const h2 = e3.getBlock(p2.anchor.blockId);
|
|
39
|
+
if (!h2 || "paragraph" !== h2.type) return null;
|
|
40
|
+
const m2 = u(e3);
|
|
41
|
+
if (-1 === m2) return null;
|
|
42
|
+
const d = t(a("paragraph"));
|
|
43
|
+
return e3.transaction("input").deleteTextAt(p2.anchor.blockId, 0, c2).setBlockType(p2.anchor.blockId, a("horizontal_rule")).insertNode([], m2 + 1, d).setSelection(n(d.id, 0)).build();
|
|
44
44
|
} });
|
|
45
45
|
}
|
|
46
46
|
registerToolbarItem(e2) {
|
|
47
|
-
e2.registerToolbarItem({ id: "horizontal-rule", group: "block", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11h16v2H4z"/></svg>', label: this.locale.label, tooltip: this.locale.tooltip(
|
|
47
|
+
e2.registerToolbarItem({ id: "horizontal-rule", group: "block", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11h16v2H4z"/></svg>', label: this.locale.label, tooltip: this.locale.tooltip(s("Mod-Shift-H")), command: "insertHorizontalRule", priority: 60, separatorAfter: this.config.separatorAfter, isActive: () => false });
|
|
48
48
|
}
|
|
49
49
|
insertHorizontalRule(e2) {
|
|
50
50
|
const o2 = e2.getState();
|
|
51
|
-
if (r(o2.selection)) return false;
|
|
52
|
-
const
|
|
53
|
-
if (-1 ===
|
|
54
|
-
const
|
|
55
|
-
return e2.dispatch(
|
|
51
|
+
if (r(o2.selection) || i(o2.selection)) return false;
|
|
52
|
+
const l2 = u(o2);
|
|
53
|
+
if (-1 === l2) return false;
|
|
54
|
+
const s2 = t(a("horizontal_rule")), c2 = t(a("paragraph")), p2 = o2.transaction("command").insertNode([], l2 + 1, s2).insertNode([], l2 + 2, c2).setSelection(n(c2.id, 0)).build();
|
|
55
|
+
return e2.dispatch(p2), true;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
m as H,
|
|
60
|
+
p as a,
|
|
61
|
+
c as b
|
|
62
62
|
};
|
|
63
|
-
//# sourceMappingURL=index-
|
|
63
|
+
//# sourceMappingURL=index-C0cEs7Jc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-C0cEs7Jc.mjs","sources":["../../src/plugins/horizontal-rule/HorizontalRuleLocale.ts","../../src/plugins/horizontal-rule/HorizontalRulePlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the HorizontalRulePlugin. */\n\n// --- Locale Interface ---\n\nexport interface HorizontalRuleLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const HORIZONTAL_RULE_LOCALE_EN: HorizontalRuleLocale = {\n\tlabel: 'Horizontal Rule',\n\ttooltip: (shortcut: string) => `Horizontal Rule (${shortcut})`,\n};\n\n// --- German Locale ---\n\nexport const HORIZONTAL_RULE_LOCALE_DE: HorizontalRuleLocale = {\n\tlabel: 'Trennlinie',\n\ttooltip: (shortcut: string) => `Trennlinie (${shortcut})`,\n};\n\n// --- Spanish Locale ---\n\nexport const HORIZONTAL_RULE_LOCALE_ES: HorizontalRuleLocale = {\n\tlabel: 'Línea horizontal',\n\ttooltip: (shortcut: string) => `Línea horizontal (${shortcut})`,\n};\n\n// --- French Locale ---\n\nexport const HORIZONTAL_RULE_LOCALE_FR: HorizontalRuleLocale = {\n\tlabel: 'Ligne horizontale',\n\ttooltip: (shortcut: string) => `Ligne horizontale (${shortcut})`,\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const HORIZONTAL_RULE_LOCALE_ZH: HorizontalRuleLocale = {\n\tlabel: '分隔线',\n\ttooltip: (shortcut: string) => `分隔线 (${shortcut})`,\n};\n\n// --- Russian Locale ---\n\nexport const HORIZONTAL_RULE_LOCALE_RU: HorizontalRuleLocale = {\n\tlabel: 'Горизонтальная линия',\n\ttooltip: (shortcut: string) => `Горизонтальная линия (${shortcut})`,\n};\n\n// --- Arabic Locale ---\n\nexport const HORIZONTAL_RULE_LOCALE_AR: HorizontalRuleLocale = {\n\tlabel: 'خط أفقي',\n\ttooltip: (shortcut: string) => `خط أفقي (${shortcut})`,\n};\n\n// --- Hindi Locale ---\n\nexport const HORIZONTAL_RULE_LOCALE_HI: HorizontalRuleLocale = {\n\tlabel: 'क्षैतिज रेखा',\n\ttooltip: (shortcut: string) => `क्षैतिज रेखा (${shortcut})`,\n};\n\n// --- Locale Map ---\n\nexport const HORIZONTAL_RULE_LOCALES: Record<string, HorizontalRuleLocale> = {\n\ten: HORIZONTAL_RULE_LOCALE_EN,\n\tde: HORIZONTAL_RULE_LOCALE_DE,\n\tes: HORIZONTAL_RULE_LOCALE_ES,\n\tfr: HORIZONTAL_RULE_LOCALE_FR,\n\tzh: HORIZONTAL_RULE_LOCALE_ZH,\n\tru: HORIZONTAL_RULE_LOCALE_RU,\n\tar: HORIZONTAL_RULE_LOCALE_AR,\n\thi: HORIZONTAL_RULE_LOCALE_HI,\n};\n","/**\n * HorizontalRulePlugin: registers a horizontal rule (divider) void block type\n * with NodeSpec, insert command, input rule, keyboard shortcut, and toolbar button.\n */\n\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport { createBlockNode } from '../../model/Document.js';\nimport { createBlockElement } from '../../model/NodeSpec.js';\nimport {\n\tcreateCollapsedSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n} from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { formatShortcut } from '../toolbar/ToolbarItem.js';\nimport { HORIZONTAL_RULE_LOCALES, type HorizontalRuleLocale } from './HorizontalRuleLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\thorizontal_rule: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\nexport interface HorizontalRuleConfig {\n\t/** When true, a separator is rendered after the toolbar item. */\n\treadonly separatorAfter?: boolean;\n\t/** Locale override for user-facing strings. */\n\treadonly locale?: HorizontalRuleLocale;\n}\n\nconst DEFAULT_CONFIG: HorizontalRuleConfig = {};\n\n// --- Helpers ---\n\n/** Finds the index of the cursor's block among top-level document children. */\nfunction findBlockIndexForCursor(state: EditorState): number {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return -1;\n\treturn state.doc.children.findIndex((b) => b.id === sel.anchor.blockId);\n}\n\n// --- Plugin ---\n\nexport class HorizontalRulePlugin implements Plugin {\n\treadonly id = 'horizontal-rule';\n\treadonly name = 'Horizontal Rule';\n\treadonly priority = 40;\n\n\tprivate readonly config: HorizontalRuleConfig;\n\tprivate locale!: HorizontalRuleLocale;\n\n\tconstructor(config?: Partial<HorizontalRuleConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.locale = resolvePluginLocale(HORIZONTAL_RULE_LOCALES, context, this.config.locale);\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerInputRule(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'horizontal_rule',\n\t\t\tgroup: 'block',\n\t\t\tisVoid: true,\n\t\t\ttoDOM(node) {\n\t\t\t\treturn createBlockElement('hr', node.id);\n\t\t\t},\n\t\t\ttoHTML() {\n\t\t\t\treturn '<hr>';\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'hr' }],\n\t\t\tsanitize: { tags: ['hr'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('insertHorizontalRule', () => {\n\t\t\treturn this.insertHorizontalRule(context);\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-H': () => context.executeCommand('insertHorizontalRule'),\n\t\t});\n\t}\n\n\tprivate registerInputRule(context: PluginContext): void {\n\t\tcontext.registerInputRule({\n\t\t\tpattern: /^-{3,} $/,\n\t\t\thandler(state, _match, _start, end) {\n\t\t\t\tconst sel = state.selection;\n\t\t\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\tconst blockIndex: number = findBlockIndexForCursor(state);\n\t\t\t\tif (blockIndex === -1) return null;\n\n\t\t\t\tconst newParagraph = createBlockNode(nodeType('paragraph'));\n\n\t\t\t\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, 0, end)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('horizontal_rule'))\n\t\t\t\t\t.insertNode([], blockIndex + 1, newParagraph)\n\t\t\t\t\t.setSelection(createCollapsedSelection(newParagraph.id, 0))\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 11h16v2H4z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'horizontal-rule',\n\t\t\tgroup: 'block',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-Shift-H')),\n\t\t\tcommand: 'insertHorizontalRule',\n\t\t\tpriority: 60,\n\t\t\tseparatorAfter: this.config.separatorAfter,\n\t\t\tisActive: () => false,\n\t\t});\n\t}\n\n\t/**\n\t * Inserts a horizontal rule after the current block,\n\t * followed by a new paragraph for continued editing.\n\t */\n\tprivate insertHorizontalRule(context: PluginContext): boolean {\n\t\tconst state: EditorState = context.getState();\n\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\tconst blockIndex: number = findBlockIndexForCursor(state);\n\t\tif (blockIndex === -1) return false;\n\n\t\tconst hrBlock = createBlockNode(nodeType('horizontal_rule'));\n\t\tconst newParagraph = createBlockNode(nodeType('paragraph'));\n\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.insertNode([], blockIndex + 1, hrBlock)\n\t\t\t.insertNode([], blockIndex + 2, newParagraph)\n\t\t\t.setSelection(createCollapsedSelection(newParagraph.id, 0))\n\t\t\t.build();\n\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n}\n"],"names":["HORIZONTAL_RULE_LOCALE_EN","label","tooltip","shortcut","HORIZONTAL_RULE_LOCALES","en","de","es","fr","zh","ru","ar","hi","DEFAULT_CONFIG","findBlockIndexForCursor","state","sel","selection","isNodeSelection","isGapCursor","doc","children","findIndex","b","id","anchor","blockId","HorizontalRulePlugin","name","priority","config","locale","this","context","resolvePluginLocale","registerNodeSpec","registerCommands","registerKeymap","registerInputRule","registerToolbarItem","type","group","isVoid","toDOM","node","createBlockElement","toHTML","parseHTML","tag","sanitize","tags","registerCommand","insertHorizontalRule","executeCommand","pattern","_match","_start","end","isCollapsed","block","getBlock","blockIndex","newParagraph","createBlockNode","nodeType","transaction","deleteTextAt","setBlockType","insertNode","setSelection","createCollapsedSelection","build","icon","formatShortcut","command","separatorAfter","isActive","getState","hrBlock","tr","dispatch"],"mappings":";;;;;;AAWO,MAAMA,IAAkD,EAC9DC,OAAO,mBACPC,SAAUC,CAAAA,OAAqB,oBAAoBA,SAsDvCC,I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,EACvD+C;IACH,EAAA,CAAA;AAAA,EAEF;AAAA,EAEQ,oBAAoBtC,IAAAA;AAI3BA,IAAAA,GAAQM,oBAAoB,EAC3Bf,IAAI,mBACJiB,OAAO,SACP+B,MALA,+FAMAvE,OAAO+B,KAAKD,OAAO9B,OACnBC,SAAS8B,KAAKD,OAAO7B,QAAQuE,EAAe,aAAA,CAAA,GAC5CC,SAAS,wBACT7C,UAAU,IACV8C,gBAAgB3C,KAAKF,OAAO6C,gBAC5BC,UAAU,YAAM,CAAA;AAAA,EAElB;AAAA,EAMQ,qBAAqB3C,IAAAA;AAC5B,UAAMlB,KAAqBkB,GAAQ4C;AACnC,QAAI3D,EAAgBH,GAAME,SAAAA,KAAcE,EAAYJ,GAAME,WAAY,QAAA;AACtE,UAAM4C,KAAqB/C,EAAwBC;AACnD,QAAA,OAAI8C,GAAmB,QAAA;AAEvB,UAAMiB,KAAUf,EAAgBC,EAAS,iBAAA,CAAA,GACnCF,KAAeC,EAAgBC,EAAS,WAAA,CAAA,GAExCe,KAAKhE,GACTkD,YAAY,SAAA,EACZG,WAAW,CAAA,GAAIP,KAAa,GAAGiB,EAAAA,EAC/BV,WAAW,IAAIP,KAAa,GAAGC,IAC/BO,aAAaC,EAAyBR,GAAatC,IAAI,CAAA,CAAA,EACvD+C;AAGF,WADAtC,GAAQ+C,SAASD,EAAAA,GAAAA;AAAAA,EAElB;AAAA;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { r as t } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
2
|
+
import { m as s } from "./TypeBrands-C09nE2qO.mjs";
|
|
3
|
+
import { f as e } from "./ToolbarItem-BpZggUGo.mjs";
|
|
4
|
+
import { e as i, b as r } from "./MarkCommands-CC37WA7Z.mjs";
|
|
5
5
|
const o = { superscriptLabel: "Superscript", superscriptTooltip: (t2) => `Superscript (${t2})`, subscriptLabel: "Subscript", subscriptTooltip: (t2) => `Subscript (${t2})` }, p = { en: o, de: { superscriptLabel: "Hochgestellt", superscriptTooltip: (t2) => `Hochgestellt (${t2})`, subscriptLabel: "Tiefgestellt", subscriptTooltip: (t2) => `Tiefgestellt (${t2})` }, es: { superscriptLabel: "Superíndice", superscriptTooltip: (t2) => `Superíndice (${t2})`, subscriptLabel: "Subíndice", subscriptTooltip: (t2) => `Subíndice (${t2})` }, fr: { superscriptLabel: "Exposant", superscriptTooltip: (t2) => `Exposant (${t2})`, subscriptLabel: "Indice", subscriptTooltip: (t2) => `Indice (${t2})` }, zh: { superscriptLabel: "上标", superscriptTooltip: (t2) => `上标 (${t2})`, subscriptLabel: "下标", subscriptTooltip: (t2) => `下标 (${t2})` }, ru: { superscriptLabel: "Надстрочный", superscriptTooltip: (t2) => `Надстрочный (${t2})`, subscriptLabel: "Подстрочный", subscriptTooltip: (t2) => `Подстрочный (${t2})` }, ar: { superscriptLabel: "مرتفع", superscriptTooltip: (t2) => `مرتفع (${t2})`, subscriptLabel: "منخفض", subscriptTooltip: (t2) => `منخفض (${t2})` }, hi: { superscriptLabel: "सुपरस्क्रिप्ट", superscriptTooltip: (t2) => `सुपरस्क्रिप्ट (${t2})`, subscriptLabel: "सबस्क्रिप्ट", subscriptTooltip: (t2) => `सबस्क्रिप्ट (${t2})` } }, c = { superscript: true, subscript: true }, a = [{ type: "superscript", opposite: "subscript", configKey: "superscript", rank: 4, tag: "sup", label: "Superscript", icon: ['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">', '<path d="M16 7.41L11.41 12 16 16.59 14.59 18l-6-6 6-6z"', ' fill="none"/>', '<path d="M9.64 7.64c.23-.5.36-1.05.36-1.64', " 0-2.21-1.79-4-4-4H2v14h4.36c2.34 0 4.24-1.9", " 4.24-4.24 0-1.6-.89-2.99-2.2-3.71zM4.5 4.5H6c.83", " 0 1.5.67 1.5 1.5S6.83 7.5 6 7.5H4.5v-3zm2 9H4.5v-3H6.5c.83", ' 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z" fill="none"/>', '<path d="M15.97 3.84c0-.47.19-.91.53-1.21.34-.31.8-.49', " 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02", "-.96-.43-1.83-1.13-2.42C19.36.77 18.45.44 17.5.44c-.88", " 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34", " 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53", " 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54", "-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96", " 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56", "-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46", '-.59-.46-.94z"/>', '<path d="M5.88 20h2.66l3.4-5.42L15.3 20h2.67l-4.73-7.38', ' 4.37-6.62h-2.6l-3.07 4.98L8.92 6h-2.6l4.26 6.58z"/>', "</svg>"].join(""), keyBinding: "Mod-.", toolbarPriority: 50, toHTMLString: (t2) => `<sup>${t2}</sup>`, parseHTML: [{ tag: "sup" }], sanitize: { tags: ["sup"] } }, { type: "subscript", opposite: "superscript", configKey: "subscript", rank: 4, tag: "sub", label: "Subscript", icon: ['<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">', '<path d="M15.97 16.84c0-.47.19-.91.53-1.21.34-.31.8-.49', " 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02", "-.96-.43-1.83-1.13-2.42-.7-.58-1.61-.91-2.56-.91-.88", " 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34", " 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53", " 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54", "-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96", " 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56", "-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46", '-.59-.46-.94z"/>', '<path d="M5.88 18h2.66l3.4-5.42L15.3 18h2.67l-4.73-7.38', ' 4.37-6.62h-2.6l-3.07 4.98L8.92 4h-2.6l4.26 6.58z"/>', "</svg>"].join(""), keyBinding: "Mod-,", toolbarPriority: 51, toHTMLString: (t2) => `<sub>${t2}</sub>`, parseHTML: [{ tag: "sub" }], sanitize: { tags: ["sub"] } }];
|
|
6
6
|
class l {
|
|
7
7
|
id = "super-sub";
|
|
@@ -12,57 +12,57 @@ class l {
|
|
|
12
12
|
constructor(t2) {
|
|
13
13
|
this.config = { ...c, ...t2 };
|
|
14
14
|
}
|
|
15
|
-
init(
|
|
16
|
-
this.locale =
|
|
17
|
-
const
|
|
18
|
-
for (const
|
|
19
|
-
const
|
|
20
|
-
this.registerMark(
|
|
15
|
+
init(s2) {
|
|
16
|
+
this.locale = t(p, s2, this.config.locale);
|
|
17
|
+
const e2 = a.filter((t2) => this.config[t2.configKey]), i2 = e2.filter((t2) => this.isToolbarVisible(t2.configKey)).at(-1);
|
|
18
|
+
for (const t2 of e2) {
|
|
19
|
+
const e3 = !!this.config.separatorAfter && t2 === i2;
|
|
20
|
+
this.registerMark(s2, t2, e3);
|
|
21
21
|
}
|
|
22
|
-
this.registerKeymaps(
|
|
22
|
+
this.registerKeymaps(s2, e2), this.registerExclusivityMiddleware(s2, e2), this.registerDisabledToolbarItems(s2);
|
|
23
23
|
}
|
|
24
|
-
registerMark(
|
|
24
|
+
registerMark(t2, o2, p2) {
|
|
25
25
|
const c2 = n(o2.type), a2 = this.isToolbarVisible(o2.configKey);
|
|
26
|
-
if (
|
|
27
|
-
const
|
|
28
|
-
return !!
|
|
26
|
+
if (t2.registerMarkSpec({ type: o2.type, rank: o2.rank, toDOM: () => document.createElement(o2.tag), toHTMLString: (t3, s2) => o2.toHTMLString(s2), parseHTML: o2.parseHTML, sanitize: o2.sanitize }), t2.registerCommand(c2, () => {
|
|
27
|
+
const e2 = i(t2.getState(), s(o2.type));
|
|
28
|
+
return !!e2 && (t2.dispatch(e2), true);
|
|
29
29
|
}), a2) {
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const i2 = "superscript" === o2.type ? this.locale.superscriptLabel : this.locale.subscriptLabel, a3 = "superscript" === o2.type ? this.locale.superscriptTooltip(e(o2.keyBinding)) : this.locale.subscriptTooltip(e(o2.keyBinding));
|
|
31
|
+
t2.registerToolbarItem({ id: o2.type, group: "format", icon: o2.icon, label: i2, tooltip: a3, command: c2, priority: o2.toolbarPriority, separatorAfter: p2, isActive: (t3) => r(t3, s(o2.type)) });
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
registerKeymaps(t2, s2) {
|
|
35
|
-
const
|
|
36
|
-
for (const
|
|
37
|
-
const s3 = n(
|
|
38
|
-
i2
|
|
35
|
+
const e2 = {};
|
|
36
|
+
for (const i2 of s2) {
|
|
37
|
+
const s3 = n(i2.type);
|
|
38
|
+
e2[i2.keyBinding] = () => t2.executeCommand(s3);
|
|
39
39
|
}
|
|
40
|
-
Object.keys(
|
|
40
|
+
Object.keys(e2).length > 0 && t2.registerKeymap(e2);
|
|
41
41
|
}
|
|
42
|
-
registerExclusivityMiddleware(t2,
|
|
43
|
-
|
|
42
|
+
registerExclusivityMiddleware(t2, e2) {
|
|
43
|
+
e2.some((t3) => "superscript" === t3.type) && e2.some((t3) => "subscript" === t3.type) && t2.registerMiddleware((t3, e3, i2) => {
|
|
44
44
|
let r2 = false;
|
|
45
45
|
const o2 = [];
|
|
46
|
-
for (const
|
|
47
|
-
if ("addMark" !==
|
|
48
|
-
o2.push(
|
|
46
|
+
for (const e4 of t3.steps) {
|
|
47
|
+
if ("addMark" !== e4.type) {
|
|
48
|
+
o2.push(e4);
|
|
49
49
|
continue;
|
|
50
50
|
}
|
|
51
|
-
const t4 =
|
|
51
|
+
const t4 = e4.mark.type, i3 = a.find((s2) => s2.type === t4);
|
|
52
52
|
if (!i3) {
|
|
53
|
-
o2.push(
|
|
53
|
+
o2.push(e4);
|
|
54
54
|
continue;
|
|
55
55
|
}
|
|
56
56
|
r2 = true;
|
|
57
|
-
const p3 = { type: "removeMark", blockId:
|
|
58
|
-
o2.push(p3,
|
|
57
|
+
const p3 = { type: "removeMark", blockId: e4.blockId, from: e4.from, to: e4.to, mark: { type: s(i3.opposite) }, ...e4.path ? { path: e4.path } : {} };
|
|
58
|
+
o2.push(p3, e4);
|
|
59
59
|
}
|
|
60
60
|
let p2 = t3.storedMarksAfter;
|
|
61
61
|
if (p2) {
|
|
62
|
-
const t4 = p2.some((t5) => "superscript" === t5.type),
|
|
63
|
-
if (t4 &&
|
|
62
|
+
const t4 = p2.some((t5) => "superscript" === t5.type), s2 = p2.some((t5) => "subscript" === t5.type);
|
|
63
|
+
if (t4 && s2) {
|
|
64
64
|
const t5 = p2.findLastIndex((t6) => "superscript" === t6.type) > p2.findLastIndex((t6) => "subscript" === t6.type) ? "subscript" : "superscript";
|
|
65
|
-
p2 = p2.filter((
|
|
65
|
+
p2 = p2.filter((s3) => s3.type !== t5), r2 = true;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
i2(r2 ? { ...t3, steps: o2, storedMarksAfter: p2 } : t3);
|
|
@@ -70,10 +70,10 @@ class l {
|
|
|
70
70
|
}
|
|
71
71
|
registerDisabledToolbarItems(t2) {
|
|
72
72
|
if (this.config.toolbar) for (const s2 of a) {
|
|
73
|
-
const
|
|
74
|
-
if (!
|
|
75
|
-
const
|
|
76
|
-
t2.registerToolbarItem({ id: s2.type, group: "format", icon: s2.icon, label:
|
|
73
|
+
const e2 = this.config[s2.configKey], i2 = this.config.toolbar[s2.configKey] ?? true;
|
|
74
|
+
if (!e2 && i2) {
|
|
75
|
+
const e3 = "superscript" === s2.type ? this.locale.superscriptLabel : this.locale.subscriptLabel;
|
|
76
|
+
t2.registerToolbarItem({ id: s2.type, group: "format", icon: s2.icon, label: e3, command: n(s2.type), priority: s2.toolbarPriority, isEnabled: () => false });
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -85,8 +85,8 @@ function n(t2) {
|
|
|
85
85
|
return `toggle${t2.charAt(0).toUpperCase()}${t2.slice(1)}`;
|
|
86
86
|
}
|
|
87
87
|
export {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
l as S,
|
|
89
|
+
p as a,
|
|
90
|
+
o as b
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=index-
|
|
92
|
+
//# sourceMappingURL=index-C9gc3Bws.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-BFsYGsBR.mjs","sources":["../../src/plugins/super-sub/SuperSubLocale.ts","../../src/plugins/super-sub/SuperSubPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the SuperSubPlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface SuperSubLocale {\n\treadonly superscriptLabel: string;\n\treadonly superscriptTooltip: (shortcut: string) => string;\n\treadonly subscriptLabel: string;\n\treadonly subscriptTooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const SUPER_SUB_LOCALE_EN: SuperSubLocale = {\n\tsuperscriptLabel: 'Superscript',\n\tsuperscriptTooltip: (shortcut: string) => `Superscript (${shortcut})`,\n\tsubscriptLabel: 'Subscript',\n\tsubscriptTooltip: (shortcut: string) => `Subscript (${shortcut})`,\n};\n\n// --- German Locale ---\n\nexport const SUPER_SUB_LOCALE_DE: SuperSubLocale = {\n\tsuperscriptLabel: 'Hochgestellt',\n\tsuperscriptTooltip: (shortcut: string) => `Hochgestellt (${shortcut})`,\n\tsubscriptLabel: 'Tiefgestellt',\n\tsubscriptTooltip: (shortcut: string) => `Tiefgestellt (${shortcut})`,\n};\n\n// --- Spanish Locale ---\n\nexport const SUPER_SUB_LOCALE_ES: SuperSubLocale = {\n\tsuperscriptLabel: 'Superíndice',\n\tsuperscriptTooltip: (shortcut: string) => `Superíndice (${shortcut})`,\n\tsubscriptLabel: 'Subíndice',\n\tsubscriptTooltip: (shortcut: string) => `Subíndice (${shortcut})`,\n};\n\n// --- French Locale ---\n\nexport const SUPER_SUB_LOCALE_FR: SuperSubLocale = {\n\tsuperscriptLabel: 'Exposant',\n\tsuperscriptTooltip: (shortcut: string) => `Exposant (${shortcut})`,\n\tsubscriptLabel: 'Indice',\n\tsubscriptTooltip: (shortcut: string) => `Indice (${shortcut})`,\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const SUPER_SUB_LOCALE_ZH: SuperSubLocale = {\n\tsuperscriptLabel: '上标',\n\tsuperscriptTooltip: (shortcut: string) => `上标 (${shortcut})`,\n\tsubscriptLabel: '下标',\n\tsubscriptTooltip: (shortcut: string) => `下标 (${shortcut})`,\n};\n\n// --- Russian Locale ---\n\nexport const SUPER_SUB_LOCALE_RU: SuperSubLocale = {\n\tsuperscriptLabel: 'Надстрочный',\n\tsuperscriptTooltip: (shortcut: string) => `Надстрочный (${shortcut})`,\n\tsubscriptLabel: 'Подстрочный',\n\tsubscriptTooltip: (shortcut: string) => `Подстрочный (${shortcut})`,\n};\n\n// --- Arabic Locale ---\n\nexport const SUPER_SUB_LOCALE_AR: SuperSubLocale = {\n\tsuperscriptLabel: 'مرتفع',\n\tsuperscriptTooltip: (shortcut: string) => `مرتفع (${shortcut})`,\n\tsubscriptLabel: 'منخفض',\n\tsubscriptTooltip: (shortcut: string) => `منخفض (${shortcut})`,\n};\n\n// --- Hindi Locale ---\n\nexport const SUPER_SUB_LOCALE_HI: SuperSubLocale = {\n\tsuperscriptLabel: 'सुपरस्क्रिप्ट',\n\tsuperscriptTooltip: (shortcut: string) => `सुपरस्क्रिप्ट (${shortcut})`,\n\tsubscriptLabel: 'सबस्क्रिप्ट',\n\tsubscriptTooltip: (shortcut: string) => `सबस्क्रिप्ट (${shortcut})`,\n};\n\n// --- Locale Map ---\n\nexport const SUPER_SUB_LOCALES: Record<string, SuperSubLocale> = {\n\ten: SUPER_SUB_LOCALE_EN,\n\tde: SUPER_SUB_LOCALE_DE,\n\tes: SUPER_SUB_LOCALE_ES,\n\tfr: SUPER_SUB_LOCALE_FR,\n\tzh: SUPER_SUB_LOCALE_ZH,\n\tru: SUPER_SUB_LOCALE_RU,\n\tar: SUPER_SUB_LOCALE_AR,\n\thi: SUPER_SUB_LOCALE_HI,\n};\n","/**\n * SuperSubPlugin: registers superscript and subscript inline marks with\n * MarkSpecs, toggle commands, keyboard shortcuts, toolbar buttons, and\n * a middleware that enforces mutual exclusivity between the two marks.\n *\n * Data-driven — each mark type is defined declaratively and all\n * registrations are derived from the same definition table.\n */\n\nimport { isMarkActive, toggleMark } from '../../commands/Commands.js';\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport type { Mark } from '../../model/Document.js';\nimport type { ParseRule } from '../../model/ParseRule.js';\nimport type { SanitizeConfig } from '../../model/SanitizeConfig.js';\nimport { markType as mkType } from '../../model/TypeBrands.js';\nimport type { RemoveMarkStep, Step } from '../../state/Transaction.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { formatShortcut } from '../toolbar/ToolbarItem.js';\nimport { SUPER_SUB_LOCALES, type SuperSubLocale } from './SuperSubLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tsuperscript: Record<string, never>;\n\t\tsubscript: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\n/** Controls toolbar button visibility per mark. */\nexport interface SuperSubToolbarConfig {\n\treadonly superscript?: boolean;\n\treadonly subscript?: boolean;\n}\n\n/** Controls which marks are enabled and which toolbar buttons are shown. */\nexport interface SuperSubConfig {\n\treadonly superscript: boolean;\n\treadonly subscript: boolean;\n\treadonly toolbar?: SuperSubToolbarConfig;\n\t/** When true, a separator is rendered after the last toolbar item. */\n\treadonly separatorAfter?: boolean;\n\treadonly locale?: SuperSubLocale;\n}\n\nconst DEFAULT_CONFIG: SuperSubConfig = {\n\tsuperscript: true,\n\tsubscript: true,\n};\n\n// --- Mark Definitions ---\n\ninterface MarkDefinition {\n\treadonly type: 'superscript' | 'subscript';\n\treadonly opposite: 'superscript' | 'subscript';\n\treadonly configKey: keyof Omit<SuperSubConfig, 'toolbar' | 'separatorAfter' | 'locale'>;\n\treadonly rank: number;\n\treadonly tag: string;\n\treadonly label: string;\n\treadonly icon: string;\n\treadonly keyBinding: string;\n\treadonly toolbarPriority: number;\n\treadonly toHTMLString: (content: string) => string;\n\treadonly parseHTML: readonly ParseRule[];\n\treadonly sanitize: SanitizeConfig;\n}\n\nconst SUPERSCRIPT_ICON: string = [\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">',\n\t'<path d=\"M16 7.41L11.41 12 16 16.59 14.59 18l-6-6 6-6z\"',\n\t' fill=\"none\"/>',\n\t'<path d=\"M9.64 7.64c.23-.5.36-1.05.36-1.64',\n\t' 0-2.21-1.79-4-4-4H2v14h4.36c2.34 0 4.24-1.9',\n\t' 4.24-4.24 0-1.6-.89-2.99-2.2-3.71zM4.5 4.5H6c.83',\n\t' 0 1.5.67 1.5 1.5S6.83 7.5 6 7.5H4.5v-3zm2 9H4.5v-3H6.5c.83',\n\t' 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z\" fill=\"none\"/>',\n\t'<path d=\"M15.97 3.84c0-.47.19-.91.53-1.21.34-.31.8-.49',\n\t' 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02',\n\t'-.96-.43-1.83-1.13-2.42C19.36.77 18.45.44 17.5.44c-.88',\n\t' 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34',\n\t' 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53',\n\t' 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54',\n\t'-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96',\n\t' 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56',\n\t'-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46',\n\t'-.59-.46-.94z\"/>',\n\t'<path d=\"M5.88 20h2.66l3.4-5.42L15.3 20h2.67l-4.73-7.38',\n\t' 4.37-6.62h-2.6l-3.07 4.98L8.92 6h-2.6l4.26 6.58z\"/>',\n\t'</svg>',\n].join('');\n\nconst SUBSCRIPT_ICON: string = [\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">',\n\t'<path d=\"M15.97 16.84c0-.47.19-.91.53-1.21.34-.31.8-.49',\n\t' 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02',\n\t'-.96-.43-1.83-1.13-2.42-.7-.58-1.61-.91-2.56-.91-.88',\n\t' 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34',\n\t' 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53',\n\t' 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54',\n\t'-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96',\n\t' 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56',\n\t'-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46',\n\t'-.59-.46-.94z\"/>',\n\t'<path d=\"M5.88 18h2.66l3.4-5.42L15.3 18h2.67l-4.73-7.38',\n\t' 4.37-6.62h-2.6l-3.07 4.98L8.92 4h-2.6l4.26 6.58z\"/>',\n\t'</svg>',\n].join('');\n\nconst MARK_DEFINITIONS: readonly MarkDefinition[] = [\n\t{\n\t\ttype: 'superscript',\n\t\topposite: 'subscript',\n\t\tconfigKey: 'superscript',\n\t\trank: 4,\n\t\ttag: 'sup',\n\t\tlabel: 'Superscript',\n\t\ticon: SUPERSCRIPT_ICON,\n\t\tkeyBinding: 'Mod-.',\n\t\ttoolbarPriority: 50,\n\t\ttoHTMLString: (content) => `<sup>${content}</sup>`,\n\t\tparseHTML: [{ tag: 'sup' }],\n\t\tsanitize: { tags: ['sup'] },\n\t},\n\t{\n\t\ttype: 'subscript',\n\t\topposite: 'superscript',\n\t\tconfigKey: 'subscript',\n\t\trank: 4,\n\t\ttag: 'sub',\n\t\tlabel: 'Subscript',\n\t\ticon: SUBSCRIPT_ICON,\n\t\tkeyBinding: 'Mod-,',\n\t\ttoolbarPriority: 51,\n\t\ttoHTMLString: (content) => `<sub>${content}</sub>`,\n\t\tparseHTML: [{ tag: 'sub' }],\n\t\tsanitize: { tags: ['sub'] },\n\t},\n];\n\n// --- Plugin ---\n\nexport class SuperSubPlugin implements Plugin {\n\treadonly id = 'super-sub';\n\treadonly name = 'Superscript & Subscript';\n\treadonly priority = 23;\n\n\tprivate readonly config: SuperSubConfig;\n\tprivate locale!: SuperSubLocale;\n\n\tconstructor(config?: Partial<SuperSubConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.locale = resolvePluginLocale(SUPER_SUB_LOCALES, context, this.config.locale);\n\n\t\tconst enabledMarks: MarkDefinition[] = MARK_DEFINITIONS.filter(\n\t\t\t(def) => this.config[def.configKey],\n\t\t);\n\n\t\tconst visibleToolbarMarks: MarkDefinition[] = enabledMarks.filter((def) =>\n\t\t\tthis.isToolbarVisible(def.configKey),\n\t\t);\n\t\tconst lastVisibleMark: MarkDefinition | undefined = visibleToolbarMarks.at(-1);\n\n\t\tfor (const def of enabledMarks) {\n\t\t\tconst isSeparatorTarget: boolean = !!this.config.separatorAfter && def === lastVisibleMark;\n\t\t\tthis.registerMark(context, def, isSeparatorTarget);\n\t\t}\n\n\t\tthis.registerKeymaps(context, enabledMarks);\n\t\tthis.registerExclusivityMiddleware(context, enabledMarks);\n\t\tthis.registerDisabledToolbarItems(context);\n\t}\n\n\tprivate registerMark(context: PluginContext, def: MarkDefinition, separatorAfter: boolean): void {\n\t\tconst commandName: string = toCommandName(def.type);\n\t\tconst toolbarVisible: boolean = this.isToolbarVisible(def.configKey);\n\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: def.type,\n\t\t\trank: def.rank,\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement(def.tag);\n\t\t\t},\n\t\t\ttoHTMLString: (_mark, content) => def.toHTMLString(content),\n\t\t\tparseHTML: def.parseHTML,\n\t\t\tsanitize: def.sanitize,\n\t\t});\n\n\t\tcontext.registerCommand(commandName, () => {\n\t\t\tconst tr = toggleMark(context.getState(), mkType(def.type));\n\t\t\tif (tr) {\n\t\t\t\tcontext.dispatch(tr);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\n\t\tif (toolbarVisible) {\n\t\t\tconst label: string =\n\t\t\t\tdef.type === 'superscript' ? this.locale.superscriptLabel : this.locale.subscriptLabel;\n\t\t\tconst tooltip: string =\n\t\t\t\tdef.type === 'superscript'\n\t\t\t\t\t? this.locale.superscriptTooltip(formatShortcut(def.keyBinding))\n\t\t\t\t\t: this.locale.subscriptTooltip(formatShortcut(def.keyBinding));\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: def.type,\n\t\t\t\tgroup: 'format',\n\t\t\t\ticon: def.icon,\n\t\t\t\tlabel,\n\t\t\t\ttooltip,\n\t\t\t\tcommand: commandName,\n\t\t\t\tpriority: def.toolbarPriority,\n\t\t\t\tseparatorAfter,\n\t\t\t\tisActive: (state) => isMarkActive(state, mkType(def.type)),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate registerKeymaps(context: PluginContext, marks: readonly MarkDefinition[]): void {\n\t\tconst keymap: Record<string, () => boolean> = {};\n\t\tfor (const def of marks) {\n\t\t\tconst commandName: string = toCommandName(def.type);\n\t\t\tkeymap[def.keyBinding] = () => context.executeCommand(commandName);\n\t\t}\n\t\tif (Object.keys(keymap).length > 0) {\n\t\t\tcontext.registerKeymap(keymap);\n\t\t}\n\t}\n\n\t/**\n\t * Ensures superscript and subscript are mutually exclusive.\n\t * When an addMark step for one type is found, a removeMark step\n\t * for the opposite type is injected. For stored marks, the opposite\n\t * mark is filtered out.\n\t */\n\tprivate registerExclusivityMiddleware(\n\t\tcontext: PluginContext,\n\t\tenabledMarks: readonly MarkDefinition[],\n\t): void {\n\t\tconst bothEnabled: boolean =\n\t\t\tenabledMarks.some((d) => d.type === 'superscript') &&\n\t\t\tenabledMarks.some((d) => d.type === 'subscript');\n\n\t\tif (!bothEnabled) return;\n\n\t\tcontext.registerMiddleware(\n\t\t\t(tr, _state, next) => {\n\t\t\t\tlet patched = false;\n\n\t\t\t\t// Handle addMark steps: inject removeMark for the opposite type\n\t\t\t\tconst patchedSteps: Step[] = [];\n\t\t\t\tfor (const step of tr.steps) {\n\t\t\t\t\tif (step.type !== 'addMark') {\n\t\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst markName: string = step.mark.type;\n\t\t\t\t\tconst def: MarkDefinition | undefined = MARK_DEFINITIONS.find((d) => d.type === markName);\n\t\t\t\t\tif (!def) {\n\t\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tpatched = true;\n\t\t\t\t\tconst removeStep: RemoveMarkStep = {\n\t\t\t\t\t\ttype: 'removeMark',\n\t\t\t\t\t\tblockId: step.blockId,\n\t\t\t\t\t\tfrom: step.from,\n\t\t\t\t\t\tto: step.to,\n\t\t\t\t\t\tmark: { type: mkType(def.opposite) },\n\t\t\t\t\t\t...(step.path ? { path: step.path } : {}),\n\t\t\t\t\t};\n\t\t\t\t\tpatchedSteps.push(removeStep, step);\n\t\t\t\t}\n\n\t\t\t\t// Handle stored marks: remove the opposite mark\n\t\t\t\tlet storedMarksAfter: readonly Mark[] | null = tr.storedMarksAfter;\n\t\t\t\tif (storedMarksAfter) {\n\t\t\t\t\tconst hasSup: boolean = storedMarksAfter.some((m) => m.type === 'superscript');\n\t\t\t\t\tconst hasSub: boolean = storedMarksAfter.some((m) => m.type === 'subscript');\n\n\t\t\t\t\tif (hasSup && hasSub) {\n\t\t\t\t\t\t// Keep the one that was most recently added (last in array)\n\t\t\t\t\t\tconst lastSupIdx: number = storedMarksAfter.findLastIndex(\n\t\t\t\t\t\t\t(m) => m.type === 'superscript',\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst lastSubIdx: number = storedMarksAfter.findLastIndex(\n\t\t\t\t\t\t\t(m) => m.type === 'subscript',\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst removeType: string = lastSupIdx > lastSubIdx ? 'subscript' : 'superscript';\n\n\t\t\t\t\t\tstoredMarksAfter = storedMarksAfter.filter((m) => m.type !== removeType);\n\t\t\t\t\t\tpatched = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnext(patched ? { ...tr, steps: patchedSteps, storedMarksAfter } : tr);\n\t\t\t},\n\t\t\t{ name: 'super-sub:exclusivity' },\n\t\t);\n\t}\n\n\t/**\n\t * Registers disabled toolbar buttons for marks whose feature is disabled\n\t * but whose toolbar button is explicitly requested.\n\t */\n\tprivate registerDisabledToolbarItems(context: PluginContext): void {\n\t\tif (!this.config.toolbar) return;\n\n\t\tfor (const def of MARK_DEFINITIONS) {\n\t\t\tconst featureEnabled: boolean = this.config[def.configKey];\n\t\t\tconst toolbarVisible: boolean = this.config.toolbar[def.configKey] ?? true;\n\n\t\t\tif (!featureEnabled && toolbarVisible) {\n\t\t\t\tconst label: string =\n\t\t\t\t\tdef.type === 'superscript' ? this.locale.superscriptLabel : this.locale.subscriptLabel;\n\t\t\t\tcontext.registerToolbarItem({\n\t\t\t\t\tid: def.type,\n\t\t\t\t\tgroup: 'format',\n\t\t\t\t\ticon: def.icon,\n\t\t\t\t\tlabel,\n\t\t\t\t\tcommand: toCommandName(def.type),\n\t\t\t\t\tpriority: def.toolbarPriority,\n\t\t\t\t\tisEnabled: () => false,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate isToolbarVisible(\n\t\tconfigKey: keyof Omit<SuperSubConfig, 'toolbar' | 'separatorAfter' | 'locale'>,\n\t): boolean {\n\t\tif (!this.config.toolbar) return true;\n\t\treturn this.config.toolbar[configKey] ?? true;\n\t}\n}\n\n/** Converts a mark type to its toggle command name (e.g. 'superscript' → 'toggleSuperscript'). */\nfunction toCommandName(markType: string): string {\n\treturn `toggle${markType.charAt(0).toUpperCase()}${markType.slice(1)}`;\n}\n"],"names":["SUPER_SUB_LOCALE_EN","superscriptLabel","superscriptTooltip","shortcut","subscriptLabel","subscriptTooltip","SUPER_SUB_LOCALES","en","de","es","fr","zh","ru","ar","hi","DEFAULT_CONFIG","superscript","subscript","MARK_DEFINITIONS","type","opposite","configKey","rank","tag","label","icon","join","keyBinding","toolbarPriority","toHTMLString","content","parseHTML","sanitize","tags","SuperSubPlugin","id","name","priority","config","locale","this","context","resolvePluginLocale","enabledMarks","filter","def","lastVisibleMark","isToolbarVisible","at","isSeparatorTarget","separatorAfter","registerMark","registerKeymaps","registerExclusivityMiddleware","registerDisabledToolbarItems","commandName","toCommandName","toolbarVisible","registerMarkSpec","toDOM","document","createElement","_mark","registerCommand","tr","toggleMark","getState","mkType","dispatch","tooltip","formatShortcut","registerToolbarItem","group","command","isActive","state","isMarkActive","marks","keymap","executeCommand","Object","keys","length","registerKeymap","some","d","registerMiddleware","_state","next","patched","patchedSteps","step","steps","push","markName","mark","find","removeStep","blockId","from","to","path","storedMarksAfter","hasSup","m","hasSub","removeType","findLastIndex","toolbar","featureEnabled","isEnabled","markType","charAt","toUpperCase","slice"],"mappings":";;;;AAeO,MAAMA,IAAsC,EAClDC,kBAAkB,eAClBC,oBAAqBC,CAAAA,OAAqB,gBAAgBA,EAAAA,KAC1DC,gBAAgB,aAChBC,kBAAmBF,CAAAA,OAAqB,cAAcA,SAoE1CG,IAAoD,EAChEC,IAAIP,GACJQ,IAjEkD,EAClDP,kBAAkB,gBAClBC,oBAAqBC,CAAAA,OAAqB,iBAAiBA,OAC3DC,gBAAgB,gBAChBC,kBAAmBF,CAAAA,OAAqB,iBAAiBA,SA8DzDM,IAzDkD,EAClDR,kBAAkB,eAClBC,oBAAqBC,CAAAA,OAAqB,gBAAgBA,OAC1DC,gBAAgB,aAChBC,kBAAmBF,CAAAA,OAAqB,cAAcA,SAsDtDO,IAjDkD,EAClDT,kBAAkB,YAClBC,oBAAqBC,CAAAA,OAAqB,aAAaA,EAAAA,KACvDC,gBAAgB,UAChBC,kBAAmBF,CAAAA,OAAqB,WAAWA,SA8CnDQ,IAzCkD,EAClDV,kBAAkB,MAClBC,oBAAqBC,CAAAA,OAAqB,OAAOA,EAAAA,KACjDC,gBAAgB,MAChBC,kBAAmBF,CAAAA,OAAqB,OAAOA,EAAAA,IAAAA,GAsC/CS,IAjCkD,EAClDX,kBAAkB,eAClBC,oBAAqBC,CAAAA,OAAqB,gBAAgBA,EAAAA,KAC1DC,gBAAgB,eAChBC,kBAAmBF,CAAAA,OAAqB,gBAAgBA,EAAAA,IAAAA,GA8BxDU,IAzBkD,EAClDZ,kBAAkB,SAClBC,oBAAqBC,CAAAA,OAAqB,UAAUA,EAAAA,KACpDC,gBAAgB,SAChBC,kBAAmBF,CAAAA,OAAqB,UA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OAAOnC;AACzEqC,QAAAA,GAAQ8B,oBAAoB,EAC3BpC,IAAIU,GAAI1B,MACRqD,OAAO,UACP/C,MAAMoB,GAAIpB,MACVD,OAAAA,IACAiD,SAASjB,EAAcX,GAAI1B,IAAAA,GAC3BkB,UAAUQ,GAAIjB,iBACdkF,WAAW,MAAA,MAAM,CAAA;AAAA,MAEnB;AAAA,IACD;AAAA,EACD;AAAA,EAEQ,iBACPzF,IAAAA;AAEA,YAAKmB,KAAKF,OAAOsE,YACVpE,KAAKF,OAAOsE,QAAQvF,EAAAA,KAAAA;AAAAA,EAC5B;AAAA;AAID,SAASmC,EAAcuD,IAAAA;AACtB,SAAO,SAASA,GAASC,OAAO,GAAGC,YAAAA,CAAAA,GAAgBF,GAASG,MAAM,CAAA,CAAA;AACnE;"}
|
|
1
|
+
{"version":3,"file":"index-C9gc3Bws.mjs","sources":["../../src/plugins/super-sub/SuperSubLocale.ts","../../src/plugins/super-sub/SuperSubPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the SuperSubPlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface SuperSubLocale {\n\treadonly superscriptLabel: string;\n\treadonly superscriptTooltip: (shortcut: string) => string;\n\treadonly subscriptLabel: string;\n\treadonly subscriptTooltip: (shortcut: string) => string;\n}\n\n// --- Default English Locale ---\n\nexport const SUPER_SUB_LOCALE_EN: SuperSubLocale = {\n\tsuperscriptLabel: 'Superscript',\n\tsuperscriptTooltip: (shortcut: string) => `Superscript (${shortcut})`,\n\tsubscriptLabel: 'Subscript',\n\tsubscriptTooltip: (shortcut: string) => `Subscript (${shortcut})`,\n};\n\n// --- German Locale ---\n\nexport const SUPER_SUB_LOCALE_DE: SuperSubLocale = {\n\tsuperscriptLabel: 'Hochgestellt',\n\tsuperscriptTooltip: (shortcut: string) => `Hochgestellt (${shortcut})`,\n\tsubscriptLabel: 'Tiefgestellt',\n\tsubscriptTooltip: (shortcut: string) => `Tiefgestellt (${shortcut})`,\n};\n\n// --- Spanish Locale ---\n\nexport const SUPER_SUB_LOCALE_ES: SuperSubLocale = {\n\tsuperscriptLabel: 'Superíndice',\n\tsuperscriptTooltip: (shortcut: string) => `Superíndice (${shortcut})`,\n\tsubscriptLabel: 'Subíndice',\n\tsubscriptTooltip: (shortcut: string) => `Subíndice (${shortcut})`,\n};\n\n// --- French Locale ---\n\nexport const SUPER_SUB_LOCALE_FR: SuperSubLocale = {\n\tsuperscriptLabel: 'Exposant',\n\tsuperscriptTooltip: (shortcut: string) => `Exposant (${shortcut})`,\n\tsubscriptLabel: 'Indice',\n\tsubscriptTooltip: (shortcut: string) => `Indice (${shortcut})`,\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const SUPER_SUB_LOCALE_ZH: SuperSubLocale = {\n\tsuperscriptLabel: '上标',\n\tsuperscriptTooltip: (shortcut: string) => `上标 (${shortcut})`,\n\tsubscriptLabel: '下标',\n\tsubscriptTooltip: (shortcut: string) => `下标 (${shortcut})`,\n};\n\n// --- Russian Locale ---\n\nexport const SUPER_SUB_LOCALE_RU: SuperSubLocale = {\n\tsuperscriptLabel: 'Надстрочный',\n\tsuperscriptTooltip: (shortcut: string) => `Надстрочный (${shortcut})`,\n\tsubscriptLabel: 'Подстрочный',\n\tsubscriptTooltip: (shortcut: string) => `Подстрочный (${shortcut})`,\n};\n\n// --- Arabic Locale ---\n\nexport const SUPER_SUB_LOCALE_AR: SuperSubLocale = {\n\tsuperscriptLabel: 'مرتفع',\n\tsuperscriptTooltip: (shortcut: string) => `مرتفع (${shortcut})`,\n\tsubscriptLabel: 'منخفض',\n\tsubscriptTooltip: (shortcut: string) => `منخفض (${shortcut})`,\n};\n\n// --- Hindi Locale ---\n\nexport const SUPER_SUB_LOCALE_HI: SuperSubLocale = {\n\tsuperscriptLabel: 'सुपरस्क्रिप्ट',\n\tsuperscriptTooltip: (shortcut: string) => `सुपरस्क्रिप्ट (${shortcut})`,\n\tsubscriptLabel: 'सबस्क्रिप्ट',\n\tsubscriptTooltip: (shortcut: string) => `सबस्क्रिप्ट (${shortcut})`,\n};\n\n// --- Locale Map ---\n\nexport const SUPER_SUB_LOCALES: Record<string, SuperSubLocale> = {\n\ten: SUPER_SUB_LOCALE_EN,\n\tde: SUPER_SUB_LOCALE_DE,\n\tes: SUPER_SUB_LOCALE_ES,\n\tfr: SUPER_SUB_LOCALE_FR,\n\tzh: SUPER_SUB_LOCALE_ZH,\n\tru: SUPER_SUB_LOCALE_RU,\n\tar: SUPER_SUB_LOCALE_AR,\n\thi: SUPER_SUB_LOCALE_HI,\n};\n","/**\n * SuperSubPlugin: registers superscript and subscript inline marks with\n * MarkSpecs, toggle commands, keyboard shortcuts, toolbar buttons, and\n * a middleware that enforces mutual exclusivity between the two marks.\n *\n * Data-driven — each mark type is defined declaratively and all\n * registrations are derived from the same definition table.\n */\n\nimport { isMarkActive, toggleMark } from '../../commands/Commands.js';\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport type { Mark } from '../../model/Document.js';\nimport type { ParseRule } from '../../model/ParseRule.js';\nimport type { SanitizeConfig } from '../../model/SanitizeConfig.js';\nimport { markType as mkType } from '../../model/TypeBrands.js';\nimport type { RemoveMarkStep, Step } from '../../state/Transaction.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { formatShortcut } from '../toolbar/ToolbarItem.js';\nimport { SUPER_SUB_LOCALES, type SuperSubLocale } from './SuperSubLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tsuperscript: Record<string, never>;\n\t\tsubscript: Record<string, never>;\n\t}\n}\n\n// --- Configuration ---\n\n/** Controls toolbar button visibility per mark. */\nexport interface SuperSubToolbarConfig {\n\treadonly superscript?: boolean;\n\treadonly subscript?: boolean;\n}\n\n/** Controls which marks are enabled and which toolbar buttons are shown. */\nexport interface SuperSubConfig {\n\treadonly superscript: boolean;\n\treadonly subscript: boolean;\n\treadonly toolbar?: SuperSubToolbarConfig;\n\t/** When true, a separator is rendered after the last toolbar item. */\n\treadonly separatorAfter?: boolean;\n\treadonly locale?: SuperSubLocale;\n}\n\nconst DEFAULT_CONFIG: SuperSubConfig = {\n\tsuperscript: true,\n\tsubscript: true,\n};\n\n// --- Mark Definitions ---\n\ninterface MarkDefinition {\n\treadonly type: 'superscript' | 'subscript';\n\treadonly opposite: 'superscript' | 'subscript';\n\treadonly configKey: keyof Omit<SuperSubConfig, 'toolbar' | 'separatorAfter' | 'locale'>;\n\treadonly rank: number;\n\treadonly tag: string;\n\treadonly label: string;\n\treadonly icon: string;\n\treadonly keyBinding: string;\n\treadonly toolbarPriority: number;\n\treadonly toHTMLString: (content: string) => string;\n\treadonly parseHTML: readonly ParseRule[];\n\treadonly sanitize: SanitizeConfig;\n}\n\nconst SUPERSCRIPT_ICON: string = [\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">',\n\t'<path d=\"M16 7.41L11.41 12 16 16.59 14.59 18l-6-6 6-6z\"',\n\t' fill=\"none\"/>',\n\t'<path d=\"M9.64 7.64c.23-.5.36-1.05.36-1.64',\n\t' 0-2.21-1.79-4-4-4H2v14h4.36c2.34 0 4.24-1.9',\n\t' 4.24-4.24 0-1.6-.89-2.99-2.2-3.71zM4.5 4.5H6c.83',\n\t' 0 1.5.67 1.5 1.5S6.83 7.5 6 7.5H4.5v-3zm2 9H4.5v-3H6.5c.83',\n\t' 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z\" fill=\"none\"/>',\n\t'<path d=\"M15.97 3.84c0-.47.19-.91.53-1.21.34-.31.8-.49',\n\t' 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02',\n\t'-.96-.43-1.83-1.13-2.42C19.36.77 18.45.44 17.5.44c-.88',\n\t' 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34',\n\t' 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53',\n\t' 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54',\n\t'-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96',\n\t' 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56',\n\t'-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46',\n\t'-.59-.46-.94z\"/>',\n\t'<path d=\"M5.88 20h2.66l3.4-5.42L15.3 20h2.67l-4.73-7.38',\n\t' 4.37-6.62h-2.6l-3.07 4.98L8.92 6h-2.6l4.26 6.58z\"/>',\n\t'</svg>',\n].join('');\n\nconst SUBSCRIPT_ICON: string = [\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">',\n\t'<path d=\"M15.97 16.84c0-.47.19-.91.53-1.21.34-.31.8-.49',\n\t' 1.3-.49.5 0 .95.18 1.28.48.32.3.5.7.51 1.15h1.59c-.02',\n\t'-.96-.43-1.83-1.13-2.42-.7-.58-1.61-.91-2.56-.91-.88',\n\t' 0-1.74.28-2.39.8-.67.53-1.06 1.28-1.06 2.1 0 .76.34',\n\t' 1.47.93 1.97.59.49 1.41.84 2.32 1.15.7.24 1.26.5 1.62.8.35.3.53.64.53',\n\t' 1.02 0 .48-.2.93-.55 1.24-.36.3-.84.48-1.37.48-.55 0-1.04-.2-1.39-.54',\n\t'-.34-.33-.53-.8-.53-1.32h-1.58c.01 1.02.43 1.95 1.16 2.57.72.62 1.67.96',\n\t' 2.67.96.92 0 1.81-.3 2.46-.84.67-.56 1.04-1.33 1.04-2.18 0-.81-.36-1.56',\n\t'-.99-2.08-.62-.51-1.48-.88-2.43-1.2-.67-.23-1.2-.47-1.52-.75-.32-.27-.46',\n\t'-.59-.46-.94z\"/>',\n\t'<path d=\"M5.88 18h2.66l3.4-5.42L15.3 18h2.67l-4.73-7.38',\n\t' 4.37-6.62h-2.6l-3.07 4.98L8.92 4h-2.6l4.26 6.58z\"/>',\n\t'</svg>',\n].join('');\n\nconst MARK_DEFINITIONS: readonly MarkDefinition[] = [\n\t{\n\t\ttype: 'superscript',\n\t\topposite: 'subscript',\n\t\tconfigKey: 'superscript',\n\t\trank: 4,\n\t\ttag: 'sup',\n\t\tlabel: 'Superscript',\n\t\ticon: SUPERSCRIPT_ICON,\n\t\tkeyBinding: 'Mod-.',\n\t\ttoolbarPriority: 50,\n\t\ttoHTMLString: (content) => `<sup>${content}</sup>`,\n\t\tparseHTML: [{ tag: 'sup' }],\n\t\tsanitize: { tags: ['sup'] },\n\t},\n\t{\n\t\ttype: 'subscript',\n\t\topposite: 'superscript',\n\t\tconfigKey: 'subscript',\n\t\trank: 4,\n\t\ttag: 'sub',\n\t\tlabel: 'Subscript',\n\t\ticon: SUBSCRIPT_ICON,\n\t\tkeyBinding: 'Mod-,',\n\t\ttoolbarPriority: 51,\n\t\ttoHTMLString: (content) => `<sub>${content}</sub>`,\n\t\tparseHTML: [{ tag: 'sub' }],\n\t\tsanitize: { tags: ['sub'] },\n\t},\n];\n\n// --- Plugin ---\n\nexport class SuperSubPlugin implements Plugin {\n\treadonly id = 'super-sub';\n\treadonly name = 'Superscript & Subscript';\n\treadonly priority = 23;\n\n\tprivate readonly config: SuperSubConfig;\n\tprivate locale!: SuperSubLocale;\n\n\tconstructor(config?: Partial<SuperSubConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.locale = resolvePluginLocale(SUPER_SUB_LOCALES, context, this.config.locale);\n\n\t\tconst enabledMarks: MarkDefinition[] = MARK_DEFINITIONS.filter(\n\t\t\t(def) => this.config[def.configKey],\n\t\t);\n\n\t\tconst visibleToolbarMarks: MarkDefinition[] = enabledMarks.filter((def) =>\n\t\t\tthis.isToolbarVisible(def.configKey),\n\t\t);\n\t\tconst lastVisibleMark: MarkDefinition | undefined = visibleToolbarMarks.at(-1);\n\n\t\tfor (const def of enabledMarks) {\n\t\t\tconst isSeparatorTarget: boolean = !!this.config.separatorAfter && def === lastVisibleMark;\n\t\t\tthis.registerMark(context, def, isSeparatorTarget);\n\t\t}\n\n\t\tthis.registerKeymaps(context, enabledMarks);\n\t\tthis.registerExclusivityMiddleware(context, enabledMarks);\n\t\tthis.registerDisabledToolbarItems(context);\n\t}\n\n\tprivate registerMark(context: PluginContext, def: MarkDefinition, separatorAfter: boolean): void {\n\t\tconst commandName: string = toCommandName(def.type);\n\t\tconst toolbarVisible: boolean = this.isToolbarVisible(def.configKey);\n\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: def.type,\n\t\t\trank: def.rank,\n\t\t\ttoDOM() {\n\t\t\t\treturn document.createElement(def.tag);\n\t\t\t},\n\t\t\ttoHTMLString: (_mark, content) => def.toHTMLString(content),\n\t\t\tparseHTML: def.parseHTML,\n\t\t\tsanitize: def.sanitize,\n\t\t});\n\n\t\tcontext.registerCommand(commandName, () => {\n\t\t\tconst tr = toggleMark(context.getState(), mkType(def.type));\n\t\t\tif (tr) {\n\t\t\t\tcontext.dispatch(tr);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t});\n\n\t\tif (toolbarVisible) {\n\t\t\tconst label: string =\n\t\t\t\tdef.type === 'superscript' ? this.locale.superscriptLabel : this.locale.subscriptLabel;\n\t\t\tconst tooltip: string =\n\t\t\t\tdef.type === 'superscript'\n\t\t\t\t\t? this.locale.superscriptTooltip(formatShortcut(def.keyBinding))\n\t\t\t\t\t: this.locale.subscriptTooltip(formatShortcut(def.keyBinding));\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: def.type,\n\t\t\t\tgroup: 'format',\n\t\t\t\ticon: def.icon,\n\t\t\t\tlabel,\n\t\t\t\ttooltip,\n\t\t\t\tcommand: commandName,\n\t\t\t\tpriority: def.toolbarPriority,\n\t\t\t\tseparatorAfter,\n\t\t\t\tisActive: (state) => isMarkActive(state, mkType(def.type)),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate registerKeymaps(context: PluginContext, marks: readonly MarkDefinition[]): void {\n\t\tconst keymap: Record<string, () => boolean> = {};\n\t\tfor (const def of marks) {\n\t\t\tconst commandName: string = toCommandName(def.type);\n\t\t\tkeymap[def.keyBinding] = () => context.executeCommand(commandName);\n\t\t}\n\t\tif (Object.keys(keymap).length > 0) {\n\t\t\tcontext.registerKeymap(keymap);\n\t\t}\n\t}\n\n\t/**\n\t * Ensures superscript and subscript are mutually exclusive.\n\t * When an addMark step for one type is found, a removeMark step\n\t * for the opposite type is injected. For stored marks, the opposite\n\t * mark is filtered out.\n\t */\n\tprivate registerExclusivityMiddleware(\n\t\tcontext: PluginContext,\n\t\tenabledMarks: readonly MarkDefinition[],\n\t): void {\n\t\tconst bothEnabled: boolean =\n\t\t\tenabledMarks.some((d) => d.type === 'superscript') &&\n\t\t\tenabledMarks.some((d) => d.type === 'subscript');\n\n\t\tif (!bothEnabled) return;\n\n\t\tcontext.registerMiddleware(\n\t\t\t(tr, _state, next) => {\n\t\t\t\tlet patched = false;\n\n\t\t\t\t// Handle addMark steps: inject removeMark for the opposite type\n\t\t\t\tconst patchedSteps: Step[] = [];\n\t\t\t\tfor (const step of tr.steps) {\n\t\t\t\t\tif (step.type !== 'addMark') {\n\t\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst markName: string = step.mark.type;\n\t\t\t\t\tconst def: MarkDefinition | undefined = MARK_DEFINITIONS.find((d) => d.type === markName);\n\t\t\t\t\tif (!def) {\n\t\t\t\t\t\tpatchedSteps.push(step);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tpatched = true;\n\t\t\t\t\tconst removeStep: RemoveMarkStep = {\n\t\t\t\t\t\ttype: 'removeMark',\n\t\t\t\t\t\tblockId: step.blockId,\n\t\t\t\t\t\tfrom: step.from,\n\t\t\t\t\t\tto: step.to,\n\t\t\t\t\t\tmark: { type: mkType(def.opposite) },\n\t\t\t\t\t\t...(step.path ? { path: step.path } : {}),\n\t\t\t\t\t};\n\t\t\t\t\tpatchedSteps.push(removeStep, step);\n\t\t\t\t}\n\n\t\t\t\t// Handle stored marks: remove the opposite mark\n\t\t\t\tlet storedMarksAfter: readonly Mark[] | null = tr.storedMarksAfter;\n\t\t\t\tif (storedMarksAfter) {\n\t\t\t\t\tconst hasSup: boolean = storedMarksAfter.some((m) => m.type === 'superscript');\n\t\t\t\t\tconst hasSub: boolean = storedMarksAfter.some((m) => m.type === 'subscript');\n\n\t\t\t\t\tif (hasSup && hasSub) {\n\t\t\t\t\t\t// Keep the one that was most recently added (last in array)\n\t\t\t\t\t\tconst lastSupIdx: number = storedMarksAfter.findLastIndex(\n\t\t\t\t\t\t\t(m) => m.type === 'superscript',\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst lastSubIdx: number = storedMarksAfter.findLastIndex(\n\t\t\t\t\t\t\t(m) => m.type === 'subscript',\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst removeType: string = lastSupIdx > lastSubIdx ? 'subscript' : 'superscript';\n\n\t\t\t\t\t\tstoredMarksAfter = storedMarksAfter.filter((m) => m.type !== removeType);\n\t\t\t\t\t\tpatched = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnext(patched ? { ...tr, steps: patchedSteps, storedMarksAfter } : tr);\n\t\t\t},\n\t\t\t{ name: 'super-sub:exclusivity' },\n\t\t);\n\t}\n\n\t/**\n\t * Registers disabled toolbar buttons for marks whose feature is disabled\n\t * but whose toolbar button is explicitly requested.\n\t */\n\tprivate registerDisabledToolbarItems(context: PluginContext): void {\n\t\tif (!this.config.toolbar) return;\n\n\t\tfor (const def of MARK_DEFINITIONS) {\n\t\t\tconst featureEnabled: boolean = this.config[def.configKey];\n\t\t\tconst toolbarVisible: boolean = this.config.toolbar[def.configKey] ?? true;\n\n\t\t\tif (!featureEnabled && toolbarVisible) {\n\t\t\t\tconst label: string =\n\t\t\t\t\tdef.type === 'superscript' ? this.locale.superscriptLabel : this.locale.subscriptLabel;\n\t\t\t\tcontext.registerToolbarItem({\n\t\t\t\t\tid: def.type,\n\t\t\t\t\tgroup: 'format',\n\t\t\t\t\ticon: def.icon,\n\t\t\t\t\tlabel,\n\t\t\t\t\tcommand: toCommandName(def.type),\n\t\t\t\t\tpriority: def.toolbarPriority,\n\t\t\t\t\tisEnabled: () => false,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate isToolbarVisible(\n\t\tconfigKey: keyof Omit<SuperSubConfig, 'toolbar' | 'separatorAfter' | 'locale'>,\n\t): boolean {\n\t\tif (!this.config.toolbar) return true;\n\t\treturn this.config.toolbar[configKey] ?? true;\n\t}\n}\n\n/** Converts a mark type to its toggle command name (e.g. 'superscript' → 'toggleSuperscript'). */\nfunction toCommandName(markType: string): string {\n\treturn `toggle${markType.charAt(0).toUpperCase()}${markType.slice(1)}`;\n}\n"],"names":["SUPER_SUB_LOCALE_EN","superscriptLabel","superscriptTooltip","shortcut","subscriptLabel","subscriptTooltip","SUPER_SUB_LOCALES","en","de","es","fr","zh","ru","ar","hi","DEFAULT_CONFIG","superscript","subscript","MARK_DEFINITIONS","type","opposite","configKey","rank","tag","label","icon","join","keyBinding","toolbarPriority","toHTMLString","content","parseHTML","sanitize","tags","SuperSubPlugin","id","name","priority","config","locale","this","context","resolvePluginLocale","enabledMarks","filter","def","lastVisibleMark","isToolbarVisible","at","isSeparatorTarget","separatorAfter","registerMark","registerKeymaps","registerExclusivityMiddleware","registerDisabledToolbarItems","commandName","toCommandName","toolbarVisible","registerMarkSpec","toDOM","document","createElement","_mark","registerCommand","tr","toggleMark","getState","mkType","dispatch","tooltip","formatShortcut","registerToolbarItem","group","command","isActive","state","isMarkActive","marks","keymap","executeCommand","Object","keys","length","registerKeymap","some","d","registerMiddleware","_state","next","patched","patchedSteps","step","steps","push","markName","mark","find","removeStep","blockId","from","to","path","storedMarksAfter","hasSup","m","hasSub","removeType","findLastIndex","toolbar","featureEnabled","isEnabled","markType","charAt","toUpperCase","slice"],"mappings":";;;;AAeO,MAAMA,IAAsC,EAClDC,kBAAkB,eAClBC,oBAAqBC,CAAAA,OAAqB,gBAAgBA,EAAAA,KAC1DC,gBAAgB,aAChBC,kBAAmBF,CAAAA,OAAqB,cAAcA,SAoE1CG,IAAoD,EAChEC,IAAIP,GACJQ,IAjEkD,EAClDP,kBAAkB,gBAClBC,oBAAqBC,CAAAA,OAAqB,iBAAiBA,OAC3DC,gBAAgB,gBAChBC,kBAAmBF,CAAAA,OAAqB,iBAAiBA,SA8DzDM,IAzDkD,EAClDR,kBAAkB,eAClBC,oBAAqBC,CAAAA,OAAqB,gBAAgBA,OAC1DC,gBAAgB,aAChBC,kBAAmBF,CAAAA,OAAqB,cAAcA,SAsDtDO,IAjDkD,EAClDT,kBAAkB,YAClBC,oBAAqBC,CAAAA,OAAqB,aAAaA,EAAAA,KACvDC,gBAAgB,UAChBC,kBAAmBF,CAAAA,OAAqB,WAAWA,SA8CnDQ,IAzCkD,EAClDV,kBAAkB,MAClBC,oBAAqBC,CAAAA,OAAqB,OAAOA,EAAAA,KACjDC,gBAAgB,MAChBC,kBAAmBF,CAAAA,OAAqB,OAAOA,EAAAA,IAAAA,GAsC/CS,IAjCkD,EAClDX,kBAAkB,eAClBC,oBAAqBC,CAAAA,OAAqB,gBAAgBA,EAAAA,KAC1DC,gBAAgB,eAChBC,kBAAmBF,CAAAA,OAAqB,gBAAgBA,EAAAA,IAAAA,GA8BxDU,IAzBkD,EAClDZ,kBAAkB,SAClBC,oBAAqBC,CAAAA,OAAqB,UAAUA,EAAAA,KACpDC,gBAAgB,SAChBC,kBAAmBF,CAAAA,OAAqB,UAAUA,EAAAA,IAAAA,GAsBlDW,IAjBkD,EAClDb,kBAAkB,iBAClBC,oBAAqBC,CAAAA,OAAqB,kBAAkBA,EAAAA,KAC5DC,gBAAgB,eA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