@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,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as
|
|
3
|
-
import {
|
|
4
|
-
import { e as
|
|
5
|
-
import { b as
|
|
1
|
+
import { i as e, a as t, r } from "./AttributedMarkCommands-BtLea72z.mjs";
|
|
2
|
+
import { r as i } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
3
|
+
import { h as n } from "./Document-Brtw2jL1.mjs";
|
|
4
|
+
import { e as o } from "./HTMLUtils-DTqQzcKR.mjs";
|
|
5
|
+
import { b as a, i as l, a as s } from "./Selection-BRTab5hO.mjs";
|
|
6
6
|
import { m as p } from "./TypeBrands-C09nE2qO.mjs";
|
|
7
7
|
import { f as c } from "./ToolbarItem-BpZggUGo.mjs";
|
|
8
|
-
const m = { label: "Link", tooltip: (e2) => `Insert Link (${e2})`, removeLink: "Remove Link", removeLinkAria: "Remove link", urlPlaceholder: "https://...", urlAria: "Link URL", apply: "Apply", applyAria: "Apply link" },
|
|
9
|
-
class
|
|
8
|
+
const m = { label: "Link", tooltip: (e2) => `Insert Link (${e2})`, removeLink: "Remove Link", removeLinkAria: "Remove link", urlPlaceholder: "https://...", urlAria: "Link URL", apply: "Apply", applyAria: "Apply link" }, u = { en: m, de: { label: "Link", tooltip: (e2) => `Link einfügen (${e2})`, removeLink: "Link entfernen", removeLinkAria: "Link entfernen", urlPlaceholder: "https://...", urlAria: "Link-URL", apply: "Anwenden", applyAria: "Link anwenden" }, es: { label: "Enlace", tooltip: (e2) => `Insertar enlace (${e2})`, removeLink: "Eliminar enlace", removeLinkAria: "Eliminar enlace", urlPlaceholder: "https://...", urlAria: "URL del enlace", apply: "Aplicar", applyAria: "Aplicar enlace" }, fr: { label: "Lien", tooltip: (e2) => `Insérer un lien (${e2})`, removeLink: "Supprimer le lien", removeLinkAria: "Supprimer le lien", urlPlaceholder: "https://...", urlAria: "URL du lien", apply: "Appliquer", applyAria: "Appliquer le lien" }, zh: { label: "链接", tooltip: (e2) => `插入链接 (${e2})`, removeLink: "移除链接", removeLinkAria: "移除链接", urlPlaceholder: "https://...", urlAria: "链接地址", apply: "应用", applyAria: "应用链接" }, ru: { label: "Ссылка", tooltip: (e2) => `Вставить ссылку (${e2})`, removeLink: "Удалить ссылку", removeLinkAria: "Удалить ссылку", urlPlaceholder: "https://...", urlAria: "URL ссылки", apply: "Применить", applyAria: "Применить ссылку" }, ar: { label: "رابط", tooltip: (e2) => `إدراج رابط (${e2})`, removeLink: "إزالة الرابط", removeLinkAria: "إزالة الرابط", urlPlaceholder: "https://...", urlAria: "عنوان الرابط", apply: "تطبيق", applyAria: "تطبيق الرابط" }, hi: { label: "लिंक", tooltip: (e2) => `लिंक डालें (${e2})`, removeLink: "लिंक हटाएँ", removeLinkAria: "लिंक हटाएँ", urlPlaceholder: "https://...", urlAria: "लिंक URL", apply: "लागू करें", applyAria: "लिंक लागू करें" } }, h = { openInNewTab: true };
|
|
9
|
+
class k {
|
|
10
10
|
id = "link";
|
|
11
11
|
name = "Link";
|
|
12
12
|
priority = 25;
|
|
@@ -16,14 +16,17 @@ class u {
|
|
|
16
16
|
this.config = { ...h, ...e2 };
|
|
17
17
|
}
|
|
18
18
|
init(e2) {
|
|
19
|
-
this.locale =
|
|
19
|
+
this.locale = i(u, e2, this.config.locale), this.registerMarkSpec(e2), this.registerCommands(e2), this.registerKeymap(e2), this.registerToolbarItem(e2);
|
|
20
20
|
}
|
|
21
21
|
registerMarkSpec(e2) {
|
|
22
22
|
const t2 = this.config.openInNewTab;
|
|
23
23
|
e2.registerMarkSpec({ type: "link", rank: 10, attrs: { href: { default: "" } }, toDOM(e3) {
|
|
24
24
|
const r2 = document.createElement("a"), i2 = e3.attrs?.href ?? "";
|
|
25
25
|
return r2.setAttribute("href", i2), t2 && (r2.setAttribute("target", "_blank"), r2.setAttribute("rel", "noopener noreferrer")), r2;
|
|
26
|
-
}, toHTMLString: (e3,
|
|
26
|
+
}, toHTMLString: (e3, r2) => {
|
|
27
|
+
const i2 = o(String(e3.attrs?.href ?? ""));
|
|
28
|
+
return t2 ? `<a href="${i2}" target="_blank" rel="noopener noreferrer">${r2}</a>` : `<a href="${i2}">${r2}</a>`;
|
|
29
|
+
}, parseHTML: [{ tag: "a", getAttrs: (e3) => ({ href: e3.getAttribute("href") ?? "" }) }], sanitize: { tags: ["a"], attrs: ["href", "target", "rel"] } });
|
|
27
30
|
}
|
|
28
31
|
registerCommands(e2) {
|
|
29
32
|
e2.registerCommand("toggleLink", () => {
|
|
@@ -40,76 +43,61 @@ class u {
|
|
|
40
43
|
registerToolbarItem(e2) {
|
|
41
44
|
e2.registerToolbarItem({ id: "link", group: "insert", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>', label: this.locale.label, tooltip: this.locale.tooltip(c("Mod-K")), command: "toggleLink", priority: 60, popupType: "custom", separatorAfter: this.config.separatorAfter, renderPopup: (e3, t2, r2) => {
|
|
42
45
|
this.renderLinkPopup(e3, t2, r2);
|
|
43
|
-
}, isActive: (e3) => this.isLinkActive(e3), isEnabled: (e3) => !
|
|
46
|
+
}, isActive: (e3) => this.isLinkActive(e3), isEnabled: (e3) => !a(e3.selection) });
|
|
44
47
|
}
|
|
45
|
-
isLinkActive(
|
|
46
|
-
|
|
47
|
-
if (a(t2) || l(t2)) return false;
|
|
48
|
-
if (o(t2)) {
|
|
49
|
-
const n3 = e2.getBlock(t2.anchor.blockId);
|
|
50
|
-
if (!n3) return false;
|
|
51
|
-
const o2 = r(n3, t2.anchor.offset);
|
|
52
|
-
return i(o2, p("link"));
|
|
53
|
-
}
|
|
54
|
-
const n2 = e2.getBlock(t2.anchor.blockId);
|
|
55
|
-
if (!n2) return false;
|
|
56
|
-
const s2 = r(n2, t2.anchor.offset);
|
|
57
|
-
return i(s2, p("link"));
|
|
48
|
+
isLinkActive(t2) {
|
|
49
|
+
return e(t2, "link");
|
|
58
50
|
}
|
|
59
51
|
toggleLink(e2, t2) {
|
|
60
52
|
return !!this.isLinkActive(t2) && this.removeLink(e2, t2);
|
|
61
53
|
}
|
|
62
|
-
addLink(
|
|
54
|
+
addLink(e2, r2, i2) {
|
|
63
55
|
const n2 = r2.selection;
|
|
64
|
-
if (
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
67
|
-
return
|
|
68
|
-
m2.addMark(e2, t3, r3, d2);
|
|
69
|
-
}), m2.setSelection(n2), t2.dispatch(m2.build()), true;
|
|
56
|
+
if (l(n2) || s(n2)) return false;
|
|
57
|
+
if (a(n2)) return false;
|
|
58
|
+
const o2 = { type: p("link"), attrs: { href: i2 } }, c2 = t(r2, o2);
|
|
59
|
+
return !!c2 && (e2.dispatch(c2), true);
|
|
70
60
|
}
|
|
71
|
-
removeLink(
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
t3.push({ pos: o2, end: e3, hasLink: i(r3.marks, p("link")) }), o2 = e3;
|
|
61
|
+
removeLink(e2, t2) {
|
|
62
|
+
const i2 = t2.selection;
|
|
63
|
+
if (l(i2) || s(i2)) return false;
|
|
64
|
+
if (a(i2)) {
|
|
65
|
+
const r2 = t2.getBlock(i2.anchor.blockId);
|
|
66
|
+
if (!r2) return false;
|
|
67
|
+
const o3 = [];
|
|
68
|
+
let a2 = 0;
|
|
69
|
+
for (const e3 of r2.children) {
|
|
70
|
+
if (!("text" in e3)) continue;
|
|
71
|
+
const t3 = a2 + e3.text.length;
|
|
72
|
+
o3.push({ pos: a2, end: t3, hasLink: n(e3.marks, p("link")) }), a2 = t3;
|
|
84
73
|
}
|
|
85
|
-
const
|
|
86
|
-
if (-1 ===
|
|
87
|
-
let
|
|
88
|
-
for (;
|
|
89
|
-
let
|
|
90
|
-
for (;
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return d2.setSelection(n2), t2.dispatch(d2.build()), true;
|
|
74
|
+
const l2 = o3.findIndex((e3) => i2.anchor.offset >= e3.pos && i2.anchor.offset <= e3.end), s2 = l2 >= 0 ? o3[l2] : void 0;
|
|
75
|
+
if (-1 === l2 || !s2?.hasLink) return false;
|
|
76
|
+
let c2 = l2;
|
|
77
|
+
for (; c2 > 0 && o3[c2 - 1]?.hasLink; ) c2--;
|
|
78
|
+
let m2 = l2;
|
|
79
|
+
for (; m2 < o3.length - 1 && o3[m2 + 1]?.hasLink; ) m2++;
|
|
80
|
+
const u2 = o3[c2], h2 = o3[m2];
|
|
81
|
+
if (!u2 || !h2) return false;
|
|
82
|
+
const k2 = u2.pos, d = h2.end, L = t2.transaction("command");
|
|
83
|
+
return L.removeMark(i2.anchor.blockId, k2, d, { type: p("link") }), L.setSelection(i2), e2.dispatch(L.build()), true;
|
|
84
|
+
}
|
|
85
|
+
const o2 = r(t2, p("link"));
|
|
86
|
+
return !!o2 && (e2.dispatch(o2), true);
|
|
99
87
|
}
|
|
100
88
|
renderLinkPopup(e2, t2, r2) {
|
|
101
|
-
e2.
|
|
89
|
+
e2.classList.add("notectl-link-popup");
|
|
102
90
|
const i2 = t2.getState();
|
|
103
91
|
if (this.isLinkActive(i2)) {
|
|
104
92
|
const i3 = document.createElement("button");
|
|
105
|
-
i3.type = "button", i3.textContent = this.locale.removeLink, i3.setAttribute("aria-label", this.locale.removeLinkAria), i3.
|
|
93
|
+
i3.type = "button", i3.className = "notectl-link-popup__button", i3.textContent = this.locale.removeLink, i3.setAttribute("aria-label", this.locale.removeLinkAria), i3.addEventListener("mousedown", (e3) => {
|
|
106
94
|
e3.preventDefault(), e3.stopPropagation(), t2.executeCommand("removeLink"), r2(), t2.getContainer().focus();
|
|
107
95
|
}), e2.appendChild(i3);
|
|
108
96
|
} else {
|
|
109
97
|
const i3 = document.createElement("input");
|
|
110
|
-
i3.type = "url", i3.placeholder = this.locale.urlPlaceholder, i3.setAttribute("aria-label", this.locale.urlAria)
|
|
98
|
+
i3.type = "url", i3.className = "notectl-link-popup__input", i3.placeholder = this.locale.urlPlaceholder, i3.setAttribute("aria-label", this.locale.urlAria);
|
|
111
99
|
const n2 = document.createElement("button");
|
|
112
|
-
n2.type = "button", n2.textContent = this.locale.apply, n2.setAttribute("aria-label", this.locale.applyAria)
|
|
100
|
+
n2.type = "button", n2.className = "notectl-link-popup__button notectl-link-popup__button--apply", n2.textContent = this.locale.apply, n2.setAttribute("aria-label", this.locale.applyAria);
|
|
113
101
|
const o2 = () => {
|
|
114
102
|
const e3 = i3.value.trim();
|
|
115
103
|
e3 && (this.addLink(t2, t2.getState(), e3), r2(), t2.getContainer().focus());
|
|
@@ -123,8 +111,8 @@ class u {
|
|
|
123
111
|
}
|
|
124
112
|
}
|
|
125
113
|
export {
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
k as L,
|
|
115
|
+
u as a,
|
|
128
116
|
m as b
|
|
129
117
|
};
|
|
130
|
-
//# sourceMappingURL=index-
|
|
118
|
+
//# sourceMappingURL=index-fsVJLutn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-fsVJLutn.mjs","sources":["../../src/plugins/link/LinkLocale.ts","../../src/plugins/link/LinkPlugin.ts"],"sourcesContent":["/**\n * Locale interface and default English locale for the LinkPlugin.\n */\n\n// --- Locale Interface ---\n\nexport interface LinkLocale {\n\treadonly label: string;\n\treadonly tooltip: (shortcut: string) => string;\n\treadonly removeLink: string;\n\treadonly removeLinkAria: string;\n\treadonly urlPlaceholder: string;\n\treadonly urlAria: string;\n\treadonly apply: string;\n\treadonly applyAria: string;\n}\n\n// --- Default English Locale ---\n\nexport const LINK_LOCALE_EN: LinkLocale = {\n\tlabel: 'Link',\n\ttooltip: (shortcut: string) => `Insert Link (${shortcut})`,\n\tremoveLink: 'Remove Link',\n\tremoveLinkAria: 'Remove link',\n\turlPlaceholder: 'https://...',\n\turlAria: 'Link URL',\n\tapply: 'Apply',\n\tapplyAria: 'Apply link',\n};\n\n// --- German Locale ---\n\nexport const LINK_LOCALE_DE: LinkLocale = {\n\tlabel: 'Link',\n\ttooltip: (shortcut: string) => `Link einfügen (${shortcut})`,\n\tremoveLink: 'Link entfernen',\n\tremoveLinkAria: 'Link entfernen',\n\turlPlaceholder: 'https://...',\n\turlAria: 'Link-URL',\n\tapply: 'Anwenden',\n\tapplyAria: 'Link anwenden',\n};\n\n// --- Spanish Locale ---\n\nexport const LINK_LOCALE_ES: LinkLocale = {\n\tlabel: 'Enlace',\n\ttooltip: (shortcut: string) => `Insertar enlace (${shortcut})`,\n\tremoveLink: 'Eliminar enlace',\n\tremoveLinkAria: 'Eliminar enlace',\n\turlPlaceholder: 'https://...',\n\turlAria: 'URL del enlace',\n\tapply: 'Aplicar',\n\tapplyAria: 'Aplicar enlace',\n};\n\n// --- French Locale ---\n\nexport const LINK_LOCALE_FR: LinkLocale = {\n\tlabel: 'Lien',\n\ttooltip: (shortcut: string) => `Insérer un lien (${shortcut})`,\n\tremoveLink: 'Supprimer le lien',\n\tremoveLinkAria: 'Supprimer le lien',\n\turlPlaceholder: 'https://...',\n\turlAria: 'URL du lien',\n\tapply: 'Appliquer',\n\tapplyAria: 'Appliquer le lien',\n};\n\n// --- Chinese (Simplified) Locale ---\n\nexport const LINK_LOCALE_ZH: LinkLocale = {\n\tlabel: '链接',\n\ttooltip: (shortcut: string) => `插入链接 (${shortcut})`,\n\tremoveLink: '移除链接',\n\tremoveLinkAria: '移除链接',\n\turlPlaceholder: 'https://...',\n\turlAria: '链接地址',\n\tapply: '应用',\n\tapplyAria: '应用链接',\n};\n\n// --- Russian Locale ---\n\nexport const LINK_LOCALE_RU: LinkLocale = {\n\tlabel: 'Ссылка',\n\ttooltip: (shortcut: string) => `Вставить ссылку (${shortcut})`,\n\tremoveLink: 'Удалить ссылку',\n\tremoveLinkAria: 'Удалить ссылку',\n\turlPlaceholder: 'https://...',\n\turlAria: 'URL ссылки',\n\tapply: 'Применить',\n\tapplyAria: 'Применить ссылку',\n};\n\n// --- Arabic Locale ---\n\nexport const LINK_LOCALE_AR: LinkLocale = {\n\tlabel: 'رابط',\n\ttooltip: (shortcut: string) => `إدراج رابط (${shortcut})`,\n\tremoveLink: 'إزالة الرابط',\n\tremoveLinkAria: 'إزالة الرابط',\n\turlPlaceholder: 'https://...',\n\turlAria: 'عنوان الرابط',\n\tapply: 'تطبيق',\n\tapplyAria: 'تطبيق الرابط',\n};\n\n// --- Hindi Locale ---\n\nexport const LINK_LOCALE_HI: LinkLocale = {\n\tlabel: 'लिंक',\n\ttooltip: (shortcut: string) => `लिंक डालें (${shortcut})`,\n\tremoveLink: 'लिंक हटाएँ',\n\tremoveLinkAria: 'लिंक हटाएँ',\n\turlPlaceholder: 'https://...',\n\turlAria: 'लिंक URL',\n\tapply: 'लागू करें',\n\tapplyAria: 'लिंक लागू करें',\n};\n\n// --- Locale Map ---\n\nexport const LINK_LOCALES: Record<string, LinkLocale> = {\n\ten: LINK_LOCALE_EN,\n\tde: LINK_LOCALE_DE,\n\tes: LINK_LOCALE_ES,\n\tfr: LINK_LOCALE_FR,\n\tzh: LINK_LOCALE_ZH,\n\tru: LINK_LOCALE_RU,\n\tar: LINK_LOCALE_AR,\n\thi: LINK_LOCALE_HI,\n};\n","/**\n * LinkPlugin: registers a link mark type with href attribute,\n * toggle command, keyboard shortcut (Mod-K), and toolbar button\n * with a URL input popup.\n */\n\nimport {\n\tapplyAttributedMark,\n\tisAttributedMarkActive,\n\tremoveAttributedMark,\n} from '../../commands/AttributedMarkCommands.js';\nimport { resolvePluginLocale } from '../../i18n/resolvePluginLocale.js';\nimport { hasMark } from '../../model/Document.js';\nimport { escapeHTML } from '../../model/HTMLUtils.js';\nimport { isCollapsed, isGapCursor, isNodeSelection } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { formatShortcut } from '../toolbar/ToolbarItem.js';\nimport { LINK_LOCALES, type LinkLocale } from './LinkLocale.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tlink: { href: string };\n\t}\n}\n\n// --- Configuration ---\n\nexport interface LinkConfig {\n\t/** Whether to add rel=\"noopener noreferrer\" and target=\"_blank\" by default. */\n\treadonly openInNewTab: boolean;\n\t/** When true, a separator is rendered after the link toolbar item. */\n\treadonly separatorAfter?: boolean;\n\treadonly locale?: LinkLocale;\n}\n\nconst DEFAULT_CONFIG: LinkConfig = {\n\topenInNewTab: true,\n};\n\n// --- Plugin ---\n\nexport class LinkPlugin implements Plugin {\n\treadonly id = 'link';\n\treadonly name = 'Link';\n\treadonly priority = 25;\n\n\tprivate readonly config: LinkConfig;\n\tprivate locale!: LinkLocale;\n\n\tconstructor(config?: Partial<LinkConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tthis.locale = resolvePluginLocale(LINK_LOCALES, context, this.config.locale);\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymap(context);\n\t\tthis.registerToolbarItem(context);\n\t}\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tconst openInNewTab = this.config.openInNewTab;\n\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'link',\n\t\t\trank: 10,\n\t\t\tattrs: {\n\t\t\t\thref: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(mark) {\n\t\t\t\tconst a = document.createElement('a');\n\t\t\t\tconst href = mark.attrs?.href ?? '';\n\t\t\t\ta.setAttribute('href', href);\n\t\t\t\tif (openInNewTab) {\n\t\t\t\t\ta.setAttribute('target', '_blank');\n\t\t\t\t\ta.setAttribute('rel', 'noopener noreferrer');\n\t\t\t\t}\n\t\t\t\treturn a;\n\t\t\t},\n\t\t\ttoHTMLString: (mark, content) => {\n\t\t\t\tconst href: string = escapeHTML(String(mark.attrs?.href ?? ''));\n\t\t\t\tif (openInNewTab) {\n\t\t\t\t\treturn `<a href=\"${href}\" target=\"_blank\" rel=\"noopener noreferrer\">${content}</a>`;\n\t\t\t\t}\n\t\t\t\treturn `<a href=\"${href}\">${content}</a>`;\n\t\t\t},\n\t\t\tparseHTML: [\n\t\t\t\t{\n\t\t\t\t\ttag: 'a',\n\t\t\t\t\tgetAttrs: (el) => {\n\t\t\t\t\t\tconst href: string = el.getAttribute('href') ?? '';\n\t\t\t\t\t\treturn { href };\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\tsanitize: { tags: ['a'], attrs: ['href', 'target', 'rel'] },\n\t\t});\n\t}\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('toggleLink', () => {\n\t\t\tconst state = context.getState();\n\t\t\treturn this.toggleLink(context, state);\n\t\t});\n\n\t\tcontext.registerCommand('setLink', () => {\n\t\t\t// setLink is called by the popup after URL input\n\t\t\t// The actual URL is set via the popup's custom render\n\t\t\treturn false;\n\t\t});\n\n\t\tcontext.registerCommand('removeLink', () => {\n\t\t\tconst state = context.getState();\n\t\t\treturn this.removeLink(context, state);\n\t\t});\n\t}\n\n\tprivate registerKeymap(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-K': () => context.executeCommand('toggleLink'),\n\t\t});\n\t}\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon =\n\t\t\t'<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path d=\"M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z\"/></svg>';\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'link',\n\t\t\tgroup: 'insert',\n\t\t\ticon,\n\t\t\tlabel: this.locale.label,\n\t\t\ttooltip: this.locale.tooltip(formatShortcut('Mod-K')),\n\t\t\tcommand: 'toggleLink',\n\t\t\tpriority: 60,\n\t\t\tpopupType: 'custom',\n\t\t\tseparatorAfter: this.config.separatorAfter,\n\t\t\trenderPopup: (container, ctx, onClose) => {\n\t\t\t\tthis.renderLinkPopup(container, ctx, onClose);\n\t\t\t},\n\t\t\tisActive: (state) => this.isLinkActive(state),\n\t\t\tisEnabled: (state) => !isCollapsed(state.selection),\n\t\t});\n\t}\n\n\tprivate isLinkActive(state: EditorState): boolean {\n\t\treturn isAttributedMarkActive(state, 'link');\n\t}\n\n\tprivate toggleLink(context: PluginContext, state: EditorState): boolean {\n\t\tif (this.isLinkActive(state)) {\n\t\t\treturn this.removeLink(context, state);\n\t\t}\n\t\t// Adding links requires the toolbar popup for URL input\n\t\treturn false;\n\t}\n\n\tprivate addLink(context: PluginContext, state: EditorState, href: string): boolean {\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 mark = { type: markType('link'), attrs: { href } };\n\t\tconst tr = applyAttributedMark(state, mark);\n\t\tif (!tr) return false;\n\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tprivate removeLink(context: PluginContext, state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel) || isGapCursor(sel)) return false;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\t// Remove link from entire link span around cursor (plugin-specific extent scan)\n\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!block) return false;\n\n\t\t\tconst textChildren: { pos: number; end: number; hasLink: boolean }[] = [];\n\t\t\tlet pos = 0;\n\t\t\tfor (const child of block.children) {\n\t\t\t\tif (!('text' in child)) continue;\n\t\t\t\tconst end = pos + child.text.length;\n\t\t\t\ttextChildren.push({ pos, end, hasLink: hasMark(child.marks, markType('link')) });\n\t\t\t\tpos = end;\n\t\t\t}\n\n\t\t\tconst cursorIdx = textChildren.findIndex(\n\t\t\t\t(c) => sel.anchor.offset >= c.pos && sel.anchor.offset <= c.end,\n\t\t\t);\n\t\t\tconst cursorEntry = cursorIdx >= 0 ? textChildren[cursorIdx] : undefined;\n\t\t\tif (cursorIdx === -1 || !cursorEntry?.hasLink) return false;\n\n\t\t\tlet startIdx = cursorIdx;\n\t\t\twhile (startIdx > 0 && textChildren[startIdx - 1]?.hasLink) {\n\t\t\t\tstartIdx--;\n\t\t\t}\n\n\t\t\tlet endIdx = cursorIdx;\n\t\t\twhile (endIdx < textChildren.length - 1 && textChildren[endIdx + 1]?.hasLink) {\n\t\t\t\tendIdx++;\n\t\t\t}\n\n\t\t\tconst startEntry = textChildren[startIdx];\n\t\t\tconst endEntry = textChildren[endIdx];\n\t\t\tif (!startEntry || !endEntry) return false;\n\n\t\t\tconst linkStart = startEntry.pos;\n\t\t\tconst linkEnd = endEntry.end;\n\n\t\t\tconst builder = state.transaction('command');\n\t\t\tbuilder.removeMark(sel.anchor.blockId, linkStart, linkEnd, { type: markType('link') });\n\t\t\tbuilder.setSelection(sel);\n\t\t\tcontext.dispatch(builder.build());\n\t\t\treturn true;\n\t\t}\n\n\t\t// Range selection: delegate to shared helper\n\t\tconst tr = removeAttributedMark(state, markType('link'));\n\t\tif (!tr) return false;\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tprivate renderLinkPopup(\n\t\tcontainer: HTMLElement,\n\t\tcontext: PluginContext,\n\t\tonClose: () => void,\n\t): void {\n\t\tcontainer.classList.add('notectl-link-popup');\n\n\t\tconst state = context.getState();\n\t\tconst isActive = this.isLinkActive(state);\n\n\t\tif (isActive) {\n\t\t\t// Show remove link button\n\t\t\tconst removeBtn = document.createElement('button');\n\t\t\tremoveBtn.type = 'button';\n\t\t\tremoveBtn.className = 'notectl-link-popup__button';\n\t\t\tremoveBtn.textContent = this.locale.removeLink;\n\t\t\tremoveBtn.setAttribute('aria-label', this.locale.removeLinkAria);\n\t\t\tremoveBtn.addEventListener('mousedown', (e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tcontext.executeCommand('removeLink');\n\t\t\t\tonClose();\n\t\t\t\tcontext.getContainer().focus();\n\t\t\t});\n\t\t\tcontainer.appendChild(removeBtn);\n\t\t} else {\n\t\t\t// Show URL input\n\t\t\tconst input = document.createElement('input');\n\t\t\tinput.type = 'url';\n\t\t\tinput.className = 'notectl-link-popup__input';\n\t\t\tinput.placeholder = this.locale.urlPlaceholder;\n\t\t\tinput.setAttribute('aria-label', this.locale.urlAria);\n\n\t\t\tconst applyBtn = document.createElement('button');\n\t\t\tapplyBtn.type = 'button';\n\t\t\tapplyBtn.className = 'notectl-link-popup__button notectl-link-popup__button--apply';\n\t\t\tapplyBtn.textContent = this.locale.apply;\n\t\t\tapplyBtn.setAttribute('aria-label', this.locale.applyAria);\n\n\t\t\tconst applyLink = (): void => {\n\t\t\t\tconst href = input.value.trim();\n\t\t\t\tif (href) {\n\t\t\t\t\tthis.addLink(context, context.getState(), href);\n\t\t\t\t\tonClose();\n\t\t\t\t\tcontext.getContainer().focus();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tapplyBtn.addEventListener('mousedown', (e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tapplyLink();\n\t\t\t});\n\n\t\t\tinput.addEventListener('keydown', (e) => {\n\t\t\t\tif (e.key === 'Enter') {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tapplyLink();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tcontainer.appendChild(input);\n\t\t\tcontainer.appendChild(applyBtn);\n\n\t\t\t// Auto-focus input\n\t\t\trequestAnimationFrame(() => input.focus());\n\t\t}\n\t}\n}\n"],"names":["LINK_LOCALE_EN","label","tooltip","shortcut","removeLink","removeLinkAria","urlPlaceholder","urlAria","apply","applyAria","LINK_LOCALES","en","de","es","fr","zh","ru","ar","hi","DEFAULT_CONFIG","openInNewTab","LinkPlugin","id","name","priority","config","locale","this","context","resolvePluginLocale","registerMarkSpec","registerCommands","registerKeymap","registerToolbarItem","type","rank","attrs","href","default","mark","a","document","createElement","setAttribute","toHTMLString","content","escapeHTML","String","parseHTML","tag","getAttrs","el","getAttribute","sanitize","tags","registerCommand","state","getState","toggleLink","executeCommand","group","icon","formatShortcut","command","popupType","separatorAfter","renderPopup","container","ctx","onClose","renderLinkPopup","isActive","isLinkActive","isEnabled","isCollapsed","selection","isAttributedMarkActive","sel","isNodeSelection","isGapCursor","markType","tr","applyAttributedMark","dispatch","block","getBlock","anchor","blockId","textChildren","pos","child","children","end","text","length","push","hasLink","hasMark","marks","cursorIdx","findIndex","c","offset","cursorEntry","startIdx","endIdx","startEntry","endEntry","linkStart","linkEnd","builder","transaction","removeMark","setSelection","build","removeAttributedMark","classList","add","removeBtn","className","textContent","addEventListener","e","preventDefault","stopPropagation","getContainer","focus","appendChild","input","placeholder","applyBtn","applyLink","value","trim","addLink","key","requestAnimationFrame"],"mappings":";;;;;;;AAmBO,MAAMA,IAA6B,EACzCC,OAAO,QACPC,SAAUC,CAAAA,OAAqB,gBAAgBA,EAAAA,KAC/CC,YAAY,eACZC,gBAAgB,eAChBC,gBAAgB,eAChBC,SAAS,YACTC,OAAO,SACPC,WAAW,aAAA,GAgGCC,IAA2C,EACvDC,IAAIX,GACJY,IA7FyC,EACzCX,OAAO,QACPC,SAAUC,CAAAA,OAAqB,kBAAkBA,OACjDC,YAAY,kBACZC,gBAAgB,kBAChBC,gBAAgB,eAChBC,SAAS,YACTC,OAAO,YACPC,WAAW,mBAsFXI,IAjFyC,EACzCZ,OAAO,UACPC,SAAUC,CAAAA,OAAqB,oBAAoBA,EAAAA,KACnDC,YAAY,mBACZC,gBAAgB,mBAChBC,gBAAgB,eAChBC,SAAS,kBACTC,OAAO,WACPC,WAAW,iBAAA,GA0EXK,IArEyC,EACzCb,OAAO,QACPC,SAAUC,CAAAA,OAAqB,oBAAoBA,EAAAA,KACnDC,YAAY,qBACZC,gBAAgB,qBAChBC,gBAAgB,eAChBC,SAAS,eACTC,OAAO,aACPC,WAAW,oBAAA,GA8DXM,IAzDyC,EACzCd,OAAO,MACPC,SAAUC,CAAAA,OAAqB,SAASA,OACxCC,YAAY,QACZC,gBAAgB,QAChBC,gBAAgB,eAChBC,SAAS,QACTC,OAAO,MACPC,WAAW,OAAA,GAkDXO,IA7CyC,EACzCf,OAAO,UACPC,SAAUC,CAAAA,OAAqB,oBAAoBA,EAAAA,KACnDC,YAAY,kBACZC,gBAAgB,kBAChBC,gBAAgB,eAChBC,SAAS,cACTC,OAAO,aACPC,WAAW,sBAsCXQ,IAjCyC,EACzChB,OAAO,QACPC,SAAUC,CAAAA,OAAqB,eAAeA,EAAAA,KAC9CC,YAAY,gBACZC,gBAAgB,gBAChBC,gBAAgB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AQiG,aAAAA,EAAeC;UAExB3D,GAAU4D,YAAYT;IACvB,OAAO;AAEN,YAAMU,KAAQvF,SAASC,cAAc,OAAA;AACrCsF,MAAAA,GAAM9F,OAAO,OACb8F,GAAMT,YAAY,6BAClBS,GAAMC,cAActG,KAAKD,OAAOpB,gBAChC0H,GAAMrF,aAAa,cAAchB,KAAKD,OAAOnB,OAAAA;AAE7C,YAAM2H,KAAWzF,SAASC,cAAc,QAAA;AACxCwF,MAAAA,GAAShG,OAAO,UAChBgG,GAASX,YAAY,gEACrBW,GAASV,cAAc7F,KAAKD,OAAOlB,OACnC0H,GAASvF,aAAa,cAAchB,KAAKD,OAAOjB,SAAAA;AAEhD,YAAM0H,KAAY,MAAA;AACjB,cAAM9F,KAAO2F,GAAMI,MAAMC;AACrBhG,QAAAA,OACHV,KAAK2G,QAAQ1G,IAASA,GAAQ6B,SAAAA,GAAYpB,KAC1CgC,GAAAA,GACAzC,GAAQiG,eAAeC,MAAAA;AAAAA,MAAAA;AAIzBI,MAAAA,GAAST,iBAAiB,aAAcC,CAAAA,OAAAA;AACvCA,QAAAA,GAAEC,eAAAA,GACFD,GAAEE,gBAAAA,GACFO;UAGDH,GAAMP,iBAAiB,WAAYC,CAAAA,OAAAA;AACpB,oBAAVA,GAAEa,QACLb,GAAEC,eAAAA,GACFQ,GAAAA;AAAAA,MAAAA,CAAAA,GAIFhE,GAAU4D,YAAYC,KACtB7D,GAAU4D,YAAYG,KAGtBM,sBAAsB,MAAMR,GAAMF,MAAAA,CAAAA;AAAAA,IACnC;AAAA,EACD;AAAA;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { MarkAttrRegistry } from '../model/AttrRegistry.js';
|
|
2
|
+
import { Mark } from '../model/Document.js';
|
|
3
|
+
import { MarkTypeName } from '../model/TypeBrands.js';
|
|
4
|
+
import { EditorState } from '../state/EditorState.js';
|
|
5
|
+
import { Transaction } from '../state/Transaction.js';
|
|
6
|
+
/**
|
|
7
|
+
* Applies an attributed mark to the current selection.
|
|
8
|
+
*
|
|
9
|
+
* - **Collapsed cursor**: replaces stored marks (filters out old mark of the
|
|
10
|
+
* same type, appends the new one).
|
|
11
|
+
* - **Range selection**: removes then re-adds the mark in every block span.
|
|
12
|
+
*
|
|
13
|
+
* Returns the built `Transaction`, or `null` when the selection is
|
|
14
|
+
* unsupported (node-selection / gap-cursor) or the anchor block is missing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyAttributedMark(state: EditorState, mark: Mark): Transaction | null;
|
|
17
|
+
/**
|
|
18
|
+
* Removes an attributed mark from the current selection.
|
|
19
|
+
*
|
|
20
|
+
* - **Collapsed cursor**: filters the mark out of stored marks.
|
|
21
|
+
* Returns `null` when the mark was not present.
|
|
22
|
+
* - **Range selection**: removes the mark across all block spans.
|
|
23
|
+
*
|
|
24
|
+
* Returns the built `Transaction`, or `null` when the selection is
|
|
25
|
+
* unsupported or the mark is absent at a collapsed cursor.
|
|
26
|
+
*/
|
|
27
|
+
export declare function removeAttributedMark(state: EditorState, markTypeName: MarkTypeName): Transaction | null;
|
|
28
|
+
/**
|
|
29
|
+
* Extracts a typed attribute value from the mark at the current selection.
|
|
30
|
+
*
|
|
31
|
+
* Looks at stored marks (collapsed w/ stored), block marks at cursor offset
|
|
32
|
+
* (collapsed w/o stored), or anchor-block marks (range).
|
|
33
|
+
*
|
|
34
|
+
* @param extractFn — Narrows the found mark and returns the desired value,
|
|
35
|
+
* or `null` when the mark's attrs don't match expectations.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getMarkAttrAtSelection<K extends keyof MarkAttrRegistry, V>(state: EditorState, markTypeName: K, extractFn: (mark: Mark & {
|
|
38
|
+
readonly type: K;
|
|
39
|
+
readonly attrs: MarkAttrRegistry[K];
|
|
40
|
+
}) => V | null): V | null;
|
|
41
|
+
/**
|
|
42
|
+
* Returns `true` when the given attributed mark type is present at the
|
|
43
|
+
* current selection (collapsed or range).
|
|
44
|
+
*/
|
|
45
|
+
export declare function isAttributedMarkActive<K extends keyof MarkAttrRegistry>(state: EditorState, markTypeName: K): boolean;
|
|
46
|
+
//# sourceMappingURL=AttributedMarkCommands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttributedMarkCommands.d.ts","sourceRoot":"","sources":["../../src/commands/AttributedMarkCommands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAa,IAAI,EAAY,MAAM,sBAAsB,CAAC;AAUtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,GAAG,IAAI,CAqCtF;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,WAAW,EAClB,YAAY,EAAE,YAAY,GACxB,WAAW,GAAG,IAAI,CAgCpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,gBAAgB,EAAE,CAAC,EACzE,KAAK,EAAE,WAAW,EAClB,YAAY,EAAE,CAAC,EACf,SAAS,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAA;CAAE,KAAK,CAAC,GAAG,IAAI,GAC7F,CAAC,GAAG,IAAI,CAcV;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACtE,KAAK,EAAE,WAAW,EAClB,YAAY,EAAE,CAAC,GACb,OAAO,CAET"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BlockNode, ChildNode } from '../model/Document.js';
|
|
2
|
+
import { Selection } from '../model/Selection.js';
|
|
3
|
+
import { BlockId } from '../model/TypeBrands.js';
|
|
4
|
+
import { EditorState } from '../state/EditorState.js';
|
|
5
|
+
/** The resolved insert position within a single block. */
|
|
6
|
+
export interface InsertPoint {
|
|
7
|
+
readonly blockId: BlockId;
|
|
8
|
+
readonly offset: number;
|
|
9
|
+
}
|
|
10
|
+
/** Resolves the children of a parent path: doc root or a nested block. */
|
|
11
|
+
export declare function getSiblings(state: EditorState, parentPath: readonly BlockId[]): readonly ChildNode[];
|
|
12
|
+
/** Creates an empty paragraph block node with the given ID. */
|
|
13
|
+
export declare function createEmptyParagraph(id: BlockId): BlockNode;
|
|
14
|
+
/**
|
|
15
|
+
* Normalizes a text selection to a single insert point.
|
|
16
|
+
*
|
|
17
|
+
* - Collapsed selection → anchor position.
|
|
18
|
+
* - Range selection → normalized `from` position (document-order start).
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveInsertPoint(sel: Selection, blockOrder: readonly BlockId[]): InsertPoint;
|
|
21
|
+
//# sourceMappingURL=CommandHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandHelpers.d.ts","sourceRoot":"","sources":["../../src/commands/CommandHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAC1B,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,SAAS,OAAO,EAAE,GAC5B,SAAS,SAAS,EAAE,CAMtB;AAED,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,OAAO,GAAG,SAAS,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,OAAO,EAAE,GAAG,WAAW,CAM9F"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { SelectionRange } from '../model/Selection.js';
|
|
2
|
-
import { BlockId } from '../model/TypeBrands.js';
|
|
3
1
|
import { EditorState } from '../state/EditorState.js';
|
|
4
2
|
import { Transaction, TransactionBuilder } from '../state/Transaction.js';
|
|
5
3
|
export { canCrossBlockBoundary, isInsideIsolating, isIsolatingBlock, isVoidBlock, sharesParent, } from '../model/NavigationUtils.js';
|
|
@@ -9,12 +7,8 @@ export { deleteBackward, deleteForward, deleteSoftLineBackward, deleteSoftLineFo
|
|
|
9
7
|
export { deleteNodeSelection, findFirstLeafBlockId, findLastLeafBlockId, insertParagraphAfterNodeSelection, insertTextAfterNodeSelection, navigateArrowIntoVoid, } from './NodeSelectionCommands.js';
|
|
10
8
|
export { deleteBackwardAtGap, deleteForwardAtGap, insertParagraphAtGap, insertTextAtGap, } from './GapCursorCommands.js';
|
|
11
9
|
export { findWordBoundaryBackward, findWordBoundaryForward, } from './WordBoundary.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* with the block ID, per-block start offset, and per-block end offset.
|
|
15
|
-
* Blocks where `from === to` are skipped automatically.
|
|
16
|
-
*/
|
|
17
|
-
export declare function forEachBlockInRange(state: EditorState, range: SelectionRange, callback: (blockId: BlockId, from: number, to: number) => void): void;
|
|
10
|
+
export { applyAttributedMark, getMarkAttrAtSelection, isAttributedMarkActive, removeAttributedMark, } from './AttributedMarkCommands.js';
|
|
11
|
+
export { forEachBlockInRange } from './RangeIterator.js';
|
|
18
12
|
/** Inserts text at the current selection, replacing any selected range. */
|
|
19
13
|
export declare function insertTextCommand(state: EditorState, text: string, origin?: 'input' | 'paste'): Transaction;
|
|
20
14
|
/** Deletes the current selection. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Commands.d.ts","sourceRoot":"","sources":["../../src/commands/Commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"Commands.d.ts","sourceRoot":"","sources":["../../src/commands/Commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0BH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAWlE,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,YAAY,GACZ,MAAM,6BAA6B,CAAC;AAErC,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACN,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,eAAe,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,iCAAiC,EACjC,4BAA4B,EAC5B,qBAAqB,GACrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,GACf,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,wBAAwB,EACxB,uB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Commands.d.ts","sourceRoot":"","sources":["../../src/commands/DeleteCommands.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AA+B3D,6BAA6B;AAC7B,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAKrE;AAED,0BAA0B;AAC1B,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAQpE;AAED,oDAAoD;AACpD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAMzE;AAED,gDAAgD;AAChD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAQxE;AAED,4DAA4D;AAC5D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAK7E;AAED,uDAAuD;AACvD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAQ5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GapCursorCommands.d.ts","sourceRoot":"","sources":["../../src/commands/GapCursorCommands.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"GapCursorCommands.d.ts","sourceRoot":"","sources":["../../src/commands/GapCursorCommands.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,uBAAuB,CAAC;AAG/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAI3D;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,kBAAkB,GACrB,WAAW,GAAG,IAAI,CA0BpB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CACjC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,kBAAkB,GACrB,WAAW,GAAG,IAAI,CAuBpB;AASD,wFAAwF;AACxF,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,kBAAkB,GACrB,WAAW,GAAG,IAAI,CAgBpB;AAED,+DAA+D;AAC/D,wBAAgB,eAAe,CAC9B,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,GAAG,OAAO,GACvB,WAAW,CAeb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeSelectionCommands.d.ts","sourceRoot":"","sources":["../../src/commands/NodeSelectionCommands.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"NodeSelectionCommands.d.ts","sourceRoot":"","sources":["../../src/commands/NodeSelectionCommands.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAgD,MAAM,sBAAsB,CAAC;AAGpG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAS3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,GAAG,IAAI,CA2C9F;AAED,yEAAyE;AACzE,wBAAgB,iCAAiC,CAChD,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,aAAa,GAChB,WAAW,GAAG,IAAI,CAepB;AAED,iFAAiF;AACjF,wBAAgB,4BAA4B,CAC3C,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,GAAG,OAAO,GACvB,WAAW,CAeb;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GACzC,WAAW,GAAG,IAAI,CAgBpB;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAS7D;AAED,sEAAsE;AACtE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAc5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasteCommand.d.ts","sourceRoot":"","sources":["../../src/commands/PasteCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"PasteCommand.d.ts","sourceRoot":"","sources":["../../src/commands/PasteCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,0BAA0B,CAAC;AAmBzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,yBAAyB,CAAC;AAI/E;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,GAAG,WAAW,CAiB/E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SelectionRange } from '../model/Selection.js';
|
|
2
|
+
import { BlockId } from '../model/TypeBrands.js';
|
|
3
|
+
import { EditorState } from '../state/EditorState.js';
|
|
4
|
+
/**
|
|
5
|
+
* Iterates over each block in the given selection range, invoking the callback
|
|
6
|
+
* with the block ID, per-block start offset, and per-block end offset.
|
|
7
|
+
* Blocks where `from === to` are skipped automatically.
|
|
8
|
+
*/
|
|
9
|
+
export declare function forEachBlockInRange(state: EditorState, range: SelectionRange, callback: (blockId: BlockId, from: number, to: number) => void): void;
|
|
10
|
+
//# sourceMappingURL=RangeIterator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeIterator.d.ts","sourceRoot":"","sources":["../../src/commands/RangeIterator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,GAC5D,IAAI,CAiBN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentParser.d.ts","sourceRoot":"","sources":["../../src/editor/DocumentParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAa,QAAQ,
|
|
1
|
+
{"version":3,"file":"DocumentParser.d.ts","sourceRoot":"","sources":["../../src/editor/DocumentParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAa,QAAQ,EAA8B,MAAM,sBAAsB,CAAC;AAQ5F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE,2FAA2F;AAC3F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,QAAQ,CAkErF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Document } from '../model/Document.js';
|
|
2
2
|
import { SchemaRegistry } from '../model/SchemaRegistry.js';
|
|
3
|
+
/** Known-safe alignment values accepted by the serializer (defense-in-depth). */
|
|
4
|
+
export declare const VALID_ALIGNMENTS: ReadonlySet<string>;
|
|
3
5
|
/** Serializes a full document to sanitized HTML, wrapping list items in `<ul>`/`<ol>`. */
|
|
4
6
|
export declare function serializeDocumentToHTML(doc: Document, registry?: SchemaRegistry): string;
|
|
5
7
|
//# sourceMappingURL=DocumentSerializer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentSerializer.d.ts","sourceRoot":"","sources":["../../src/editor/DocumentSerializer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAa,QAAQ,
|
|
1
|
+
{"version":3,"file":"DocumentSerializer.d.ts","sourceRoot":"","sources":["../../src/editor/DocumentSerializer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAa,QAAQ,EAAwB,MAAM,sBAAsB,CAAC;AAUtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAGjE,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAK/C,CAAC;AAEH,0FAA0F;AAC1F,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,MAAM,CAUxF"}
|
|
@@ -4,12 +4,15 @@ export declare class EditorThemeController {
|
|
|
4
4
|
private systemThemeQuery;
|
|
5
5
|
private systemThemeHandler;
|
|
6
6
|
private pluginSheets;
|
|
7
|
+
private runtimeSheets;
|
|
7
8
|
private readonly shadow;
|
|
8
9
|
constructor(shadow: ShadowRoot);
|
|
9
10
|
/** Applies a theme preset or custom Theme to the shadow root. */
|
|
10
11
|
apply(theme: ThemePreset | Theme): void;
|
|
11
12
|
/** Updates the plugin-registered stylesheets and refreshes adoptedStyleSheets. */
|
|
12
13
|
setPluginStyleSheets(sheets: readonly CSSStyleSheet[]): void;
|
|
14
|
+
/** Updates runtime-generated stylesheets (e.g. strict CSP dynamic rules). */
|
|
15
|
+
setRuntimeStyleSheets(sheets: readonly CSSStyleSheet[]): void;
|
|
13
16
|
/** Removes the system-theme listener. */
|
|
14
17
|
destroy(): void;
|
|
15
18
|
private setThemeStyleSheet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorThemeController.d.ts","sourceRoot":"","sources":["../../src/editor/EditorThemeController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,KAAK,EAAE,WAAW,EAAgB,MAAM,wBAAwB,CAAC;AAE/E,qBAAa,qBAAqB;IACjC,OAAO,CAAC,eAAe,CAAsC;IAC7D,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,kBAAkB,CAAmD;IAC7E,OAAO,CAAC,YAAY,CAAgC;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;gBAExB,MAAM,EAAE,UAAU;IAI9B,iEAAiE;IACjE,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,GAAG,IAAI;IAYvC,kFAAkF;IAClF,oBAAoB,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI;IAK5D,yCAAyC;IACzC,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,yBAAyB;
|
|
1
|
+
{"version":3,"file":"EditorThemeController.d.ts","sourceRoot":"","sources":["../../src/editor/EditorThemeController.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,KAAK,KAAK,EAAE,WAAW,EAAgB,MAAM,wBAAwB,CAAC;AAE/E,qBAAa,qBAAqB;IACjC,OAAO,CAAC,eAAe,CAAsC;IAC7D,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,kBAAkB,CAAmD;IAC7E,OAAO,CAAC,YAAY,CAAgC;IACpD,OAAO,CAAC,aAAa,CAAgC;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;gBAExB,MAAM,EAAE,UAAU;IAI9B,iEAAiE;IACjE,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,GAAG,IAAI;IAYvC,kFAAkF;IAClF,oBAAoB,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI;IAK5D,6EAA6E;IAC7E,qBAAqB,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI;IAK7D,yCAAyC;IACzC,OAAO,IAAI,IAAI;IAIf,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,yBAAyB;IASjC,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,0BAA0B;IAQlC,OAAO,CAAC,cAAc;CAItB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Mark } from '../model/Document.js';
|
|
2
|
+
import { SchemaRegistry } from '../model/SchemaRegistry.js';
|
|
3
|
+
/** Builds a map of mark type name to rank from the registry (compute once per pass). */
|
|
4
|
+
export declare function buildMarkOrder(registry: SchemaRegistry): Map<string, number>;
|
|
5
|
+
/**
|
|
6
|
+
* Serializes text with marks to HTML.
|
|
7
|
+
* Style-based marks (`toHTMLStyle`) are merged into a single `<span style="...">`.
|
|
8
|
+
* Tag-based marks (`toHTMLString`) wrap the content in rank order.
|
|
9
|
+
*/
|
|
10
|
+
export declare function serializeMarksToHTML(text: string, marks: readonly Mark[], registry: SchemaRegistry, markOrder?: Map<string, number>): string;
|
|
11
|
+
//# sourceMappingURL=MarkSerializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkSerializer.d.ts","sourceRoot":"","sources":["../../src/editor/MarkSerializer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAQ5E;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,QAAQ,EAAE,cAAc,EACxB,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,MAAM,CAyCR"}
|
|
@@ -5,6 +5,7 @@ import { TextFormattingConfig } from '../plugins/text-formatting/TextFormattingP
|
|
|
5
5
|
import { ToolbarOverflowBehavior } from '../plugins/toolbar/ToolbarOverflowBehavior.js';
|
|
6
6
|
import { EditorState } from '../state/EditorState.js';
|
|
7
7
|
import { Transaction } from '../state/Transaction.js';
|
|
8
|
+
import { RuntimeStyleMode } from '../style/StyleRuntime.js';
|
|
8
9
|
import { PaperSize } from './PaperSize.js';
|
|
9
10
|
import { Theme, ThemePreset } from './theme/ThemeTokens.js';
|
|
10
11
|
/**
|
|
@@ -26,7 +27,7 @@ export interface ToolbarConfig {
|
|
|
26
27
|
export interface NotectlEditorConfig {
|
|
27
28
|
/** Controls which inline marks are enabled. Used to auto-configure TextFormattingPlugin. */
|
|
28
29
|
features?: Partial<TextFormattingConfig>;
|
|
29
|
-
plugins?: Plugin[];
|
|
30
|
+
plugins?: readonly Plugin[];
|
|
30
31
|
/**
|
|
31
32
|
* Toolbar configuration. Accepts either:
|
|
32
33
|
* - A shorthand array of plugin groups: `[[BoldPlugin, ItalicPlugin], [HeadingPlugin]]`
|
|
@@ -41,6 +42,15 @@ export interface NotectlEditorConfig {
|
|
|
41
42
|
maxHistoryDepth?: number;
|
|
42
43
|
/** Theme preset or custom Theme object. Defaults to ThemePreset.Light. */
|
|
43
44
|
theme?: ThemePreset | Theme;
|
|
45
|
+
/**
|
|
46
|
+
* Runtime style mode.
|
|
47
|
+
* - `strict`: avoids inline style attributes via dynamic stylesheet tokens (default)
|
|
48
|
+
* - `inline`: legacy inline style mutations
|
|
49
|
+
* Evaluated during initialization.
|
|
50
|
+
*/
|
|
51
|
+
styleMode?: RuntimeStyleMode;
|
|
52
|
+
/** Optional nonce for fallback runtime `<style>` elements when strict mode cannot use adopted sheets. */
|
|
53
|
+
styleNonce?: string;
|
|
44
54
|
/** Paper size for WYSIWYG page layout. When set, content renders at exact paper width. */
|
|
45
55
|
paperSize?: PaperSize;
|
|
46
56
|
/** Editor locale. Defaults to Locale.BROWSER (auto-detect from navigator.language). */
|
|
@@ -77,6 +87,7 @@ export declare class NotectlEditor extends HTMLElement {
|
|
|
77
87
|
private preInitPlugins;
|
|
78
88
|
private themeController;
|
|
79
89
|
private paperLayout;
|
|
90
|
+
private runtimeStyleSheet;
|
|
80
91
|
constructor();
|
|
81
92
|
static get observedAttributes(): string[];
|
|
82
93
|
connectedCallback(): void;
|
|
@@ -93,11 +104,11 @@ export declare class NotectlEditor extends HTMLElement {
|
|
|
93
104
|
/** Sets the document from JSON. */
|
|
94
105
|
setJSON(doc: Document): void;
|
|
95
106
|
/** Returns sanitized HTML representation of the document. */
|
|
96
|
-
|
|
107
|
+
getContentHTML(options?: {
|
|
97
108
|
pretty?: boolean;
|
|
98
109
|
}): string;
|
|
99
110
|
/** Sets content from HTML (sanitized). */
|
|
100
|
-
|
|
111
|
+
setContentHTML(html: string): void;
|
|
101
112
|
/** Returns plain text content. */
|
|
102
113
|
getText(): string;
|
|
103
114
|
/** Returns true if the editor is empty (single empty paragraph). */
|
|
@@ -117,7 +128,10 @@ export declare class NotectlEditor extends HTMLElement {
|
|
|
117
128
|
toggleUnderline: () => boolean;
|
|
118
129
|
undo: () => boolean;
|
|
119
130
|
redo: () => boolean;
|
|
131
|
+
selectAll: () => boolean;
|
|
120
132
|
};
|
|
133
|
+
/** Returns whether a named command can be executed. */
|
|
134
|
+
canExecuteCommand(name: string): boolean;
|
|
121
135
|
/** Executes a named command registered by a plugin. */
|
|
122
136
|
executeCommand(name: string): boolean;
|
|
123
137
|
/** Configures a plugin at runtime. */
|
|
@@ -162,6 +176,8 @@ export declare class NotectlEditor extends HTMLElement {
|
|
|
162
176
|
/** Auto-registers GapCursorPlugin if not explicitly provided. */
|
|
163
177
|
private ensureGapCursorPlugin;
|
|
164
178
|
private applyPaperSize;
|
|
179
|
+
private setupStyleRuntime;
|
|
180
|
+
private teardownStyleRuntime;
|
|
165
181
|
private emit;
|
|
166
182
|
private onStateChange;
|
|
167
183
|
private updateEmptyState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotectlEditor.d.ts","sourceRoot":"","sources":["../../src/editor/NotectlEditor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,KAAK,QAAQ,EAAgB,MAAM,sBAAsB,CAAC;AAKnE,OAAO,KAAK,EACX,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,MAAM,sBAAsB,CAAC;AAM9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAC/F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAG7F,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"NotectlEditor.d.ts","sourceRoot":"","sources":["../../src/editor/NotectlEditor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,KAAK,QAAQ,EAAgB,MAAM,sBAAsB,CAAC;AAKnE,OAAO,KAAK,EACX,QAAQ,EACR,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,cAAc;IActB,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,IAAI;IASZ,OAAO,CAAC,aAAa;IA0BrB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,YAAY;CAMpB;AAOD,yEAAyE;AACzE,wBAAsB,YAAY,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAIvF"}
|
|
@@ -10,6 +10,7 @@ export declare class PaperLayoutController {
|
|
|
10
10
|
private currentPaperWidthPx;
|
|
11
11
|
private currentPaperHeightPx;
|
|
12
12
|
private currentScale;
|
|
13
|
+
private compensationFrameId;
|
|
13
14
|
constructor(wrapper: HTMLElement, content: HTMLElement);
|
|
14
15
|
/** Enables, changes, or disables paper mode. Pass `null` to disable. */
|
|
15
16
|
apply(paperSize: PaperSize | null): void;
|
|
@@ -22,6 +23,7 @@ export declare class PaperLayoutController {
|
|
|
22
23
|
private updateSurfaceDimensions;
|
|
23
24
|
private onViewportResize;
|
|
24
25
|
private onSurfaceResize;
|
|
26
|
+
private scheduleHeightCompensation;
|
|
25
27
|
private updateHeightCompensation;
|
|
26
28
|
}
|
|
27
29
|
//# sourceMappingURL=PaperLayoutController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaperLayoutController.d.ts","sourceRoot":"","sources":["../../src/editor/PaperLayoutController.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"PaperLayoutController.d.ts","sourceRoot":"","sources":["../../src/editor/PaperLayoutController.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAA6B,KAAK,SAAS,EAAsB,MAAM,gBAAgB,CAAC;AAE/F,qBAAa,qBAAqB;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IAEtC,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,OAAO,CAA4B;IAE3C,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,eAAe,CAA+B;IAEtD,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,mBAAmB,CAAK;IAChC,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,mBAAmB,CAAuB;gBAEtC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW;IAKtD,wEAAwE;IACxE,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI;IAmBxC,qDAAqD;IACrD,OAAO,IAAI,IAAI;IAIf,qEAAqE;IACrE,YAAY,IAAI,SAAS,GAAG,IAAI;IAMhC,OAAO,CAAC,MAAM;IAyCd,OAAO,CAAC,OAAO;IAoCf,OAAO,CAAC,uBAAuB;IAM/B,OAAO,CAAC,gBAAgB;IAaxB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,0BAA0B;IAUlC,OAAO,CAAC,wBAAwB;CAehC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Font picker toolbar combobox + popup styles. */
|
|
2
|
-
export declare const FONT_SELECT_CSS = "\n/* Font Select \u2014
|
|
2
|
+
export declare const FONT_SELECT_CSS = "\n/* Font Select \u2014 Width overrides for combobox button */\n.notectl-toolbar-btn--font {\n\tmin-width: 100px;\n\tmax-width: 160px;\n}\n\n/* Font Picker Popup */\n.notectl-font-picker {\n\tmin-width: 200px;\n\tmax-height: 320px;\n\toverflow-y: auto;\n}\n\n.notectl-font-picker__list {\n\tpadding: 4px 0;\n}\n\n.notectl-font-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\tline-height: 1.4;\n\ttext-align: left;\n\twhite-space: nowrap;\n\tfont-family: inherit;\n\ttransition: background 0.1s;\n}\n\n.notectl-font-picker__item:hover {\n\tbackground: var(--notectl-hover-bg);\n}\n\n.notectl-font-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-font-picker__item--active:hover {\n\tbackground: var(--notectl-active-bg);\n}\n\n.notectl-font-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-font-picker__label {\n\tflex: 1;\n}\n\n.notectl-font-picker__separator {\n\theight: 1px;\n\tbackground: var(--notectl-border);\n\tmargin: 4px 8px;\n}\n";
|
|
3
3
|
//# sourceMappingURL=font-select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-select.d.ts","sourceRoot":"","sources":["../../../src/editor/styles/font-select.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"font-select.d.ts","sourceRoot":"","sources":["../../../src/editor/styles/font-select.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,eAAO,MAAM,eAAe,00CAqE3B,CAAC"}
|