@notectl/core 1.7.0 → 1.7.2
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/README.md +2 -2
- package/dist/chunks/{AttrRegistry-I-VdmRnN.mjs → AttrRegistry-D9Jx_RVb.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-I-VdmRnN.mjs.map → AttrRegistry-D9Jx_RVb.mjs.map} +1 -1
- package/dist/chunks/AttributedMarkCommands-BtLea72z.mjs +80 -0
- package/dist/chunks/AttributedMarkCommands-BtLea72z.mjs.map +1 -0
- package/dist/chunks/{CaretNavigation-CAJXoaae.mjs → CaretNavigation-7JYpIKbs.mjs} +56 -56
- package/dist/chunks/{CaretNavigation-CAJXoaae.mjs.map → CaretNavigation-7JYpIKbs.mjs.map} +1 -1
- package/dist/chunks/ColorGrid-Dneqb8if.mjs +81 -0
- package/dist/chunks/ColorGrid-Dneqb8if.mjs.map +1 -0
- package/dist/chunks/ColorPickerPopup-CiCLBbe9.mjs +37 -0
- package/dist/chunks/ColorPickerPopup-CiCLBbe9.mjs.map +1 -0
- package/dist/chunks/ColorValidation-CV4f1wu6.mjs +39 -0
- package/dist/chunks/ColorValidation-CV4f1wu6.mjs.map +1 -0
- package/dist/chunks/{Document-CuwE73FF.mjs → Document-Brtw2jL1.mjs} +18 -18
- package/dist/chunks/{Document-CuwE73FF.mjs.map → Document-Brtw2jL1.mjs.map} +1 -1
- package/dist/chunks/MarkCommands-6RUJ4L3r.mjs +94 -0
- package/dist/chunks/MarkCommands-6RUJ4L3r.mjs.map +1 -0
- package/dist/chunks/{NavigationUtils-CyW0Vo8A.mjs → NavigationUtils-Cspt2ZrK.mjs} +3 -3
- package/dist/chunks/{NavigationUtils-CyW0Vo8A.mjs.map → NavigationUtils-Cspt2ZrK.mjs.map} +1 -1
- package/dist/chunks/{NodeResolver-B-wzthAQ.mjs → NodeResolver-C2XYkeOi.mjs} +2 -2
- package/dist/chunks/{NodeResolver-B-wzthAQ.mjs.map → NodeResolver-C2XYkeOi.mjs.map} +1 -1
- package/dist/chunks/PopupPositioning-BTT-_pQ3.mjs +32 -0
- package/dist/chunks/PopupPositioning-BTT-_pQ3.mjs.map +1 -0
- package/dist/chunks/RangeIterator-Bh4Vl_6D.mjs +16 -0
- package/dist/chunks/RangeIterator-Bh4Vl_6D.mjs.map +1 -0
- package/dist/chunks/{Selection-DmFDwiPJ.mjs → Selection-BRTab5hO.mjs} +7 -7
- package/dist/chunks/{Selection-DmFDwiPJ.mjs.map → Selection-BRTab5hO.mjs.map} +1 -1
- package/dist/chunks/StyleRuntime-ChRjVQwL.mjs +239 -0
- package/dist/chunks/StyleRuntime-ChRjVQwL.mjs.map +1 -0
- package/dist/chunks/ToolbarItem-BpZggUGo.mjs.map +1 -1
- package/dist/chunks/{ToolbarKeyboardNav-B32OMv8r.mjs → ToolbarKeyboardNav-DhpL8zNV.mjs} +3 -3
- package/dist/chunks/{ToolbarKeyboardNav-B32OMv8r.mjs.map → ToolbarKeyboardNav-DhpL8zNV.mjs.map} +1 -1
- package/dist/chunks/{ToolbarPlugin-B6JETWaw.mjs → ToolbarPlugin-DpLVJ71w.mjs} +348 -135
- package/dist/chunks/ToolbarPlugin-DpLVJ71w.mjs.map +1 -0
- package/dist/chunks/index--n1RGpq-.mjs +171 -0
- package/dist/chunks/index--n1RGpq-.mjs.map +1 -0
- package/dist/chunks/index-4or5UzNO.mjs +168 -0
- package/dist/chunks/index-4or5UzNO.mjs.map +1 -0
- package/dist/chunks/{index-pxbbDHVH.mjs → index-ABlTDvEX.mjs} +20 -19
- package/dist/chunks/index-ABlTDvEX.mjs.map +1 -0
- package/dist/chunks/{index--z_Txzej.mjs → index-BAke7kNL.mjs} +45 -45
- package/dist/chunks/{index--z_Txzej.mjs.map → index-BAke7kNL.mjs.map} +1 -1
- package/dist/chunks/{index-DMt3ojrY.mjs → index-BXtw5PNN.mjs} +2 -2
- package/dist/chunks/{index-DMt3ojrY.mjs.map → index-BXtw5PNN.mjs.map} +1 -1
- package/dist/chunks/{index-FlTg80Pk.mjs → index-BhDXjueu.mjs} +285 -325
- package/dist/chunks/index-BhDXjueu.mjs.map +1 -0
- package/dist/chunks/{index-D0s0Q8Wc.mjs → index-BqNUfq-y.mjs} +43 -35
- package/dist/chunks/index-BqNUfq-y.mjs.map +1 -0
- package/dist/chunks/{index-CflvcXSd.mjs → index-BvqkuEY1.mjs} +21 -17
- package/dist/chunks/index-BvqkuEY1.mjs.map +1 -0
- package/dist/chunks/{index-C9gc3Bws.mjs → index-C1opJocO.mjs} +32 -32
- package/dist/chunks/{index-C9gc3Bws.mjs.map → index-C1opJocO.mjs.map} +1 -1
- package/dist/chunks/index-CWltg1wK.mjs +124 -0
- package/dist/chunks/index-CWltg1wK.mjs.map +1 -0
- package/dist/chunks/{index-D8tbbW97.mjs → index-Cd3uJLP3.mjs} +2 -2
- package/dist/chunks/{index-D8tbbW97.mjs.map → index-Cd3uJLP3.mjs.map} +1 -1
- package/dist/chunks/{index-C0cEs7Jc.mjs → index-CluzpB2b.mjs} +10 -10
- package/dist/chunks/{index-C0cEs7Jc.mjs.map → index-CluzpB2b.mjs.map} +1 -1
- package/dist/chunks/{index-CoeD4T9-.mjs → index-D3NlpmT1.mjs} +15 -11
- package/dist/chunks/index-D3NlpmT1.mjs.map +1 -0
- package/dist/chunks/{index-CAV2N-fF.mjs → index-D515iymW.mjs} +75 -74
- package/dist/chunks/{index-CAV2N-fF.mjs.map → index-D515iymW.mjs.map} +1 -1
- package/dist/chunks/{index-B-NSeaM4.mjs → index-Dk49P9N4.mjs} +2 -2
- package/dist/chunks/{index-B-NSeaM4.mjs.map → index-Dk49P9N4.mjs.map} +1 -1
- package/dist/chunks/index-DyzigvbZ.mjs +410 -0
- package/dist/chunks/index-DyzigvbZ.mjs.map +1 -0
- package/dist/chunks/index-ErZ5_a1o.mjs +296 -0
- package/dist/chunks/index-ErZ5_a1o.mjs.map +1 -0
- package/dist/chunks/{index-CNs4QQ8l.mjs → index-fsVJLutn.mjs} +52 -64
- package/dist/chunks/index-fsVJLutn.mjs.map +1 -0
- package/dist/commands/AttributedMarkCommands.d.ts +46 -0
- package/dist/commands/AttributedMarkCommands.d.ts.map +1 -0
- package/dist/commands/CommandHelpers.d.ts +21 -0
- package/dist/commands/CommandHelpers.d.ts.map +1 -0
- package/dist/commands/Commands.d.ts +2 -8
- package/dist/commands/Commands.d.ts.map +1 -1
- package/dist/commands/DeleteCommands.d.ts.map +1 -1
- package/dist/commands/GapCursorCommands.d.ts.map +1 -1
- package/dist/commands/NodeSelectionCommands.d.ts.map +1 -1
- package/dist/commands/PasteCommand.d.ts.map +1 -1
- package/dist/commands/RangeIterator.d.ts +10 -0
- package/dist/commands/RangeIterator.d.ts.map +1 -0
- package/dist/editor/DocumentParser.d.ts.map +1 -1
- package/dist/editor/DocumentSerializer.d.ts +2 -0
- package/dist/editor/DocumentSerializer.d.ts.map +1 -1
- package/dist/editor/EditorThemeController.d.ts +3 -0
- package/dist/editor/EditorThemeController.d.ts.map +1 -1
- package/dist/editor/MarkSerializer.d.ts +11 -0
- package/dist/editor/MarkSerializer.d.ts.map +1 -0
- package/dist/editor/NotectlEditor.d.ts +19 -3
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/PaperLayoutController.d.ts +2 -0
- package/dist/editor/PaperLayoutController.d.ts.map +1 -1
- package/dist/editor/styles/font-select.d.ts +1 -1
- package/dist/editor/styles/font-select.d.ts.map +1 -1
- package/dist/editor/styles/font-size-select.d.ts +1 -1
- package/dist/editor/styles/font-size-select.d.ts.map +1 -1
- package/dist/editor/styles/heading-select.d.ts +1 -1
- package/dist/editor/styles/heading-select.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 +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/input/ClipboardHandler.d.ts +0 -2
- package/dist/input/ClipboardHandler.d.ts.map +1 -1
- package/dist/input/LegacyHTMLNormalizer.d.ts.map +1 -1
- package/dist/model/MarkSpec.d.ts +6 -0
- package/dist/model/MarkSpec.d.ts.map +1 -1
- package/dist/notectl-core.mjs +2244 -2095
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +2862 -2415
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/PluginManager.d.ts +2 -0
- 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.mjs +1 -1
- package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font/FontPlugin.d.ts +0 -6
- 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/FontSizePlugin.d.ts +0 -5
- package/dist/plugins/font-size/FontSizePlugin.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.mjs +2 -2
- package/dist/plugins/hard-break.mjs +2 -25
- package/dist/plugins/hard-break.mjs.map +1 -1
- package/dist/plugins/heading/HeadingBlockTypePicker.d.ts +1 -7
- package/dist/plugins/heading/HeadingBlockTypePicker.d.ts.map +1 -1
- package/dist/plugins/heading/HeadingPlugin.d.ts +0 -6
- 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.mjs +1 -1
- package/dist/plugins/image/ImageNodeView.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.map +1 -1
- package/dist/plugins/list.mjs +1 -1
- package/dist/plugins/print/PrintContentPreparer.d.ts.map +1 -1
- package/dist/plugins/shared/ColorGrid.d.ts +25 -0
- package/dist/plugins/shared/ColorGrid.d.ts.map +1 -0
- package/dist/plugins/shared/ColorMarkOperations.d.ts.map +1 -1
- package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -1
- package/dist/plugins/shared/ColorValidation.d.ts +13 -2
- package/dist/plugins/shared/ColorValidation.d.ts.map +1 -1
- package/dist/plugins/shared/PopupKeyboardPatterns.d.ts +43 -0
- package/dist/plugins/shared/PopupKeyboardPatterns.d.ts.map +1 -0
- package/dist/plugins/shared/PopupManager.d.ts +45 -0
- package/dist/plugins/shared/PopupManager.d.ts.map +1 -0
- package/dist/plugins/shared/PopupPositioning.d.ts +21 -0
- package/dist/plugins/shared/PopupPositioning.d.ts.map +1 -0
- package/dist/plugins/strikethrough.mjs +1 -1
- package/dist/plugins/super-sub.mjs +1 -1
- package/dist/plugins/table/TableBorderColor.d.ts.map +1 -1
- package/dist/plugins/table/TableContextMenu.d.ts +2 -1
- package/dist/plugins/table/TableContextMenu.d.ts.map +1 -1
- package/dist/plugins/table/TableControls.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsLayout.d.ts.map +1 -1
- package/dist/plugins/table/TableNodeViews.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.mjs +1 -1
- package/dist/plugins/toolbar/ToolbarItem.d.ts +11 -2
- package/dist/plugins/toolbar/ToolbarItem.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts +5 -1
- package/dist/plugins/toolbar/ToolbarOverflowController.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts +1 -0
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts +9 -1
- package/dist/plugins/toolbar/ToolbarPopupController.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarRenderers.d.ts.map +1 -1
- package/dist/plugins/toolbar/ToolbarTooltip.d.ts.map +1 -1
- package/dist/plugins/toolbar/index.d.ts +1 -1
- package/dist/plugins/toolbar/index.d.ts.map +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/state/BlockTreeOps.d.ts +21 -0
- package/dist/state/BlockTreeOps.d.ts.map +1 -0
- package/dist/state/InlineContentOps.d.ts +37 -0
- package/dist/state/InlineContentOps.d.ts.map +1 -0
- package/dist/state/StepApplication.d.ts.map +1 -1
- package/dist/style/StyleRuntime.d.ts +38 -0
- package/dist/style/StyleRuntime.d.ts.map +1 -0
- package/dist/test/PluginTestUtils.d.ts +4 -0
- package/dist/test/PluginTestUtils.d.ts.map +1 -1
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/chunks/ColorNames-BdsHwA2f.mjs +0 -59
- package/dist/chunks/ColorNames-BdsHwA2f.mjs.map +0 -1
- package/dist/chunks/ColorPickerPopup-xL8ZUfpB.mjs +0 -125
- package/dist/chunks/ColorPickerPopup-xL8ZUfpB.mjs.map +0 -1
- package/dist/chunks/Commands-CicwYoTQ.mjs +0 -286
- package/dist/chunks/Commands-CicwYoTQ.mjs.map +0 -1
- package/dist/chunks/MarkCommands-CC37WA7Z.mjs +0 -94
- package/dist/chunks/MarkCommands-CC37WA7Z.mjs.map +0 -1
- package/dist/chunks/ToolbarPlugin-B6JETWaw.mjs.map +0 -1
- package/dist/chunks/index-B9GkDVsx.mjs +0 -187
- package/dist/chunks/index-B9GkDVsx.mjs.map +0 -1
- package/dist/chunks/index-CKPrAOr6.mjs +0 -209
- package/dist/chunks/index-CKPrAOr6.mjs.map +0 -1
- package/dist/chunks/index-CNs4QQ8l.mjs.map +0 -1
- package/dist/chunks/index-CflvcXSd.mjs.map +0 -1
- package/dist/chunks/index-CoeD4T9-.mjs.map +0 -1
- package/dist/chunks/index-D0s0Q8Wc.mjs.map +0 -1
- package/dist/chunks/index-DfzCof6H.mjs +0 -191
- package/dist/chunks/index-DfzCof6H.mjs.map +0 -1
- package/dist/chunks/index-DyIwN_67.mjs +0 -404
- package/dist/chunks/index-DyIwN_67.mjs.map +0 -1
- package/dist/chunks/index-FlTg80Pk.mjs.map +0 -1
- package/dist/chunks/index-pxbbDHVH.mjs.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { r as t } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
2
|
-
import { a as e } from "./AttrRegistry-
|
|
3
|
-
import {
|
|
2
|
+
import { a as e } from "./AttrRegistry-D9Jx_RVb.mjs";
|
|
3
|
+
import { m as n, u as i } from "./Document-Brtw2jL1.mjs";
|
|
4
4
|
import { c as s } from "./NodeSpec-NZVvcCuH.mjs";
|
|
5
|
-
import { i as
|
|
5
|
+
import { i as c, a as r, b as l, d as o } from "./Selection-BRTab5hO.mjs";
|
|
6
6
|
import { n as a, b as d } from "./TypeBrands-C09nE2qO.mjs";
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
import { a as h } from "./StyleRuntime-ChRjVQwL.mjs";
|
|
8
|
+
const u = { bulletList: "Bullet List", numberedList: "Numbered List", checklist: "Checklist" }, p = { en: u, de: { bulletList: "Aufzählung", numberedList: "Nummerierte Liste", checklist: "Checkliste" }, es: { bulletList: "Lista con viñetas", numberedList: "Lista numerada", checklist: "Lista de verificación" }, fr: { bulletList: "Liste à puces", numberedList: "Liste numérotée", checklist: "Liste de contrôle" }, zh: { bulletList: "无序列表", numberedList: "有序列表", checklist: "清单" }, ru: { bulletList: "Маркированный список", numberedList: "Нумерованный список", checklist: "Чек-лист" }, ar: { bulletList: "قائمة نقطية", numberedList: "قائمة مرقمة", checklist: "قائمة تحقق" }, hi: { bulletList: "बुलेट सूची", numberedList: "क्रमांकित सूची", checklist: "चेकलिस्ट" } }, m = { types: ["bullet", "ordered", "checklist"], maxIndent: 4 }, g = [{ type: "bullet", label: "Bullet List", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"/></svg>', inputPattern: /^[-*] $/, inputPrefix: "- " }, { type: "ordered", label: "Numbered List", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"/></svg>', inputPattern: /^\d+\. $/, inputPrefix: "1. " }, { type: "checklist", label: "Checklist", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z"/></svg>', inputPattern: /^\[[ x]] $/, inputPrefix: "[ ] " }];
|
|
9
|
+
class k {
|
|
9
10
|
id = "list";
|
|
10
11
|
name = "List";
|
|
11
12
|
priority = 35;
|
|
@@ -14,10 +15,10 @@ class g {
|
|
|
14
15
|
context = null;
|
|
15
16
|
checkboxClickHandler = null;
|
|
16
17
|
constructor(t2) {
|
|
17
|
-
this.config = { ...
|
|
18
|
+
this.config = { ...m, ...t2 };
|
|
18
19
|
}
|
|
19
20
|
init(e2) {
|
|
20
|
-
this.context = e2, this.locale = t(
|
|
21
|
+
this.context = e2, this.locale = t(p, e2, this.config.locale), e2.registerStyleSheet(`
|
|
21
22
|
/* List Wrappers — suppress native markers, we use ::before pseudo-elements */
|
|
22
23
|
.notectl-list {
|
|
23
24
|
list-style: none;
|
|
@@ -87,12 +88,19 @@ class g {
|
|
|
87
88
|
}
|
|
88
89
|
registerNodeSpec(t2) {
|
|
89
90
|
t2.registerNodeSpec({ type: "list_item", group: "block", content: { allow: ["text"] }, attrs: { listType: { default: "bullet" }, indent: { default: 0 }, checked: { default: false } }, toDOM(t3) {
|
|
90
|
-
const e2 = t3.attrs?.listType ?? "bullet", n2 = t3.attrs?.indent ?? 0, i2 = t3.attrs?.checked ?? false,
|
|
91
|
-
return
|
|
91
|
+
const e2 = t3.attrs?.listType ?? "bullet", n2 = t3.attrs?.indent ?? 0, i2 = t3.attrs?.checked ?? false, c2 = s("li", t3.id);
|
|
92
|
+
return c2.setAttribute("role", "listitem"), c2.setAttribute("data-list-type", e2), c2.setAttribute("data-indent", String(n2)), c2.className = `notectl-list-item notectl-list-item--${e2}`, n2 > 0 && h(c2, "marginLeft", 24 * n2 + "px"), "checklist" === e2 && (c2.setAttribute("data-checked", String(i2)), c2.setAttribute("aria-checked", String(i2))), c2.setAttribute("aria-level", String(n2 + 1)), c2;
|
|
92
93
|
}, wrapper(t3) {
|
|
93
94
|
const e2 = t3.attrs?.listType ?? "bullet";
|
|
94
95
|
return { tag: "ordered" === e2 ? "ol" : "ul", key: `list-${e2}`, className: `notectl-list notectl-list--${e2}`, attrs: { role: "list" } };
|
|
95
|
-
}, toHTML
|
|
96
|
+
}, toHTML(t3, e2) {
|
|
97
|
+
const n2 = t3.attrs?.listType ?? "bullet", i2 = t3.attrs?.checked ?? false;
|
|
98
|
+
if ("checklist" === n2) {
|
|
99
|
+
const t4 = i2 ? " checked" : "";
|
|
100
|
+
return `<li role="checkbox" aria-checked="${String(i2)}"><input type="checkbox" disabled${t4}>${e2 || "<br>"}</li>`;
|
|
101
|
+
}
|
|
102
|
+
return `<li>${e2 || "<br>"}</li>`;
|
|
103
|
+
}, parseHTML: [{ tag: "li" }], sanitize: { tags: ["ul", "ol", "li", "input"], attrs: ["type", "disabled", "checked", "role", "aria-checked"] } });
|
|
96
104
|
}
|
|
97
105
|
registerCommands(t2) {
|
|
98
106
|
const e2 = this.getEnabledTypes();
|
|
@@ -106,8 +114,8 @@ class g {
|
|
|
106
114
|
const e2 = this.getEnabledTypes();
|
|
107
115
|
for (const n2 of e2) t2.registerInputRule({ pattern: n2.inputPattern, handler: (t3, e3, i2, s2) => {
|
|
108
116
|
const d2 = t3.selection;
|
|
109
|
-
if (
|
|
110
|
-
if (!
|
|
117
|
+
if (c(d2) || r(d2)) return null;
|
|
118
|
+
if (!l(d2)) return null;
|
|
111
119
|
const h2 = t3.getBlock(d2.anchor.blockId);
|
|
112
120
|
if (!h2 || "paragraph" !== h2.type) return null;
|
|
113
121
|
const u2 = e3[0] ?? "", p2 = u2.length, m2 = { listType: n2.type, indent: 0 };
|
|
@@ -123,51 +131,51 @@ class g {
|
|
|
123
131
|
}
|
|
124
132
|
toggleList(t2, n2) {
|
|
125
133
|
const i2 = t2.getState(), s2 = i2.selection;
|
|
126
|
-
if (
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
129
|
-
if ("list_item" ===
|
|
134
|
+
if (c(s2) || r(s2)) return false;
|
|
135
|
+
const l2 = i2.getBlock(s2.anchor.blockId);
|
|
136
|
+
if (!l2) return false;
|
|
137
|
+
if ("list_item" === l2.type && l2.attrs?.listType === n2) {
|
|
130
138
|
const e2 = i2.transaction("command").setBlockType(s2.anchor.blockId, a("paragraph")).setSelection(s2).build();
|
|
131
139
|
return t2.dispatch(e2), true;
|
|
132
140
|
}
|
|
133
|
-
const o2 = { listType: n2, indent: e(
|
|
141
|
+
const o2 = { listType: n2, indent: e(l2, "list_item") ? l2.attrs.indent : 0 };
|
|
134
142
|
"checklist" === n2 && (o2.checked = false);
|
|
135
143
|
const d2 = i2.transaction("command").setBlockType(s2.anchor.blockId, a("list_item"), o2).setSelection(s2).build();
|
|
136
144
|
return t2.dispatch(d2), true;
|
|
137
145
|
}
|
|
138
146
|
indent(t2) {
|
|
139
147
|
const n2 = t2.getState();
|
|
140
|
-
if (
|
|
148
|
+
if (c(n2.selection) || r(n2.selection)) return false;
|
|
141
149
|
const i2 = n2.getBlock(n2.selection.anchor.blockId);
|
|
142
150
|
return !(!i2 || !e(i2, "list_item")) && !(i2.attrs.indent >= this.config.maxIndent) && this.setIndent(t2, n2, i2.attrs.indent + 1);
|
|
143
151
|
}
|
|
144
152
|
outdent(t2) {
|
|
145
153
|
const n2 = t2.getState();
|
|
146
|
-
if (
|
|
154
|
+
if (c(n2.selection) || r(n2.selection)) return false;
|
|
147
155
|
const i2 = n2.getBlock(n2.selection.anchor.blockId);
|
|
148
156
|
return !(!i2 || !e(i2, "list_item")) && !(i2.attrs.indent <= 0) && this.setIndent(t2, n2, i2.attrs.indent - 1);
|
|
149
157
|
}
|
|
150
158
|
setIndent(t2, e2, n2) {
|
|
151
159
|
const i2 = e2.selection;
|
|
152
|
-
if (
|
|
160
|
+
if (c(i2) || r(i2)) return false;
|
|
153
161
|
const s2 = e2.getBlock(i2.anchor.blockId);
|
|
154
162
|
if (!s2) return false;
|
|
155
|
-
const
|
|
163
|
+
const l2 = { ...s2.attrs, indent: n2 }, o2 = e2.transaction("command").setBlockType(i2.anchor.blockId, a("list_item"), l2).setSelection(i2).build();
|
|
156
164
|
return t2.dispatch(o2), true;
|
|
157
165
|
}
|
|
158
166
|
toggleChecked(t2, e2) {
|
|
159
167
|
if (t2.isReadOnly() && !this.config.interactiveCheckboxes) return false;
|
|
160
|
-
const n2 = t2.getState(), i2 = e2 ?? (
|
|
168
|
+
const n2 = t2.getState(), i2 = e2 ?? (c(n2.selection) || r(n2.selection) ? null : n2.selection.anchor.blockId);
|
|
161
169
|
if (!i2) return false;
|
|
162
170
|
const s2 = n2.getBlock(i2);
|
|
163
171
|
if (!s2 || "list_item" !== s2.type || "checklist" !== s2.attrs?.listType) return false;
|
|
164
|
-
const
|
|
172
|
+
const l2 = !s2.attrs?.checked, o2 = { ...s2.attrs, checked: l2 }, d2 = n2.transaction("command").setBlockType(i2, a("list_item"), o2).setSelection(n2.selection).build();
|
|
165
173
|
return t2.dispatch(d2), true;
|
|
166
174
|
}
|
|
167
175
|
handleBackspace(t2) {
|
|
168
176
|
const e2 = t2.getState(), n2 = e2.selection;
|
|
169
|
-
if (
|
|
170
|
-
if (!
|
|
177
|
+
if (c(n2) || r(n2)) return false;
|
|
178
|
+
if (!l(n2)) return false;
|
|
171
179
|
const i2 = e2.getBlock(n2.anchor.blockId);
|
|
172
180
|
if (!i2 || "list_item" !== i2.type) return false;
|
|
173
181
|
if (0 !== n2.anchor.offset) return false;
|
|
@@ -176,8 +184,8 @@ class g {
|
|
|
176
184
|
}
|
|
177
185
|
handleEnter(t2) {
|
|
178
186
|
const s2 = t2.getState(), d2 = s2.selection;
|
|
179
|
-
if (
|
|
180
|
-
if (!
|
|
187
|
+
if (c(d2) || r(d2)) return false;
|
|
188
|
+
if (!l(d2)) return false;
|
|
181
189
|
const h2 = s2.getBlock(d2.anchor.blockId);
|
|
182
190
|
if (!h2 || "list_item" !== h2.type) return false;
|
|
183
191
|
if ("" === n(h2)) {
|
|
@@ -199,22 +207,22 @@ class g {
|
|
|
199
207
|
const s2 = i2.getBoundingClientRect();
|
|
200
208
|
if (e2.clientX - s2.left >= 24) return;
|
|
201
209
|
e2.preventDefault();
|
|
202
|
-
const
|
|
203
|
-
|
|
210
|
+
const c2 = i2.getAttribute("data-block-id");
|
|
211
|
+
c2 && this.toggleChecked(t2, d(c2));
|
|
204
212
|
}, t2.getContainer().addEventListener("mousedown", this.checkboxClickHandler));
|
|
205
213
|
}
|
|
206
214
|
isListActive(t2, e2) {
|
|
207
|
-
if (
|
|
215
|
+
if (c(t2.selection) || r(t2.selection)) return false;
|
|
208
216
|
const n2 = t2.getBlock(t2.selection.anchor.blockId);
|
|
209
217
|
return "list_item" === n2?.type && n2.attrs?.listType === e2;
|
|
210
218
|
}
|
|
211
219
|
getEnabledTypes() {
|
|
212
|
-
return
|
|
220
|
+
return g.filter((t2) => this.config.types.includes(t2.type));
|
|
213
221
|
}
|
|
214
222
|
}
|
|
215
223
|
export {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
224
|
+
k as L,
|
|
225
|
+
p as a,
|
|
226
|
+
u as b
|
|
219
227
|
};
|
|
220
|
-
//# sourceMappingURL=index-
|
|
228
|
+
//# sourceMappingURL=index-BqNUfq-y.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BqNUfq-y.mjs","sources":["../../src/editor/styles/list.ts","../../src/plugins/list/ListLocale.ts","../../src/plugins/list/ListPlugin.ts"],"sourcesContent":["/** Width of the list marker / checkbox area in pixels. */\nexport const LIST_MARKER_WIDTH = 24;\n\n/** List styles — bullet, ordered, checklist items. */\nexport const LIST_CSS = `\n/* List Wrappers — suppress native markers, we use ::before pseudo-elements */\n.notectl-list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n/* Ordered List — each <ol> wrapper resets the counter */\n.notectl-list--ordered {\n\tcounter-reset: notectl-ordered;\n}\n\n/* List Items */\n.notectl-list-item {\n\tmargin: 0;\n\tpadding: 2px 0 2px ${LIST_MARKER_WIDTH}px;\n\tmin-height: 1.6em;\n\tposition: relative;\n}\n\n.notectl-list-item::before {\n\tposition: absolute;\n\tleft: 0;\n\tdisplay: inline-block;\n\twidth: ${LIST_MARKER_WIDTH}px;\n\ttext-align: center;\n}\n\n/* Bullet List */\n.notectl-list-item--bullet::before {\n\tcontent: '\\\\2022';\n\tcolor: var(--notectl-fg);\n}\n\n/* Ordered List — counter increment per item */\n.notectl-list-item--ordered {\n\tcounter-increment: notectl-ordered;\n}\n\n.notectl-list-item--ordered::before {\n\tcontent: counter(notectl-ordered) '.';\n\tcolor: var(--notectl-fg);\n\tfont-size: 14px;\n}\n\n/* Checklist */\n.notectl-list-item--checklist::before {\n\tcontent: '\\\\2610';\n\tfont-size: 16px;\n\tcolor: var(--notectl-fg-muted);\n\tcursor: pointer;\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"]::before {\n\tcontent: '\\\\2611';\n\tcolor: var(--notectl-success);\n}\n\n.notectl-list-item--checklist[data-checked=\"true\"] {\n\tcolor: var(--notectl-fg-muted);\n\ttext-decoration: line-through;\n}\n`;\n","/**\n * Locale interface and default English locale for the ListPlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface ListLocale {\n\treadonly bulletList: string;\n\treadonly numberedList: string;\n\treadonly checklist: string;\n}\n\n// --- Default English Locale ---\n\nexport const LIST_LOCALE_EN: ListLocale = {\n\tbulletList: 'Bullet List',\n\tnumberedList: 'Numbered List',\n\tchecklist: 'Checklist',\n};\n\n// --- German Locale ---\n\nexport const LIST_LOCALE_DE: ListLocale = {\n\tbulletList: 'Aufzählung',\n\tnumberedList: 'Nummerierte Liste',\n\tchecklist: 'Checkliste',\n};\n\n// --- Spanish Locale ---\n\nexport const LIST_LOCALE_ES: ListLocale = {\n\tbulletList: 'Lista con viñetas',\n\tnumberedList: 'Lista numerada',\n\tchecklist: 'Lista de verificación',\n};\n\n// --- French Locale ---\n\nexport const LIST_LOCALE_FR: ListLocale = {\n\tbulletList: 'Liste à puces',\n\tnumberedList: 'Liste numérotée',\n\tchecklist: 'Liste de contrôle',\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const LIST_LOCALE_ZH: ListLocale = {\n\tbulletList: '无序列表',\n\tnumberedList: '有序列表',\n\tchecklist: '清单',\n};\n\n// --- Russian Locale ---\n\nexport const LIST_LOCALE_RU: ListLocale = {\n\tbulletList: 'Маркированный список',\n\tnumberedList: 'Нумерованный список',\n\tchecklist: 'Чек-лист',\n};\n\n// --- Arabic Locale ---\n\nexport const LIST_LOCALE_AR: ListLocale = {\n\tbulletList: 'قائمة نقطية',\n\tnumberedList: 'قائمة مرقمة',\n\tchecklist: 'قائمة تحقق',\n};\n\n// --- Hindi Locale ---\n\nexport const LIST_LOCALE_HI: ListLocale = {\n\tbulletList: 'बुलेट सूची',\n\tnumberedList: 'क्रमांकित सूची',\n\tchecklist: 'चेकलिस्ट',\n};\n\n// --- Locale Map ---\n\nexport const LIST_LOCALES: Record<string, ListLocale> = {\n\ten: LIST_LOCALE_EN,\n\tde: LIST_LOCALE_DE,\n\tes: LIST_LOCALE_ES,\n\tfr: LIST_LOCALE_FR,\n\tzh: LIST_LOCALE_ZH,\n\tru: LIST_LOCALE_RU,\n\tar: LIST_LOCALE_AR,\n\thi: LIST_LOCALE_HI,\n};\n","/**\n * ListPlugin: registers ordered, unordered, and checklist block types\n * with NodeSpecs, toggle commands, indent/outdent (Tab/Shift-Tab),\n * input rules, and toolbar buttons.\n *\n * List items are modeled as flat blocks with a `listType` and `indent` attribute,\n * allowing simple nesting representation without deep tree structures.\n */\n\nimport { LIST_CSS, LIST_MARKER_WIDTH } from '../../editor/styles/list.js';\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport { isNodeOfType } from '../../model/AttrRegistry.js';\nimport { generateBlockId, getBlockText } 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 { type BlockId, blockId, nodeType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { LIST_LOCALES, type ListLocale } from './ListLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\nexport type ListType = 'bullet' | 'ordered' | 'checklist';\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface NodeAttrRegistry {\n\t\tlist_item: { listType: ListType; indent: number; checked: boolean };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface ListConfig {\n\t/** Which list types to enable. Defaults to all. */\n\treadonly types: readonly ListType[];\n\t/** Maximum indent depth. Defaults to 4. */\n\treadonly maxIndent: number;\n\t/** When true, a separator is rendered after the last list toolbar item. */\n\treadonly separatorAfter?: boolean;\n\t/**\n\t * When true, checklist checkboxes remain interactive even in read-only mode.\n\t * Defaults to false (checkboxes are fully read-only).\n\t */\n\treadonly interactiveCheckboxes?: boolean;\n\treadonly locale?: ListLocale;\n}\n\nconst DEFAULT_CONFIG: ListConfig = {\n\ttypes: ['bullet', 'ordered', 'checklist'],\n\tmaxIndent: 4,\n};\n\n// --- List Type Metadata ---\n\ninterface ListTypeDefinition {\n\treadonly type: ListType;\n\treadonly label: string;\n\treadonly icon: string;\n\treadonly inputPattern: RegExp;\n\treadonly inputPrefix: string;\n}\n\nconst BULLET_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z\"/></svg>';\nconst NUMBERED_LIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z\"/></svg>';\nconst CHECKLIST_ICON =\n\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M22 7h-9v2h9V7zm0 8h-9v2h9v-2zM5.54 11L2 7.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 11zm0 8L2 15.46l1.41-1.41 2.12 2.12 4.24-4.24 1.41 1.41L5.54 19z\"/></svg>';\n\nconst LIST_TYPE_DEFINITIONS: readonly ListTypeDefinition[] = [\n\t{\n\t\ttype: 'bullet',\n\t\tlabel: 'Bullet List',\n\t\ticon: BULLET_LIST_ICON,\n\t\tinputPattern: /^[-*] $/,\n\t\tinputPrefix: '- ',\n\t},\n\t{\n\t\ttype: 'ordered',\n\t\tlabel: 'Numbered List',\n\t\ticon: NUMBERED_LIST_ICON,\n\t\tinputPattern: /^\\d+\\. $/,\n\t\tinputPrefix: '1. ',\n\t},\n\t{\n\t\ttype: 'checklist',\n\t\tlabel: 'Checklist',\n\t\ticon: CHECKLIST_ICON,\n\t\tinputPattern: /^\\[[ x]] $/,\n\t\tinputPrefix: '[ ] ',\n\t},\n];\n\n// --- Plugin ---\n\nexport class ListPlugin implements Plugin {\n\treadonly id = 'list';\n\treadonly name = 'List';\n\treadonly priority = 35;\n\n\tprivate readonly config: ListConfig;\n\tprivate locale!: ListLocale;\n\tprivate context: PluginContext | null = null;\n\tprivate checkboxClickHandler: ((e: MouseEvent) => void) | null = null;\n\n\tconstructor(config?: Partial<ListConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.context = context;\n\t\tthis.locale = resolvePluginLocale(LIST_LOCALES, context, this.config.locale);\n\t\tcontext.registerStyleSheet(LIST_CSS);\n\t\tthis.registerNodeSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerInputRules(context);\n\t\tthis.registerToolbarItems(context);\n\t\tthis.registerCheckboxClickHandler(context);\n\t}\n\n\tdestroy(): void {\n\t\tif (this.checkboxClickHandler && this.context) {\n\t\t\tconst container: HTMLElement = this.context.getContainer();\n\t\t\tcontainer.removeEventListener('mousedown', this.checkboxClickHandler);\n\t\t}\n\t\tthis.checkboxClickHandler = null;\n\t\tthis.context = null;\n\t}\n\n\tprivate registerNodeSpec(context: PluginContext): void {\n\t\tcontext.registerNodeSpec({\n\t\t\ttype: 'list_item',\n\t\t\tgroup: 'block',\n\t\t\tcontent: { allow: ['text'] },\n\t\t\tattrs: {\n\t\t\t\tlistType: { default: 'bullet' },\n\t\t\t\tindent: { default: 0 },\n\t\t\t\tchecked: { default: false },\n\t\t\t},\n\t\t\ttoDOM(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst indent = node.attrs?.indent ?? 0;\n\t\t\t\tconst checked = node.attrs?.checked ?? false;\n\n\t\t\t\tconst li = createBlockElement('li', node.id);\n\t\t\t\tli.setAttribute('role', 'listitem');\n\t\t\t\tli.setAttribute('data-list-type', listType);\n\t\t\t\tli.setAttribute('data-indent', String(indent));\n\t\t\t\tli.className = `notectl-list-item notectl-list-item--${listType}`;\n\n\t\t\t\tif (indent > 0) {\n\t\t\t\t\tsetStyleProperty(li, 'marginLeft', `${indent * LIST_MARKER_WIDTH}px`);\n\t\t\t\t}\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\tli.setAttribute('data-checked', String(checked));\n\t\t\t\t\tli.setAttribute('aria-checked', String(checked));\n\t\t\t\t}\n\t\t\t\tli.setAttribute('aria-level', String(indent + 1));\n\n\t\t\t\treturn li;\n\t\t\t},\n\t\t\twrapper(node) {\n\t\t\t\tconst listType = node.attrs?.listType ?? 'bullet';\n\t\t\t\tconst tag = listType === 'ordered' ? 'ol' : 'ul';\n\t\t\t\treturn {\n\t\t\t\t\ttag,\n\t\t\t\t\tkey: `list-${listType}`,\n\t\t\t\t\tclassName: `notectl-list notectl-list--${listType}`,\n\t\t\t\t\tattrs: { role: 'list' },\n\t\t\t\t};\n\t\t\t},\n\t\t\ttoHTML(node, content) {\n\t\t\t\tconst listType: string = (node.attrs?.listType as string) ?? 'bullet';\n\t\t\t\tconst checked: boolean = (node.attrs?.checked as boolean) ?? false;\n\n\t\t\t\tif (listType === 'checklist') {\n\t\t\t\t\tconst checkedAttr: string = checked ? ' checked' : '';\n\t\t\t\t\tconst ariaChecked: string = String(checked);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t`<li role=\"checkbox\" aria-checked=\"${ariaChecked}\">` +\n\t\t\t\t\t\t`<input type=\"checkbox\" disabled${checkedAttr}>` +\n\t\t\t\t\t\t`${content || '<br>'}</li>`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn `<li>${content || '<br>'}</li>`;\n\t\t\t},\n\t\t\tparseHTML: [{ tag: 'li' }],\n\t\t\tsanitize: {\n\t\t\t\ttags: ['ul', 'ol', 'li', 'input'],\n\t\t\t\tattrs: ['type', 'disabled', 'checked', 'role', 'aria-checked'],\n\t\t\t},\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tconst enabledTypes = this.getEnabledTypes();\n\n\t\tfor (const def of enabledTypes) {\n\t\t\tcontext.registerCommand(`toggleList:${def.type}`, () => {\n\t\t\t\treturn this.toggleList(context, def.type);\n\t\t\t});\n\t\t}\n\n\t\tcontext.registerCommand('indentListItem', () => {\n\t\t\treturn this.indent(context);\n\t\t});\n\n\t\tcontext.registerCommand('outdentListItem', () => {\n\t\t\treturn this.outdent(context);\n\t\t});\n\n\t\tif (this.config.types.includes('checklist')) {\n\t\t\tcontext.registerCommand('toggleChecklistItem', () => this.toggleChecked(context), {\n\t\t\t\treadonlyAllowed: true,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\tEnter: () => this.handleEnter(context),\n\t\t\tBackspace: () => this.handleBackspace(context),\n\t\t\tTab: () => this.indent(context),\n\t\t\t'Shift-Tab': () => this.outdent(context),\n\t\t});\n\t}\n\n\tprivate registerInputRules(context: PluginContext): void {\n\t\tconst enabledTypes = this.getEnabledTypes();\n\n\t\tfor (const def of enabledTypes) {\n\t\t\tcontext.registerInputRule({\n\t\t\t\tpattern: def.inputPattern,\n\t\t\t\thandler: (state, match, start, _end) => {\n\t\t\t\t\tconst sel = state.selection;\n\t\t\t\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return null;\n\t\t\t\t\tif (!isCollapsed(sel)) return null;\n\n\t\t\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\t\t\tif (!block || block.type !== 'paragraph') return null;\n\n\t\t\t\t\tconst matchStr = match[0] ?? '';\n\t\t\t\t\tconst matchLen = matchStr.length;\n\t\t\t\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\t\t\t\tlistType: def.type,\n\t\t\t\t\t\tindent: 0,\n\t\t\t\t\t};\n\t\t\t\t\tif (def.type === 'checklist') {\n\t\t\t\t\t\tattrs.checked = matchStr.includes('[x]');\n\t\t\t\t\t}\n\n\t\t\t\t\treturn state\n\t\t\t\t\t\t.transaction('input')\n\t\t\t\t\t\t.deleteTextAt(sel.anchor.blockId, start, start + matchLen)\n\t\t\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t\t\t\t.setSelection(createCollapsedSelection(sel.anchor.blockId, 0))\n\t\t\t\t\t\t.build();\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate getListLabel(type: ListType): string {\n\t\tconst labels: Record<ListType, string> = {\n\t\t\tbullet: this.locale.bulletList,\n\t\t\tordered: this.locale.numberedList,\n\t\t\tchecklist: this.locale.checklist,\n\t\t};\n\t\treturn labels[type];\n\t}\n\n\tprivate registerToolbarItems(context: PluginContext): void {\n\t\tconst enabledTypes = this.getEnabledTypes();\n\t\tconst lastType = enabledTypes.at(-1);\n\n\t\tfor (const def of enabledTypes) {\n\t\t\tcontext.registerToolbarItem({\n\t\t\t\tid: `list-${def.type}`,\n\t\t\t\tgroup: 'block',\n\t\t\t\ticon: def.icon,\n\t\t\t\tlabel: this.getListLabel(def.type),\n\t\t\t\tcommand: `toggleList:${def.type}`,\n\t\t\t\tpriority: def.type === 'bullet' ? 70 : def.type === 'ordered' ? 71 : 72,\n\t\t\t\tseparatorAfter: this.config.separatorAfter && def === lastType,\n\t\t\t\tisActive: (state) => this.isListActive(state, def.type),\n\t\t\t});\n\t\t}\n\t}\n\n\t// --- Command Implementations ---\n\n\tprivate toggleList(context: PluginContext, listType: ListType): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block) return false;\n\n\t\t// If already this list type, convert back to paragraph\n\t\tif (block.type === 'list_item' && block.attrs?.listType === listType) {\n\t\t\tconst tr = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(sel)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\t// Convert to list item\n\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\tlistType,\n\t\t\tindent: isNodeOfType(block, 'list_item') ? block.attrs.indent : 0,\n\t\t};\n\t\tif (listType === 'checklist') {\n\t\t\tattrs.checked = false;\n\t\t}\n\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tprivate indent(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\tif (!block || !isNodeOfType(block, 'list_item')) return false;\n\n\t\tif (block.attrs.indent >= this.config.maxIndent) return false;\n\n\t\treturn this.setIndent(context, state, block.attrs.indent + 1);\n\t}\n\n\tprivate outdent(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\tif (!block || !isNodeOfType(block, 'list_item')) return false;\n\n\t\tif (block.attrs.indent <= 0) return false;\n\n\t\treturn this.setIndent(context, state, block.attrs.indent - 1);\n\t}\n\n\tprivate setIndent(context: PluginContext, state: EditorState, indent: number): boolean {\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block) return false;\n\n\t\tconst attrs = { ...block.attrs, indent } as Record<string, string | number | boolean>;\n\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setBlockType(sel.anchor.blockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tprivate toggleChecked(context: PluginContext, targetId?: BlockId): boolean {\n\t\tif (context.isReadOnly() && !this.config.interactiveCheckboxes) return false;\n\n\t\tconst state = context.getState();\n\t\tconst bid: BlockId | null =\n\t\t\ttargetId ??\n\t\t\t(isNodeSelection(state.selection) || isGapCursor(state.selection)\n\t\t\t\t? null\n\t\t\t\t: state.selection.anchor.blockId);\n\t\tif (!bid) return false;\n\n\t\tconst block = state.getBlock(bid);\n\t\tif (!block || block.type !== 'list_item' || block.attrs?.listType !== 'checklist') {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst checked: boolean = !block.attrs?.checked;\n\t\tconst attrs = { ...block.attrs, checked } as Record<string, string | number | boolean>;\n\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setBlockType(bid, nodeType('list_item'), attrs)\n\t\t\t.setSelection(state.selection)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Handles Backspace at the start of a list item.\n\t * Converts the list item back to a paragraph, preserving text.\n\t */\n\tprivate handleBackspace(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\t\tif (!isCollapsed(sel)) return false;\n\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block || block.type !== 'list_item') return false;\n\t\tif (sel.anchor.offset !== 0) return false;\n\n\t\tconst tr = state\n\t\t\t.transaction('input')\n\t\t\t.setBlockType(sel.anchor.blockId, nodeType('paragraph'))\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Handles Enter inside a list item.\n\t * Empty item → exit list (convert to paragraph).\n\t * Non-empty item → split and create a new list item with the same type.\n\t */\n\tprivate handleEnter(context: PluginContext): boolean {\n\t\tconst state = context.getState();\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\t\tif (!isCollapsed(sel)) return false;\n\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block || block.type !== 'list_item') return false;\n\n\t\tconst text = getBlockText(block);\n\n\t\tif (text === '') {\n\t\t\t// Empty list item → convert to paragraph (exit list)\n\t\t\tconst tr = state\n\t\t\t\t.transaction('input')\n\t\t\t\t.setBlockType(sel.anchor.blockId, nodeType('paragraph'))\n\t\t\t\t.setSelection(sel)\n\t\t\t\t.build();\n\t\t\tcontext.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\n\t\t// Non-empty → split block and set new block to same list type\n\t\tconst newBlockId = generateBlockId();\n\t\tconst attrs: Record<string, string | number | boolean> = {\n\t\t\tlistType: isNodeOfType(block, 'list_item') ? block.attrs.listType : 'bullet',\n\t\t\tindent: isNodeOfType(block, 'list_item') ? block.attrs.indent : 0,\n\t\t};\n\t\tif (attrs.listType === 'checklist') {\n\t\t\tattrs.checked = false;\n\t\t}\n\n\t\tconst tr = state\n\t\t\t.transaction('input')\n\t\t\t.splitBlock(sel.anchor.blockId, sel.anchor.offset, newBlockId)\n\t\t\t.setBlockType(newBlockId, nodeType('list_item'), attrs)\n\t\t\t.setSelection(createCollapsedSelection(newBlockId, 0))\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\t// --- Checkbox Click Handling ---\n\n\tprivate registerCheckboxClickHandler(context: PluginContext): void {\n\t\tif (!this.config.types.includes('checklist')) return;\n\n\t\tthis.checkboxClickHandler = (e: MouseEvent) => {\n\t\t\tif (context.isReadOnly() && !this.config.interactiveCheckboxes) return;\n\n\t\t\tconst target: EventTarget | null = e.target;\n\t\t\tif (!(target instanceof HTMLElement)) return;\n\n\t\t\tconst li: HTMLElement | null = target.closest('.notectl-list-item--checklist');\n\t\t\tif (!li) return;\n\n\t\t\tconst rect: DOMRect = li.getBoundingClientRect();\n\t\t\tif (e.clientX - rect.left >= LIST_MARKER_WIDTH) return;\n\n\t\t\te.preventDefault();\n\n\t\t\tconst bid: string | null = li.getAttribute('data-block-id');\n\t\t\tif (!bid) return;\n\n\t\t\tthis.toggleChecked(context, blockId(bid));\n\t\t};\n\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tcontainer.addEventListener('mousedown', this.checkboxClickHandler);\n\t}\n\n\t// --- Helpers ---\n\n\tprivate isListActive(state: EditorState, listType: ListType): boolean {\n\t\tif (isNodeSelection(state.selection) || isGapCursor(state.selection)) return false;\n\t\tconst block = state.getBlock(state.selection.anchor.blockId);\n\t\treturn block?.type === 'list_item' && block.attrs?.listType === listType;\n\t}\n\n\tprivate getEnabledTypes(): readonly ListTypeDefinition[] {\n\t\treturn LIST_TYPE_DEFINITIONS.filter((def) => this.config.types.includes(def.type));\n\t}\n}\n"],"names":["LIST_LOCALE_EN","bulletList","numberedList","checklist","LIST_LOCALES","en","de","es","fr","zh","ru","ar","hi","DEFAULT_CONFIG","types","maxIndent","LIST_TYPE_DEFINITIONS","type","label","icon","inputPattern","inputPrefix","ListPlugin","id","name","priority","config","locale","context","checkboxClickHandler","this","resolvePluginLocale","registerStyleSheet","registerNodeSpec","registerCommands","registerKeymaps","registerInputRules","registerToolbarItems","registerCheckboxClickHandler","getContainer","removeEventListener","group","content","allow","attrs","listType","default","indent","checked","node","li","createBlockElement","setAttribute","String","className","setStyleProperty","tag","key","role","checkedAttr","parseHTML","sanitize","tags","enabledTypes","getEnabledTypes","def","registerCommand","toggleList","outdent","includes","toggleChecked","readonlyAllowed","registerKeymap","Enter","handleEnter","Backspace","handleBackspace","Tab","registerInputRule","pattern","handler","state","match","start","_end","sel","selection","isNodeSelection","isGapCursor","isCollapsed","block","getBlock","anchor","blockId","matchStr","matchLen","length","transaction","deleteTextAt","setBlockType","nodeType","setSelection","createCollapsedSelection","build","bullet","ordered","lastType","at","registerToolbarItem","getListLabel","command","separatorAfter","isActive","isListActive","getState","tr","dispatch","isNodeOfType","setIndent","targetId","isReadOnly","interactiveCheckboxes","bid","offset","getBlockText","newBlockId","generateBlockId","splitBlock","e","target","HTMLElement","closest","rect","getBoundingClientRect","clientX","left","preventDefault","getAttribute","addEventListener","filter"],"mappings":";;;;;;;AACO,MCaMA,IAA6B,EACzCC,YAAY,eACZC,cAAc,iBACdC,WAAW,YAAA,GA6DCC,IAA2C,EACvDC,IAAIL,GACJM,IA1DyC,EACzCL,YAAY,cACZC,cAAc,qBACdC,WAAW,aAAA,GAwDXI,IAnDyC,EACzCN,YAAY,qBACZC,cAAc,kBACdC,WAAW,wBAAA,GAiDXK,IA5CyC,EACzCP,YAAY,iBACZC,cAAc,mBACdC,WAAW,oBAAA,GA0CXM,IArCyC,EACzCR,YAAY,QACZC,cAAc,QACdC,WAAW,KAAA,GAmCXO,IA9ByC,EACzCT,YAAY,wBACZC,cAAc,uBACdC,WAAW,WAAA,GA4BXQ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AAMQ,KAA6BD,GAAEC;AACrC,UAAA,EAAMA,cAAkBC,aAAc;AAEtC,YAAMhF,KAAyB+E,GAAOE,QAAQ,+BAAA;AAC9C,UAAA,CAAKjF,GAAI;AAET,YAAMkF,KAAgBlF,GAAGmF,sBAAAA;AACzB,UAAIL,GAAEM,UAAUF,GAAKG,QFveS,GEuekB;AAEhDP,MAAAA,GAAEQ,eAAAA;AAEF,YAAMd,KAAqBxE,GAAGuF,aAAa,eAAA;AACtCf,MAAAA,MAEL5F,KAAKwC,cAAc1C,IAASiE,EAAQ6B,EAAAA,CAAAA;AAAAA,IAAAA,GAGN9F,GAAQW,aAAAA,EAC7BmG,iBAAiB,aAAa5G,KAAKD;EAC9C;AAAA,EAIQ,aAAaoD,IAAoBpC;AACxC,QAAI0C,EAAgBN,GAAMK,SAAAA,KAAcE,EAAYP,GAAMK,SAAAA,EAAY,QAAA;AACtE,UAAMI,KAAQT,GAAMU,SAASV,GAAMK,UAAUM,OAAOC,OAAAA;AACpD,WAAuB,gBAAhBH,IAAOzE,QAAwByE,GAAM9C,OAAOC,aAAaA;AAAAA,EACjE;AAAA,EAEQ,kBAAAmB;AACP,WAAOhD,EAAsB2H,OAAQ1E,CAAAA,OAAQnC,KAAKJ,OAAOZ,MAAMuD,SAASJ,GAAIhD,IAAAA,CAAAA;AAAAA,EAC7E;AAAA;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { C as e, r as t, i as
|
|
1
|
+
import { C as e, r as t, i as o, a as r } from "./ColorPickerPopup-CiCLBbe9.mjs";
|
|
2
2
|
import { r as a } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
3
3
|
import { e as l } from "./HTMLUtils-DTqQzcKR.mjs";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { a as s } from "./StyleRuntime-ChRjVQwL.mjs";
|
|
5
|
+
import { r as i, i as c } from "./ColorValidation-CV4f1wu6.mjs";
|
|
6
|
+
const f = { label: "Text Color", tooltip: "Text Color", resetLabel: "Default", ariaLabelPrefix: "Text color" }, b = { en: f, de: { label: "Textfarbe", tooltip: "Textfarbe", resetLabel: "Standard", ariaLabelPrefix: "Textfarbe" }, es: { label: "Color de texto", tooltip: "Color de texto", resetLabel: "Predeterminado", ariaLabelPrefix: "Color de texto" }, fr: { label: "Couleur du texte", tooltip: "Couleur du texte", resetLabel: "Par défaut", ariaLabelPrefix: "Couleur du texte" }, zh: { label: "文字颜色", tooltip: "文字颜色", resetLabel: "默认", ariaLabelPrefix: "文字颜色" }, ru: { label: "Цвет текста", tooltip: "Цвет текста", resetLabel: "По умолчанию", ariaLabelPrefix: "Цвет текста" }, ar: { label: "لون النص", tooltip: "لون النص", resetLabel: "افتراضي", ariaLabelPrefix: "لون النص" }, hi: { label: "टेक्स्ट रंग", tooltip: "टेक्स्ट रंग", resetLabel: "डिफ़ॉल्ट", ariaLabelPrefix: "टेक्स्ट रंग" } }, d = ["#000000", "#434343", "#666666", "#999999", "#b7b7b7", "#cccccc", "#d9d9d9", "#efefef", "#f3f3f3", "#ffffff", "#980000", "#ff0000", "#ff9900", "#ffff00", "#00ff00", "#00ffff", "#4a86e8", "#0000ff", "#9900ff", "#ff00ff", "#e6b8af", "#f4cccc", "#fce5cd", "#fff2cc", "#d9ead3", "#d0e0e3", "#c9daf8", "#cfe2f3", "#d9d2e9", "#ead1dc", "#dd7e6b", "#ea9999", "#f9cb9c", "#ffe599", "#b6d7a8", "#a2c4c9", "#a4c2f4", "#9fc5e8", "#b4a7d6", "#d5a6bd", "#cc4125", "#e06666", "#f6b26b", "#ffd966", "#93c47d", "#76a5af", "#6d9eeb", "#6fa8dc", "#8e7cc3", "#c27ba0", "#a61c00", "#cc0000", "#e69138", "#f1c232", "#6aa84f", "#45818e", "#3c78d8", "#3d85c6", "#674ea7", "#a64d79", "#85200c", "#990000", "#b45f06", "#bf9000", "#38761d", "#134f5c", "#1155cc", "#0b5394", "#351c75", "#741b47"];
|
|
7
|
+
class n {
|
|
7
8
|
id = "textColor";
|
|
8
9
|
name = "Text Color";
|
|
9
10
|
priority = 23;
|
|
@@ -11,21 +12,24 @@ class d {
|
|
|
11
12
|
colors;
|
|
12
13
|
locale;
|
|
13
14
|
constructor(e2) {
|
|
14
|
-
this.config = { ...e2 }, this.colors =
|
|
15
|
+
this.config = { ...e2 }, this.colors = i(e2?.colors, d, "TextColorPlugin");
|
|
15
16
|
}
|
|
16
17
|
init(t2) {
|
|
17
|
-
this.locale = a(
|
|
18
|
+
this.locale = a(b, t2, this.config.locale), t2.registerStyleSheet(e), this.registerMarkSpec(t2), this.registerCommands(t2), this.registerToolbarItem(t2);
|
|
18
19
|
}
|
|
19
20
|
registerMarkSpec(e2) {
|
|
20
21
|
e2.registerMarkSpec({ type: "textColor", rank: 5, attrs: { color: { default: "" } }, toDOM(e3) {
|
|
21
|
-
const t2 = document.createElement("span"),
|
|
22
|
-
return t2
|
|
22
|
+
const t2 = document.createElement("span"), o2 = e3.attrs?.color ?? "";
|
|
23
|
+
return s(t2, "color", o2), t2;
|
|
23
24
|
}, toHTMLString: (e3, t2) => {
|
|
24
|
-
const
|
|
25
|
-
return
|
|
25
|
+
const o2 = String(e3.attrs?.color ?? "");
|
|
26
|
+
return o2 && c(o2) ? `<span style="color: ${l(o2)}">${t2}</span>` : t2;
|
|
27
|
+
}, toHTMLStyle: (e3) => {
|
|
28
|
+
const t2 = String(e3.attrs?.color ?? "");
|
|
29
|
+
return t2 && c(t2) ? `color: ${l(t2)}` : null;
|
|
26
30
|
}, parseHTML: [{ tag: "span", getAttrs: (e3) => {
|
|
27
31
|
const t2 = e3.style.color;
|
|
28
|
-
return !(!t2 || !
|
|
32
|
+
return !(!t2 || !c(t2)) && { color: t2 };
|
|
29
33
|
} }], sanitize: { tags: ["span"] } });
|
|
30
34
|
}
|
|
31
35
|
registerCommands(e2) {
|
|
@@ -33,14 +37,14 @@ class d {
|
|
|
33
37
|
}
|
|
34
38
|
registerToolbarItem(e2) {
|
|
35
39
|
const t2 = ['<svg xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 24 24">', '<path d="M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2zm-1.38 9L12 5.67 14.38 12H9.62z"/>', '<rect x="3" y="19.5" width="18" height="3"', ' rx="0.5" fill="#e53935"/>', "</svg>"].join("");
|
|
36
|
-
e2.registerToolbarItem({ id: "textColor", group: "format", icon: t2, label: this.locale.label, tooltip: this.locale.tooltip, command: "removeTextColor", priority: 45, popupType: "custom", separatorAfter: this.config.separatorAfter, renderPopup: (e3, t3,
|
|
37
|
-
|
|
38
|
-
}, isActive: (e3) =>
|
|
40
|
+
e2.registerToolbarItem({ id: "textColor", group: "format", icon: t2, label: this.locale.label, tooltip: this.locale.tooltip, command: "removeTextColor", priority: 45, popupType: "custom", separatorAfter: this.config.separatorAfter, renderPopup: (e3, t3, o2) => {
|
|
41
|
+
r(e3, t3, { markType: "textColor", colors: this.colors, columns: 10, resetLabel: this.locale.resetLabel, resetCommand: "removeTextColor", ariaLabelPrefix: this.locale.ariaLabelPrefix, onClose: o2 });
|
|
42
|
+
}, isActive: (e3) => o(e3, "textColor") });
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
export {
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
n as T,
|
|
47
|
+
b as a,
|
|
44
48
|
f as b
|
|
45
49
|
};
|
|
46
|
-
//# sourceMappingURL=index-
|
|
50
|
+
//# sourceMappingURL=index-BvqkuEY1.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BvqkuEY1.mjs","sources":["../../src/plugins/text-color/TextColorLocale.ts","../../src/plugins/text-color/TextColorPlugin.ts"],"sourcesContent":["/** Locale interface and default English locale for the TextColorPlugin. */\n\n// --- Locale Interface ---\n\nexport interface TextColorLocale {\n\treadonly label: string;\n\treadonly tooltip: string;\n\treadonly resetLabel: string;\n\treadonly ariaLabelPrefix: string;\n}\n\n// --- Default English Locale ---\n\nexport const TEXT_COLOR_LOCALE_EN: TextColorLocale = {\n\tlabel: 'Text Color',\n\ttooltip: 'Text Color',\n\tresetLabel: 'Default',\n\tariaLabelPrefix: 'Text color',\n};\n\n// --- German Locale ---\n\nexport const TEXT_COLOR_LOCALE_DE: TextColorLocale = {\n\tlabel: 'Textfarbe',\n\ttooltip: 'Textfarbe',\n\tresetLabel: 'Standard',\n\tariaLabelPrefix: 'Textfarbe',\n};\n\n// --- Spanish Locale ---\n\nexport const TEXT_COLOR_LOCALE_ES: TextColorLocale = {\n\tlabel: 'Color de texto',\n\ttooltip: 'Color de texto',\n\tresetLabel: 'Predeterminado',\n\tariaLabelPrefix: 'Color de texto',\n};\n\n// --- French Locale ---\n\nexport const TEXT_COLOR_LOCALE_FR: TextColorLocale = {\n\tlabel: 'Couleur du texte',\n\ttooltip: 'Couleur du texte',\n\tresetLabel: 'Par défaut',\n\tariaLabelPrefix: 'Couleur du texte',\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const TEXT_COLOR_LOCALE_ZH: TextColorLocale = {\n\tlabel: '文字颜色',\n\ttooltip: '文字颜色',\n\tresetLabel: '默认',\n\tariaLabelPrefix: '文字颜色',\n};\n\n// --- Russian Locale ---\n\nexport const TEXT_COLOR_LOCALE_RU: TextColorLocale = {\n\tlabel: 'Цвет текста',\n\ttooltip: 'Цвет текста',\n\tresetLabel: 'По умолчанию',\n\tariaLabelPrefix: 'Цвет текста',\n};\n\n// --- Arabic Locale ---\n\nexport const TEXT_COLOR_LOCALE_AR: TextColorLocale = {\n\tlabel: 'لون النص',\n\ttooltip: 'لون النص',\n\tresetLabel: 'افتراضي',\n\tariaLabelPrefix: 'لون النص',\n};\n\n// --- Hindi Locale ---\n\nexport const TEXT_COLOR_LOCALE_HI: TextColorLocale = {\n\tlabel: 'टेक्स्ट रंग',\n\ttooltip: 'टेक्स्ट रंग',\n\tresetLabel: 'डिफ़ॉल्ट',\n\tariaLabelPrefix: 'टेक्स्ट रंग',\n};\n\n// --- Locale Map ---\n\nexport const TEXT_COLOR_LOCALES: Record<string, TextColorLocale> = {\n\ten: TEXT_COLOR_LOCALE_EN,\n\tde: TEXT_COLOR_LOCALE_DE,\n\tes: TEXT_COLOR_LOCALE_ES,\n\tfr: TEXT_COLOR_LOCALE_FR,\n\tzh: TEXT_COLOR_LOCALE_ZH,\n\tru: TEXT_COLOR_LOCALE_RU,\n\tar: TEXT_COLOR_LOCALE_AR,\n\thi: TEXT_COLOR_LOCALE_HI,\n};\n","/**\n * TextColorPlugin: registers a text color mark with attrs,\n * toolbar button with a color picker popup, and removeTextColor command.\n */\n\nimport { COLOR_PICKER_CSS } from '../../editor/styles/color-picker.js';\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport { escapeHTML } from '../../model/HTMLUtils.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport { setStyleProperty } from '../../style/StyleRuntime.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { isColorMarkActive, removeColorMark } from '../shared/ColorMarkOperations.js';\nimport { renderColorPickerPopup } from '../shared/ColorPickerPopup.js';\nimport { isValidCSSColor, resolveColors } from '../shared/ColorValidation.js';\nimport { TEXT_COLOR_LOCALES, type TextColorLocale } from './TextColorLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\ttextColor: { color: string };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface TextColorConfig {\n\t/**\n\t * Restricts the color picker to a specific set of hex colors.\n\t * Each value must be a valid hex color code (`#RGB` or `#RRGGBB`).\n\t * Duplicates are removed automatically (case-insensitive).\n\t * When omitted, the full default palette is shown.\n\t */\n\treadonly colors?: readonly string[];\n\t/** When true, a separator is rendered after the textColor toolbar item. */\n\treadonly separatorAfter?: boolean;\n\treadonly locale?: TextColorLocale;\n}\n\n// --- Color Palette (Google Docs style: 10 columns x 7 rows) ---\n\nconst COLOR_PALETTE: readonly string[] = [\n\t// Row 1 — dark\n\t'#000000',\n\t'#434343',\n\t'#666666',\n\t'#999999',\n\t'#b7b7b7',\n\t'#cccccc',\n\t'#d9d9d9',\n\t'#efefef',\n\t'#f3f3f3',\n\t'#ffffff',\n\t// Row 2 — vivid\n\t'#980000',\n\t'#ff0000',\n\t'#ff9900',\n\t'#ffff00',\n\t'#00ff00',\n\t'#00ffff',\n\t'#4a86e8',\n\t'#0000ff',\n\t'#9900ff',\n\t'#ff00ff',\n\t// Row 3 — light 3\n\t'#e6b8af',\n\t'#f4cccc',\n\t'#fce5cd',\n\t'#fff2cc',\n\t'#d9ead3',\n\t'#d0e0e3',\n\t'#c9daf8',\n\t'#cfe2f3',\n\t'#d9d2e9',\n\t'#ead1dc',\n\t// Row 4 — light 2\n\t'#dd7e6b',\n\t'#ea9999',\n\t'#f9cb9c',\n\t'#ffe599',\n\t'#b6d7a8',\n\t'#a2c4c9',\n\t'#a4c2f4',\n\t'#9fc5e8',\n\t'#b4a7d6',\n\t'#d5a6bd',\n\t// Row 5 — light 1\n\t'#cc4125',\n\t'#e06666',\n\t'#f6b26b',\n\t'#ffd966',\n\t'#93c47d',\n\t'#76a5af',\n\t'#6d9eeb',\n\t'#6fa8dc',\n\t'#8e7cc3',\n\t'#c27ba0',\n\t// Row 6 — dark 1\n\t'#a61c00',\n\t'#cc0000',\n\t'#e69138',\n\t'#f1c232',\n\t'#6aa84f',\n\t'#45818e',\n\t'#3c78d8',\n\t'#3d85c6',\n\t'#674ea7',\n\t'#a64d79',\n\t// Row 7 — dark 2\n\t'#85200c',\n\t'#990000',\n\t'#b45f06',\n\t'#bf9000',\n\t'#38761d',\n\t'#134f5c',\n\t'#1155cc',\n\t'#0b5394',\n\t'#351c75',\n\t'#741b47',\n];\n\n// --- Plugin ---\n\nexport class TextColorPlugin implements Plugin {\n\treadonly id = 'textColor';\n\treadonly name = 'Text Color';\n\treadonly priority = 23;\n\n\tprivate readonly config: TextColorConfig;\n\tprivate readonly colors: readonly string[];\n\tprivate locale!: TextColorLocale;\n\n\tconstructor(config?: Partial<TextColorConfig>) {\n\t\tthis.config = { ...config };\n\t\tthis.colors = resolveColors(config?.colors, COLOR_PALETTE, 'TextColorPlugin');\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.locale = resolvePluginLocale(TEXT_COLOR_LOCALES, context, this.config.locale);\n\n\t\tcontext.registerStyleSheet(COLOR_PICKER_CSS);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'textColor',\n\t\t\trank: 5,\n\t\t\tattrs: {\n\t\t\t\tcolor: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(mark) {\n\t\t\t\tconst span = document.createElement('span');\n\t\t\t\tconst color = mark.attrs?.color ?? '';\n\t\t\t\tsetStyleProperty(span, 'color', color);\n\t\t\t\treturn span;\n\t\t\t},\n\t\t\ttoHTMLString: (mark, content) => {\n\t\t\t\tconst color: string = String(mark.attrs?.color ?? '');\n\t\t\t\tif (!color || !isValidCSSColor(color)) return content;\n\t\t\t\treturn `<span style=\"color: ${escapeHTML(color)}\">${content}</span>`;\n\t\t\t},\n\t\t\ttoHTMLStyle: (mark) => {\n\t\t\t\tconst color: string = String(mark.attrs?.color ?? '');\n\t\t\t\tif (!color || !isValidCSSColor(color)) return null;\n\t\t\t\treturn `color: ${escapeHTML(color)}`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'span',\n\t\t\t\t\tgetAttrs: (el) => {\n\t\t\t\t\t\tconst color: string = el.style.color;\n\t\t\t\t\t\tif (!color || !isValidCSSColor(color)) return false;\n\t\t\t\t\t\treturn { color };\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['span'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('removeTextColor', () => {\n\t\t\treturn removeColorMark(context, context.getState(), 'textColor');\n\t\t});\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst pathD =\n\t\t\t'M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2z' + 'm-1.38 9L12 5.67 14.38 12H9.62z';\n\t\tconst icon: string = [\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\"',\n\t\t\t' viewBox=\"0 0 24 24\">',\n\t\t\t`<path d=\"${pathD}\"/>`,\n\t\t\t'<rect x=\"3\" y=\"19.5\" width=\"18\" height=\"3\"',\n\t\t\t' rx=\"0.5\" fill=\"#e53935\"/>',\n\t\t\t'</svg>',\n\t\t].join('');\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'textColor',\n\t\t\tgroup: 'format',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip,\n\t\t\tcommand: 'removeTextColor',\n\t\t\tpriority: 45,\n\t\t\tpopupType: 'custom',\n\t\t\tseparatorAfter: this.config.separatorAfter,\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\trenderColorPickerPopup(container, ctx, {\n\t\t\t\t\tmarkType: 'textColor',\n\t\t\t\t\tcolors: this.colors,\n\t\t\t\t\tcolumns: 10,\n\t\t\t\t\tresetLabel: this.locale.resetLabel,\n\t\t\t\t\tresetCommand: 'removeTextColor',\n\t\t\t\t\tariaLabelPrefix: this.locale.ariaLabelPrefix,\n\t\t\t\t\tonClose,\n\t\t\t\t});\n\t\t\t},\n\t\t\tisActive: (state: EditorState) => isColorMarkActive(state, 'textColor'),\n\t\t});\n\t}\n}\n"],"names":["TEXT_COLOR_LOCALE_EN","label","tooltip","resetLabel","ariaLabelPrefix","TEXT_COLOR_LOCALES","en","de","es","fr","zh","ru","ar","hi","COLOR_PALETTE","TextColorPlugin","id","name","priority","config","colors","locale","this","resolveColors","context","resolvePluginLocale","registerStyleSheet","COLOR_PICKER_CSS","registerMarkSpec","registerCommands","registerToolbarItem","type","rank","attrs","color","default","mark","span","document","createElement","setStyleProperty","toHTMLString","content","String","isValidCSSColor","escapeHTML","toHTMLStyle","parseHTML","tag","getAttrs","el","style","sanitize","tags","registerCommand","removeColorMark","getState","icon","join","group","command","popupType","separatorAfter","renderPopup","container","ctx","onClose","renderColorPickerPopup","markType","columns","resetCommand","isActive","state","isColorMarkActive"],"mappings":";;;;;AAaO,MAAMA,IAAwC,EACpDC,OAAO,cACPC,SAAS,cACTC,YAAY,WACZC,iBAAiB,gBAoELC,IAAsD,EAClEC,IAAIN,GACJO,IAjEoD,EACpDN,OAAO,aACPC,SAAS,aACTC,YAAY,YACZC,iBAAiB,YAAA,GA8DjBI,IAzDoD,EACpDP,OAAO,kBACPC,SAAS,kBACTC,YAAY,kBACZC,iBAAiB,iBAAA,GAsDjBK,IAjDoD,EACpDR,OAAO,oBACPC,SAAS,oBACTC,YAAY,cACZC,iBAAiB,mBAAA,GA8CjBM,IAzCoD,EACpDT,OAAO,QACPC,SAAS,QACTC,YAAY,MACZC,iBAAiB,UAsCjBO,IAjCoD,EACpDV,OAAO,eACPC,SAAS,eACTC,YAAY,gBACZC,iBAAiB,iBA8BjBQ,IAzBoD,EACpDX,OAAO,YACPC,SAAS,YACTC,YAAY,WACZC,iBAAiB,cAsBjBS,IAjBoD,EACpDZ,OAAO,eACPC,SAAS,eACTC,YAAY,YACZC,iBAAiB,cAAA,EAAA,GCvCZU,IAAmC,CAExC,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WAEA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WAEA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WAEA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WAEA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WAEA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WAEA,WACA,WACA,WACA,WACA,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AC/B,aAAA,EAAA,CAAKA,MAAAA,CAAUU,EAAgBV,EAAAA,MACxB,EAAEA;UAIZkB,UAAU,EAAEC,MAAM,CAAC,MAAA,EAAA,EAAA,CAAA;AAAA,EAErB;AAAA,EAEQ,iBAAiB7B;AACxBA,IAAAA,GAAQ8B,gBAAgB,mBAAmB,MACnCC,EAAgB/B,IAASA,GAAQgC,SAAAA,GAAY,WAAA,CAAA;AAAA,EAEtD;AAAA,EAEQ,oBAAoBhC;AAC3B,UAEMiC,KAAe,CACpB,2CACA,yBACA,iGACA,8CACA,8BACA,QAAA,EACCC,KAAK,EAAA;AAEPlC,IAAAA,GAAQM,oBAAoB,EAC3Bd,IAAI,aACJ2C,OAAO,UACPF,MAAAA,IACAxD,OAAOqB,KAAKD,OAAOpB,OACnBC,SAASoB,KAAKD,OAAOnB,SACrB0D,SAAS,mBACT1C,UAAU,IACV2C,WAAW,UACXC,gBAAgBxC,KAAKH,OAAO2C,gBAC5BC,aAAa,CAACC,IAAWC,IAAKC,OAAAA;AAC7BC,QAAuBH,IAAWC,IAAK,EACtCG,UAAU,aACVhD,QAAQE,KAAKF,QACbiD,SAAS,IACTlE,YAAYmB,KAAKD,OAAOlB,YACxBmE,cAAc,mBACdlE,iBAAiBkB,KAAKD,OAAOjB,iBAC7B8D;OAGFK,UAAWC,CAAAA,OAAuBC,EAAkBD,IAAO,WAAA,EAAA,CAAA;AAAA,EAE7D;AAAA;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as t } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
2
2
|
import { m as s } from "./TypeBrands-C09nE2qO.mjs";
|
|
3
|
-
import { f as
|
|
4
|
-
import { e
|
|
3
|
+
import { f as i } from "./ToolbarItem-BpZggUGo.mjs";
|
|
4
|
+
import { e, b as r } from "./MarkCommands-6RUJ4L3r.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";
|
|
@@ -14,48 +14,48 @@ class l {
|
|
|
14
14
|
}
|
|
15
15
|
init(s2) {
|
|
16
16
|
this.locale = t(p, s2, this.config.locale);
|
|
17
|
-
const
|
|
18
|
-
for (const t2 of
|
|
19
|
-
const
|
|
20
|
-
this.registerMark(s2, t2,
|
|
17
|
+
const i2 = a.filter((t2) => this.config[t2.configKey]), e2 = i2.filter((t2) => this.isToolbarVisible(t2.configKey)).at(-1);
|
|
18
|
+
for (const t2 of i2) {
|
|
19
|
+
const i3 = !!this.config.separatorAfter && t2 === e2;
|
|
20
|
+
this.registerMark(s2, t2, i3);
|
|
21
21
|
}
|
|
22
|
-
this.registerKeymaps(s2,
|
|
22
|
+
this.registerKeymaps(s2, i2), this.registerExclusivityMiddleware(s2, i2), this.registerDisabledToolbarItems(s2);
|
|
23
23
|
}
|
|
24
24
|
registerMark(t2, o2, p2) {
|
|
25
25
|
const c2 = n(o2.type), a2 = this.isToolbarVisible(o2.configKey);
|
|
26
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
|
|
28
|
-
return !!
|
|
27
|
+
const i2 = e(t2.getState(), s(o2.type));
|
|
28
|
+
return !!i2 && (t2.dispatch(i2), true);
|
|
29
29
|
}), a2) {
|
|
30
|
-
const
|
|
31
|
-
t2.registerToolbarItem({ id: o2.type, group: "format", icon: o2.icon, label:
|
|
30
|
+
const e2 = "superscript" === o2.type ? this.locale.superscriptLabel : this.locale.subscriptLabel, a3 = "superscript" === o2.type ? this.locale.superscriptTooltip(i(o2.keyBinding)) : this.locale.subscriptTooltip(i(o2.keyBinding));
|
|
31
|
+
t2.registerToolbarItem({ id: o2.type, group: "format", icon: o2.icon, label: e2, 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
|
-
e2
|
|
35
|
+
const i2 = {};
|
|
36
|
+
for (const e2 of s2) {
|
|
37
|
+
const s3 = n(e2.type);
|
|
38
|
+
i2[e2.keyBinding] = () => t2.executeCommand(s3);
|
|
39
39
|
}
|
|
40
|
-
Object.keys(
|
|
40
|
+
Object.keys(i2).length > 0 && t2.registerKeymap(i2);
|
|
41
41
|
}
|
|
42
|
-
registerExclusivityMiddleware(t2,
|
|
43
|
-
|
|
42
|
+
registerExclusivityMiddleware(t2, i2) {
|
|
43
|
+
i2.some((t3) => "superscript" === t3.type) && i2.some((t3) => "subscript" === t3.type) && t2.registerMiddleware((t3, i3, e2) => {
|
|
44
44
|
let r2 = false;
|
|
45
45
|
const o2 = [];
|
|
46
|
-
for (const
|
|
47
|
-
if ("addMark" !==
|
|
48
|
-
o2.push(
|
|
46
|
+
for (const i4 of t3.steps) {
|
|
47
|
+
if ("addMark" !== i4.type) {
|
|
48
|
+
o2.push(i4);
|
|
49
49
|
continue;
|
|
50
50
|
}
|
|
51
|
-
const t4 =
|
|
52
|
-
if (!
|
|
53
|
-
o2.push(
|
|
51
|
+
const t4 = i4.mark.type, e3 = a.find((s2) => s2.type === t4);
|
|
52
|
+
if (!e3) {
|
|
53
|
+
o2.push(i4);
|
|
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: i4.blockId, from: i4.from, to: i4.to, mark: { type: s(e3.opposite) }, ...i4.path ? { path: i4.path } : {} };
|
|
58
|
+
o2.push(p3, i4);
|
|
59
59
|
}
|
|
60
60
|
let p2 = t3.storedMarksAfter;
|
|
61
61
|
if (p2) {
|
|
@@ -65,15 +65,15 @@ class l {
|
|
|
65
65
|
p2 = p2.filter((s3) => s3.type !== t5), r2 = true;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
e2(r2 ? { ...t3, steps: o2, storedMarksAfter: p2 } : t3);
|
|
69
69
|
}, { name: "super-sub:exclusivity" });
|
|
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 i2 = this.config[s2.configKey], e2 = this.config.toolbar[s2.configKey] ?? true;
|
|
74
|
+
if (!i2 && e2) {
|
|
75
|
+
const i3 = "superscript" === s2.type ? this.locale.superscriptLabel : this.locale.subscriptLabel;
|
|
76
|
+
t2.registerToolbarItem({ id: s2.type, group: "format", icon: s2.icon, label: i3, command: n(s2.type), priority: s2.toolbarPriority, isEnabled: () => false });
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -89,4 +89,4 @@ export {
|
|
|
89
89
|
p as a,
|
|
90
90
|
o as b
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=index-
|
|
92
|
+
//# sourceMappingURL=index-C1opJocO.mjs.map
|