@notectl/core 1.0.5 → 1.0.6
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 -1
- package/dist/chunks/{ToolbarPlugin-D5VqeBPT.mjs → ToolbarPlugin-sJTiZr-S.mjs} +2 -2
- package/dist/chunks/ToolbarPlugin-sJTiZr-S.mjs.map +1 -0
- package/dist/chunks/index-QvKiO9_4.mjs +538 -0
- package/dist/chunks/index-QvKiO9_4.mjs.map +1 -0
- package/dist/editor/EditorDOM.d.ts.map +1 -1
- package/dist/editor/NotectlEditor.d.ts +5 -1
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/notectl-core.mjs +1846 -1712
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +1050 -966
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/PluginManager.d.ts +3 -1
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockCommands.d.ts +5 -0
- package/dist/plugins/code-block/CodeBlockCommands.d.ts.map +1 -0
- package/dist/plugins/code-block/CodeBlockKeyboardHandlers.d.ts +10 -0
- package/dist/plugins/code-block/CodeBlockKeyboardHandlers.d.ts.map +1 -0
- package/dist/plugins/code-block/CodeBlockNodeView.d.ts +1 -1
- package/dist/plugins/code-block/CodeBlockNodeView.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts +3 -111
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockService.d.ts +5 -0
- package/dist/plugins/code-block/CodeBlockService.d.ts.map +1 -0
- package/dist/plugins/code-block/CodeBlockTypes.d.ts +69 -0
- package/dist/plugins/code-block/CodeBlockTypes.d.ts.map +1 -0
- package/dist/plugins/code-block.mjs +1 -1
- package/dist/plugins/font-size/FontSizeOperations.d.ts +22 -0
- package/dist/plugins/font-size/FontSizeOperations.d.ts.map +1 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts +1 -10
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePopup.d.ts +9 -0
- package/dist/plugins/font-size/FontSizePopup.d.ts.map +1 -0
- package/dist/plugins/font-size.mjs +146 -162
- package/dist/plugins/font-size.mjs.map +1 -1
- package/dist/plugins/font.mjs +1 -1
- package/dist/plugins/heading.mjs +1 -1
- package/dist/plugins/image/ImageNodeView.d.ts.map +1 -1
- package/dist/plugins/image.mjs +1 -1
- package/dist/plugins/image.mjs.map +1 -1
- package/dist/plugins/print/PrintContentPreparer.d.ts +12 -0
- package/dist/plugins/print/PrintContentPreparer.d.ts.map +1 -0
- package/dist/plugins/print/PrintPlugin.d.ts +12 -0
- package/dist/plugins/print/PrintPlugin.d.ts.map +1 -0
- package/dist/plugins/print/PrintServiceImpl.d.ts +7 -0
- package/dist/plugins/print/PrintServiceImpl.d.ts.map +1 -0
- package/dist/plugins/print/PrintStyleCollector.d.ts +10 -0
- package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -0
- package/dist/plugins/print/PrintTypes.d.ts +56 -0
- package/dist/plugins/print/PrintTypes.d.ts.map +1 -0
- package/dist/plugins/table/TableControls.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
- package/dist/plugins/table.mjs +13 -13
- package/dist/plugins/table.mjs.map +1 -1
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/view/Reconciler.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/ToolbarPlugin-D5VqeBPT.mjs.map +0 -1
- package/dist/chunks/index-CPPb-Jah.mjs +0 -569
- package/dist/chunks/index-CPPb-Jah.mjs.map +0 -1
|
@@ -1,11 +1,83 @@
|
|
|
1
|
-
import { t } from "../chunks/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { a as t } from "../chunks/ToolbarPlugin-sJTiZr-S.mjs";
|
|
2
|
+
import { t as e } from "../chunks/Commands-DLP85Mp5.mjs";
|
|
3
|
+
import { b as n } from "../chunks/AttrRegistry-DTsHyDVA.mjs";
|
|
4
|
+
import { e as o, h as i } from "../chunks/Document-CI3iCwEP.mjs";
|
|
5
|
+
import { i as r, a as s, s as a } from "../chunks/Selection-D5ZjXoB7.mjs";
|
|
5
6
|
import { m as c } from "../chunks/TypeBrands-C09nE2qO.mjs";
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
function l(t2) {
|
|
8
|
+
const e2 = t2.selection;
|
|
9
|
+
if (r(e2)) return null;
|
|
10
|
+
if (s(e2) && t2.storedMarks) return b(t2.storedMarks);
|
|
11
|
+
const n2 = t2.getBlock(e2.anchor.blockId);
|
|
12
|
+
return n2 ? b(o(n2, e2.anchor.offset)) : null;
|
|
13
|
+
}
|
|
14
|
+
function p(t2, e2) {
|
|
15
|
+
const n2 = l(t2);
|
|
16
|
+
if (!n2) return e2;
|
|
17
|
+
const o2 = Number.parseInt(n2, 10);
|
|
18
|
+
return Number.isNaN(o2) ? e2 : o2;
|
|
19
|
+
}
|
|
20
|
+
function u(t2, n2, i2) {
|
|
21
|
+
const l2 = n2.selection;
|
|
22
|
+
if (r(l2)) return false;
|
|
23
|
+
if (s(l2)) {
|
|
24
|
+
const e2 = n2.getBlock(l2.anchor.blockId);
|
|
25
|
+
if (!e2) return false;
|
|
26
|
+
const r2 = [...(n2.storedMarks ?? o(e2, l2.anchor.offset)).filter((t3) => "fontSize" !== t3.type), { type: c("fontSize"), attrs: { size: i2 } }], s2 = n2.transaction("command").setStoredMarks(r2, n2.storedMarks).setSelection(l2).build();
|
|
27
|
+
return t2.dispatch(s2), true;
|
|
28
|
+
}
|
|
29
|
+
const p2 = a(l2, n2.getBlockOrder()), u2 = n2.transaction("command"), f2 = { type: c("fontSize"), attrs: { size: i2 } };
|
|
30
|
+
return e(n2, p2, (t3, e2, n3) => {
|
|
31
|
+
u2.removeMark(t3, e2, n3, { type: c("fontSize") }), u2.addMark(t3, e2, n3, f2);
|
|
32
|
+
}), u2.setSelection(l2), t2.dispatch(u2.build()), true;
|
|
33
|
+
}
|
|
34
|
+
function f(t2, n2) {
|
|
35
|
+
const l2 = n2.selection;
|
|
36
|
+
if (r(l2)) return false;
|
|
37
|
+
if (s(l2)) {
|
|
38
|
+
const e2 = n2.getBlock(l2.anchor.blockId);
|
|
39
|
+
if (!e2) return false;
|
|
40
|
+
const r2 = n2.storedMarks ?? o(e2, l2.anchor.offset);
|
|
41
|
+
if (!i(r2, c("fontSize"))) return false;
|
|
42
|
+
const s2 = r2.filter((t3) => "fontSize" !== t3.type), a2 = n2.transaction("command").setStoredMarks(s2, n2.storedMarks).setSelection(l2).build();
|
|
43
|
+
return t2.dispatch(a2), true;
|
|
44
|
+
}
|
|
45
|
+
const p2 = a(l2, n2.getBlockOrder()), u2 = n2.transaction("command");
|
|
46
|
+
return e(n2, p2, (t3, e2, n3) => {
|
|
47
|
+
u2.removeMark(t3, e2, n3, { type: c("fontSize") });
|
|
48
|
+
}), u2.setSelection(l2), t2.dispatch(u2.build()), true;
|
|
49
|
+
}
|
|
50
|
+
function d(t2, e2, n2, o2, i2) {
|
|
51
|
+
const r2 = (function(t3, e3, n3) {
|
|
52
|
+
if ("up" === e3) {
|
|
53
|
+
for (const e4 of n3) if (e4 > t3) return e4;
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
for (let e4 = n3.length - 1; e4 >= 0; e4--) {
|
|
57
|
+
const o3 = n3[e4];
|
|
58
|
+
if (void 0 !== o3 && o3 < t3) return o3;
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
})(p(e2, i2), n2, o2);
|
|
62
|
+
return null !== r2 && (r2 === i2 ? f(t2, e2) : u(t2, e2, `${r2}px`));
|
|
63
|
+
}
|
|
64
|
+
function m(t2, e2, n2) {
|
|
65
|
+
e2 === n2 ? t2.executeCommand("removeFontSize") : u(t2, t2.getState(), `${e2}px`);
|
|
66
|
+
}
|
|
67
|
+
function b(t2) {
|
|
68
|
+
const e2 = t2.find((t3) => "fontSize" === t3.type);
|
|
69
|
+
return e2 && n(e2, "fontSize") ? e2.attrs.size ?? null : null;
|
|
70
|
+
}
|
|
71
|
+
function z(t2, e2) {
|
|
72
|
+
const n2 = document.createElement("button");
|
|
73
|
+
n2.type = "button", n2.id = `notectl-font-size-option-${t2}`, n2.className = "notectl-font-size-picker__item", n2.setAttribute("role", "option"), n2.setAttribute("aria-selected", String(e2)), e2 && n2.classList.add("notectl-font-size-picker__item--active");
|
|
74
|
+
const o2 = document.createElement("span");
|
|
75
|
+
o2.className = "notectl-font-size-picker__check", o2.textContent = e2 ? "✓" : "", n2.appendChild(o2);
|
|
76
|
+
const i2 = document.createElement("span");
|
|
77
|
+
return i2.className = "notectl-font-size-picker__label", i2.textContent = String(t2), n2.appendChild(i2), n2;
|
|
78
|
+
}
|
|
79
|
+
const g = [8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96];
|
|
80
|
+
class h {
|
|
9
81
|
id = "fontSize";
|
|
10
82
|
name = "Font Size";
|
|
11
83
|
priority = 21;
|
|
@@ -16,10 +88,10 @@ class u {
|
|
|
16
88
|
comboLabel = null;
|
|
17
89
|
constructor(t2) {
|
|
18
90
|
var e2;
|
|
19
|
-
this.config = { ...
|
|
20
|
-
if (!t3 || 0 === t3.length) return
|
|
91
|
+
this.config = { ...t2 }, this.sizes = (function(t3) {
|
|
92
|
+
if (!t3 || 0 === t3.length) return g;
|
|
21
93
|
const e3 = [...new Set(t3)].filter((t4) => Number.isInteger(t4) && t4 > 0);
|
|
22
|
-
return e3.sort((t4, e4) => t4 - e4), e3.length > 0 ? e3 :
|
|
94
|
+
return e3.sort((t4, e4) => t4 - e4), e3.length > 0 ? e3 : g;
|
|
23
95
|
})(t2?.sizes), this.defaultSize = (e2 = t2?.defaultSize, void 0 === e2 ? 16 : Number.isInteger(e2) && e2 > 0 ? e2 : 16);
|
|
24
96
|
}
|
|
25
97
|
init(t2) {
|
|
@@ -44,177 +116,89 @@ class u {
|
|
|
44
116
|
} }], sanitize: { tags: ["span"] } });
|
|
45
117
|
}
|
|
46
118
|
registerCommands(t2) {
|
|
47
|
-
t2.registerCommand("removeFontSize", () =>
|
|
48
|
-
const e2 = t2.getState();
|
|
49
|
-
return this.removeFontSize(t2, e2);
|
|
50
|
-
}), t2.registerCommand("setFontSize", () => false), t2.registerCommand("increaseFontSize", () => {
|
|
51
|
-
const e2 = t2.getState();
|
|
52
|
-
return this.stepFontSize(t2, e2, "up");
|
|
53
|
-
}), t2.registerCommand("decreaseFontSize", () => {
|
|
54
|
-
const e2 = t2.getState();
|
|
55
|
-
return this.stepFontSize(t2, e2, "down");
|
|
56
|
-
});
|
|
119
|
+
t2.registerCommand("removeFontSize", () => f(t2, t2.getState())), t2.registerCommand("setFontSize", () => false), t2.registerCommand("increaseFontSize", () => d(t2, t2.getState(), "up", this.sizes, this.defaultSize)), t2.registerCommand("decreaseFontSize", () => d(t2, t2.getState(), "down", this.sizes, this.defaultSize));
|
|
57
120
|
}
|
|
58
121
|
registerKeymaps(t2) {
|
|
59
|
-
t2.registerKeymap({ "Mod-Shift-+": () =>
|
|
60
|
-
const e2 = t2.getState();
|
|
61
|
-
return this.stepFontSize(t2, e2, "up");
|
|
62
|
-
}, "Mod-Shift-_": () => {
|
|
63
|
-
const e2 = t2.getState();
|
|
64
|
-
return this.stepFontSize(t2, e2, "down");
|
|
65
|
-
} });
|
|
122
|
+
t2.registerKeymap({ "Mod-Shift-+": () => d(t2, t2.getState(), "up", this.sizes, this.defaultSize), "Mod-Shift-_": () => d(t2, t2.getState(), "down", this.sizes, this.defaultSize) });
|
|
66
123
|
}
|
|
67
124
|
registerToolbarItem(t2) {
|
|
68
125
|
const e2 = `<span class="notectl-font-size-select__label" data-font-size-label>${this.defaultSize}</span><span class="notectl-font-size-select__arrow">▾</span>`;
|
|
69
126
|
t2.registerToolbarItem({ id: "fontSize", group: "format", icon: e2, label: "Font Size", tooltip: "Font Size", command: "removeFontSize", priority: 6, popupType: "custom", separatorAfter: this.config.separatorAfter, renderPopup: (t3, e3) => {
|
|
70
|
-
|
|
71
|
-
|
|
127
|
+
!(function(t4, e4, n2) {
|
|
128
|
+
t4.classList.add("notectl-font-size-picker");
|
|
129
|
+
const o2 = p(e4.getState(), n2.defaultSize), i2 = (function(t5) {
|
|
130
|
+
const e5 = document.createElement("input");
|
|
131
|
+
return e5.type = "number", e5.className = "notectl-font-size-picker__input", e5.min = String(1), e5.max = String(400), e5.value = String(t5), e5.setAttribute("aria-label", "Custom font size"), e5;
|
|
132
|
+
})(o2);
|
|
133
|
+
!(function(t5, e5) {
|
|
134
|
+
const n3 = document.createElement("div");
|
|
135
|
+
n3.className = "notectl-font-size-picker__input-wrapper", n3.appendChild(e5), t5.appendChild(n3);
|
|
136
|
+
})(t4, i2);
|
|
137
|
+
const { list: r2, items: s2 } = (function(t5, e5, n3, o3) {
|
|
138
|
+
const i3 = document.createElement("div");
|
|
139
|
+
i3.className = "notectl-font-size-picker__list", i3.setAttribute("role", "listbox"), i3.setAttribute("aria-label", "Font sizes");
|
|
140
|
+
const r3 = [];
|
|
141
|
+
for (const s3 of t5) {
|
|
142
|
+
const t6 = z(s3, s3 === e5);
|
|
143
|
+
t6.addEventListener("mousedown", (t7) => {
|
|
144
|
+
t7.preventDefault(), t7.stopPropagation(), m(n3, s3, o3.defaultSize), o3.dismissPopup();
|
|
145
|
+
}), r3.push(t6), i3.appendChild(t6);
|
|
146
|
+
}
|
|
147
|
+
return { list: i3, items: r3 };
|
|
148
|
+
})(n2.sizes, o2, e4, n2);
|
|
149
|
+
t4.appendChild(r2), (function(t5, e5, n3, o3) {
|
|
150
|
+
const i3 = e5.indexOf(n3);
|
|
151
|
+
if (i3 < 0) return;
|
|
152
|
+
const r3 = t5[i3];
|
|
153
|
+
r3 && (requestAnimationFrame(() => {
|
|
154
|
+
r3.scrollIntoView({ block: "nearest" });
|
|
155
|
+
}), o3.setAttribute("aria-activedescendant", r3.id));
|
|
156
|
+
})(s2, n2.sizes, o2, r2), (function(t5, e5, n3, o3, i3) {
|
|
157
|
+
let r3 = -1;
|
|
158
|
+
const s3 = (t6) => {
|
|
159
|
+
r3 >= 0 && r3 < n3.length && n3[r3]?.classList.remove("notectl-font-size-picker__item--focused"), r3 = t6;
|
|
160
|
+
const o4 = n3[r3];
|
|
161
|
+
r3 >= 0 && r3 < n3.length && o4 && (o4.classList.add("notectl-font-size-picker__item--focused"), o4.scrollIntoView({ block: "nearest" }), e5.setAttribute("aria-activedescendant", o4.id));
|
|
162
|
+
};
|
|
163
|
+
t5.addEventListener("keydown", (e6) => {
|
|
164
|
+
if ("Enter" === e6.key) {
|
|
165
|
+
e6.preventDefault();
|
|
166
|
+
const n4 = Number.parseInt(t5.value, 10);
|
|
167
|
+
!Number.isNaN(n4) && n4 >= 1 && n4 <= 400 && (m(o3, n4, i3.defaultSize), i3.dismissPopup());
|
|
168
|
+
} else "ArrowDown" === e6.key ? (e6.preventDefault(), s3(0), n3[0]?.focus()) : "Escape" === e6.key && (e6.preventDefault(), i3.dismissPopup());
|
|
169
|
+
}), e5.addEventListener("keydown", (e6) => {
|
|
170
|
+
if ("ArrowDown" === e6.key) e6.preventDefault(), r3 < n3.length - 1 && (s3(r3 + 1), n3[r3]?.focus());
|
|
171
|
+
else if ("ArrowUp" === e6.key) e6.preventDefault(), r3 > 0 ? (s3(r3 - 1), n3[r3]?.focus()) : (s3(-1), t5.focus());
|
|
172
|
+
else if ("Enter" === e6.key) {
|
|
173
|
+
e6.preventDefault();
|
|
174
|
+
const t6 = i3.sizes[r3];
|
|
175
|
+
r3 >= 0 && r3 < i3.sizes.length && void 0 !== t6 && (m(o3, t6, i3.defaultSize), i3.dismissPopup());
|
|
176
|
+
} else "Escape" === e6.key && (e6.preventDefault(), i3.dismissPopup());
|
|
177
|
+
});
|
|
178
|
+
})(i2, r2, s2, e4, n2);
|
|
179
|
+
})(t3, e3, { sizes: this.sizes, defaultSize: this.defaultSize, dismissPopup: () => this.dismissPopup() });
|
|
180
|
+
}, isActive: (t3) => (function(t4) {
|
|
181
|
+
return null !== l(t4);
|
|
182
|
+
})(t3) });
|
|
72
183
|
}
|
|
73
184
|
applyDefaultSizeToContainer(t2) {
|
|
74
185
|
t2.getContainer().style.fontSize = `${this.defaultSize}px`;
|
|
75
186
|
}
|
|
187
|
+
dismissPopup() {
|
|
188
|
+
const e2 = this.context?.getService(t);
|
|
189
|
+
e2?.closePopup();
|
|
190
|
+
}
|
|
76
191
|
updateComboLabel(t2) {
|
|
77
192
|
if (!this.comboLabel) {
|
|
78
193
|
const t3 = this.context?.getPluginContainer("top");
|
|
79
194
|
if (!t3) return;
|
|
80
195
|
if (this.comboLabel = t3.querySelector("[data-font-size-label]") ?? null, !this.comboLabel) return;
|
|
81
196
|
}
|
|
82
|
-
const e2 = this.
|
|
197
|
+
const e2 = p(t2, this.defaultSize);
|
|
83
198
|
this.comboLabel.textContent = String(e2);
|
|
84
199
|
}
|
|
85
|
-
isFontSizeActive(t2) {
|
|
86
|
-
return null !== this.getActiveSize(t2);
|
|
87
|
-
}
|
|
88
|
-
getActiveSize(t2) {
|
|
89
|
-
const o2 = t2.selection;
|
|
90
|
-
if (i(o2)) return null;
|
|
91
|
-
if (s(o2)) {
|
|
92
|
-
if (t2.storedMarks) {
|
|
93
|
-
const n2 = t2.storedMarks.find((t3) => "fontSize" === t3.type);
|
|
94
|
-
return n2 && e(n2, "fontSize") ? n2.attrs.size ?? null : null;
|
|
95
|
-
}
|
|
96
|
-
const i2 = t2.getBlock(o2.anchor.blockId);
|
|
97
|
-
if (!i2) return null;
|
|
98
|
-
const s2 = n(i2, o2.anchor.offset).find((t3) => "fontSize" === t3.type);
|
|
99
|
-
return s2 && e(s2, "fontSize") ? s2.attrs.size ?? null : null;
|
|
100
|
-
}
|
|
101
|
-
const r2 = t2.getBlock(o2.anchor.blockId);
|
|
102
|
-
if (!r2) return null;
|
|
103
|
-
const c2 = n(r2, o2.anchor.offset).find((t3) => "fontSize" === t3.type);
|
|
104
|
-
return c2 && e(c2, "fontSize") ? c2.attrs.size ?? null : null;
|
|
105
|
-
}
|
|
106
|
-
getActiveSizeNumeric(t2) {
|
|
107
|
-
const e2 = this.getActiveSize(t2);
|
|
108
|
-
if (!e2) return this.defaultSize;
|
|
109
|
-
const n2 = Number.parseInt(e2, 10);
|
|
110
|
-
return Number.isNaN(n2) ? this.defaultSize : n2;
|
|
111
|
-
}
|
|
112
|
-
applyFontSize(e2, o2, a2) {
|
|
113
|
-
const l2 = o2.selection;
|
|
114
|
-
if (i(l2)) return false;
|
|
115
|
-
if (s(l2)) {
|
|
116
|
-
const t2 = o2.getBlock(l2.anchor.blockId);
|
|
117
|
-
if (!t2) return false;
|
|
118
|
-
const i2 = [...(o2.storedMarks ?? n(t2, l2.anchor.offset)).filter((t3) => "fontSize" !== t3.type), { type: c("fontSize"), attrs: { size: a2 } }], s2 = o2.transaction("command").setStoredMarks(i2, o2.storedMarks).setSelection(l2).build();
|
|
119
|
-
return e2.dispatch(s2), true;
|
|
120
|
-
}
|
|
121
|
-
const p2 = r(l2, o2.getBlockOrder()), u2 = o2.transaction("command"), f = { type: c("fontSize"), attrs: { size: a2 } };
|
|
122
|
-
return t(o2, p2, (t2, e3, n2) => {
|
|
123
|
-
u2.removeMark(t2, e3, n2, { type: c("fontSize") }), u2.addMark(t2, e3, n2, f);
|
|
124
|
-
}), u2.setSelection(l2), e2.dispatch(u2.build()), true;
|
|
125
|
-
}
|
|
126
|
-
removeFontSize(e2, a2) {
|
|
127
|
-
const l2 = a2.selection;
|
|
128
|
-
if (i(l2)) return false;
|
|
129
|
-
if (s(l2)) {
|
|
130
|
-
const t2 = a2.getBlock(l2.anchor.blockId);
|
|
131
|
-
if (!t2) return false;
|
|
132
|
-
const i2 = a2.storedMarks ?? n(t2, l2.anchor.offset);
|
|
133
|
-
if (!o(i2, c("fontSize"))) return false;
|
|
134
|
-
const s2 = i2.filter((t3) => "fontSize" !== t3.type), r2 = a2.transaction("command").setStoredMarks(s2, a2.storedMarks).setSelection(l2).build();
|
|
135
|
-
return e2.dispatch(r2), true;
|
|
136
|
-
}
|
|
137
|
-
const p2 = r(l2, a2.getBlockOrder()), u2 = a2.transaction("command");
|
|
138
|
-
return t(a2, p2, (t2, e3, n2) => {
|
|
139
|
-
u2.removeMark(t2, e3, n2, { type: c("fontSize") });
|
|
140
|
-
}), u2.setSelection(l2), e2.dispatch(u2.build()), true;
|
|
141
|
-
}
|
|
142
|
-
stepFontSize(t2, e2, n2) {
|
|
143
|
-
const o2 = this.getActiveSizeNumeric(e2), i2 = this.getNextPresetSize(o2, n2);
|
|
144
|
-
return null !== i2 && (i2 === this.defaultSize ? this.removeFontSize(t2, e2) : this.applyFontSize(t2, e2, `${i2}px`));
|
|
145
|
-
}
|
|
146
|
-
getNextPresetSize(t2, e2) {
|
|
147
|
-
if ("up" === e2) {
|
|
148
|
-
for (const e3 of this.sizes) if (e3 > t2) return e3;
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
for (let e3 = this.sizes.length - 1; e3 >= 0; e3--) {
|
|
152
|
-
const n2 = this.sizes[e3];
|
|
153
|
-
if (void 0 !== n2 && n2 < t2) return n2;
|
|
154
|
-
}
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
dismissPopup() {
|
|
158
|
-
const t2 = this.context?.getService(a);
|
|
159
|
-
t2?.closePopup();
|
|
160
|
-
}
|
|
161
|
-
renderFontSizePopup(t2, e2) {
|
|
162
|
-
t2.classList.add("notectl-font-size-picker");
|
|
163
|
-
const n2 = e2.getState(), o2 = this.getActiveSizeNumeric(n2);
|
|
164
|
-
let i2 = -1;
|
|
165
|
-
const s2 = document.createElement("div");
|
|
166
|
-
s2.className = "notectl-font-size-picker__input-wrapper";
|
|
167
|
-
const r2 = document.createElement("input");
|
|
168
|
-
r2.type = "number", r2.className = "notectl-font-size-picker__input", r2.min = String(1), r2.max = String(400), r2.value = String(o2), r2.setAttribute("aria-label", "Custom font size"), s2.appendChild(r2), t2.appendChild(s2);
|
|
169
|
-
const c2 = document.createElement("div");
|
|
170
|
-
c2.className = "notectl-font-size-picker__list", c2.setAttribute("role", "listbox"), c2.setAttribute("aria-label", "Font sizes");
|
|
171
|
-
const a2 = [];
|
|
172
|
-
for (let t3 = 0; t3 < this.sizes.length; t3++) {
|
|
173
|
-
const n3 = this.sizes[t3];
|
|
174
|
-
if (void 0 === n3) continue;
|
|
175
|
-
const i3 = n3 === o2, s3 = `notectl-font-size-option-${n3}`, r3 = document.createElement("button");
|
|
176
|
-
r3.type = "button", r3.id = s3, r3.className = "notectl-font-size-picker__item", r3.setAttribute("role", "option"), r3.setAttribute("aria-selected", String(i3)), i3 && r3.classList.add("notectl-font-size-picker__item--active");
|
|
177
|
-
const l3 = document.createElement("span");
|
|
178
|
-
l3.className = "notectl-font-size-picker__check", l3.textContent = i3 ? "✓" : "", r3.appendChild(l3);
|
|
179
|
-
const p3 = document.createElement("span");
|
|
180
|
-
p3.className = "notectl-font-size-picker__label", p3.textContent = String(n3), r3.appendChild(p3), r3.addEventListener("mousedown", (t4) => {
|
|
181
|
-
t4.preventDefault(), t4.stopPropagation(), this.selectSize(e2, n3), this.dismissPopup();
|
|
182
|
-
}), a2.push(r3), c2.appendChild(r3);
|
|
183
|
-
}
|
|
184
|
-
t2.appendChild(c2);
|
|
185
|
-
const l2 = this.sizes.indexOf(o2);
|
|
186
|
-
if (l2 >= 0) {
|
|
187
|
-
const t3 = a2[l2];
|
|
188
|
-
t3 && (requestAnimationFrame(() => {
|
|
189
|
-
t3.scrollIntoView({ block: "nearest" });
|
|
190
|
-
}), c2.setAttribute("aria-activedescendant", t3.id));
|
|
191
|
-
}
|
|
192
|
-
const p2 = (t3) => {
|
|
193
|
-
i2 >= 0 && i2 < a2.length && a2[i2]?.classList.remove("notectl-font-size-picker__item--focused"), i2 = t3;
|
|
194
|
-
const e3 = a2[i2];
|
|
195
|
-
i2 >= 0 && i2 < a2.length && e3 && (e3.classList.add("notectl-font-size-picker__item--focused"), e3.scrollIntoView({ block: "nearest" }), c2.setAttribute("aria-activedescendant", e3.id));
|
|
196
|
-
};
|
|
197
|
-
r2.addEventListener("keydown", (t3) => {
|
|
198
|
-
if ("Enter" === t3.key) {
|
|
199
|
-
t3.preventDefault();
|
|
200
|
-
const n3 = Number.parseInt(r2.value, 10);
|
|
201
|
-
!Number.isNaN(n3) && n3 >= 1 && n3 <= 400 && (this.selectSize(e2, n3), this.dismissPopup());
|
|
202
|
-
} else "ArrowDown" === t3.key ? (t3.preventDefault(), p2(0), a2[0]?.focus()) : "Escape" === t3.key && (t3.preventDefault(), this.dismissPopup());
|
|
203
|
-
}), c2.addEventListener("keydown", (t3) => {
|
|
204
|
-
if ("ArrowDown" === t3.key) t3.preventDefault(), i2 < a2.length - 1 && (p2(i2 + 1), a2[i2]?.focus());
|
|
205
|
-
else if ("ArrowUp" === t3.key) t3.preventDefault(), i2 > 0 ? (p2(i2 - 1), a2[i2]?.focus()) : (p2(-1), r2.focus());
|
|
206
|
-
else if ("Enter" === t3.key) {
|
|
207
|
-
t3.preventDefault();
|
|
208
|
-
const n3 = this.sizes[i2];
|
|
209
|
-
i2 >= 0 && i2 < this.sizes.length && void 0 !== n3 && (this.selectSize(e2, n3), this.dismissPopup());
|
|
210
|
-
} else "Escape" === t3.key && (t3.preventDefault(), this.dismissPopup());
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
selectSize(t2, e2) {
|
|
214
|
-
e2 === this.defaultSize ? t2.executeCommand("removeFontSize") : this.applyFontSize(t2, t2.getState(), `${e2}px`);
|
|
215
|
-
}
|
|
216
200
|
}
|
|
217
201
|
export {
|
|
218
|
-
|
|
202
|
+
h as FontSizePlugin
|
|
219
203
|
};
|
|
220
204
|
//# sourceMappingURL=font-size.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"font-size.mjs","sources":["../../src/editor/styles/font-size-select.ts","../../src/plugins/font-size/FontSizePlugin.ts"],"sourcesContent":["/** Font size picker toolbar combobox + popup styles. */\nexport const FONT_SIZE_SELECT_CSS = `\n/* Font Size Select — Combobox-style toolbar button */\n.notectl-toolbar-btn--fontSize {\n\twidth: auto;\n\tmin-width: 60px;\n\tmax-width: 80px;\n\tpadding: 0 8px;\n\tgap: 4px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-bg);\n}\n\n.notectl-toolbar-btn--fontSize:hover {\n\tbackground: var(--notectl-hover-bg);\n\tborder-color: var(--notectl-fg-muted);\n}\n\n.notectl-toolbar-btn--fontSize.notectl-toolbar-btn--active {\n\tbackground: var(--notectl-bg);\n\tborder-color: var(--notectl-primary-muted);\n}\n\n.notectl-toolbar-btn--fontSize .notectl-toolbar-btn__icon {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 4px;\n\twidth: 100%;\n\toverflow: hidden;\n}\n\n.notectl-toolbar-btn--fontSize .notectl-toolbar-btn__icon svg {\n\tdisplay: none;\n}\n\n.notectl-font-size-select__label {\n\tflex: 1;\n\tfont-size: 13px;\n\tfont-weight: 500;\n\tcolor: var(--notectl-fg);\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\ttext-align: left;\n\tline-height: 30px;\n}\n\n.notectl-font-size-select__arrow {\n\tflex-shrink: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\tline-height: 30px;\n}\n\n/* Font Size Picker Popup */\n.notectl-font-size-picker {\n\tmin-width: 140px;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.notectl-font-size-picker__input-wrapper {\n\tpadding: 8px 8px 4px;\n}\n\n.notectl-font-size-picker__input {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tfont-family: inherit;\n\tcolor: var(--notectl-fg);\n\tbackground: var(--notectl-bg);\n\toutline: none;\n\tbox-sizing: border-box;\n\t-moz-appearance: textfield;\n}\n\n.notectl-font-size-picker__input::-webkit-inner-spin-button,\n.notectl-font-size-picker__input::-webkit-outer-spin-button {\n\t-webkit-appearance: none;\n\tmargin: 0;\n}\n\n.notectl-font-size-picker__input:focus {\n\tborder-color: var(--notectl-border-focus);\n\tbox-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n.notectl-font-size-picker__list {\n\tmax-height: 280px;\n\toverflow-y: auto;\n\tpadding: 4px 0;\n}\n\n.notectl-font-size-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\toutline: none;\n}\n\n.notectl-font-size-picker__item:hover {\n\tbackground: var(--notectl-hover-bg);\n}\n\n.notectl-font-size-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-font-size-picker__item--active:hover {\n\tbackground: var(--notectl-active-bg);\n}\n\n.notectl-font-size-picker__item--focused {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: -2px;\n}\n\n.notectl-font-size-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-size-picker__label {\n\tflex: 1;\n}\n`;\n","/**\n * FontSizePlugin: registers a fontSize mark with attrs, a combobox-style\n * toolbar selector with WCAG-accessible popup, and commands for\n * increasing / decreasing font size.\n */\n\nimport { forEachBlockInRange } from '../../commands/Commands.js';\nimport { FONT_SIZE_SELECT_CSS } from '../../editor/styles/font-size-select.js';\nimport { isMarkOfType } from '../../model/AttrRegistry.js';\nimport { getBlockMarksAtOffset, hasMark } from '../../model/Document.js';\nimport { isCollapsed, isNodeSelection, selectionRange } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { ToolbarServiceKey } from '../toolbar/ToolbarPlugin.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tfontSize: { size: string };\n\t}\n}\n\n// --- Constants ---\n\n/** Default preset sizes shown in the font size dropdown. */\nexport const DEFAULT_FONT_SIZES: readonly number[] = [\n\t8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96,\n];\n\nconst DEFAULT_FONT_SIZE = 16;\nconst MIN_CUSTOM_SIZE = 1;\nconst MAX_CUSTOM_SIZE = 400;\n\n// --- Configuration ---\n\nexport interface FontSizeConfig {\n\t/**\n\t * Preset sizes shown in the font size dropdown.\n\t * Must contain positive integers. Values are sorted and deduplicated automatically.\n\t * Defaults to {@link DEFAULT_FONT_SIZES} when omitted or empty.\n\t */\n\treadonly sizes?: readonly number[];\n\t/**\n\t * The base font size that text has when no fontSize mark is applied.\n\t * Shown as the initial value in the toolbar combo and used as the\n\t * \"neutral\" size — selecting it removes the mark instead of applying one.\n\t * Defaults to 16.\n\t */\n\treadonly defaultSize?: number;\n\t/** When true, a separator is rendered after the fontSize toolbar item. */\n\treadonly separatorAfter?: boolean;\n}\n\nconst DEFAULT_CONFIG: FontSizeConfig = {};\n\n// --- Plugin ---\n\nexport class FontSizePlugin implements Plugin {\n\treadonly id = 'fontSize';\n\treadonly name = 'Font Size';\n\treadonly priority = 21;\n\n\tprivate readonly config: FontSizeConfig;\n\tprivate readonly sizes: readonly number[];\n\tprivate readonly defaultSize: number;\n\tprivate context: PluginContext | null = null;\n\tprivate comboLabel: HTMLSpanElement | null = null;\n\n\tconstructor(config?: Partial<FontSizeConfig>) {\n\t\tthis.config = { ...DEFAULT_CONFIG, ...config };\n\t\tthis.sizes = resolveSizes(config?.sizes);\n\t\tthis.defaultSize = resolveDefaultSize(config?.defaultSize);\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tcontext.registerStyleSheet(FONT_SIZE_SELECT_CSS);\n\t\tthis.context = context;\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerToolbarItem(context);\n\t\tthis.applyDefaultSizeToContainer(context);\n\t}\n\n\tdestroy(): void {\n\t\tthis.context = null;\n\t\tthis.comboLabel = null;\n\t}\n\n\tonStateChange(_oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tthis.updateComboLabel(newState);\n\t}\n\n\t// --- Schema ---\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'fontSize',\n\t\t\trank: 4,\n\t\t\tattrs: {\n\t\t\t\tsize: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(mark) {\n\t\t\t\tconst span: HTMLElement = document.createElement('span');\n\t\t\t\tconst size: string = mark.attrs?.size ?? '';\n\t\t\t\tif (size) {\n\t\t\t\t\tspan.style.fontSize = size;\n\t\t\t\t}\n\t\t\t\treturn span;\n\t\t\t},\n\t\t\ttoHTMLString: (mark, content) => {\n\t\t\t\tconst size: string = String(mark.attrs?.size ?? '');\n\t\t\t\tif (!size) return content;\n\t\t\t\treturn `<span style=\"font-size: ${size}\">${content}</span>`;\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 size: string = el.style.fontSize;\n\t\t\t\t\t\tif (!size) return false;\n\t\t\t\t\t\treturn { size };\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\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('removeFontSize', () => {\n\t\t\tconst state: EditorState = context.getState();\n\t\t\treturn this.removeFontSize(context, state);\n\t\t});\n\n\t\tcontext.registerCommand('setFontSize', () => {\n\t\t\treturn false;\n\t\t});\n\n\t\tcontext.registerCommand('increaseFontSize', () => {\n\t\t\tconst state: EditorState = context.getState();\n\t\t\treturn this.stepFontSize(context, state, 'up');\n\t\t});\n\n\t\tcontext.registerCommand('decreaseFontSize', () => {\n\t\t\tconst state: EditorState = context.getState();\n\t\t\treturn this.stepFontSize(context, state, 'down');\n\t\t});\n\t}\n\n\t// --- Keymaps ---\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-+': () => {\n\t\t\t\tconst state: EditorState = context.getState();\n\t\t\t\treturn this.stepFontSize(context, state, 'up');\n\t\t\t},\n\t\t\t'Mod-Shift-_': () => {\n\t\t\t\tconst state: EditorState = context.getState();\n\t\t\t\treturn this.stepFontSize(context, state, 'down');\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon: string = `<span class=\"notectl-font-size-select__label\" data-font-size-label>${this.defaultSize}</span><span class=\"notectl-font-size-select__arrow\">\\u25BE</span>`;\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'fontSize',\n\t\t\tgroup: 'format',\n\t\t\ticon,\n\t\t\tlabel: 'Font Size',\n\t\t\ttooltip: 'Font Size',\n\t\t\tcommand: 'removeFontSize',\n\t\t\tpriority: 6,\n\t\t\tpopupType: 'custom',\n\t\t\tseparatorAfter: this.config.separatorAfter,\n\t\t\trenderPopup: (container, ctx) => {\n\t\t\t\tthis.renderFontSizePopup(container, ctx);\n\t\t\t},\n\t\t\tisActive: (state) => this.isFontSizeActive(state),\n\t\t});\n\t}\n\n\t/**\n\t * Sets the configured default font size on the editor content container\n\t * so that unformatted text renders at the correct size instead of the\n\t * browser default (16px).\n\t */\n\tprivate applyDefaultSizeToContainer(context: PluginContext): void {\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tcontainer.style.fontSize = `${this.defaultSize}px`;\n\t}\n\n\tprivate updateComboLabel(state: EditorState): void {\n\t\tif (!this.comboLabel) {\n\t\t\tconst container: HTMLElement | undefined = this.context?.getPluginContainer('top');\n\t\t\tif (!container) return;\n\t\t\tthis.comboLabel = container.querySelector<HTMLSpanElement>('[data-font-size-label]') ?? null;\n\t\t\tif (!this.comboLabel) return;\n\t\t}\n\n\t\tconst activeSize: number = this.getActiveSizeNumeric(state);\n\t\tthis.comboLabel.textContent = String(activeSize);\n\t}\n\n\t// --- State Queries ---\n\n\tprivate isFontSizeActive(state: EditorState): boolean {\n\t\treturn this.getActiveSize(state) !== null;\n\t}\n\n\tprivate getActiveSize(state: EditorState): string | null {\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel)) return null;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\tif (state.storedMarks) {\n\t\t\t\tconst mark = state.storedMarks.find((m) => m.type === 'fontSize');\n\t\t\t\treturn mark && isMarkOfType(mark, 'fontSize') ? (mark.attrs.size ?? null) : null;\n\t\t\t}\n\t\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!block) return null;\n\t\t\tconst marks = getBlockMarksAtOffset(block, sel.anchor.offset);\n\t\t\tconst mark = marks.find((m) => m.type === 'fontSize');\n\t\t\treturn mark && isMarkOfType(mark, 'fontSize') ? (mark.attrs.size ?? null) : null;\n\t\t}\n\n\t\tconst block = state.getBlock(sel.anchor.blockId);\n\t\tif (!block) return null;\n\t\tconst marks = getBlockMarksAtOffset(block, sel.anchor.offset);\n\t\tconst mark = marks.find((m) => m.type === 'fontSize');\n\t\treturn mark && isMarkOfType(mark, 'fontSize') ? (mark.attrs.size ?? null) : null;\n\t}\n\n\tprivate getActiveSizeNumeric(state: EditorState): number {\n\t\tconst raw: string | null = this.getActiveSize(state);\n\t\tif (!raw) return this.defaultSize;\n\t\tconst parsed: number = Number.parseInt(raw, 10);\n\t\treturn Number.isNaN(parsed) ? this.defaultSize : parsed;\n\t}\n\n\t// --- Font Size Application ---\n\n\tprivate applyFontSize(context: PluginContext, state: EditorState, size: string): boolean {\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel)) return false;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!anchorBlock) return false;\n\t\t\tconst currentMarks =\n\t\t\t\tstate.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\t\tconst withoutSize = currentMarks.filter((m) => m.type !== 'fontSize');\n\t\t\tconst newMarks = [...withoutSize, { type: markType('fontSize'), attrs: { size } }];\n\n\t\t\tconst tr = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setStoredMarks(newMarks, state.storedMarks)\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\tconst range = selectionRange(sel, state.getBlockOrder());\n\t\tconst builder = state.transaction('command');\n\t\tconst mark = { type: markType('fontSize'), attrs: { size } };\n\n\t\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\t\tbuilder.removeMark(blockId, from, to, { type: markType('fontSize') });\n\t\t\tbuilder.addMark(blockId, from, to, mark);\n\t\t});\n\n\t\tbuilder.setSelection(sel);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\tprivate removeFontSize(context: PluginContext, state: EditorState): boolean {\n\t\tconst sel = state.selection;\n\t\tif (isNodeSelection(sel)) return false;\n\n\t\tif (isCollapsed(sel)) {\n\t\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\t\tif (!anchorBlock) return false;\n\t\t\tconst currentMarks =\n\t\t\t\tstate.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\t\tif (!hasMark(currentMarks, markType('fontSize'))) return false;\n\n\t\t\tconst newMarks = currentMarks.filter((m) => m.type !== 'fontSize');\n\t\t\tconst tr = state\n\t\t\t\t.transaction('command')\n\t\t\t\t.setStoredMarks(newMarks, state.storedMarks)\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\tconst range = selectionRange(sel, state.getBlockOrder());\n\t\tconst builder = state.transaction('command');\n\n\t\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\t\tbuilder.removeMark(blockId, from, to, { type: markType('fontSize') });\n\t\t});\n\n\t\tbuilder.setSelection(sel);\n\t\tcontext.dispatch(builder.build());\n\t\treturn true;\n\t}\n\n\t// --- Increase / Decrease ---\n\n\tprivate stepFontSize(\n\t\tcontext: PluginContext,\n\t\tstate: EditorState,\n\t\tdirection: 'up' | 'down',\n\t): boolean {\n\t\tconst current: number = this.getActiveSizeNumeric(state);\n\t\tconst next: number | null = this.getNextPresetSize(current, direction);\n\t\tif (next === null) return false;\n\n\t\tif (next === this.defaultSize) {\n\t\t\treturn this.removeFontSize(context, state);\n\t\t}\n\t\treturn this.applyFontSize(context, state, `${next}px`);\n\t}\n\n\tprivate getNextPresetSize(current: number, direction: 'up' | 'down'): number | null {\n\t\tif (direction === 'up') {\n\t\t\tfor (const size of this.sizes) {\n\t\t\t\tif (size > current) return size;\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t\tfor (let i: number = this.sizes.length - 1; i >= 0; i--) {\n\t\t\tconst size: number | undefined = this.sizes[i];\n\t\t\tif (size !== undefined && size < current) return size;\n\t\t}\n\t\treturn null;\n\t}\n\n\t// --- Popup Rendering ---\n\n\tprivate dismissPopup(): void {\n\t\tconst toolbar = this.context?.getService(ToolbarServiceKey);\n\t\ttoolbar?.closePopup();\n\t}\n\n\tprivate renderFontSizePopup(container: HTMLElement, context: PluginContext): void {\n\t\tcontainer.classList.add('notectl-font-size-picker');\n\n\t\tconst state: EditorState = context.getState();\n\t\tconst currentSize: number = this.getActiveSizeNumeric(state);\n\t\tlet focusedIndex = -1;\n\n\t\t// --- Custom Input ---\n\t\tconst inputWrapper: HTMLDivElement = document.createElement('div');\n\t\tinputWrapper.className = 'notectl-font-size-picker__input-wrapper';\n\n\t\tconst input: HTMLInputElement = document.createElement('input');\n\t\tinput.type = 'number';\n\t\tinput.className = 'notectl-font-size-picker__input';\n\t\tinput.min = String(MIN_CUSTOM_SIZE);\n\t\tinput.max = String(MAX_CUSTOM_SIZE);\n\t\tinput.value = String(currentSize);\n\t\tinput.setAttribute('aria-label', 'Custom font size');\n\n\t\tinputWrapper.appendChild(input);\n\t\tcontainer.appendChild(inputWrapper);\n\n\t\t// --- List ---\n\t\tconst list: HTMLDivElement = document.createElement('div');\n\t\tlist.className = 'notectl-font-size-picker__list';\n\t\tlist.setAttribute('role', 'listbox');\n\t\tlist.setAttribute('aria-label', 'Font sizes');\n\n\t\tconst items: HTMLButtonElement[] = [];\n\n\t\tfor (let idx = 0; idx < this.sizes.length; idx++) {\n\t\t\tconst size: number | undefined = this.sizes[idx];\n\t\t\tif (size === undefined) continue;\n\t\t\tconst isActive: boolean = size === currentSize;\n\t\t\tconst itemId: string = `notectl-font-size-option-${size}`;\n\n\t\t\tconst item: HTMLButtonElement = document.createElement('button');\n\t\t\titem.type = 'button';\n\t\t\titem.id = itemId;\n\t\t\titem.className = 'notectl-font-size-picker__item';\n\t\t\titem.setAttribute('role', 'option');\n\t\t\titem.setAttribute('aria-selected', String(isActive));\n\n\t\t\tif (isActive) {\n\t\t\t\titem.classList.add('notectl-font-size-picker__item--active');\n\t\t\t}\n\n\t\t\tconst check: HTMLSpanElement = document.createElement('span');\n\t\t\tcheck.className = 'notectl-font-size-picker__check';\n\t\t\tcheck.textContent = isActive ? '\\u2713' : '';\n\t\t\titem.appendChild(check);\n\n\t\t\tconst label: HTMLSpanElement = document.createElement('span');\n\t\t\tlabel.className = 'notectl-font-size-picker__label';\n\t\t\tlabel.textContent = String(size);\n\t\t\titem.appendChild(label);\n\n\t\t\titem.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t\tthis.selectSize(context, size);\n\t\t\t\tthis.dismissPopup();\n\t\t\t});\n\n\t\t\titems.push(item);\n\t\t\tlist.appendChild(item);\n\t\t}\n\n\t\tcontainer.appendChild(list);\n\n\t\t// --- Scroll active item into view ---\n\t\tconst activeIdx: number = this.sizes.indexOf(currentSize);\n\t\tif (activeIdx >= 0) {\n\t\t\tconst activeItem: HTMLButtonElement | undefined = items[activeIdx];\n\t\t\tif (activeItem) {\n\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\tactiveItem.scrollIntoView({ block: 'nearest' });\n\t\t\t\t});\n\t\t\t\tlist.setAttribute('aria-activedescendant', activeItem.id);\n\t\t\t}\n\t\t}\n\n\t\t// --- Keyboard helpers ---\n\t\tconst setFocusedIndex = (idx: number): void => {\n\t\t\tif (focusedIndex >= 0 && focusedIndex < items.length) {\n\t\t\t\titems[focusedIndex]?.classList.remove('notectl-font-size-picker__item--focused');\n\t\t\t}\n\t\t\tfocusedIndex = idx;\n\t\t\tconst focused: HTMLButtonElement | undefined = items[focusedIndex];\n\t\t\tif (focusedIndex >= 0 && focusedIndex < items.length && focused) {\n\t\t\t\tfocused.classList.add('notectl-font-size-picker__item--focused');\n\t\t\t\tfocused.scrollIntoView({ block: 'nearest' });\n\t\t\t\tlist.setAttribute('aria-activedescendant', focused.id);\n\t\t\t}\n\t\t};\n\n\t\t// --- Input Events ---\n\t\tinput.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\t\tif (e.key === 'Enter') {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst val: number = Number.parseInt(input.value, 10);\n\t\t\t\tif (!Number.isNaN(val) && val >= MIN_CUSTOM_SIZE && val <= MAX_CUSTOM_SIZE) {\n\t\t\t\t\tthis.selectSize(context, val);\n\t\t\t\t\tthis.dismissPopup();\n\t\t\t\t}\n\t\t\t} else if (e.key === 'ArrowDown') {\n\t\t\t\te.preventDefault();\n\t\t\t\tsetFocusedIndex(0);\n\t\t\t\titems[0]?.focus();\n\t\t\t} else if (e.key === 'Escape') {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.dismissPopup();\n\t\t\t}\n\t\t});\n\n\t\t// --- List Keyboard Navigation ---\n\t\tlist.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\t\tif (e.key === 'ArrowDown') {\n\t\t\t\te.preventDefault();\n\t\t\t\tif (focusedIndex < items.length - 1) {\n\t\t\t\t\tsetFocusedIndex(focusedIndex + 1);\n\t\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\t}\n\t\t\t} else if (e.key === 'ArrowUp') {\n\t\t\t\te.preventDefault();\n\t\t\t\tif (focusedIndex > 0) {\n\t\t\t\t\tsetFocusedIndex(focusedIndex - 1);\n\t\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t\t} else {\n\t\t\t\t\tsetFocusedIndex(-1);\n\t\t\t\t\tinput.focus();\n\t\t\t\t}\n\t\t\t} else if (e.key === 'Enter') {\n\t\t\t\te.preventDefault();\n\t\t\t\tconst selectedSize: number | undefined = this.sizes[focusedIndex];\n\t\t\t\tif (focusedIndex >= 0 && focusedIndex < this.sizes.length && selectedSize !== undefined) {\n\t\t\t\t\tthis.selectSize(context, selectedSize);\n\t\t\t\t\tthis.dismissPopup();\n\t\t\t\t}\n\t\t\t} else if (e.key === 'Escape') {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.dismissPopup();\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate selectSize(context: PluginContext, size: number): void {\n\t\tif (size === this.defaultSize) {\n\t\t\tcontext.executeCommand('removeFontSize');\n\t\t} else {\n\t\t\tthis.applyFontSize(context, context.getState(), `${size}px`);\n\t\t}\n\t}\n}\n\n// --- Helpers ---\n\nfunction resolveSizes(sizes: readonly number[] | undefined): readonly number[] {\n\tif (!sizes || sizes.length === 0) return DEFAULT_FONT_SIZES;\n\tconst unique: number[] = [...new Set(sizes)].filter((n) => Number.isInteger(n) && n > 0);\n\tunique.sort((a, b) => a - b);\n\treturn unique.length > 0 ? unique : DEFAULT_FONT_SIZES;\n}\n\nfunction resolveDefaultSize(size: number | undefined): number {\n\tif (size === undefined) return DEFAULT_FONT_SIZE;\n\treturn Number.isInteger(size) && size > 0 ? size : DEFAULT_FONT_SIZE;\n}\n"],"names":["DEFAULT_FONT_SIZES","DEFAULT_CONFIG","FontSizePlugin","id","name","priority","config","sizes","defaultSize","context","comboLabel","size","this","length","unique","Set","filter","n","Number","isInteger","sort","a","b","registerStyleSheet","registerMarkSpec","registerCommands","registerKeymaps","registerToolbarItem","applyDefaultSizeToContainer","destroy","_oldState","newState","_tr","updateComboLabel","type","rank","attrs","default","mark","span","document","createElement","style","fontSize","toHTMLString","content","String","parseHTML","tag","getAttrs","el","sanitize","tags","registerCommand","state","getState","removeFontSize","stepFontSize","registerKeymap","icon","group","label","tooltip","command","popupType","separatorAfter","renderPopup","container","ctx","renderFontSizePopup","isActive","isFontSizeActive","getContainer","getPluginContainer","querySelector","activeSize","getActiveSizeNumeric","textContent","getActiveSize","sel","selection","isNodeSelection","isCollapsed","storedMarks","find","m","isMarkOfType","block","getBlock","anchor","blockId","getBlockMarksAtOffset","offset","raw","parsed","parseInt","isNaN","anchorBlock","newMarks","markType","tr","transaction","setStoredMarks","setSelection","build","dispatch","range","selectionRange","getBlockOrder","builder","forEachBlockInRange","from","to","removeMark","addMark","currentMarks","hasMark","direction","current","next","getNextPresetSize","applyFontSize","i","toolbar","getService","ToolbarServiceKey","closePopup","classList","add","currentSize","focusedIndex","inputWrapper","className","input","min","max","value","setAttribute","appendChild","list","items","idx","itemId","item","check","addEventListener","e","preventDefault","stopPropagation","selectSize","dismissPopup","push","activeIdx","indexOf","activeItem","requestAnimationFrame","scrollIntoView","setFocusedIndex","remove","focused","key","val","focus","selectedSize","executeCommand"],"mappings":";;;;;;AACO,MC2BMA,IAAwC,CACpD,GAAG,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAA,GA2BzDC,IAAiC,CAAA;AAIhC,MAAMC,EAAAA;AAAAA,EACHC,KAAK;AAAA,EACLC,OAAO;AAAA,EACPC,WAAW;AAAA,EAEHC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACTC,UAAgC;AAAA,EAChCC,aAAqC;AAAA,EAE7C,YAAYJ;AAmcb,QAA4BK;AAlc1BC,SAAKN,SAAS,KAAKL,GAAAA,GAAmBK,GAAAA,GACtCM,KAAKL,SA0bP,SAAsBA,IAAAA;AACrB,UAAA,CAAKA,MAA0B,MAAjBA,GAAMM,OAAc,QAAOb;AACzC,YAAMc,KAAmB,CAAA,GAAI,IAAIC,IAAIR,EAAAA,CAAAA,EAAQS,OAAQC,CAAAA,OAAMC,OAAOC,UAAUF,OAAMA,KAAI,CAAA;AAEtF,aADAH,GAAOM,KAAK,CAACC,IAAGC,OAAMD,KAAIC,KACnBR,GAAOD,SAAS,IAAIC,KAASd;AAAAA,IACrC,GA/b4BM,IAAQC,KAAAA,GAClCK,KAAKJ,eAgcqBG,KAhcYL,IAAQE,aAAAA,WAic3CG,KA3eqB,KA4elBO,OAAOC,UAAUR,OAASA,KAAO,IAAIA,KA5enB;AAAA,EA2CzB;AAAA,EAEA,KAAKF,IAAAA;AACJA,IAAAA,GAAQc,mBD7E0B,wkGAAA,GC8ElCX,KAAKH,UAAUA,IACfG,KAAKY,iBAAiBf,EAAAA,GACtBG,KAAKa,iBAAiBhB,KACtBG,KAAKc,gBAAgBjB,EAAAA,GACrBG,KAAKe,oBAAoBlB,EAAAA,GACzBG,KAAKgB,4BAA4BnB,EAAAA;AAAAA,EAClC;AAAA,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B,KAAmCvJ,KAAKL,MAAM2H;AAChDA,QAAAA,MAAgB,KAAKA,KAAetH,KAAKL,MAAMM,UAAAA,WAAUsJ,OAC5DvJ,KAAKyI,WAAW5I,IAAS0J,EAAAA,GACzBvJ,KAAK0I,aAAAA;AAAAA,MAEP,MAAqB,cAAVJ,GAAEc,QACZd,GAAEC,kBACFvI,KAAK0I,aAAAA;AAAAA,IAAAA,CAAAA;AAAAA,EAGR;AAAA,EAEQ,WAAW7I,IAAwBE,IAAAA;AACtCA,IAAAA,OAASC,KAAKJ,cACjBC,GAAQ2J,eAAe,gBAAA,IAEvBxJ,KAAK6G,cAAchH,IAASA,GAAQ8C,SAAAA,GAAY,GAAG5C;EAErD;AAAA;"}
|
|
1
|
+
{"version":3,"file":"font-size.mjs","sources":["../../src/plugins/font-size/FontSizeOperations.ts","../../src/plugins/font-size/FontSizePopup.ts","../../src/plugins/font-size/FontSizePlugin.ts","../../src/editor/styles/font-size-select.ts"],"sourcesContent":["/**\n * Pure business logic for font-size state queries and transaction builders.\n * All functions are DOM-free and operate on EditorState / PluginContext.\n */\n\nimport { forEachBlockInRange } from '../../commands/Commands.js';\nimport { isMarkOfType } from '../../model/AttrRegistry.js';\nimport type { Mark } from '../../model/Document.js';\nimport { getBlockMarksAtOffset, hasMark } from '../../model/Document.js';\nimport { isCollapsed, isNodeSelection, selectionRange } from '../../model/Selection.js';\nimport { markType } from '../../model/TypeBrands.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { PluginContext } from '../Plugin.js';\n\n// --- State Queries ---\n\n/** Returns the raw fontSize CSS value at the current selection, or null. */\nexport function getActiveSize(state: EditorState): string | null {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel)) return null;\n\n\tif (isCollapsed(sel) && state.storedMarks) {\n\t\treturn extractFontSize(state.storedMarks);\n\t}\n\n\tconst block = state.getBlock(sel.anchor.blockId);\n\tif (!block) return null;\n\treturn extractFontSize(getBlockMarksAtOffset(block, sel.anchor.offset));\n}\n\n/** Returns the active font size as a number, falling back to defaultSize. */\nexport function getActiveSizeNumeric(state: EditorState, defaultSize: number): number {\n\tconst raw: string | null = getActiveSize(state);\n\tif (!raw) return defaultSize;\n\tconst parsed: number = Number.parseInt(raw, 10);\n\treturn Number.isNaN(parsed) ? defaultSize : parsed;\n}\n\n/** Returns true when the selection carries a fontSize mark. */\nexport function isFontSizeActive(state: EditorState): boolean {\n\treturn getActiveSize(state) !== null;\n}\n\n// --- Commands ---\n\n/** Applies a fontSize mark with the given CSS size string to the selection. */\nexport function applyFontSize(context: PluginContext, state: EditorState, size: string): boolean {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel)) return false;\n\n\tif (isCollapsed(sel)) {\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return false;\n\t\tconst currentMarks = state.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\tconst withoutSize = currentMarks.filter((m) => m.type !== 'fontSize');\n\t\tconst newMarks = [...withoutSize, { type: markType('fontSize'), attrs: { size } }];\n\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\tconst mark = { type: markType('fontSize'), attrs: { size } };\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tbuilder.removeMark(blockId, from, to, { type: markType('fontSize') });\n\t\tbuilder.addMark(blockId, from, to, mark);\n\t});\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Removes the fontSize mark from the current selection. */\nexport function removeFontSize(context: PluginContext, state: EditorState): boolean {\n\tconst sel = state.selection;\n\tif (isNodeSelection(sel)) return false;\n\n\tif (isCollapsed(sel)) {\n\t\tconst anchorBlock = state.getBlock(sel.anchor.blockId);\n\t\tif (!anchorBlock) return false;\n\t\tconst currentMarks = state.storedMarks ?? getBlockMarksAtOffset(anchorBlock, sel.anchor.offset);\n\t\tif (!hasMark(currentMarks, markType('fontSize'))) return false;\n\n\t\tconst newMarks = currentMarks.filter((m) => m.type !== 'fontSize');\n\t\tconst tr = state\n\t\t\t.transaction('command')\n\t\t\t.setStoredMarks(newMarks, state.storedMarks)\n\t\t\t.setSelection(sel)\n\t\t\t.build();\n\t\tcontext.dispatch(tr);\n\t\treturn true;\n\t}\n\n\tconst range = selectionRange(sel, state.getBlockOrder());\n\tconst builder = state.transaction('command');\n\n\tforEachBlockInRange(state, range, (blockId, from, to) => {\n\t\tbuilder.removeMark(blockId, from, to, { type: markType('fontSize') });\n\t});\n\n\tbuilder.setSelection(sel);\n\tcontext.dispatch(builder.build());\n\treturn true;\n}\n\n/** Steps the font size up or down through the preset list. */\nexport function stepFontSize(\n\tcontext: PluginContext,\n\tstate: EditorState,\n\tdirection: 'up' | 'down',\n\tsizes: readonly number[],\n\tdefaultSize: number,\n): boolean {\n\tconst current: number = getActiveSizeNumeric(state, defaultSize);\n\tconst next: number | null = getNextPresetSize(current, direction, sizes);\n\tif (next === null) return false;\n\n\tif (next === defaultSize) {\n\t\treturn removeFontSize(context, state);\n\t}\n\treturn applyFontSize(context, state, `${next}px`);\n}\n\n/**\n * Selects a specific font size: removes the mark when size equals the\n * default, otherwise applies the new size.\n */\nexport function selectSize(context: PluginContext, size: number, defaultSize: number): void {\n\tif (size === defaultSize) {\n\t\tcontext.executeCommand('removeFontSize');\n\t} else {\n\t\tapplyFontSize(context, context.getState(), `${size}px`);\n\t}\n}\n\n// --- Helpers ---\n\n/** Finds the next preset size in the given direction, or null at boundaries. */\nexport function getNextPresetSize(\n\tcurrent: number,\n\tdirection: 'up' | 'down',\n\tsizes: readonly number[],\n): number | null {\n\tif (direction === 'up') {\n\t\tfor (const size of sizes) {\n\t\t\tif (size > current) return size;\n\t\t}\n\t\treturn null;\n\t}\n\tfor (let i: number = sizes.length - 1; i >= 0; i--) {\n\t\tconst size: number | undefined = sizes[i];\n\t\tif (size !== undefined && size < current) return size;\n\t}\n\treturn null;\n}\n\nfunction extractFontSize(marks: readonly Mark[]): string | null {\n\tconst mark = marks.find((m) => m.type === 'fontSize');\n\treturn mark && isMarkOfType(mark, 'fontSize') ? (mark.attrs.size ?? null) : null;\n}\n","/**\n * Renders the font-size picker popup with a custom numeric input\n * and an accessible preset list with keyboard navigation.\n */\n\nimport type { PluginContext } from '../Plugin.js';\nimport { getActiveSizeNumeric, selectSize } from './FontSizeOperations.js';\n\n// --- Constants ---\n\nconst MIN_CUSTOM_SIZE = 1;\nconst MAX_CUSTOM_SIZE = 400;\n\n// --- Config ---\n\nexport interface FontSizePopupConfig {\n\treadonly sizes: readonly number[];\n\treadonly defaultSize: number;\n\treadonly dismissPopup: () => void;\n}\n\n// --- Public Entry Point ---\n\n/** Builds the font-size picker DOM inside the given container. */\nexport function renderFontSizePopup(\n\tcontainer: HTMLElement,\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): void {\n\tcontainer.classList.add('notectl-font-size-picker');\n\n\tconst currentSize: number = getActiveSizeNumeric(context.getState(), config.defaultSize);\n\n\tconst input: HTMLInputElement = buildCustomInput(currentSize);\n\tappendInputWrapper(container, input);\n\n\tconst { list, items } = buildSizeList(config.sizes, currentSize, context, config);\n\tcontainer.appendChild(list);\n\n\tscrollActiveIntoView(items, config.sizes, currentSize, list);\n\tattachKeyboardNavigation(input, list, items, context, config);\n}\n\n// --- Custom Input ---\n\nfunction buildCustomInput(currentSize: number): HTMLInputElement {\n\tconst input: HTMLInputElement = document.createElement('input');\n\tinput.type = 'number';\n\tinput.className = 'notectl-font-size-picker__input';\n\tinput.min = String(MIN_CUSTOM_SIZE);\n\tinput.max = String(MAX_CUSTOM_SIZE);\n\tinput.value = String(currentSize);\n\tinput.setAttribute('aria-label', 'Custom font size');\n\treturn input;\n}\n\nfunction appendInputWrapper(container: HTMLElement, input: HTMLInputElement): void {\n\tconst wrapper: HTMLDivElement = document.createElement('div');\n\twrapper.className = 'notectl-font-size-picker__input-wrapper';\n\twrapper.appendChild(input);\n\tcontainer.appendChild(wrapper);\n}\n\n// --- Size List ---\n\ninterface SizeListResult {\n\treadonly list: HTMLDivElement;\n\treadonly items: HTMLButtonElement[];\n}\n\nfunction buildSizeList(\n\tsizes: readonly number[],\n\tcurrentSize: number,\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): SizeListResult {\n\tconst list: HTMLDivElement = document.createElement('div');\n\tlist.className = 'notectl-font-size-picker__list';\n\tlist.setAttribute('role', 'listbox');\n\tlist.setAttribute('aria-label', 'Font sizes');\n\n\tconst items: HTMLButtonElement[] = [];\n\n\tfor (const size of sizes) {\n\t\tconst isActive: boolean = size === currentSize;\n\t\tconst item: HTMLButtonElement = buildSizeItem(size, isActive);\n\n\t\titem.addEventListener('mousedown', (e: MouseEvent) => {\n\t\t\te.preventDefault();\n\t\t\te.stopPropagation();\n\t\t\tselectSize(context, size, config.defaultSize);\n\t\t\tconfig.dismissPopup();\n\t\t});\n\n\t\titems.push(item);\n\t\tlist.appendChild(item);\n\t}\n\n\treturn { list, items };\n}\n\nfunction buildSizeItem(size: number, isActive: boolean): HTMLButtonElement {\n\tconst item: HTMLButtonElement = document.createElement('button');\n\titem.type = 'button';\n\titem.id = `notectl-font-size-option-${size}`;\n\titem.className = 'notectl-font-size-picker__item';\n\titem.setAttribute('role', 'option');\n\titem.setAttribute('aria-selected', String(isActive));\n\n\tif (isActive) {\n\t\titem.classList.add('notectl-font-size-picker__item--active');\n\t}\n\n\tconst check: HTMLSpanElement = document.createElement('span');\n\tcheck.className = 'notectl-font-size-picker__check';\n\tcheck.textContent = isActive ? '\\u2713' : '';\n\titem.appendChild(check);\n\n\tconst label: HTMLSpanElement = document.createElement('span');\n\tlabel.className = 'notectl-font-size-picker__label';\n\tlabel.textContent = String(size);\n\titem.appendChild(label);\n\n\treturn item;\n}\n\n// --- Scroll ---\n\nfunction scrollActiveIntoView(\n\titems: HTMLButtonElement[],\n\tsizes: readonly number[],\n\tcurrentSize: number,\n\tlist: HTMLDivElement,\n): void {\n\tconst activeIdx: number = sizes.indexOf(currentSize);\n\tif (activeIdx < 0) return;\n\n\tconst activeItem: HTMLButtonElement | undefined = items[activeIdx];\n\tif (!activeItem) return;\n\n\trequestAnimationFrame(() => {\n\t\tactiveItem.scrollIntoView({ block: 'nearest' });\n\t});\n\tlist.setAttribute('aria-activedescendant', activeItem.id);\n}\n\n// --- Keyboard Navigation ---\n\nfunction attachKeyboardNavigation(\n\tinput: HTMLInputElement,\n\tlist: HTMLDivElement,\n\titems: HTMLButtonElement[],\n\tcontext: PluginContext,\n\tconfig: FontSizePopupConfig,\n): void {\n\tlet focusedIndex = -1;\n\n\tconst setFocused = (idx: number): void => {\n\t\tif (focusedIndex >= 0 && focusedIndex < items.length) {\n\t\t\titems[focusedIndex]?.classList.remove('notectl-font-size-picker__item--focused');\n\t\t}\n\t\tfocusedIndex = idx;\n\t\tconst el: HTMLButtonElement | undefined = items[focusedIndex];\n\t\tif (focusedIndex >= 0 && focusedIndex < items.length && el) {\n\t\t\tel.classList.add('notectl-font-size-picker__item--focused');\n\t\t\tel.scrollIntoView({ block: 'nearest' });\n\t\t\tlist.setAttribute('aria-activedescendant', el.id);\n\t\t}\n\t};\n\n\tinput.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'Enter') {\n\t\t\te.preventDefault();\n\t\t\tconst val: number = Number.parseInt(input.value, 10);\n\t\t\tif (!Number.isNaN(val) && val >= MIN_CUSTOM_SIZE && val <= MAX_CUSTOM_SIZE) {\n\t\t\t\tselectSize(context, val, config.defaultSize);\n\t\t\t\tconfig.dismissPopup();\n\t\t\t}\n\t\t} else if (e.key === 'ArrowDown') {\n\t\t\te.preventDefault();\n\t\t\tsetFocused(0);\n\t\t\titems[0]?.focus();\n\t\t} else if (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tconfig.dismissPopup();\n\t\t}\n\t});\n\n\tlist.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\tif (e.key === 'ArrowDown') {\n\t\t\te.preventDefault();\n\t\t\tif (focusedIndex < items.length - 1) {\n\t\t\t\tsetFocused(focusedIndex + 1);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t}\n\t\t} else if (e.key === 'ArrowUp') {\n\t\t\te.preventDefault();\n\t\t\tif (focusedIndex > 0) {\n\t\t\t\tsetFocused(focusedIndex - 1);\n\t\t\t\titems[focusedIndex]?.focus();\n\t\t\t} else {\n\t\t\t\tsetFocused(-1);\n\t\t\t\tinput.focus();\n\t\t\t}\n\t\t} else if (e.key === 'Enter') {\n\t\t\te.preventDefault();\n\t\t\tconst selectedSize: number | undefined = config.sizes[focusedIndex];\n\t\t\tif (focusedIndex >= 0 && focusedIndex < config.sizes.length && selectedSize !== undefined) {\n\t\t\t\tselectSize(context, selectedSize, config.defaultSize);\n\t\t\t\tconfig.dismissPopup();\n\t\t\t}\n\t\t} else if (e.key === 'Escape') {\n\t\t\te.preventDefault();\n\t\t\tconfig.dismissPopup();\n\t\t}\n\t});\n}\n","/**\n * FontSizePlugin: registers a fontSize mark with attrs, a combobox-style\n * toolbar selector with WCAG-accessible popup, and commands for\n * increasing / decreasing font size.\n */\n\nimport { FONT_SIZE_SELECT_CSS } from '../../editor/styles/font-size-select.js';\nimport type { EditorState } from '../../state/EditorState.js';\nimport type { Transaction } from '../../state/Transaction.js';\nimport type { Plugin, PluginContext } from '../Plugin.js';\nimport { ToolbarServiceKey } from '../toolbar/ToolbarPlugin.js';\nimport {\n\tgetActiveSizeNumeric,\n\tisFontSizeActive,\n\tremoveFontSize,\n\tstepFontSize,\n} from './FontSizeOperations.js';\nimport { renderFontSizePopup } from './FontSizePopup.js';\n\n// --- Attribute Registry Augmentation ---\n\ndeclare module '../../model/AttrRegistry.js' {\n\tinterface MarkAttrRegistry {\n\t\tfontSize: { size: string };\n\t}\n}\n\n// --- Constants ---\n\n/** Default preset sizes shown in the font size dropdown. */\nexport const DEFAULT_FONT_SIZES: readonly number[] = [\n\t8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 64, 72, 96,\n];\n\nconst DEFAULT_FONT_SIZE = 16;\n\n// --- Configuration ---\n\nexport interface FontSizeConfig {\n\t/**\n\t * Preset sizes shown in the font size dropdown.\n\t * Must contain positive integers. Values are sorted and deduplicated automatically.\n\t * Defaults to {@link DEFAULT_FONT_SIZES} when omitted or empty.\n\t */\n\treadonly sizes?: readonly number[];\n\t/**\n\t * The base font size that text has when no fontSize mark is applied.\n\t * Shown as the initial value in the toolbar combo and used as the\n\t * \"neutral\" size — selecting it removes the mark instead of applying one.\n\t * Defaults to 16.\n\t */\n\treadonly defaultSize?: number;\n\t/** When true, a separator is rendered after the fontSize toolbar item. */\n\treadonly separatorAfter?: boolean;\n}\n\n// --- Plugin ---\n\nexport class FontSizePlugin implements Plugin {\n\treadonly id = 'fontSize';\n\treadonly name = 'Font Size';\n\treadonly priority = 21;\n\n\tprivate readonly config: FontSizeConfig;\n\tprivate readonly sizes: readonly number[];\n\tprivate readonly defaultSize: number;\n\tprivate context: PluginContext | null = null;\n\tprivate comboLabel: HTMLSpanElement | null = null;\n\n\tconstructor(config?: Partial<FontSizeConfig>) {\n\t\tthis.config = { ...config };\n\t\tthis.sizes = resolveSizes(config?.sizes);\n\t\tthis.defaultSize = resolveDefaultSize(config?.defaultSize);\n\t}\n\n\tinit(context: PluginContext): void {\n\t\tcontext.registerStyleSheet(FONT_SIZE_SELECT_CSS);\n\t\tthis.context = context;\n\t\tthis.registerMarkSpec(context);\n\t\tthis.registerCommands(context);\n\t\tthis.registerKeymaps(context);\n\t\tthis.registerToolbarItem(context);\n\t\tthis.applyDefaultSizeToContainer(context);\n\t}\n\n\tdestroy(): void {\n\t\tthis.context = null;\n\t\tthis.comboLabel = null;\n\t}\n\n\tonStateChange(_oldState: EditorState, newState: EditorState, _tr: Transaction): void {\n\t\tthis.updateComboLabel(newState);\n\t}\n\n\t// --- Schema ---\n\n\tprivate registerMarkSpec(context: PluginContext): void {\n\t\tcontext.registerMarkSpec({\n\t\t\ttype: 'fontSize',\n\t\t\trank: 4,\n\t\t\tattrs: {\n\t\t\t\tsize: { default: '' },\n\t\t\t},\n\t\t\ttoDOM(mark) {\n\t\t\t\tconst span: HTMLElement = document.createElement('span');\n\t\t\t\tconst size: string = mark.attrs?.size ?? '';\n\t\t\t\tif (size) {\n\t\t\t\t\tspan.style.fontSize = size;\n\t\t\t\t}\n\t\t\t\treturn span;\n\t\t\t},\n\t\t\ttoHTMLString: (mark, content) => {\n\t\t\t\tconst size: string = String(mark.attrs?.size ?? '');\n\t\t\t\tif (!size) return content;\n\t\t\t\treturn `<span style=\"font-size: ${size}\">${content}</span>`;\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 size: string = el.style.fontSize;\n\t\t\t\t\t\tif (!size) return false;\n\t\t\t\t\t\treturn { size };\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\t// --- Commands ---\n\n\tprivate registerCommands(context: PluginContext): void {\n\t\tcontext.registerCommand('removeFontSize', () => {\n\t\t\treturn removeFontSize(context, context.getState());\n\t\t});\n\n\t\tcontext.registerCommand('setFontSize', () => {\n\t\t\treturn false;\n\t\t});\n\n\t\tcontext.registerCommand('increaseFontSize', () => {\n\t\t\treturn stepFontSize(context, context.getState(), 'up', this.sizes, this.defaultSize);\n\t\t});\n\n\t\tcontext.registerCommand('decreaseFontSize', () => {\n\t\t\treturn stepFontSize(context, context.getState(), 'down', this.sizes, this.defaultSize);\n\t\t});\n\t}\n\n\t// --- Keymaps ---\n\n\tprivate registerKeymaps(context: PluginContext): void {\n\t\tcontext.registerKeymap({\n\t\t\t'Mod-Shift-+': () => {\n\t\t\t\treturn stepFontSize(context, context.getState(), 'up', this.sizes, this.defaultSize);\n\t\t\t},\n\t\t\t'Mod-Shift-_': () => {\n\t\t\t\treturn stepFontSize(context, context.getState(), 'down', this.sizes, this.defaultSize);\n\t\t\t},\n\t\t});\n\t}\n\n\t// --- Toolbar ---\n\n\tprivate registerToolbarItem(context: PluginContext): void {\n\t\tconst icon: string = `<span class=\"notectl-font-size-select__label\" data-font-size-label>${this.defaultSize}</span><span class=\"notectl-font-size-select__arrow\">\\u25BE</span>`;\n\n\t\tcontext.registerToolbarItem({\n\t\t\tid: 'fontSize',\n\t\t\tgroup: 'format',\n\t\t\ticon,\n\t\t\tlabel: 'Font Size',\n\t\t\ttooltip: 'Font Size',\n\t\t\tcommand: 'removeFontSize',\n\t\t\tpriority: 6,\n\t\t\tpopupType: 'custom',\n\t\t\tseparatorAfter: this.config.separatorAfter,\n\t\t\trenderPopup: (container, ctx) => {\n\t\t\t\trenderFontSizePopup(container, ctx, {\n\t\t\t\t\tsizes: this.sizes,\n\t\t\t\t\tdefaultSize: this.defaultSize,\n\t\t\t\t\tdismissPopup: () => this.dismissPopup(),\n\t\t\t\t});\n\t\t\t},\n\t\t\tisActive: (state) => isFontSizeActive(state),\n\t\t});\n\t}\n\n\t/**\n\t * Sets the configured default font size on the editor content container\n\t * so that unformatted text renders at the correct size instead of the\n\t * browser default (16px).\n\t */\n\tprivate applyDefaultSizeToContainer(context: PluginContext): void {\n\t\tconst container: HTMLElement = context.getContainer();\n\t\tcontainer.style.fontSize = `${this.defaultSize}px`;\n\t}\n\n\tprivate dismissPopup(): void {\n\t\tconst toolbar = this.context?.getService(ToolbarServiceKey);\n\t\ttoolbar?.closePopup();\n\t}\n\n\tprivate updateComboLabel(state: EditorState): void {\n\t\tif (!this.comboLabel) {\n\t\t\tconst container: HTMLElement | undefined = this.context?.getPluginContainer('top');\n\t\t\tif (!container) return;\n\t\t\tthis.comboLabel = container.querySelector<HTMLSpanElement>('[data-font-size-label]') ?? null;\n\t\t\tif (!this.comboLabel) return;\n\t\t}\n\n\t\tconst activeSize: number = getActiveSizeNumeric(state, this.defaultSize);\n\t\tthis.comboLabel.textContent = String(activeSize);\n\t}\n}\n\n// --- Helpers ---\n\nfunction resolveSizes(sizes: readonly number[] | undefined): readonly number[] {\n\tif (!sizes || sizes.length === 0) return DEFAULT_FONT_SIZES;\n\tconst unique: number[] = [...new Set(sizes)].filter((n) => Number.isInteger(n) && n > 0);\n\tunique.sort((a, b) => a - b);\n\treturn unique.length > 0 ? unique : DEFAULT_FONT_SIZES;\n}\n\nfunction resolveDefaultSize(size: number | undefined): number {\n\tif (size === undefined) return DEFAULT_FONT_SIZE;\n\treturn Number.isInteger(size) && size > 0 ? size : DEFAULT_FONT_SIZE;\n}\n","/** Font size picker toolbar combobox + popup styles. */\nexport const FONT_SIZE_SELECT_CSS = `\n/* Font Size Select — Combobox-style toolbar button */\n.notectl-toolbar-btn--fontSize {\n\twidth: auto;\n\tmin-width: 60px;\n\tmax-width: 80px;\n\tpadding: 0 8px;\n\tgap: 4px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tbackground: var(--notectl-bg);\n}\n\n.notectl-toolbar-btn--fontSize:hover {\n\tbackground: var(--notectl-hover-bg);\n\tborder-color: var(--notectl-fg-muted);\n}\n\n.notectl-toolbar-btn--fontSize.notectl-toolbar-btn--active {\n\tbackground: var(--notectl-bg);\n\tborder-color: var(--notectl-primary-muted);\n}\n\n.notectl-toolbar-btn--fontSize .notectl-toolbar-btn__icon {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 4px;\n\twidth: 100%;\n\toverflow: hidden;\n}\n\n.notectl-toolbar-btn--fontSize .notectl-toolbar-btn__icon svg {\n\tdisplay: none;\n}\n\n.notectl-font-size-select__label {\n\tflex: 1;\n\tfont-size: 13px;\n\tfont-weight: 500;\n\tcolor: var(--notectl-fg);\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\ttext-align: left;\n\tline-height: 30px;\n}\n\n.notectl-font-size-select__arrow {\n\tflex-shrink: 0;\n\tfont-size: 11px;\n\tcolor: var(--notectl-fg-muted);\n\tline-height: 30px;\n}\n\n/* Font Size Picker Popup */\n.notectl-font-size-picker {\n\tmin-width: 140px;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n\n.notectl-font-size-picker__input-wrapper {\n\tpadding: 8px 8px 4px;\n}\n\n.notectl-font-size-picker__input {\n\twidth: 100%;\n\tpadding: 6px 8px;\n\tborder: 1px solid var(--notectl-border);\n\tborder-radius: 4px;\n\tfont-size: 13px;\n\tfont-family: inherit;\n\tcolor: var(--notectl-fg);\n\tbackground: var(--notectl-bg);\n\toutline: none;\n\tbox-sizing: border-box;\n\t-moz-appearance: textfield;\n}\n\n.notectl-font-size-picker__input::-webkit-inner-spin-button,\n.notectl-font-size-picker__input::-webkit-outer-spin-button {\n\t-webkit-appearance: none;\n\tmargin: 0;\n}\n\n.notectl-font-size-picker__input:focus {\n\tborder-color: var(--notectl-border-focus);\n\tbox-shadow: 0 0 0 2px var(--notectl-focus-ring);\n}\n\n.notectl-font-size-picker__list {\n\tmax-height: 280px;\n\toverflow-y: auto;\n\tpadding: 4px 0;\n}\n\n.notectl-font-size-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\toutline: none;\n}\n\n.notectl-font-size-picker__item:hover {\n\tbackground: var(--notectl-hover-bg);\n}\n\n.notectl-font-size-picker__item--active {\n\tbackground: var(--notectl-active-bg);\n\tcolor: var(--notectl-primary-fg);\n}\n\n.notectl-font-size-picker__item--active:hover {\n\tbackground: var(--notectl-active-bg);\n}\n\n.notectl-font-size-picker__item--focused {\n\toutline: 2px solid var(--notectl-primary);\n\toutline-offset: -2px;\n}\n\n.notectl-font-size-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-size-picker__label {\n\tflex: 1;\n}\n`;\n"],"names":["getActiveSize","state","sel","selection","isNodeSelection","isCollapsed","storedMarks","extractFontSize","block","getBlock","anchor","blockId","getBlockMarksAtOffset","offset","getActiveSizeNumeric","defaultSize","raw","parsed","Number","parseInt","isNaN","applyFontSize","context","size","anchorBlock","newMarks","filter","m","type","markType","attrs","tr","transaction","setStoredMarks","setSelection","build","dispatch","range","selectionRange","getBlockOrder","builder","mark","forEachBlockInRange","from","to","removeMark","addMark","removeFontSize","currentMarks","hasMark","stepFontSize","direction","sizes","next","current","i","length","selectSize","executeCommand","getState","marks","find","isMarkOfType","buildSizeItem","isActive","item","document","createElement","id","className","setAttribute","String","classList","add","check","textContent","appendChild","label","DEFAULT_FONT_SIZES","FontSizePlugin","name","priority","config","comboLabel","this","unique","Set","n","isInteger","sort","a","b","registerStyleSheet","registerMarkSpec","registerCommands","registerKeymaps","registerToolbarItem","applyDefaultSizeToContainer","destroy","_oldState","newState","_tr","updateComboLabel","rank","default","span","style","fontSize","toHTMLString","content","parseHTML","tag","getAttrs","el","sanitize","tags","registerCommand","registerKeymap","icon","group","tooltip","command","popupType","separatorAfter","renderPopup","container","ctx","currentSize","input","min","max","value","wrapper","list","items","addEventListener","e","preventDefault","stopPropagation","dismissPopup","push","activeIdx","indexOf","activeItem","requestAnimationFrame","scrollIntoView","focusedIndex","setFocused","idx","remove","key","val","focus","selectedSize","getContainer","toolbar","getService","ToolbarServiceKey","closePopup","getPluginContainer","querySelector","activeSize"],"mappings":";;;;;;AAiBO,SAASA,EAAcC,IAAAA;AAC7B,QAAMC,KAAMD,GAAME;AAClB,MAAIC,EAAgBF,EAAAA,EAAM,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KAAKrE;AAC5DqE,SAAKD,WAAWR,cAAcJ,OAAO0F;EACtC;AAAA;"}
|
package/dist/plugins/font.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { b as n } from "../chunks/AttrRegistry-DTsHyDVA.mjs";
|
|
|
3
3
|
import { e, h as o, v as r } from "../chunks/Document-CI3iCwEP.mjs";
|
|
4
4
|
import { i, a as s, s as a } from "../chunks/Selection-D5ZjXoB7.mjs";
|
|
5
5
|
import { m as c } from "../chunks/TypeBrands-C09nE2qO.mjs";
|
|
6
|
-
import { a as l } from "../chunks/ToolbarPlugin-
|
|
6
|
+
import { a as l } from "../chunks/ToolbarPlugin-sJTiZr-S.mjs";
|
|
7
7
|
class f {
|
|
8
8
|
id = "font";
|
|
9
9
|
name = "Font";
|
package/dist/plugins/heading.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { p as t, g as e, b as n, j as o, k as r } from "../chunks/Document-CI3iC
|
|
|
2
2
|
import { c as i } from "../chunks/NodeSpec-NZVvcCuH.mjs";
|
|
3
3
|
import { i as l, a, c as s } from "../chunks/Selection-D5ZjXoB7.mjs";
|
|
4
4
|
import { n as c } from "../chunks/TypeBrands-C09nE2qO.mjs";
|
|
5
|
-
import { a as g } from "../chunks/ToolbarPlugin-
|
|
5
|
+
import { a as g } from "../chunks/ToolbarPlugin-sJTiZr-S.mjs";
|
|
6
6
|
const d = { levels: [1, 2, 3, 4, 5, 6] }, p = { 1: "h1", 2: "h2", 3: "h3", 4: "h4", 5: "h5", 6: "h6" }, h = { 1: "Heading 1", 2: "Heading 2", 3: "Heading 3", 4: "Heading 4", 5: "Heading 5", 6: "Heading 6" }, u = "Paragraph";
|
|
7
7
|
class b {
|
|
8
8
|
id = "heading";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageNodeView.d.ts","sourceRoot":"","sources":["../../../src/plugins/image/ImageNodeView.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA8DpF,kDAAkD;AAClD,wBAAgB,0BAA0B,CACzC,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,EACvC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,GACjE,eAAe,
|
|
1
|
+
{"version":3,"file":"ImageNodeView.d.ts","sourceRoot":"","sources":["../../../src/plugins/image/ImageNodeView.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA8DpF,kDAAkD;AAClD,wBAAgB,0BAA0B,CACzC,MAAM,EAAE,iBAAiB,EACzB,YAAY,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,EACvC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,GACjE,eAAe,CAkTjB"}
|
package/dist/plugins/image.mjs
CHANGED
|
@@ -128,7 +128,7 @@ function x(t2, e2, n2) {
|
|
|
128
128
|
}), { dom: s2, contentDOM: null, update: (t3) => "image" === t3.type && (g2 = t3.id, s2.setAttribute("data-block-id", t3.id), x2(t3), true), selectNode() {
|
|
129
129
|
s2.classList.add("notectl-image--selected"), (function(e3) {
|
|
130
130
|
if (!t2.resizable || m2) return;
|
|
131
|
-
m2 = document.createElement("div"), m2.className = "notectl-image__resize-overlay";
|
|
131
|
+
m2 = document.createElement("div"), m2.className = "notectl-image__resize-overlay", m2.setAttribute("data-notectl-no-print", "");
|
|
132
132
|
const i3 = document.createElement("div");
|
|
133
133
|
i3.className = "notectl-image__size-indicator", m2.appendChild(i3);
|
|
134
134
|
const r3 = ["nw", "ne", "sw", "se"];
|