@notectl/core 1.0.8 → 1.6.1
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-B6JETWaw.mjs +818 -0
- package/dist/chunks/ToolbarPlugin-B6JETWaw.mjs.map +1 -0
- package/dist/chunks/index--z_Txzej.mjs +467 -0
- package/dist/chunks/index--z_Txzej.mjs.map +1 -0
- package/dist/chunks/{index-o6hDR07y.mjs → index-83QoUENW.mjs} +25 -20
- package/dist/chunks/index-83QoUENW.mjs.map +1 -0
- package/dist/chunks/{index-CT3HGdQt.mjs → index-B0UFAfyb.mjs} +13 -13
- package/dist/chunks/{index-CT3HGdQt.mjs.map → index-B0UFAfyb.mjs.map} +1 -1
- package/dist/chunks/{index-C2GQoHot.mjs → index-BDMP86F4.mjs} +40 -40
- package/dist/chunks/{index-C2GQoHot.mjs.map → index-BDMP86F4.mjs.map} +1 -1
- package/dist/chunks/{index-Bsp4LC5t.mjs → index-BWXkaC2Z.mjs} +36 -36
- package/dist/chunks/index-BWXkaC2Z.mjs.map +1 -0
- package/dist/chunks/{index-C-YWHOcC.mjs → index-BigJ0z6n.mjs} +22 -22
- package/dist/chunks/{index-C-YWHOcC.mjs.map → index-BigJ0z6n.mjs.map} +1 -1
- package/dist/chunks/{index-uTnc9y7M.mjs → index-CPjf45-o.mjs} +28 -28
- package/dist/chunks/index-CPjf45-o.mjs.map +1 -0
- package/dist/chunks/{index-BAk1EG1x.mjs → index-CPyHuEzh.mjs} +106 -106
- package/dist/chunks/index-CPyHuEzh.mjs.map +1 -0
- package/dist/chunks/{index-Ct0ivLhO.mjs → index-D4GKlc-A.mjs} +256 -259
- package/dist/chunks/index-D4GKlc-A.mjs.map +1 -0
- package/dist/chunks/{index-BRYzYOYC.mjs → index-D67mP19g.mjs} +29 -29
- package/dist/chunks/index-D67mP19g.mjs.map +1 -0
- package/dist/chunks/index-D8tbbW97.mjs +73 -0
- package/dist/chunks/index-D8tbbW97.mjs.map +1 -0
- package/dist/chunks/{index-DC1EK22F.mjs → index-DIAXWwgJ.mjs} +24 -19
- package/dist/chunks/index-DIAXWwgJ.mjs.map +1 -0
- package/dist/chunks/{index-BSFLNveF.mjs → index-DQryjfJs.mjs} +352 -341
- package/dist/chunks/index-DQryjfJs.mjs.map +1 -0
- package/dist/chunks/index-DRZwd-1W.mjs +187 -0
- package/dist/chunks/index-DRZwd-1W.mjs.map +1 -0
- package/dist/chunks/{index-BYgspns5.mjs → index-DUC1X43Z.mjs} +54 -54
- package/dist/chunks/index-DUC1X43Z.mjs.map +1 -0
- package/dist/chunks/{index-CxiWyUho.mjs → index-DipAT_Q9.mjs} +31 -31
- package/dist/chunks/index-DipAT_Q9.mjs.map +1 -0
- package/dist/chunks/{index-D3CQWJiw.mjs → index-tBDVaSjG.mjs} +81 -61
- package/dist/chunks/index-tBDVaSjG.mjs.map +1 -0
- 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 +34 -6
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/styles/list.d.ts +2 -0
- package/dist/editor/styles/list.d.ts.map +1 -1
- package/dist/editor/styles/toolbar.d.ts +1 -1
- package/dist/editor/styles/toolbar.d.ts.map +1 -1
- package/dist/index.d.ts +31 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/input/ClipboardHandler.d.ts +2 -0
- 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 +8 -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 +22 -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/LegacyHTMLNormalizer.d.ts +18 -0
- package/dist/input/LegacyHTMLNormalizer.d.ts.map +1 -0
- package/dist/input/PasteHandler.d.ts +7 -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/HTMLParser.d.ts +13 -0
- package/dist/model/HTMLParser.d.ts.map +1 -1
- 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 +2831 -2420
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +3616 -2013
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/Plugin.d.ts +34 -5
- package/dist/plugins/Plugin.d.ts.map +1 -1
- package/dist/plugins/PluginManager.d.ts +31 -1
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +1 -1
- package/dist/plugins/blockquote.mjs +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/plugins/font.mjs +1 -1
- 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/HeadingBlockTypePicker.d.ts +14 -0
- package/dist/plugins/heading/HeadingBlockTypePicker.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingCommands.d.ts +5 -0
- package/dist/plugins/heading/HeadingCommands.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingInputRules.d.ts +5 -0
- package/dist/plugins/heading/HeadingInputRules.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingKeyboardHandlers.d.ts +5 -0
- package/dist/plugins/heading/HeadingKeyboardHandlers.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts +1 -41
- package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +1 -1
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule.mjs +1 -1
- package/dist/plugins/image/ImageCommands.d.ts.map +1 -1
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link.mjs +1 -1
- package/dist/plugins/list/ListPlugin.d.ts +9 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- 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/StrikethroughPlugin.d.ts.map +1 -1
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- 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 +1 -1
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color.mjs +1 -1
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarLocale.d.ts +1 -0
- package/dist/plugins/toolbar/ToolbarLocale.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarOverflowBehavior.d.ts +23 -0
- package/dist/plugins/toolbar/ToolbarOverflowBehavior.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +56 -0
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts +17 -0
- package/dist/plugins/toolbar/ToolbarPlugin.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/state/EditorState.d.ts.map +1 -1
- package/dist/state/History.d.ts.map +1 -1
- package/dist/state/ReadonlyGuard.d.ts +6 -0
- package/dist/state/ReadonlyGuard.d.ts.map +1 -0
- package/dist/state/SelectionTransactions.d.ts +10 -0
- package/dist/state/SelectionTransactions.d.ts.map +1 -0
- package/dist/state/Transaction.d.ts +4 -0
- package/dist/state/Transaction.d.ts.map +1 -1
- 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 +45 -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/ToolbarPlugin-DY2xaJiu.mjs +0 -368
- package/dist/chunks/ToolbarPlugin-DY2xaJiu.mjs.map +0 -1
- package/dist/chunks/index-BAk1EG1x.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-BYgspns5.mjs.map +0 -1
- package/dist/chunks/index-B_3qDrUN.mjs +0 -64
- package/dist/chunks/index-B_3qDrUN.mjs.map +0 -1
- package/dist/chunks/index-Bsp4LC5t.mjs.map +0 -1
- package/dist/chunks/index-Ct0ivLhO.mjs.map +0 -1
- package/dist/chunks/index-CxiWyUho.mjs.map +0 -1
- package/dist/chunks/index-D3CQWJiw.mjs.map +0 -1
- package/dist/chunks/index-DC1EK22F.mjs.map +0 -1
- package/dist/chunks/index-Dh76rR13.mjs +0 -196
- package/dist/chunks/index-Dh76rR13.mjs.map +0 -1
- package/dist/chunks/index-o6hDR07y.mjs.map +0 -1
- package/dist/chunks/index-uTnc9y7M.mjs.map +0 -1
- package/dist/input/SourceNormalizer.d.ts +0 -7
- package/dist/input/SourceNormalizer.d.ts.map +0 -1
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { r as e } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
2
|
+
import { c as t } from "./NodeSpec-NZVvcCuH.mjs";
|
|
3
|
+
import { i as n, a as o, b as i, c as a } from "./Selection-DmFDwiPJ.mjs";
|
|
4
|
+
import { a as r } from "./ToolbarPlugin-B6JETWaw.mjs";
|
|
5
|
+
import { b as l, c, d as s, p as g, e as d } from "./Document-CuwE73FF.mjs";
|
|
6
|
+
import { n as h } from "./TypeBrands-C09nE2qO.mjs";
|
|
7
|
+
function p(e2, t2, n2, o2) {
|
|
8
|
+
const i2 = document.createElement("button");
|
|
9
|
+
i2.type = "button", i2.className = "notectl-heading-picker__item", i2.setAttribute("role", "option"), i2.setAttribute("aria-selected", String(t2)), t2 && i2.classList.add("notectl-heading-picker__item--active");
|
|
10
|
+
const a2 = document.createElement("span");
|
|
11
|
+
a2.className = "notectl-heading-picker__check", a2.textContent = t2 ? "✓" : "", i2.appendChild(a2);
|
|
12
|
+
const r2 = document.createElement("span");
|
|
13
|
+
return r2.className = "notectl-heading-picker__label", r2.textContent = e2, o2 && (r2.style.fontSize = o2.fontSize, r2.style.fontWeight = o2.fontWeight), i2.appendChild(r2), i2.addEventListener("mousedown", n2), i2;
|
|
14
|
+
}
|
|
15
|
+
function b(e2, t2) {
|
|
16
|
+
return e2[`heading${t2}`];
|
|
17
|
+
}
|
|
18
|
+
function u(e2, t2) {
|
|
19
|
+
const i2 = e2.getState();
|
|
20
|
+
if (n(i2.selection) || o(i2.selection)) return false;
|
|
21
|
+
const a2 = i2.getBlock(i2.selection.anchor.blockId);
|
|
22
|
+
return !!a2 && (a2.type === t2 ? k(e2, h("paragraph")) : k(e2, h(t2)));
|
|
23
|
+
}
|
|
24
|
+
function f(e2, t2) {
|
|
25
|
+
const i2 = e2.getState(), a2 = i2.selection;
|
|
26
|
+
if (n(a2) || o(a2)) return false;
|
|
27
|
+
const r2 = i2.getBlock(a2.anchor.blockId);
|
|
28
|
+
return !!r2 && ("heading" === r2.type && r2.attrs?.level === t2 ? k(e2, h("paragraph")) : k(e2, h("heading"), { level: t2 }));
|
|
29
|
+
}
|
|
30
|
+
function k(e2, t2, i2) {
|
|
31
|
+
const a2 = e2.getState(), r2 = a2.selection;
|
|
32
|
+
if (n(r2) || o(r2)) return false;
|
|
33
|
+
const g2 = a2.getBlock(r2.anchor.blockId);
|
|
34
|
+
if (!g2) return false;
|
|
35
|
+
const d2 = a2.transaction("command"), h2 = e2.getSchemaRegistry().getNodeSpec(t2);
|
|
36
|
+
h2?.excludeMarks && h2.excludeMarks.length > 0 && ((function(e3, t3, n2) {
|
|
37
|
+
if (0 === l(t3)) return;
|
|
38
|
+
const o2 = new Set(n2), i3 = c(t3);
|
|
39
|
+
let a3 = 0;
|
|
40
|
+
for (const n3 of i3) if (s(n3)) {
|
|
41
|
+
if (n3.text.length > 0) for (const i4 of n3.marks) o2.has(i4.type) && e3.removeMark(t3.id, a3, a3 + n3.text.length, i4);
|
|
42
|
+
a3 += n3.text.length;
|
|
43
|
+
} else a3 += 1;
|
|
44
|
+
})(d2, g2, h2.excludeMarks), (function(e3, t3, n2) {
|
|
45
|
+
if (!t3.storedMarks) return;
|
|
46
|
+
const o2 = new Set(n2), i3 = t3.storedMarks.filter((e4) => !o2.has(e4.type));
|
|
47
|
+
i3.length !== t3.storedMarks.length && e3.setStoredMarks(i3.length > 0 ? i3 : null, t3.storedMarks);
|
|
48
|
+
})(d2, a2, h2.excludeMarks));
|
|
49
|
+
const p2 = d2.setBlockType(r2.anchor.blockId, t2, i2).setSelection(r2).build();
|
|
50
|
+
return e2.dispatch(p2), true;
|
|
51
|
+
}
|
|
52
|
+
const m = /* @__PURE__ */ new Set(["heading", "title", "subtitle"]);
|
|
53
|
+
const y = { paragraph: "Paragraph", title: "Title", subtitle: "Subtitle", heading1: "Heading 1", heading2: "Heading 2", heading3: "Heading 3", heading4: "Heading 4", heading5: "Heading 5", heading6: "Heading 6", blockTypeLabel: "Block Type", blockTypesAria: "Block types" }, v = { en: y, de: { paragraph: "Absatz", title: "Titel", subtitle: "Untertitel", heading1: "Überschrift 1", heading2: "Überschrift 2", heading3: "Überschrift 3", heading4: "Überschrift 4", heading5: "Überschrift 5", heading6: "Überschrift 6", blockTypeLabel: "Blocktyp", blockTypesAria: "Blocktypen" }, es: { paragraph: "Párrafo", title: "Título", subtitle: "Subtítulo", heading1: "Encabezado 1", heading2: "Encabezado 2", heading3: "Encabezado 3", heading4: "Encabezado 4", heading5: "Encabezado 5", heading6: "Encabezado 6", blockTypeLabel: "Tipo de bloque", blockTypesAria: "Tipos de bloque" }, fr: { paragraph: "Paragraphe", title: "Titre", subtitle: "Sous-titre", heading1: "Titre 1", heading2: "Titre 2", heading3: "Titre 3", heading4: "Titre 4", heading5: "Titre 5", heading6: "Titre 6", blockTypeLabel: "Type de bloc", blockTypesAria: "Types de bloc" }, zh: { paragraph: "正文", title: "标题", subtitle: "副标题", heading1: "一级标题", heading2: "二级标题", heading3: "三级标题", heading4: "四级标题", heading5: "五级标题", heading6: "六级标题", blockTypeLabel: "块类型", blockTypesAria: "块类型列表" }, ru: { paragraph: "Абзац", title: "Заголовок", subtitle: "Подзаголовок", heading1: "Заголовок 1", heading2: "Заголовок 2", heading3: "Заголовок 3", heading4: "Заголовок 4", heading5: "Заголовок 5", heading6: "Заголовок 6", blockTypeLabel: "Тип блока", blockTypesAria: "Типы блоков" }, ar: { paragraph: "فقرة", title: "عنوان", subtitle: "عنوان فرعي", heading1: "عنوان 1", heading2: "عنوان 2", heading3: "عنوان 3", heading4: "عنوان 4", heading5: "عنوان 5", heading6: "عنوان 6", blockTypeLabel: "نوع الكتلة", blockTypesAria: "أنواع الكتل" }, hi: { paragraph: "अनुच्छेद", title: "शीर्षक", subtitle: "उपशीर्षक", heading1: "शीर्षक 1", heading2: "शीर्षक 2", heading3: "शीर्षक 3", heading4: "शीर्षक 4", heading5: "शीर्षक 5", heading6: "शीर्षक 6", blockTypeLabel: "ब्लॉक प्रकार", blockTypesAria: "ब्लॉक प्रकार सूची" } }, x = { levels: [1, 2, 3, 4, 5, 6] }, T = { 1: "h1", 2: "h2", 3: "h3", 4: "h4", 5: "h5", 6: "h6" };
|
|
54
|
+
class S {
|
|
55
|
+
id = "heading";
|
|
56
|
+
name = "Heading";
|
|
57
|
+
priority = 30;
|
|
58
|
+
config;
|
|
59
|
+
locale;
|
|
60
|
+
context = null;
|
|
61
|
+
comboLabel = null;
|
|
62
|
+
constructor(e2) {
|
|
63
|
+
this.config = { ...x, ...e2 };
|
|
64
|
+
}
|
|
65
|
+
init(t2) {
|
|
66
|
+
this.locale = e(v, t2, this.config.locale), t2.registerStyleSheet("\n/* Heading Select — Combobox-style toolbar button */\n.notectl-toolbar-btn--heading {\n width: auto;\n min-width: 100px;\n max-width: 160px;\n padding: 0 8px;\n gap: 4px;\n border: 1px solid var(--notectl-border);\n border-radius: 4px;\n background: var(--notectl-bg);\n}\n\n.notectl-toolbar-btn--heading:hover {\n background: var(--notectl-hover-bg);\n border-color: var(--notectl-fg-muted);\n}\n\n.notectl-toolbar-btn--heading.notectl-toolbar-btn--active {\n background: var(--notectl-bg);\n border-color: var(--notectl-primary-muted);\n}\n\n.notectl-toolbar-btn--heading .notectl-toolbar-btn__icon {\n display: flex;\n align-items: center;\n gap: 4px;\n width: 100%;\n overflow: hidden;\n}\n\n.notectl-toolbar-btn--heading .notectl-toolbar-btn__icon svg {\n display: none;\n}\n\n.notectl-heading-select__label {\n flex: 1;\n font-size: 13px;\n font-weight: 500;\n color: var(--notectl-fg);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: left;\n line-height: 30px;\n}\n\n.notectl-heading-select__arrow {\n flex-shrink: 0;\n font-size: 11px;\n color: var(--notectl-fg-muted);\n line-height: 30px;\n}\n\n/* Heading Picker Popup */\n.notectl-heading-picker {\n min-width: 200px;\n max-height: 320px;\n overflow-y: auto;\n}\n\n.notectl-heading-picker__list {\n padding: 4px 0;\n}\n\n.notectl-heading-picker__item {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 7px 12px;\n border: none;\n background: none;\n cursor: pointer;\n font-size: 14px;\n color: var(--notectl-fg);\n text-align: left;\n white-space: nowrap;\n font-family: inherit;\n transition: background 0.1s;\n}\n\n.notectl-heading-picker__item:hover {\n background: var(--notectl-hover-bg);\n}\n\n.notectl-heading-picker__item--active {\n background: var(--notectl-active-bg);\n color: var(--notectl-primary-fg);\n}\n\n.notectl-heading-picker__item--active:hover {\n background: var(--notectl-active-bg);\n}\n\n.notectl-heading-picker__check {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n flex-shrink: 0;\n font-size: 13px;\n font-weight: 600;\n color: var(--notectl-primary-fg);\n}\n\n.notectl-heading-picker__label {\n flex: 1;\n}\n"), this.context = t2, this.registerNodeSpecs(t2), (function(e2, t3) {
|
|
67
|
+
e2.registerCommand("setTitle", () => u(e2, "title")), e2.registerCommand("setSubtitle", () => u(e2, "subtitle"));
|
|
68
|
+
for (const n2 of t3.levels) e2.registerCommand(`setHeading${n2}`, () => f(e2, n2));
|
|
69
|
+
e2.registerCommand("toggleHeading", () => f(e2, 1)), e2.registerCommand("setParagraph", () => k(e2, h("paragraph")));
|
|
70
|
+
})(t2, this.config), (function(e2, t3) {
|
|
71
|
+
const r2 = { Enter: () => (function(e3) {
|
|
72
|
+
return (function(e4, t4) {
|
|
73
|
+
const a2 = e4.getState();
|
|
74
|
+
if (n(a2.selection) || o(a2.selection)) return false;
|
|
75
|
+
const r3 = a2.selection;
|
|
76
|
+
if (!i(r3)) return false;
|
|
77
|
+
const l2 = a2.getBlock(r3.anchor.blockId);
|
|
78
|
+
return !(!l2 || !m.has(l2.type)) && t4({ state: a2, block: l2, blockId: r3.anchor.blockId, offset: r3.anchor.offset });
|
|
79
|
+
})(e3, (t4) => {
|
|
80
|
+
if ("" === g(t4.block)) {
|
|
81
|
+
const n3 = t4.state.transaction("input").setBlockType(t4.blockId, h("paragraph")).setSelection(t4.state.selection).build();
|
|
82
|
+
return e3.dispatch(n3), true;
|
|
83
|
+
}
|
|
84
|
+
const n2 = l(t4.block);
|
|
85
|
+
if (t4.offset >= n2) {
|
|
86
|
+
const n3 = d(), o2 = t4.state.transaction("input").splitBlock(t4.blockId, t4.offset, n3).setBlockType(n3, h("paragraph")).setSelection(a(n3, 0)).build();
|
|
87
|
+
return e3.dispatch(o2), true;
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
});
|
|
91
|
+
})(e2) };
|
|
92
|
+
for (const n2 of t3.levels) n2 <= 6 && (r2[`Mod-Shift-${n2}`] = () => e2.executeCommand(`setHeading${n2}`));
|
|
93
|
+
e2.registerKeymap(r2);
|
|
94
|
+
})(t2, this.config), (function(e2, t3) {
|
|
95
|
+
for (const r2 of t3.levels) {
|
|
96
|
+
const t4 = "#".repeat(r2), l2 = new RegExp(`^${t4} $`);
|
|
97
|
+
e2.registerInputRule({ pattern: l2, handler(e3, t5, l3, c2) {
|
|
98
|
+
const s2 = e3.selection;
|
|
99
|
+
if (n(s2) || o(s2)) return null;
|
|
100
|
+
if (!i(s2)) return null;
|
|
101
|
+
const g2 = e3.getBlock(s2.anchor.blockId);
|
|
102
|
+
return g2 && "paragraph" === g2.type ? e3.transaction("input").deleteTextAt(s2.anchor.blockId, l3, l3 + r2 + 1).setBlockType(s2.anchor.blockId, h("heading"), { level: r2 }).setSelection(a(s2.anchor.blockId, 0)).build() : null;
|
|
103
|
+
} });
|
|
104
|
+
}
|
|
105
|
+
})(t2, this.config), (function(e2, t3, i2) {
|
|
106
|
+
e2.registerBlockTypePickerEntry({ id: "paragraph", label: i2.paragraph, command: "setParagraph", priority: 10, isActive: (e3) => {
|
|
107
|
+
if (n(e3.selection) || o(e3.selection)) return false;
|
|
108
|
+
const t4 = e3.getBlock(e3.selection.anchor.blockId);
|
|
109
|
+
return "paragraph" === t4?.type;
|
|
110
|
+
} }), e2.registerBlockTypePickerEntry({ id: "title", label: i2.title, command: "setTitle", priority: 20, style: { fontSize: "1.6em", fontWeight: "700" }, isActive: (e3) => {
|
|
111
|
+
if (n(e3.selection) || o(e3.selection)) return false;
|
|
112
|
+
const t4 = e3.getBlock(e3.selection.anchor.blockId);
|
|
113
|
+
return "title" === t4?.type;
|
|
114
|
+
} }), e2.registerBlockTypePickerEntry({ id: "subtitle", label: i2.subtitle, command: "setSubtitle", priority: 30, style: { fontSize: "1.3em", fontWeight: "500" }, isActive: (e3) => {
|
|
115
|
+
if (n(e3.selection) || o(e3.selection)) return false;
|
|
116
|
+
const t4 = e3.getBlock(e3.selection.anchor.blockId);
|
|
117
|
+
return "subtitle" === t4?.type;
|
|
118
|
+
} });
|
|
119
|
+
for (const a2 of t3.levels) e2.registerBlockTypePickerEntry({ id: `heading-${a2}`, label: b(i2, a2), command: `setHeading${a2}`, priority: 100 + a2, style: { fontSize: 1.4 - 0.1 * a2 + "em", fontWeight: "600" }, isActive: (e3) => {
|
|
120
|
+
if (n(e3.selection) || o(e3.selection)) return false;
|
|
121
|
+
const t4 = e3.getBlock(e3.selection.anchor.blockId);
|
|
122
|
+
return "heading" === t4?.type && t4.attrs?.level === a2;
|
|
123
|
+
} });
|
|
124
|
+
})(t2, this.config, this.locale), (function(e2, t3, i2) {
|
|
125
|
+
const a2 = `<span class="notectl-heading-select__label" data-heading-label>${i2.paragraph}</span><span class="notectl-heading-select__arrow">▾</span>`;
|
|
126
|
+
e2.registerToolbarItem({ id: "heading", group: "block", icon: a2, label: i2.blockTypeLabel, tooltip: i2.blockTypeLabel, command: "setParagraph", priority: 50, popupType: "custom", separatorAfter: t3.separatorAfter, renderPopup: (e3, t4) => {
|
|
127
|
+
!(function(e4, t5, i3) {
|
|
128
|
+
e4.classList.add("notectl-heading-picker");
|
|
129
|
+
const a3 = t5.getState();
|
|
130
|
+
if (n(a3.selection) || o(a3.selection)) return;
|
|
131
|
+
const l2 = document.createElement("div");
|
|
132
|
+
l2.className = "notectl-heading-picker__list", l2.setAttribute("role", "listbox"), l2.setAttribute("aria-label", i3.blockTypesAria);
|
|
133
|
+
const c2 = t5.getBlockTypePickerRegistry().getBlockTypePickerEntries();
|
|
134
|
+
for (const e5 of c2) {
|
|
135
|
+
const n2 = e5.isActive(a3);
|
|
136
|
+
l2.appendChild(p(e5.label, n2, (n3) => {
|
|
137
|
+
n3.preventDefault(), n3.stopPropagation(), t5.executeCommand(e5.command);
|
|
138
|
+
const o2 = t5.getService(r);
|
|
139
|
+
o2?.closePopup();
|
|
140
|
+
}, e5.style));
|
|
141
|
+
}
|
|
142
|
+
e4.appendChild(l2);
|
|
143
|
+
})(e3, t4, i2);
|
|
144
|
+
}, isActive: (t4) => e2.getBlockTypePickerRegistry().getBlockTypePickerEntries().some((e3) => "paragraph" !== e3.id && e3.isActive(t4)) });
|
|
145
|
+
})(t2, this.config, this.locale);
|
|
146
|
+
}
|
|
147
|
+
destroy() {
|
|
148
|
+
this.context = null, this.comboLabel = null;
|
|
149
|
+
}
|
|
150
|
+
onStateChange(e2, t2, i2) {
|
|
151
|
+
this.context && (this.comboLabel = (function(e3, t3, i3, a2) {
|
|
152
|
+
let r2 = a2;
|
|
153
|
+
if (!r2) {
|
|
154
|
+
const e4 = t3.getPluginContainer("top");
|
|
155
|
+
if (!e4) return null;
|
|
156
|
+
if (r2 = e4.querySelector("[data-heading-label]") ?? null, !r2) return null;
|
|
157
|
+
}
|
|
158
|
+
return r2.textContent = (function(e4, t4, i4) {
|
|
159
|
+
if (n(e4.selection) || o(e4.selection)) return i4.paragraph;
|
|
160
|
+
const a3 = t4.getBlockTypePickerRegistry().getBlockTypePickerEntries();
|
|
161
|
+
for (const t5 of a3) if (t5.isActive(e4)) return t5.label;
|
|
162
|
+
return i4.paragraph;
|
|
163
|
+
})(e3, t3, i3), r2;
|
|
164
|
+
})(t2, this.context, this.locale, this.comboLabel));
|
|
165
|
+
}
|
|
166
|
+
registerNodeSpecs(e2) {
|
|
167
|
+
e2.registerNodeSpec({ type: "title", group: "block", content: { allow: ["text"] }, excludeMarks: ["fontSize"], toDOM(e3) {
|
|
168
|
+
const n2 = t("h1", e3.id);
|
|
169
|
+
return n2.classList.add("notectl-title"), n2;
|
|
170
|
+
}, toHTML: (e3, t2) => `<h1>${t2 || "<br>"}</h1>`, sanitize: { tags: ["h1"] } }), e2.registerNodeSpec({ type: "subtitle", group: "block", content: { allow: ["text"] }, excludeMarks: ["fontSize"], toDOM(e3) {
|
|
171
|
+
const n2 = t("h2", e3.id);
|
|
172
|
+
return n2.classList.add("notectl-subtitle"), n2;
|
|
173
|
+
}, toHTML: (e3, t2) => `<h2>${t2 || "<br>"}</h2>`, sanitize: { tags: ["h2"] } }), e2.registerNodeSpec({ type: "heading", group: "block", content: { allow: ["text"] }, excludeMarks: ["fontSize"], attrs: { level: { default: 1 } }, toDOM(e3) {
|
|
174
|
+
const n2 = e3.attrs?.level ?? 1;
|
|
175
|
+
return t(T[n2] ?? "h1", e3.id);
|
|
176
|
+
}, toHTML(e3, t2) {
|
|
177
|
+
const n2 = e3.attrs?.level ?? 1, o2 = T[n2] ?? "h1";
|
|
178
|
+
return `<${o2}>${t2 || "<br>"}</${o2}>`;
|
|
179
|
+
}, parseHTML: [{ tag: "h1", getAttrs: () => ({ level: 1 }) }, { tag: "h2", getAttrs: () => ({ level: 2 }) }, { tag: "h3", getAttrs: () => ({ level: 3 }) }, { tag: "h4", getAttrs: () => ({ level: 4 }) }, { tag: "h5", getAttrs: () => ({ level: 5 }) }, { tag: "h6", getAttrs: () => ({ level: 6 }) }], sanitize: { tags: ["h1", "h2", "h3", "h4", "h5", "h6"] } });
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export {
|
|
183
|
+
v as H,
|
|
184
|
+
y as a,
|
|
185
|
+
S as b
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=index-DRZwd-1W.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DRZwd-1W.mjs","sources":["../../src/plugins/heading/HeadingBlockTypePicker.ts","../../src/plugins/heading/HeadingCommands.ts","../../src/plugins/heading/HeadingKeyboardHandlers.ts","../../src/plugins/heading/HeadingLocale.ts","../../src/plugins/heading/HeadingPlugin.ts","../../src/editor/styles/heading-select.ts","../../src/plugins/heading/HeadingInputRules.ts"],"sourcesContent":["/**\n * Block type picker entries and toolbar dropdown for heading block types.\n * Registers picker entries for paragraph, title, subtitle, and all heading levels,\n * plus a combobox-style toolbar item with a custom popup.\n */\n\nimport { isGapCursor, isNodeSelection } from '../../model/Selection.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport { ToolbarServiceKey } from '../toolbar/ToolbarPlugin.js';\nimport type { PickerEntryStyle } from './BlockTypePickerEntry.js';\nimport type { HeadingLocale } from './HeadingLocale.js';\nimport type { HeadingConfig, HeadingLevel } from './HeadingPlugin.js';\n\n// --- Picker Entry Registration ---\n\n/** Registers block type picker entries for paragraph, title, subtitle, and heading levels. */\nexport function registerHeadingPickerEntries(\n\tcontext: PluginContext,\n\tconfig: HeadingConfig,\n\tlocale: HeadingLocale,\n): void {\n\tcontext.registerBlockTypePickerEntry({\n\t\tid: 'paragraph',\n\t\tlabel: locale.paragraph,\n\t\tcommand: 'setParagraph',\n\t\tpriority: 10,\n\t\tisActive: (state) => {\n\t\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\t\treturn block?.type === 'paragraph';\n\t\t},\n\t});\n\n\tcontext.registerBlockTypePickerEntry({\n\t\tid: 'title',\n\t\tlabel: locale.title,\n\t\tcommand: 'setTitle',\n\t\tpriority: 20,\n\t\tstyle: { fontSize: '1.6em', fontWeight: '700' },\n\t\tisActive: (state) => {\n\t\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\t\treturn block?.type === 'title';\n\t\t},\n\t});\n\n\tcontext.registerBlockTypePickerEntry({\n\t\tid: 'subtitle',\n\t\tlabel: locale.subtitle,\n\t\tcommand: 'setSubtitle',\n\t\tpriority: 30,\n\t\tstyle: { fontSize: '1.3em', fontWeight: '500' },\n\t\tisActive: (state) => {\n\t\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\t\treturn block?.type === 'subtitle';\n\t\t},\n\t});\n\n\tfor (const level of config.levels) {\n\t\tcontext.registerBlockTypePickerEntry({\n\t\t\tid: `heading-${level}`,\n\t\t\tlabel: getHeadingLabel(locale, level),\n\t\t\tcommand: `setHeading${level}`,\n\t\t\tpriority: 100 + level,\n\t\t\tstyle: { fontSize: `${1.4 - level * 0.1}em`, fontWeight: '600' },\n\t\t\tisActive: (state) => {\n\t\t\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\t\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\t\t\treturn block?.type === 'heading' && block.attrs?.level === level;\n\t\t\t},\n\t\t});\n\t}\n}\n\n// --- Toolbar Item ---\n\n/** Registers the heading toolbar dropdown with a custom picker popup. */\nexport function registerHeadingToolbarItem(\n\tcontext: PluginContext,\n\tconfig: HeadingConfig,\n\tlocale: HeadingLocale,\n): void {\n\tconst icon: string = `<span class=\"notectl-heading-select__label\" data-heading-label>${locale.paragraph}</span><span class=\"notectl-heading-select__arrow\">\\u25BE</span>`;\n\n\tcontext.registerToolbarItem({\n\t\tid: 'heading',\n\t\tgroup: 'block',\n\t\ticon,\n\t\tlabel: locale.blockTypeLabel,\n\t\ttooltip: locale.blockTypeLabel,\n\t\tcommand: 'setParagraph',\n\t\tpriority: 50,\n\t\tpopupType: 'custom',\n\t\tseparatorAfter: config.separatorAfter,\n\t\trenderPopup: (container, ctx) => {\n\t\t\trenderHeadingPopup(container, ctx, locale);\n\t\t},\n\t\tisActive: (state) => {\n\t\t\tconst entries = context.getBlockTypePickerRegistry().getBlockTypePickerEntries();\n\t\t\treturn entries.some((entry) => entry.id !== 'paragraph' && entry.isActive(state));\n\t\t},\n\t});\n}\n\n// --- Combo Label Update ---\n\n/**\n * Updates the combobox label in the toolbar to reflect the current block type.\n * Returns the resolved HTMLSpanElement (cached across calls) for reuse.\n */\nexport function updateComboLabel(\n\tstate: EditorState,\n\tcontext: PluginContext,\n\tlocale: HeadingLocale,\n\tcachedLabel: HTMLSpanElement | null,\n): HTMLSpanElement | null {\n\tlet label: HTMLSpanElement | null = cachedLabel;\n\n\tif (!label) {\n\t\tconst container: HTMLElement | undefined = context.getPluginContainer('top');\n\t\tif (!container) return null;\n\t\tlabel = container.querySelector<HTMLSpanElement>('[data-heading-label]') ?? null;\n\t\tif (!label) return null;\n\t}\n\n\tlabel.textContent = getActiveLabel(state, context, locale);\n\treturn label;\n}\n\n// --- Popup Rendering ---\n\nfunction renderHeadingPopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tlocale: HeadingLocale,\n): void {\n\tcontainer.classList.add('notectl-heading-picker');\n\n\tconst state: EditorState = context.getState();\n\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return;\n\n\tconst list: HTMLDivElement = document.createElement('div');\n\tlist.className = 'notectl-heading-picker__list';\n\tlist.setAttribute('role', 'listbox');\n\tlist.setAttribute('aria-label', locale.blockTypesAria);\n\n\tconst entries = context.getBlockTypePickerRegistry().getBlockTypePickerEntries();\n\tfor (const entry of entries) {\n\t\tconst active: boolean = entry.isActive(state);\n\t\tlist.appendChild(\n\t\t\tcreatePickerItem(\n\t\t\t\tentry.label,\n\t\t\t\tactive,\n\t\t\t\t(e: MouseEvent) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\tcontext.executeCommand(entry.command);\n\t\t\t\t\tconst toolbar = context.getService(ToolbarServiceKey);\n\t\t\t\t\ttoolbar?.closePopup();\n\t\t\t\t},\n\t\t\t\tentry.style,\n\t\t\t),\n\t\t);\n\t}\n\n\tcontainer.appendChild(list);\n}\n\nfunction createPickerItem(\n\tlabel: string,\n\tisActive: boolean,\n\thandler: (e: MouseEvent) => void,\n\tstyle?: PickerEntryStyle,\n): HTMLButtonElement {\n\tconst item: HTMLButtonElement = document.createElement('button');\n\titem.type = 'button';\n\titem.className = 'notectl-heading-picker__item';\n\titem.setAttribute('role', 'option');\n\titem.setAttribute('aria-selected', String(isActive));\n\n\tif (isActive) {\n\t\titem.classList.add('notectl-heading-picker__item--active');\n\t}\n\n\tconst check: HTMLSpanElement = document.createElement('span');\n\tcheck.className = 'notectl-heading-picker__check';\n\tcheck.textContent = isActive ? '\\u2713' : '';\n\titem.appendChild(check);\n\n\tconst labelSpan: HTMLSpanElement = document.createElement('span');\n\tlabelSpan.className = 'notectl-heading-picker__label';\n\tlabelSpan.textContent = label;\n\tif (style) {\n\t\tlabelSpan.style.fontSize = style.fontSize;\n\t\tlabelSpan.style.fontWeight = style.fontWeight;\n\t}\n\titem.appendChild(labelSpan);\n\n\titem.addEventListener('mousedown', handler);\n\treturn item;\n}\n\n// --- Helpers ---\n\nfunction getHeadingLabel(locale: HeadingLocale, level: HeadingLevel): string {\n\tconst key = `heading${level}` as keyof HeadingLocale;\n\treturn locale[key] as string;\n}\n\nfunction getActiveLabel(state: EditorState, context: PluginContext, locale: HeadingLocale): string {\n\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return locale.paragraph;\n\tconst entries = context.getBlockTypePickerRegistry().getBlockTypePickerEntries();\n\tfor (const entry of entries) {\n\t\tif (entry.isActive(state)) return entry.label;\n\t}\n\treturn locale.paragraph;\n}\n","/**\n * Command registration and implementations for heading block types.\n * Handles toggle between heading/title/subtitle and paragraph,\n * plus excluded-mark stripping when switching block types.\n */\n\nimport type { BlockNode, Mark } from '../../model/Document.js';\nimport { getBlockLength, getInlineChildren, isTextNode } from '../../model/Document.js';\nimport { isGapCursor, isNodeSelection } from '../../model/Selection.js';\nimport { type NodeTypeName, nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { TransactionBuilder } from '../../state/Transaction.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { HeadingConfig, HeadingLevel } from './HeadingPlugin.js';\n\n/** Registers all heading commands (setTitle, setSubtitle, setHeadingN, toggleHeading, setParagraph). */\nexport function registerHeadingCommands(context: PluginContext, config: HeadingConfig): void {\n\tcontext.registerCommand('setTitle', () => toggleSpecialBlock(context, 'title'));\n\n\tcontext.registerCommand('setSubtitle', () => toggleSpecialBlock(context, 'subtitle'));\n\n\tfor (const level of config.levels) {\n\t\tcontext.registerCommand(`setHeading${level}`, () => toggleHeading(context, level));\n\t}\n\n\tcontext.registerCommand('toggleHeading', () => toggleHeading(context, 1));\n\n\tcontext.registerCommand('setParagraph', () => setBlockType(context, nodeType('paragraph')));\n}\n\n// --- Command Implementations ---\n\n/**\n * Toggles between a special block type (title/subtitle) and paragraph.\n * If the block is already that type, resets to paragraph.\n */\nfunction toggleSpecialBlock(context: PluginContext, type: string): boolean {\n\tconst state: EditorState = context.getState();\n\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(state.selection.anchor.blockId);\n\tif (!block) return false;\n\n\tif (block.type === type) {\n\t\treturn setBlockType(context, nodeType('paragraph'));\n\t}\n\n\treturn setBlockType(context, nodeType(type) as NodeTypeName);\n}\n\n/**\n * Toggles between heading (at given level) and paragraph.\n * If the block is already a heading at the same level, resets to paragraph.\n */\nfunction toggleHeading(context: PluginContext, level: HeadingLevel): boolean {\n\tconst state: EditorState = context.getState();\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tif (block.type === 'heading' && block.attrs?.level === level) {\n\t\treturn setBlockType(context, nodeType('paragraph'));\n\t}\n\n\treturn setBlockType(context, nodeType('heading'), { level });\n}\n\nfunction setBlockType(\n\tcontext: PluginContext,\n\ttype: NodeTypeName,\n\tattrs?: Record<string, string | number | boolean>,\n): boolean {\n\tconst state: EditorState = context.getState();\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block) return false;\n\n\tconst builder: TransactionBuilder = state.transaction('command');\n\n\tconst spec = context.getSchemaRegistry().getNodeSpec(type);\n\tif (spec?.excludeMarks && spec.excludeMarks.length > 0) {\n\t\tstripExcludedMarks(builder, block, spec.excludeMarks);\n\t\tclearExcludedStoredMarks(builder, state, spec.excludeMarks);\n\t}\n\n\tconst tr = builder.setBlockType(sel.anchor.blockId, type, attrs).setSelection(sel).build();\n\tcontext.dispatch(tr);\n\treturn true;\n}\n\n// --- Mark Stripping Helpers ---\n\n/**\n * Adds removeMark steps for each excluded mark type found\n * on the block's inline text content.\n */\nfunction stripExcludedMarks(\n\tbuilder: TransactionBuilder,\n\tblock: BlockNode,\n\texcludeMarks: readonly string[],\n): void {\n\tconst blockLength: number = getBlockLength(block);\n\tif (blockLength === 0) return;\n\n\tconst excludeSet: Set<string> = new Set(excludeMarks);\n\tconst inlineChildren = getInlineChildren(block);\n\tlet offset = 0;\n\n\tfor (const child of inlineChildren) {\n\t\tif (isTextNode(child)) {\n\t\t\tif (child.text.length > 0) {\n\t\t\t\tfor (const mark of child.marks) {\n\t\t\t\t\tif (excludeSet.has(mark.type)) {\n\t\t\t\t\t\tbuilder.removeMark(block.id, offset, offset + child.text.length, mark);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\toffset += child.text.length;\n\t\t} else {\n\t\t\toffset += 1;\n\t\t}\n\t}\n}\n\n/**\n * Clears excluded mark types from stored marks so that\n * subsequent typing does not reintroduce them.\n */\nfunction clearExcludedStoredMarks(\n\tbuilder: TransactionBuilder,\n\tstate: EditorState,\n\texcludeMarks: readonly string[],\n): void {\n\tif (!state.storedMarks) return;\n\n\tconst excludeSet: Set<string> = new Set(excludeMarks);\n\tconst filtered: readonly Mark[] = state.storedMarks.filter((m: Mark) => !excludeSet.has(m.type));\n\n\tif (filtered.length !== state.storedMarks.length) {\n\t\tbuilder.setStoredMarks(filtered.length > 0 ? filtered : null, state.storedMarks);\n\t}\n}\n","/**\n * Keyboard handlers for heading block types.\n * Handles Enter key behavior: empty heading → paragraph, cursor at end → split + paragraph.\n */\n\nimport type { BlockNode } from '../../model/Document.js';\nimport { generateBlockId, getBlockLength, getBlockText } from '../../model/Document.js';\nimport {\n\tcreateCollapsedSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n} from '../../model/Selection.js';\nimport type { BlockId } from '../../model/TypeBrands.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { HeadingConfig } from './HeadingPlugin.js';\n\n// --- Context Guard ---\n\nconst HEADING_TYPES: ReadonlySet<string> = new Set(['heading', 'title', 'subtitle']);\n\ninterface HeadingContext {\n\treadonly state: EditorState;\n\treadonly block: BlockNode;\n\treadonly blockId: BlockId;\n\treadonly offset: number;\n}\n\n/**\n * Guards against NodeSelection, non-collapsed selections, and non-heading blocks.\n * Returns false (not handled) if the cursor is not inside a heading-type block.\n */\nfunction withHeadingContext(\n\tcontext: PluginContext,\n\thandler: (ctx: HeadingContext) => boolean,\n): boolean {\n\tconst state: EditorState = context.getState();\n\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\n\tconst sel = state.selection;\n\tif (!isCollapsed(sel)) return false;\n\n\tconst block: BlockNode | undefined = state.getBlock(sel.anchor.blockId);\n\tif (!block || !HEADING_TYPES.has(block.type)) return false;\n\n\treturn handler({\n\t\tstate,\n\t\tblock,\n\t\tblockId: sel.anchor.blockId,\n\t\toffset: sel.anchor.offset,\n\t});\n}\n\n/** Registers all heading keyboard handlers (Enter, Mod-Shift-N shortcuts). */\nexport function registerHeadingKeymaps(context: PluginContext, config: HeadingConfig): void {\n\tconst keymap: Record<string, () => boolean> = {\n\t\tEnter: () => handleEnter(context),\n\t};\n\n\tfor (const level of config.levels) {\n\t\tif (level <= 6) {\n\t\t\tkeymap[`Mod-Shift-${level}`] = () => context.executeCommand(`setHeading${level}`);\n\t\t}\n\t}\n\n\tcontext.registerKeymap(keymap);\n}\n\n// --- Enter Handler ---\n\n/**\n * Handles Enter inside a heading block.\n * Empty heading → convert to paragraph.\n * Cursor at end → split and convert new block to paragraph.\n * Cursor in middle → normal split (both stay heading).\n */\nfunction handleEnter(context: PluginContext): boolean {\n\treturn withHeadingContext(context, (ctx) => {\n\t\tconst text: string = getBlockText(ctx.block);\n\n\t\tif (text === '') {\n\t\t\tconst tr = ctx.state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setBlockType(ctx.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(ctx.state.selection)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\tconst blockLength: number = getBlockLength(ctx.block);\n\n\t\tif (ctx.offset >= blockLength) {\n\t\t\tconst newBlockId = generateBlockId();\n\t\t\tconst tr = ctx.state\n\t\t\t\t.transaction('input')\n\t\t\t\t.splitBlock(ctx.blockId, ctx.offset, newBlockId)\n\t\t\t\t.setBlockType(newBlockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(createCollapsedSelection(newBlockId, 0))\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t});\n}\n","/**\n * Locale interface and default English locale for the HeadingPlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface HeadingLocale {\n\treadonly paragraph: string;\n\treadonly title: string;\n\treadonly subtitle: string;\n\treadonly heading1: string;\n\treadonly heading2: string;\n\treadonly heading3: string;\n\treadonly heading4: string;\n\treadonly heading5: string;\n\treadonly heading6: string;\n\treadonly blockTypeLabel: string;\n\treadonly blockTypesAria: string;\n}\n\n// --- Default English Locale ---\n\nexport const HEADING_LOCALE_EN: HeadingLocale = {\n\tparagraph: 'Paragraph',\n\ttitle: 'Title',\n\tsubtitle: 'Subtitle',\n\theading1: 'Heading 1',\n\theading2: 'Heading 2',\n\theading3: 'Heading 3',\n\theading4: 'Heading 4',\n\theading5: 'Heading 5',\n\theading6: 'Heading 6',\n\tblockTypeLabel: 'Block Type',\n\tblockTypesAria: 'Block types',\n};\n\n// --- German Locale ---\n\nexport const HEADING_LOCALE_DE: HeadingLocale = {\n\tparagraph: 'Absatz',\n\ttitle: 'Titel',\n\tsubtitle: 'Untertitel',\n\theading1: 'Überschrift 1',\n\theading2: 'Überschrift 2',\n\theading3: 'Überschrift 3',\n\theading4: 'Überschrift 4',\n\theading5: 'Überschrift 5',\n\theading6: 'Überschrift 6',\n\tblockTypeLabel: 'Blocktyp',\n\tblockTypesAria: 'Blocktypen',\n};\n\n// --- Spanish Locale ---\n\nexport const HEADING_LOCALE_ES: HeadingLocale = {\n\tparagraph: 'Párrafo',\n\ttitle: 'Título',\n\tsubtitle: 'Subtítulo',\n\theading1: 'Encabezado 1',\n\theading2: 'Encabezado 2',\n\theading3: 'Encabezado 3',\n\theading4: 'Encabezado 4',\n\theading5: 'Encabezado 5',\n\theading6: 'Encabezado 6',\n\tblockTypeLabel: 'Tipo de bloque',\n\tblockTypesAria: 'Tipos de bloque',\n};\n\n// --- French Locale ---\n\nexport const HEADING_LOCALE_FR: HeadingLocale = {\n\tparagraph: 'Paragraphe',\n\ttitle: 'Titre',\n\tsubtitle: 'Sous-titre',\n\theading1: 'Titre 1',\n\theading2: 'Titre 2',\n\theading3: 'Titre 3',\n\theading4: 'Titre 4',\n\theading5: 'Titre 5',\n\theading6: 'Titre 6',\n\tblockTypeLabel: 'Type de bloc',\n\tblockTypesAria: 'Types de bloc',\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const HEADING_LOCALE_ZH: HeadingLocale = {\n\tparagraph: '正文',\n\ttitle: '标题',\n\tsubtitle: '副标题',\n\theading1: '一级标题',\n\theading2: '二级标题',\n\theading3: '三级标题',\n\theading4: '四级标题',\n\theading5: '五级标题',\n\theading6: '六级标题',\n\tblockTypeLabel: '块类型',\n\tblockTypesAria: '块类型列表',\n};\n\n// --- Russian Locale ---\n\nexport const HEADING_LOCALE_RU: HeadingLocale = {\n\tparagraph: 'Абзац',\n\ttitle: 'Заголовок',\n\tsubtitle: 'Подзаголовок',\n\theading1: 'Заголовок 1',\n\theading2: 'Заголовок 2',\n\theading3: 'Заголовок 3',\n\theading4: 'Заголовок 4',\n\theading5: 'Заголовок 5',\n\theading6: 'Заголовок 6',\n\tblockTypeLabel: 'Тип блока',\n\tblockTypesAria: 'Типы блоков',\n};\n\n// --- Arabic Locale ---\n\nexport const HEADING_LOCALE_AR: HeadingLocale = {\n\tparagraph: 'فقرة',\n\ttitle: 'عنوان',\n\tsubtitle: 'عنوان فرعي',\n\theading1: 'عنوان 1',\n\theading2: 'عنوان 2',\n\theading3: 'عنوان 3',\n\theading4: 'عنوان 4',\n\theading5: 'عنوان 5',\n\theading6: 'عنوان 6',\n\tblockTypeLabel: 'نوع الكتلة',\n\tblockTypesAria: 'أنواع الكتل',\n};\n\n// --- Hindi Locale ---\n\nexport const HEADING_LOCALE_HI: HeadingLocale = {\n\tparagraph: 'अनुच्छेद',\n\ttitle: 'शीर्षक',\n\tsubtitle: 'उपशीर्षक',\n\theading1: 'शीर्षक 1',\n\theading2: 'शीर्षक 2',\n\theading3: 'शीर्षक 3',\n\theading4: 'शीर्षक 4',\n\theading5: 'शीर्षक 5',\n\theading6: 'शीर्षक 6',\n\tblockTypeLabel: 'ब्लॉक प्रकार',\n\tblockTypesAria: 'ब्लॉक प्रकार सूची',\n};\n\n// --- Locale Map ---\n\nexport const HEADING_LOCALES: Record<string, HeadingLocale> = {\n\ten: HEADING_LOCALE_EN,\n\tde: HEADING_LOCALE_DE,\n\tes: HEADING_LOCALE_ES,\n\tfr: HEADING_LOCALE_FR,\n\tzh: HEADING_LOCALE_ZH,\n\tru: HEADING_LOCALE_RU,\n\tar: HEADING_LOCALE_AR,\n\thi: HEADING_LOCALE_HI,\n};\n","/**\n * HeadingPlugin: registers Title, Subtitle, and H1–H6 heading block types\n * with NodeSpec, toggle commands, keyboard shortcuts, input rules, and a\n * combobox-style toolbar dropdown that reflects the current block type.\n *\n * This file is a thin orchestrator — command logic, input rules, keyboard\n * handlers, and picker/toolbar rendering are delegated to dedicated modules.\n */\n\nimport { HEADING_SELECT_CSS } from '../../editor/styles/heading-select.js';\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport { createBlockElement } from '../../model/NodeSpec.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport type { BlockAlignment } from '../alignment/AlignmentPlugin.js';\nimport {\n\tregisterHeadingPickerEntries,\n\tregisterHeadingToolbarItem,\n\tupdateComboLabel,\n} from './HeadingBlockTypePicker.js';\nimport { registerHeadingCommands } from './HeadingCommands.js';\nimport { registerHeadingInputRules } from './HeadingInputRules.js';\nimport { registerHeadingKeymaps } from './HeadingKeyboardHandlers.js';\nimport { HEADING_LOCALES, type HeadingLocale } from './HeadingLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\theading: { level: HeadingLevel; align?: BlockAlignment };\n\t\ttitle: { align?: BlockAlignment };\n\t\tsubtitle: { align?: BlockAlignment };\n\t}\n}\n\n// --- Configuration ---\n\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nexport interface HeadingConfig {\n\t/** Which heading levels to enable. Defaults to [1, 2, 3, 4, 5, 6]. */\n\treadonly levels: readonly HeadingLevel[];\n\t/** When true, a separator is rendered after the heading toolbar item. */\n\treadonly separatorAfter?: boolean;\n\treadonly locale?: HeadingLocale;\n}\n\nconst DEFAULT_CONFIG: HeadingConfig = {\n\tlevels: [1, 2, 3, 4, 5, 6],\n};\n\n// --- Heading Tag Mapping ---\n\nconst HEADING_TAGS: Record<HeadingLevel, string> = {\n\t1: 'h1',\n\t2: 'h2',\n\t3: 'h3',\n\t4: 'h4',\n\t5: 'h5',\n\t6: 'h6',\n};\n\n// --- Plugin ---\n\nexport class HeadingPlugin implements Plugin {\n\treadonly id = 'heading';\n\treadonly name = 'Heading';\n\treadonly priority = 30;\n\n\tprivate readonly config: HeadingConfig;\n\tprivate locale!: HeadingLocale;\n\tprivate context: PluginContext | null = null;\n\tprivate comboLabel: HTMLSpanElement | null = null;\n\n\tconstructor(config?: Partial<HeadingConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.locale = resolvePluginLocale(HEADING_LOCALES, context, this.config.locale);\n\t\tcontext.registerStyleSheet(HEADING_SELECT_CSS);\n\t\tthis.context = context;\n\n\t\tthis.registerNodeSpecs(context);\n\t\tregisterHeadingCommands(context, this.config);\n\t\tregisterHeadingKeymaps(context, this.config);\n\t\tregisterHeadingInputRules(context, this.config);\n\t\tregisterHeadingPickerEntries(context, this.config, this.locale);\n\t\tregisterHeadingToolbarItem(context, this.config, this.locale);\n\t}\n\n\tdestroy(): void {\n\t\tthis.context = null;\n\t\tthis.comboLabel = null;\n\t}\n\n\tonStateChange(_oldState: EditorState, _newState: EditorState, _tr: Transaction): void {\n\t\tif (!this.context) return;\n\t\tthis.comboLabel = updateComboLabel(_newState, this.context, this.locale, this.comboLabel);\n\t}\n\n\tprivate registerNodeSpecs(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'title',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\texcludeMarks: ['fontSize'],\n\t\t\ttoDOM(node) {\n\t\t\t\tconst el = createBlockElement('h1', node.id);\n\t\t\t\tel.classList.add('notectl-title');\n\t\t\t\treturn el;\n\t\t\t},\n\t\t\ttoHTML(_node, content) {\n\t\t\t\treturn `<h1>${content || '<br>'}</h1>`;\n\t\t\t},\n\t\t\tsanitize: { tags: ['h1'] },\n\t\t});\n\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'subtitle',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\texcludeMarks: ['fontSize'],\n\t\t\ttoDOM(node) {\n\t\t\t\tconst el = createBlockElement('h2', node.id);\n\t\t\t\tel.classList.add('notectl-subtitle');\n\t\t\t\treturn el;\n\t\t\t},\n\t\t\ttoHTML(_node, content) {\n\t\t\t\treturn `<h2>${content || '<br>'}</h2>`;\n\t\t\t},\n\t\t\tsanitize: { tags: ['h2'] },\n\t\t});\n\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'heading',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\texcludeMarks: ['fontSize'],\n\t\t\tattrs: {\n\t\t\t\tlevel: { default: 1 },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst level = node.attrs?.level ?? 1;\n\t\t\t\tconst tag = HEADING_TAGS[level] ?? 'h1';\n\t\t\t\treturn createBlockElement(tag, node.id);\n\t\t\t},\n\t\t\ttoHTML(node, content) {\n\t\t\t\tconst level = (node.attrs?.level ?? 1) as HeadingLevel;\n\t\t\t\tconst tag: string = HEADING_TAGS[level] ?? 'h1';\n\t\t\t\treturn `<${tag}>${content || '<br>'}</${tag}>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{ tag: 'h1', getAttrs: () => ({ level: 1 }) },\n\t\t\t\t{ tag: 'h2', getAttrs: () => ({ level: 2 }) },\n\t\t\t\t{ tag: 'h3', getAttrs: () => ({ level: 3 }) },\n\t\t\t\t{ tag: 'h4', getAttrs: () => ({ level: 4 }) },\n\t\t\t\t{ tag: 'h5', getAttrs: () => ({ level: 5 }) },\n\t\t\t\t{ tag: 'h6', getAttrs: () => ({ level: 6 }) },\n\t\t\t],\n\t\t\tsanitize: { tags: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] },\n\t\t});\n\t}\n}\n","/** Heading picker toolbar combobox + popup styles. */\nexport const HEADING_SELECT_CSS = `\n/* Heading Select — Combobox-style toolbar button */\n.notectl-toolbar-btn--heading {\n\twidth: auto;\n\tmin-width: 100px;\n\tmax-width: 160px;\n\tpadding: 0 8px;\n\tgap: 4px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-bg);\n}\n\n.notectl-toolbar-btn--heading:hover {\n\tbackground: var(--notectl-hover-bg);\n\tborder-color: var(--notectl-fg-muted);\n}\n\n.notectl-toolbar-btn--heading.notectl-toolbar-btn--active {\n\tbackground: var(--notectl-bg);\n\tborder-color: var(--notectl-primary-muted);\n}\n\n.notectl-toolbar-btn--heading .notectl-toolbar-btn__icon {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 4px;\n\twidth: 100%;\n\toverflow: hidden;\n}\n\n.notectl-toolbar-btn--heading .notectl-toolbar-btn__icon svg {\n\tdisplay: none;\n}\n\n.notectl-heading-select__label {\n\tflex: 1;\n\tfont-size: 13px;\n\tfont-weight: 500;\n\tcolor: var(--notectl-fg);\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\ttext-align: left;\n\tline-height: 30px;\n}\n\n.notectl-heading-select__arrow {\n\tflex-shrink: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\tline-height: 30px;\n}\n\n/* Heading Picker Popup */\n.notectl-heading-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-heading-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-heading-picker__item {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\twidth: 100%;\n\tpadding: 7px 12px;\n\tborder: none;\n\tbackground: none;\n\tcursor: pointer;\n\tfont-size: 14px;\n\tcolor: var(--notectl-fg);\n\ttext-align: left;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n.notectl-heading-picker__item:hover {\n\tbackground: var(--notectl-hover-bg);\n}\n\n.notectl-heading-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-heading-picker__item--active:hover {\n\tbackground: var(--notectl-active-bg);\n}\n\n.notectl-heading-picker__check {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 16px;\n\tflex-shrink: 0;\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-heading-picker__label {\n\tflex: 1;\n}\n`;\n","/**\n * Input rule registration for heading block types.\n * Converts `# `, `## `, etc. at the start of a paragraph into headings.\n */\n\nimport {\n\tcreateCollapsedSelection,\n\tisCollapsed,\n\tisGapCursor,\n\tisNodeSelection,\n} from '../../model/Selection.js';\nimport { nodeType } from '../../model/TypeBrands.js';\nimport type { PluginContext } from '../Plugin.js';\nimport type { HeadingConfig } from './HeadingPlugin.js';\n\n/** Registers markdown-style input rules (e.g. `# ` → H1) for configured heading levels. */\nexport function registerHeadingInputRules(context: PluginContext, config: HeadingConfig): void {\n\tfor (const level of config.levels) {\n\t\tconst hashes: string = '#'.repeat(level);\n\t\tconst pattern: RegExp = new RegExp(`^${hashes} $`);\n\n\t\tcontext.registerInputRule({\n\t\t\tpattern,\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\treturn state\n\t\t\t\t\t.transaction('input')\n\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + level + 1)\n\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('heading'), { level })\n\t\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0))\n\t\t\t\t\t.build();\n\t\t\t},\n\t\t});\n\t}\n}\n"],"names":["createPickerItem","label","isActive","handler","style","item","document","createElement","type","className","setAttribute","String","classList","add","check","textContent","appendChild","labelSpan","fontSize","fontWeight","addEventListener","getHeadingLabel","locale","level","toggleSpecialBlock","context","state","getState","isNodeSelection","selection","isGapCursor","block","getBlock","anchor","blockId","setBlockType","nodeType","toggleHeading","sel","attrs","builder","transaction","spec","getSchemaRegistry","getNodeSpec","excludeMarks","length","getBlockLength","excludeSet","Set","inlineChildren","getInlineChildren","offset","child","isTextNode","text","mark","marks","has","removeMark","id","storedMarks","filtered","filter","m","setStoredMarks","tr","setSelection","build","dispatch","HEADING_TYPES","HEADING_LOCALE_EN","paragraph","title","subtitle","heading1","heading2","heading3","heading4","heading5","heading6","blockTypeLabel","blockTypesAria","HEADING_LOCALES","en","de","es","fr","zh","ru","ar","hi","DEFAULT_CONFIG","levels","HEADING_TAGS","HeadingPlugin","name","priority","config","comboLabel","this","resolvePluginLocale","registerStyleSheet","registerNodeSpecs","registerCommand","keymap","Enter","isCollapsed","ctx","getBlockText","blockLength","newBlockId","generateBlockId","splitBlock","createCollapsedSelection","executeCommand","registerKeymap","hashes","repeat","pattern","RegExp","registerInputRule","_match","start","_end","deleteTextAt","registerBlockTypePickerEntry","command","icon","registerToolbarItem","group","tooltip","popupType","separatorAfter","renderPopup","container","list","entries","getBlockTypePickerRegistry","getBlockTypePickerEntries","entry","active","e","preventDefault","stopPropagation","toolbar","getService","ToolbarServiceKey","closePopup","some","destroy","_oldState","_newState","_tr","cachedLabel","getPluginContainer","querySelector","registerNodeSpec","content","allow","node","el","createBlockElement","toHTML","_node","sanitize","tags","default","tag","parseHTML","getAttrs"],"mappings":";;;;;;AA0KA,SAASA,EACRC,IACAC,IACAC,IACAC,IAAAA;AAEA,QAAMC,KAA0BC,SAASC,cAAc;AACvDF,EAAAA,GAAKG,OAAO,UACZH,GAAKI,YAAY,gCACjBJ,GAAKK,aAAa,QAAQ,QAAA,GAC1BL,GAAKK,aAAa,iBAAiBC,OAAOT,EAAAA,CAAAA,GAEtCA,MACHG,GAAKO,UAAUC,IAAI,sCAAA;AAGpB,QAAMC,KAAyBR,SAASC,cAAc;AACtDO,EAAAA,GAAML,YAAY,iCAClBK,GAAMC,cAAcb,KAAW,MAAW,IAC1CG,GAAKW,YAAYF,EAAAA;AAEjB,QAAMG,KAA6BX,SAASC,cAAc,MAAA;AAU1D,SATAU,GAAUR,YAAY,iCACtBQ,GAAUF,cAAcd,IACpBG,OACHa,GAAUb,MAAMc,WAAWd,GAAMc,UACjCD,GAAUb,MAAMe,aAAaf,GAAMe,aAEpCd,GAAKW,YAAYC,EAAAA,GAEjBZ,GAAKe,iBAAiB,aAAajB,EAAAA,GAC5BE;AACR;AAIA,SAASgB,EAAgBC,IAAuBC,IAAAA;AAE/C,SAAOD,GADK,UAAUC,EAAAA,EAAAA;AAEvB;AC7KA,SAASC,EAAmBC,IAAwBjB,IAAAA;AACnD,QAAMkB,KAAqBD,GAAQE,SAAAA;AACnC,MAAIC,EAAgBF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N,OAAOA,MAAW,MAAA,SAE1BO,UAAU,EAAEC,MAAM,CAAC,YAGpB7I,GAAQoI,iBAAiB,EACxBrJ,MAAM,WACN0H,OAAO,SACP4B,SAAS,EAAEC,OAAO,CAAC,WACnBlH,cAAc,CAAC,aACfN,OAAO,EACNhB,OAAO,EAAEgJ,SAAS,EAAA,EAAA,GAEnB,MAAMP,IAAAA;AACL,YAAMzI,KAAQyI,GAAKzH,OAAOhB,SAAS;AAEnC,aAAO2I,EADKpE,EAAavE,OAAU,MACJyI,GAAKpG;IACrC,GACA,OAAOoG,IAAMF,IAAAA;AACZ,YAAMvI,KAASyI,GAAKzH,OAAOhB,SAAS,GAC9BiJ,KAAc1E,EAAavE,EAAAA,KAAU;AAC3C,aAAO,IAAIiJ,MAAOV,MAAW,MAAA,KAAWU;IACzC,GACAC,WAAW,CACV,EAAED,KAAK,MAAME,UAAU,OAAA,EAASnJ,OAAO,EAAA,GAAA,GACvC,EAAEiJ,KAAK,MAAME,UAAU,OAAA,EAASnJ,OAAO,QACvC,EAAEiJ,KAAK,MAAME,UAAU,OAAA,EAASnJ,OAAO,EAAA,GAAA,GACvC,EAAEiJ,KAAK,MAAME,UAAU,OAAA,EAASnJ,OAAO,EAAA,GAAA,GACvC,EAAEiJ,KAAK,MAAME,UAAU,OAAA,EAASnJ,OAAO,EAAA,GAAA,GACvC,EAAEiJ,KAAK,MAAME,UAAU,OAAA,EAASnJ,OAAO,EAAA,GAAA,CAAA,GAExC8I,UAAU,EAAEC,MAAM,CAAC,MAAM,MAAM,MAAM,MAAM,MAAM,IAAA,EAAA,EAAA,CAAA;AAAA,EAEnD;AAAA;"}
|
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
import { r as t } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
2
|
-
import { a as e } from "./ToolbarPlugin-
|
|
3
|
-
import { f as n } from "./Commands-
|
|
4
|
-
import { i as o } from "./AttrRegistry-
|
|
5
|
-
import {
|
|
6
|
-
import { i as s, a,
|
|
7
|
-
import { m as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
2
|
+
import { a as e } from "./ToolbarPlugin-B6JETWaw.mjs";
|
|
3
|
+
import { f as n } from "./Commands-CicwYoTQ.mjs";
|
|
4
|
+
import { i as o } from "./AttrRegistry-I-VdmRnN.mjs";
|
|
5
|
+
import { g as i, h as r } from "./Document-CuwE73FF.mjs";
|
|
6
|
+
import { i as s, a, b as l, s as c } from "./Selection-DmFDwiPJ.mjs";
|
|
7
|
+
import { m as p } from "./TypeBrands-C09nE2qO.mjs";
|
|
8
|
+
const f = { label: "Font Size", tooltip: "Font Size", customFontSizeAria: "Custom font size", fontSizesAria: "Font sizes" }, u = { en: f, de: { label: "Schriftgröße", tooltip: "Schriftgröße", customFontSizeAria: "Benutzerdefinierte Schriftgröße", fontSizesAria: "Schriftgrößen" }, es: { label: "Tamaño de fuente", tooltip: "Tamaño de fuente", customFontSizeAria: "Tamaño de fuente personalizado", fontSizesAria: "Tamaños de fuente" }, fr: { label: "Taille de police", tooltip: "Taille de police", customFontSizeAria: "Taille de police personnalisée", fontSizesAria: "Tailles de police" }, zh: { label: "字号", tooltip: "字号", customFontSizeAria: "自定义字号", fontSizesAria: "字号列表" }, ru: { label: "Размер шрифта", tooltip: "Размер шрифта", customFontSizeAria: "Произвольный размер шрифта", fontSizesAria: "Размеры шрифта" }, ar: { label: "حجم الخط", tooltip: "حجم الخط", customFontSizeAria: "حجم خط مخصص", fontSizesAria: "أحجام الخط" }, hi: { label: "फ़ॉन्ट आकार", tooltip: "फ़ॉन्ट आकार", customFontSizeAria: "कस्टम फ़ॉन्ट आकार", fontSizesAria: "फ़ॉन्ट आकार सूची" } };
|
|
9
|
+
function d(t2) {
|
|
10
10
|
const e2 = t2.selection;
|
|
11
|
-
if (s(e2)) return null;
|
|
12
|
-
if (
|
|
11
|
+
if (s(e2) || a(e2)) return null;
|
|
12
|
+
if (l(e2) && t2.storedMarks) return S(t2.storedMarks);
|
|
13
13
|
const n2 = t2.getBlock(e2.anchor.blockId);
|
|
14
|
-
return n2 ?
|
|
14
|
+
return n2 ? S(i(n2, e2.anchor.offset)) : null;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const n2 =
|
|
16
|
+
function m(t2, e2) {
|
|
17
|
+
const n2 = d(t2);
|
|
18
18
|
if (!n2) return e2;
|
|
19
19
|
const o2 = Number.parseInt(n2, 10);
|
|
20
20
|
return Number.isNaN(o2) ? e2 : o2;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function z(t2, e2, o2) {
|
|
23
23
|
const r2 = e2.selection;
|
|
24
|
-
if (s(r2)) return false;
|
|
25
|
-
if (
|
|
24
|
+
if (s(r2) || a(r2)) return false;
|
|
25
|
+
if (l(r2)) {
|
|
26
26
|
const n2 = e2.getBlock(r2.anchor.blockId);
|
|
27
27
|
if (!n2) return false;
|
|
28
|
-
const s2 = [...(e2.storedMarks ?? i(n2, r2.anchor.offset)).filter((t3) => "fontSize" !== t3.type), { type:
|
|
28
|
+
const s2 = [...(e2.storedMarks ?? i(n2, r2.anchor.offset)).filter((t3) => "fontSize" !== t3.type), { type: p("fontSize"), attrs: { size: o2 } }], a2 = e2.transaction("command").setStoredMarks(s2, e2.storedMarks).setSelection(r2).build();
|
|
29
29
|
return t2.dispatch(a2), true;
|
|
30
30
|
}
|
|
31
|
-
const
|
|
32
|
-
return n(e2,
|
|
33
|
-
|
|
34
|
-
}),
|
|
31
|
+
const f2 = c(r2, e2.getBlockOrder()), u2 = e2.transaction("command"), d2 = { type: p("fontSize"), attrs: { size: o2 } };
|
|
32
|
+
return n(e2, f2, (t3, e3, n2) => {
|
|
33
|
+
u2.removeMark(t3, e3, n2, { type: p("fontSize") }), u2.addMark(t3, e3, n2, d2);
|
|
34
|
+
}), u2.setSelection(r2), t2.dispatch(u2.build()), true;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function b(t2, e2) {
|
|
37
37
|
const o2 = e2.selection;
|
|
38
|
-
if (s(o2)) return false;
|
|
39
|
-
if (
|
|
38
|
+
if (s(o2) || a(o2)) return false;
|
|
39
|
+
if (l(o2)) {
|
|
40
40
|
const n2 = e2.getBlock(o2.anchor.blockId);
|
|
41
41
|
if (!n2) return false;
|
|
42
42
|
const s2 = e2.storedMarks ?? i(n2, o2.anchor.offset);
|
|
43
|
-
if (!r(s2,
|
|
43
|
+
if (!r(s2, p("fontSize"))) return false;
|
|
44
44
|
const a2 = s2.filter((t3) => "fontSize" !== t3.type), l2 = e2.transaction("command").setStoredMarks(a2, e2.storedMarks).setSelection(o2).build();
|
|
45
45
|
return t2.dispatch(l2), true;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
return n(e2,
|
|
49
|
-
|
|
50
|
-
}),
|
|
47
|
+
const f2 = c(o2, e2.getBlockOrder()), u2 = e2.transaction("command");
|
|
48
|
+
return n(e2, f2, (t3, e3, n2) => {
|
|
49
|
+
u2.removeMark(t3, e3, n2, { type: p("fontSize") });
|
|
50
|
+
}), u2.setSelection(o2), t2.dispatch(u2.build()), true;
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function g(t2, e2, n2, o2, i2) {
|
|
53
53
|
const r2 = (function(t3, e3, n3) {
|
|
54
54
|
if ("up" === e3) {
|
|
55
55
|
for (const e4 of n3) if (e4 > t3) return e4;
|
|
@@ -60,17 +60,17 @@ function b(t2, e2, n2, o2, i2) {
|
|
|
60
60
|
if (void 0 !== o3 && o3 < t3) return o3;
|
|
61
61
|
}
|
|
62
62
|
return null;
|
|
63
|
-
})(
|
|
64
|
-
return null !== r2 && (r2 === i2 ?
|
|
63
|
+
})(m(e2, i2), n2, o2);
|
|
64
|
+
return null !== r2 && (r2 === i2 ? b(t2, e2) : z(t2, e2, `${r2}px`));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
e2 === n2 ? t2.executeCommand("removeFontSize") :
|
|
66
|
+
function h(t2, e2, n2) {
|
|
67
|
+
e2 === n2 ? t2.executeCommand("removeFontSize") : z(t2, t2.getState(), `${e2}px`);
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function S(t2) {
|
|
70
70
|
const e2 = t2.find((t3) => "fontSize" === t3.type);
|
|
71
71
|
return e2 && o(e2, "fontSize") ? e2.attrs.size ?? null : null;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function k(t2, e2) {
|
|
74
74
|
const n2 = document.createElement("button");
|
|
75
75
|
n2.type = "button", n2.id = `notectl-font-size-option-${t2}`, n2.className = "notectl-font-size-picker__item", n2.setAttribute("role", "option"), n2.setAttribute("aria-selected", String(e2)), e2 && n2.classList.add("notectl-font-size-picker__item--active");
|
|
76
76
|
const o2 = document.createElement("span");
|
|
@@ -78,8 +78,8 @@ function S(t2, e2) {
|
|
|
78
78
|
const i2 = document.createElement("span");
|
|
79
79
|
return i2.className = "notectl-font-size-picker__label", i2.textContent = String(t2), n2.appendChild(i2), n2;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
class
|
|
81
|
+
const v = [8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96];
|
|
82
|
+
class x {
|
|
83
83
|
id = "fontSize";
|
|
84
84
|
name = "Font Size";
|
|
85
85
|
priority = 21;
|
|
@@ -92,13 +92,13 @@ class v {
|
|
|
92
92
|
constructor(t2) {
|
|
93
93
|
var e2;
|
|
94
94
|
this.config = { ...t2 }, this.sizes = (function(t3) {
|
|
95
|
-
if (!t3 || 0 === t3.length) return
|
|
95
|
+
if (!t3 || 0 === t3.length) return v;
|
|
96
96
|
const e3 = [...new Set(t3)].filter((t4) => Number.isInteger(t4) && t4 > 0);
|
|
97
|
-
return e3.sort((t4, e4) => t4 - e4), e3.length > 0 ? e3 :
|
|
97
|
+
return e3.sort((t4, e4) => t4 - e4), e3.length > 0 ? e3 : v;
|
|
98
98
|
})(t2?.sizes), this.defaultSize = (e2 = t2?.defaultSize, void 0 === e2 ? 16 : Number.isInteger(e2) && e2 > 0 ? e2 : 16);
|
|
99
99
|
}
|
|
100
100
|
init(e2) {
|
|
101
|
-
this.locale = t(
|
|
101
|
+
this.locale = t(u, e2, this.config.locale), e2.registerStyleSheet("\n/* Font Size Select — Combobox-style toolbar button */\n.notectl-toolbar-btn--fontSize {\n width: auto;\n min-width: 60px;\n max-width: 80px;\n padding: 0 8px;\n gap: 4px;\n border: 1px solid var(--notectl-border);\n border-radius: 4px;\n background: var(--notectl-bg);\n}\n\n.notectl-toolbar-btn--fontSize:hover {\n background: var(--notectl-hover-bg);\n border-color: var(--notectl-fg-muted);\n}\n\n.notectl-toolbar-btn--fontSize.notectl-toolbar-btn--active {\n background: var(--notectl-bg);\n border-color: var(--notectl-primary-muted);\n}\n\n.notectl-toolbar-btn--fontSize .notectl-toolbar-btn__icon {\n display: flex;\n align-items: center;\n gap: 4px;\n width: 100%;\n overflow: hidden;\n}\n\n.notectl-toolbar-btn--fontSize .notectl-toolbar-btn__icon svg {\n display: none;\n}\n\n.notectl-font-size-select__label {\n flex: 1;\n font-size: 13px;\n font-weight: 500;\n color: var(--notectl-fg);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: left;\n line-height: 30px;\n}\n\n.notectl-font-size-select__arrow {\n flex-shrink: 0;\n font-size: 11px;\n color: var(--notectl-fg-muted);\n line-height: 30px;\n}\n\n/* Font Size Picker Popup */\n.notectl-font-size-picker {\n min-width: 140px;\n display: flex;\n flex-direction: column;\n}\n\n.notectl-font-size-picker__input-wrapper {\n padding: 8px 8px 4px;\n}\n\n.notectl-font-size-picker__input {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--notectl-border);\n border-radius: 4px;\n font-size: 13px;\n font-family: inherit;\n color: var(--notectl-fg);\n background: var(--notectl-bg);\n outline: none;\n box-sizing: border-box;\n -moz-appearance: textfield;\n}\n\n.notectl-font-size-picker__input::-webkit-inner-spin-button,\n.notectl-font-size-picker__input::-webkit-outer-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\n.notectl-font-size-picker__input:focus {\n border-color: var(--notectl-border-focus);\n box-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n.notectl-font-size-picker__list {\n max-height: 280px;\n overflow-y: auto;\n padding: 4px 0;\n}\n\n.notectl-font-size-picker__item {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 7px 12px;\n border: none;\n background: none;\n cursor: pointer;\n font-size: 14px;\n color: var(--notectl-fg);\n line-height: 1.4;\n text-align: left;\n white-space: nowrap;\n font-family: inherit;\n transition: background 0.1s;\n outline: none;\n}\n\n.notectl-font-size-picker__item:hover {\n background: var(--notectl-hover-bg);\n}\n\n.notectl-font-size-picker__item--active {\n background: var(--notectl-active-bg);\n color: var(--notectl-primary-fg);\n}\n\n.notectl-font-size-picker__item--active:hover {\n background: var(--notectl-active-bg);\n}\n\n.notectl-font-size-picker__item--focused {\n outline: 2px solid var(--notectl-primary);\n outline-offset: -2px;\n}\n\n.notectl-font-size-picker__check {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n flex-shrink: 0;\n font-size: 13px;\n font-weight: 600;\n color: var(--notectl-primary-fg);\n}\n\n.notectl-font-size-picker__label {\n flex: 1;\n}\n"), this.context = e2, this.registerMarkSpec(e2), this.registerCommands(e2), this.registerKeymaps(e2), this.registerToolbarItem(e2), this.applyDefaultSizeToContainer(e2);
|
|
102
102
|
}
|
|
103
103
|
destroy() {
|
|
104
104
|
this.context = null, this.comboLabel = null;
|
|
@@ -119,17 +119,17 @@ class v {
|
|
|
119
119
|
} }], sanitize: { tags: ["span"] } });
|
|
120
120
|
}
|
|
121
121
|
registerCommands(t2) {
|
|
122
|
-
t2.registerCommand("removeFontSize", () =>
|
|
122
|
+
t2.registerCommand("removeFontSize", () => b(t2, t2.getState())), t2.registerCommand("setFontSize", () => false), t2.registerCommand("increaseFontSize", () => g(t2, t2.getState(), "up", this.sizes, this.defaultSize)), t2.registerCommand("decreaseFontSize", () => g(t2, t2.getState(), "down", this.sizes, this.defaultSize));
|
|
123
123
|
}
|
|
124
124
|
registerKeymaps(t2) {
|
|
125
|
-
t2.registerKeymap({ "Mod-Shift-+": () =>
|
|
125
|
+
t2.registerKeymap({ "Mod-Shift-+": () => g(t2, t2.getState(), "up", this.sizes, this.defaultSize), "Mod-Shift-_": () => g(t2, t2.getState(), "down", this.sizes, this.defaultSize) });
|
|
126
126
|
}
|
|
127
127
|
registerToolbarItem(t2) {
|
|
128
128
|
const e2 = `<span class="notectl-font-size-select__label" data-font-size-label>${this.defaultSize}</span><span class="notectl-font-size-select__arrow">▾</span>`;
|
|
129
129
|
t2.registerToolbarItem({ id: "fontSize", group: "format", icon: e2, label: this.locale.label, tooltip: this.locale.tooltip, command: "removeFontSize", priority: 6, popupType: "custom", separatorAfter: this.config.separatorAfter, renderPopup: (t3, e3) => {
|
|
130
130
|
!(function(t4, e4, n2) {
|
|
131
131
|
t4.classList.add("notectl-font-size-picker");
|
|
132
|
-
const o2 =
|
|
132
|
+
const o2 = m(e4.getState(), n2.defaultSize), i2 = (function(t5, e5) {
|
|
133
133
|
const n3 = document.createElement("input");
|
|
134
134
|
return n3.type = "number", n3.className = "notectl-font-size-picker__input", n3.min = String(1), n3.max = String(400), n3.value = String(t5), n3.setAttribute("aria-label", e5.locale?.customFontSizeAria ?? "Custom font size"), n3;
|
|
135
135
|
})(o2, n2);
|
|
@@ -142,9 +142,9 @@ class v {
|
|
|
142
142
|
i3.className = "notectl-font-size-picker__list", i3.setAttribute("role", "listbox"), i3.setAttribute("aria-label", o3.locale?.fontSizesAria ?? "Font sizes");
|
|
143
143
|
const r3 = [];
|
|
144
144
|
for (const s3 of t5) {
|
|
145
|
-
const t6 =
|
|
145
|
+
const t6 = k(s3, s3 === e5);
|
|
146
146
|
t6.addEventListener("mousedown", (t7) => {
|
|
147
|
-
t7.preventDefault(), t7.stopPropagation(),
|
|
147
|
+
t7.preventDefault(), t7.stopPropagation(), h(n3, s3, o3.defaultSize), o3.dismissPopup();
|
|
148
148
|
}), r3.push(t6), i3.appendChild(t6);
|
|
149
149
|
}
|
|
150
150
|
return { list: i3, items: r3 };
|
|
@@ -167,7 +167,7 @@ class v {
|
|
|
167
167
|
if ("Enter" === e6.key) {
|
|
168
168
|
e6.preventDefault();
|
|
169
169
|
const n4 = Number.parseInt(t5.value, 10);
|
|
170
|
-
!Number.isNaN(n4) && n4 >= 1 && n4 <= 400 && (
|
|
170
|
+
!Number.isNaN(n4) && n4 >= 1 && n4 <= 400 && (h(o3, n4, i3.defaultSize), i3.dismissPopup());
|
|
171
171
|
} else "ArrowDown" === e6.key ? (e6.preventDefault(), s3(0), n3[0]?.focus()) : "Escape" === e6.key && (e6.preventDefault(), i3.dismissPopup());
|
|
172
172
|
}), e5.addEventListener("keydown", (e6) => {
|
|
173
173
|
if ("ArrowDown" === e6.key) e6.preventDefault(), r3 < n3.length - 1 && (s3(r3 + 1), n3[r3]?.focus());
|
|
@@ -175,13 +175,13 @@ class v {
|
|
|
175
175
|
else if ("Enter" === e6.key) {
|
|
176
176
|
e6.preventDefault();
|
|
177
177
|
const t6 = i3.sizes[r3];
|
|
178
|
-
r3 >= 0 && r3 < i3.sizes.length && void 0 !== t6 && (
|
|
178
|
+
r3 >= 0 && r3 < i3.sizes.length && void 0 !== t6 && (h(o3, t6, i3.defaultSize), i3.dismissPopup());
|
|
179
179
|
} else "Escape" === e6.key && (e6.preventDefault(), i3.dismissPopup());
|
|
180
180
|
});
|
|
181
181
|
})(i2, r2, s2, e4, n2);
|
|
182
182
|
})(t3, e3, { sizes: this.sizes, defaultSize: this.defaultSize, dismissPopup: () => this.dismissPopup(), locale: this.locale });
|
|
183
183
|
}, isActive: (t3) => (function(t4) {
|
|
184
|
-
return null !==
|
|
184
|
+
return null !== d(t4);
|
|
185
185
|
})(t3) });
|
|
186
186
|
}
|
|
187
187
|
applyDefaultSizeToContainer(t2) {
|
|
@@ -197,13 +197,13 @@ class v {
|
|
|
197
197
|
if (!t3) return;
|
|
198
198
|
if (this.comboLabel = t3.querySelector("[data-font-size-label]") ?? null, !this.comboLabel) return;
|
|
199
199
|
}
|
|
200
|
-
const e2 =
|
|
200
|
+
const e2 = m(t2, this.defaultSize);
|
|
201
201
|
this.comboLabel.textContent = String(e2);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
export {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
u as F,
|
|
206
|
+
f as a,
|
|
207
|
+
x as b
|
|
208
208
|
};
|
|
209
|
-
//# sourceMappingURL=index-
|
|
209
|
+
//# sourceMappingURL=index-DUC1X43Z.mjs.map
|