@notectl/core 1.6.1 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/chunks/{AttrRegistry-I-VdmRnN.mjs → AttrRegistry-Ci0qAvtS.mjs} +2 -2
- package/dist/chunks/{AttrRegistry-I-VdmRnN.mjs.map → AttrRegistry-Ci0qAvtS.mjs.map} +1 -1
- package/dist/chunks/AttributedMarkCommands-BETuHXj8.mjs +58 -0
- package/dist/chunks/AttributedMarkCommands-BETuHXj8.mjs.map +1 -0
- package/dist/chunks/{CaretNavigation-CAJXoaae.mjs → CaretNavigation-qLfeL0So.mjs} +56 -56
- package/dist/chunks/{CaretNavigation-CAJXoaae.mjs.map → CaretNavigation-qLfeL0So.mjs.map} +1 -1
- package/dist/chunks/ColorGrid-BBkN0AOb.mjs +80 -0
- package/dist/chunks/ColorGrid-BBkN0AOb.mjs.map +1 -0
- package/dist/chunks/ColorPickerPopup-D3ysvOH-.mjs +37 -0
- package/dist/chunks/ColorPickerPopup-D3ysvOH-.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-DfZ1NOjs.mjs} +15 -15
- package/dist/chunks/{Document-CuwE73FF.mjs.map → Document-DfZ1NOjs.mjs.map} +1 -1
- package/dist/chunks/MarkCommands-uybmkw9l.mjs +94 -0
- package/dist/chunks/MarkCommands-uybmkw9l.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-CzLmmrph.mjs} +2 -2
- package/dist/chunks/{NodeResolver-B-wzthAQ.mjs.map → NodeResolver-CzLmmrph.mjs.map} +1 -1
- package/dist/chunks/PopupPositioning-Cn6L_mO2.mjs +30 -0
- package/dist/chunks/PopupPositioning-Cn6L_mO2.mjs.map +1 -0
- package/dist/chunks/RangeIterator-Bye0UtbY.mjs +16 -0
- package/dist/chunks/RangeIterator-Bye0UtbY.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/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-B7oJRzpl.mjs} +339 -127
- package/dist/chunks/ToolbarPlugin-B7oJRzpl.mjs.map +1 -0
- package/dist/chunks/{index-CPyHuEzh.mjs → index-Bt_d4IqB.mjs} +12 -12
- package/dist/chunks/{index-CPyHuEzh.mjs.map → index-Bt_d4IqB.mjs.map} +1 -1
- package/dist/chunks/{index-BigJ0z6n.mjs → index-CFJFD4lF.mjs} +8 -8
- package/dist/chunks/{index-BigJ0z6n.mjs.map → index-CFJFD4lF.mjs.map} +1 -1
- package/dist/chunks/{index-D67mP19g.mjs → index-CFPP456m.mjs} +13 -13
- package/dist/chunks/{index-D67mP19g.mjs.map → index-CFPP456m.mjs.map} +1 -1
- package/dist/chunks/{index-DQryjfJs.mjs → index-CH1r7DL-.mjs} +259 -300
- package/dist/chunks/index-CH1r7DL-.mjs.map +1 -0
- package/dist/chunks/{index-tBDVaSjG.mjs → index-CfyS_pgH.mjs} +28 -21
- package/dist/chunks/index-CfyS_pgH.mjs.map +1 -0
- package/dist/chunks/{index-DIAXWwgJ.mjs → index-Ckzqtn5D.mjs} +17 -14
- package/dist/chunks/{index-DIAXWwgJ.mjs.map → index-Ckzqtn5D.mjs.map} +1 -1
- package/dist/chunks/{index-BDMP86F4.mjs → index-CrKz_IEn.mjs} +35 -35
- package/dist/chunks/{index-BDMP86F4.mjs.map → index-CrKz_IEn.mjs.map} +1 -1
- package/dist/chunks/{index-B0UFAfyb.mjs → index-DGKQhSAl.mjs} +5 -5
- package/dist/chunks/{index-B0UFAfyb.mjs.map → index-DGKQhSAl.mjs.map} +1 -1
- package/dist/chunks/{index-83QoUENW.mjs → index-DIvHQtE2.mjs} +12 -9
- package/dist/chunks/{index-83QoUENW.mjs.map → index-DIvHQtE2.mjs.map} +1 -1
- package/dist/chunks/index-DayTn6Re.mjs +166 -0
- package/dist/chunks/index-DayTn6Re.mjs.map +1 -0
- package/dist/chunks/index-Deag_lVi.mjs +121 -0
- package/dist/chunks/index-Deag_lVi.mjs.map +1 -0
- package/dist/chunks/{index--z_Txzej.mjs → index-DmuuFS5D.mjs} +6 -6
- package/dist/chunks/{index--z_Txzej.mjs.map → index-DmuuFS5D.mjs.map} +1 -1
- package/dist/chunks/{index-DRZwd-1W.mjs → index-DoCvDkfj.mjs} +79 -96
- package/dist/chunks/index-DoCvDkfj.mjs.map +1 -0
- package/dist/chunks/index-DuRNETFv.mjs +296 -0
- package/dist/chunks/index-DuRNETFv.mjs.map +1 -0
- package/dist/chunks/{index-CPjf45-o.mjs → index-Dum8yE_t.mjs} +14 -14
- package/dist/chunks/{index-CPjf45-o.mjs.map → index-Dum8yE_t.mjs.map} +1 -1
- package/dist/chunks/{index-BWXkaC2Z.mjs → index-Dy6SllXW.mjs} +53 -65
- package/dist/chunks/index-Dy6SllXW.mjs.map +1 -0
- package/dist/chunks/{index-D8tbbW97.mjs → index-E7OgN7hM.mjs} +2 -2
- package/dist/chunks/{index-D8tbbW97.mjs.map → index-E7OgN7hM.mjs.map} +1 -1
- package/dist/chunks/{index-D4GKlc-A.mjs → index-yhz2qeeh.mjs} +224 -222
- package/dist/chunks/index-yhz2qeeh.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/MarkSerializer.d.ts +11 -0
- package/dist/editor/MarkSerializer.d.ts.map +1 -0
- package/dist/editor/NotectlEditor.d.ts +6 -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 +11 -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/model/MarkSpec.d.ts +6 -0
- package/dist/model/MarkSpec.d.ts.map +1 -1
- package/dist/notectl-core.mjs +2245 -2085
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +5568 -5345
- 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.mjs +3 -3
- package/dist/plugins/blockquote.mjs +2 -2
- package/dist/plugins/caret-navigation.mjs +1 -1
- package/dist/plugins/code-block.mjs +3 -3
- 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 +2 -2
- package/dist/plugins/font.mjs +2 -2
- package/dist/plugins/gap-cursor.mjs +7 -7
- 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 +2 -2
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +2 -2
- package/dist/plugins/horizontal-rule.mjs +2 -2
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image.mjs +3 -3
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link.mjs +2 -2
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +2 -2
- package/dist/plugins/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 +2 -2
- package/dist/plugins/super-sub.mjs +2 -2
- 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.mjs +10 -10
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color.mjs +2 -2
- package/dist/plugins/text-formatting.mjs +1 -1
- package/dist/plugins/toolbar/ToolbarItem.d.ts +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/index.d.ts +1 -1
- package/dist/plugins/toolbar/index.d.ts.map +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/presets/FullPreset.d.ts +16 -0
- package/dist/presets/FullPreset.d.ts.map +1 -0
- package/dist/presets/MinimalPreset.d.ts +7 -0
- package/dist/presets/MinimalPreset.d.ts.map +1 -0
- package/dist/presets/PresetTypes.d.ts +50 -0
- package/dist/presets/PresetTypes.d.ts.map +1 -0
- package/dist/state/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/test/PluginTestUtils.d.ts +4 -0
- package/dist/test/PluginTestUtils.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-BWXkaC2Z.mjs.map +0 -1
- package/dist/chunks/index-D4GKlc-A.mjs.map +0 -1
- package/dist/chunks/index-DQryjfJs.mjs.map +0 -1
- package/dist/chunks/index-DRZwd-1W.mjs.map +0 -1
- package/dist/chunks/index-DUC1X43Z.mjs +0 -209
- package/dist/chunks/index-DUC1X43Z.mjs.map +0 -1
- package/dist/chunks/index-DipAT_Q9.mjs +0 -191
- package/dist/chunks/index-DipAT_Q9.mjs.map +0 -1
- package/dist/chunks/index-tBDVaSjG.mjs.map +0 -1
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
import { S as
|
|
1
|
+
import { S as t, r as e } from "./resolvePluginLocale-B4w1OkPy.mjs";
|
|
2
2
|
import { e as n } from "./HTMLUtils-DTqQzcKR.mjs";
|
|
3
3
|
import { c as i } from "./NodeSpec-NZVvcCuH.mjs";
|
|
4
|
-
import { i as r, a as o,
|
|
4
|
+
import { i as r, a as o, d as a, e as s } from "./Selection-BRTab5hO.mjs";
|
|
5
5
|
import { f as l } from "./ToolbarItem-BpZggUGo.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { b as c, k as d, q as g } from "./Document-DfZ1NOjs.mjs";
|
|
7
7
|
import { n as u } from "./TypeBrands-C09nE2qO.mjs";
|
|
8
|
-
function m(
|
|
9
|
-
const n2 =
|
|
8
|
+
function m(t2, e2) {
|
|
9
|
+
const n2 = t2.getState(), i2 = n2.selection, a2 = { src: e2.src, alt: e2.alt ?? "", align: e2.align ?? "center", ...void 0 !== e2.width ? { width: e2.width } : {}, ...void 0 !== e2.height ? { height: e2.height } : {} };
|
|
10
10
|
if (o(i2)) return false;
|
|
11
|
-
const l2 = r(i2) ? i2.nodeId : i2.anchor.blockId, m2 = (function(
|
|
12
|
-
const n3 =
|
|
13
|
-
if ("table_cell" === n3?.type) return
|
|
14
|
-
const i3 =
|
|
15
|
-
if (i3) for (const
|
|
16
|
-
const n4 =
|
|
17
|
-
if ("table_cell" === n4?.type) return
|
|
11
|
+
const l2 = r(i2) ? i2.nodeId : i2.anchor.blockId, m2 = (function(t3, e3) {
|
|
12
|
+
const n3 = t3.getBlock(e3);
|
|
13
|
+
if ("table_cell" === n3?.type) return e3;
|
|
14
|
+
const i3 = t3.getNodePath(e3);
|
|
15
|
+
if (i3) for (const e4 of i3) {
|
|
16
|
+
const n4 = t3.getBlock(e4);
|
|
17
|
+
if ("table_cell" === n4?.type) return e4;
|
|
18
18
|
}
|
|
19
19
|
})(n2, l2);
|
|
20
|
-
return m2 ? (function(
|
|
21
|
-
const r2 =
|
|
20
|
+
return m2 ? (function(t3, e3, n3, i3) {
|
|
21
|
+
const r2 = t3.getNodePath(n3);
|
|
22
22
|
if (!r2) return false;
|
|
23
|
-
const o2 = d(u("image"), [], void 0, i3), a3 =
|
|
23
|
+
const o2 = d(u("image"), [], void 0, i3), a3 = t3.getBlock(n3);
|
|
24
24
|
if (!a3) return false;
|
|
25
|
-
const l3 =
|
|
26
|
-
for (let
|
|
27
|
-
const
|
|
28
|
-
-1 !==
|
|
25
|
+
const l3 = t3.transaction("command"), m3 = g(a3);
|
|
26
|
+
for (let t4 = m3.length - 1; t4 >= 0; t4--) {
|
|
27
|
+
const e4 = a3.children.findIndex((e5) => c(e5) && e5.id === m3[t4]?.id);
|
|
28
|
+
-1 !== e4 && l3.removeNode(r2, e4);
|
|
29
29
|
}
|
|
30
|
-
return l3.insertNode(r2, 0, o2), l3.setSelection(s(o2.id, [...r2, o2.id])),
|
|
31
|
-
})(n2,
|
|
32
|
-
const r2 =
|
|
30
|
+
return l3.insertNode(r2, 0, o2), l3.setSelection(s(o2.id, [...r2, o2.id])), e3.dispatch(l3.build()), true;
|
|
31
|
+
})(n2, t2, m2, a2) : (function(t3, e3, n3, i3) {
|
|
32
|
+
const r2 = t3.doc.children.findIndex((t4) => t4.id === n3);
|
|
33
33
|
if (-1 === r2) return false;
|
|
34
|
-
const o2 = d(u("image"), [], void 0, i3), a3 = d(u("paragraph")), l3 =
|
|
35
|
-
return
|
|
36
|
-
})(n2,
|
|
34
|
+
const o2 = d(u("image"), [], void 0, i3), a3 = d(u("paragraph")), l3 = t3.transaction("command").insertNode([], r2 + 1, o2).insertNode([], r2 + 2, a3).setSelection(s(o2.id, [])).build();
|
|
35
|
+
return e3.dispatch(l3), true;
|
|
36
|
+
})(n2, t2, l2, a2);
|
|
37
37
|
}
|
|
38
|
-
function p(
|
|
39
|
-
const i2 =
|
|
38
|
+
function p(t2, e2, n2) {
|
|
39
|
+
const i2 = t2.getState(), o2 = i2.selection;
|
|
40
40
|
if (!r(o2)) return false;
|
|
41
41
|
const a2 = i2.getBlock(o2.nodeId);
|
|
42
42
|
if (!a2 || "image" !== a2.type) return false;
|
|
43
43
|
const s2 = a2.attrs?.width, l2 = a2.attrs?.height;
|
|
44
44
|
if (void 0 === s2 || void 0 === l2) return false;
|
|
45
|
-
const c2 = l2 > 0 ? s2 / l2 : 1, d2 = Math.max(50, Math.min(n2, s2 +
|
|
46
|
-
return (d2 !== s2 || g2 !== l2) && (function(
|
|
47
|
-
const n3 =
|
|
45
|
+
const c2 = l2 > 0 ? s2 / l2 : 1, d2 = Math.max(50, Math.min(n2, s2 + e2)), g2 = Math.round(d2 / c2);
|
|
46
|
+
return (d2 !== s2 || g2 !== l2) && (function(t3, e3) {
|
|
47
|
+
const n3 = t3.getState(), i3 = n3.selection;
|
|
48
48
|
if (!r(i3)) return false;
|
|
49
49
|
const o3 = n3.getBlock(i3.nodeId);
|
|
50
50
|
if (!o3 || "image" !== o3.type) return false;
|
|
51
51
|
const a3 = n3.getNodePath(i3.nodeId);
|
|
52
52
|
if (!a3) return false;
|
|
53
|
-
const s3 = { ...o3.attrs ?? {}, ...
|
|
54
|
-
return
|
|
55
|
-
})(
|
|
53
|
+
const s3 = { ...o3.attrs ?? {}, ...e3 }, l3 = n3.transaction("command").setNodeAttr(a3, s3).build();
|
|
54
|
+
return t3.dispatch(l3), true;
|
|
55
|
+
})(t2, { width: d2, height: g2 });
|
|
56
56
|
}
|
|
57
|
-
const h = { insertImage: "Insert Image", insertImageTooltip: "Insert Image", uploadFromComputer: "Upload from computer", uploadAria: "Upload image from computer", separator: "or", urlPlaceholder: "https://...", urlAria: "Image URL", insertButton: "Insert", insertAria: "Insert image", imageAria: (
|
|
58
|
-
const i2 = [
|
|
59
|
-
return void 0 !==
|
|
60
|
-
}, resetToNaturalSize: "Image reset to natural size.", uploadFailed: "Image upload failed." }, f = { en: h, de: { insertImage: "Bild einfügen", insertImageTooltip: "Bild einfügen", uploadFromComputer: "Vom Computer hochladen", uploadAria: "Bild vom Computer hochladen", separator: "oder", urlPlaceholder: "https://...", urlAria: "Bild-URL", insertButton: "Einfügen", insertAria: "Bild einfügen", imageAria: (
|
|
61
|
-
const i2 = [
|
|
62
|
-
return void 0 !==
|
|
63
|
-
}, resetToNaturalSize: "Bild auf Originalgröße zurückgesetzt.", uploadFailed: "Bild-Upload fehlgeschlagen." }, es: { insertImage: "Insertar imagen", insertImageTooltip: "Insertar imagen", uploadFromComputer: "Subir desde el ordenador", uploadAria: "Subir imagen desde el ordenador", separator: "o", urlPlaceholder: "https://...", urlAria: "URL de la imagen", insertButton: "Insertar", insertAria: "Insertar imagen", imageAria: (
|
|
64
|
-
const i2 = [
|
|
65
|
-
return void 0 !==
|
|
66
|
-
}, resetToNaturalSize: "Imagen restablecida a tamaño natural.", uploadFailed: "Error al subir la imagen." }, fr: { insertImage: "Insérer une image", insertImageTooltip: "Insérer une image", uploadFromComputer: "Télécharger depuis l’ordinateur", uploadAria: "Télécharger une image depuis l’ordinateur", separator: "ou", urlPlaceholder: "https://...", urlAria: "URL de l’image", insertButton: "Insérer", insertAria: "Insérer une image", imageAria: (
|
|
67
|
-
const i2 = [
|
|
68
|
-
return void 0 !==
|
|
69
|
-
}, resetToNaturalSize: "Image rétablie à sa taille d’origine.", uploadFailed: "Échec du téléchargement de l’image." }, zh: { insertImage: "插入图片", insertImageTooltip: "插入图片", uploadFromComputer: "从电脑上传", uploadAria: "从电脑上传图片", separator: "或", urlPlaceholder: "https://...", urlAria: "图片链接", insertButton: "插入", insertAria: "插入图片", imageAria: (
|
|
70
|
-
const i2 = [
|
|
71
|
-
return void 0 !==
|
|
72
|
-
}, resetToNaturalSize: "图片已恢复原始大小。", uploadFailed: "图片上传失败。" }, ru: { insertImage: "Вставить изображение", insertImageTooltip: "Вставить изображение", uploadFromComputer: "Загрузить с компьютера", uploadAria: "Загрузить изображение с компьютера", separator: "или", urlPlaceholder: "https://...", urlAria: "URL изображения", insertButton: "Вставить", insertAria: "Вставить изображение", imageAria: (
|
|
73
|
-
const i2 = [
|
|
74
|
-
return void 0 !==
|
|
75
|
-
}, resetToNaturalSize: "Изображение сброшено до исходного размера.", uploadFailed: "Ошибка загрузки изображения." }, ar: { insertImage: "إدراج صورة", insertImageTooltip: "إدراج صورة", uploadFromComputer: "رفع من الحاسوب", uploadAria: "رفع صورة من الحاسوب", separator: "أو", urlPlaceholder: "https://...", urlAria: "رابط الصورة", insertButton: "إدراج", insertAria: "إدراج صورة", imageAria: (
|
|
76
|
-
const i2 = [
|
|
77
|
-
return void 0 !==
|
|
78
|
-
}, resetToNaturalSize: "تمت إعادة الصورة إلى حجمها الطبيعي.", uploadFailed: "فشل رفع الصورة." }, hi: { insertImage: "चित्र डालें", insertImageTooltip: "चित्र डालें", uploadFromComputer: "कंप्यूटर से अपलोड करें", uploadAria: "कंप्यूटर से चित्र अपलोड करें", separator: "या", urlPlaceholder: "https://...", urlAria: "चित्र URL", insertButton: "डालें", insertAria: "चित्र डालें", imageAria: (
|
|
79
|
-
const i2 = [
|
|
80
|
-
return void 0 !==
|
|
57
|
+
const h = { insertImage: "Insert Image", insertImageTooltip: "Insert Image", uploadFromComputer: "Upload from computer", uploadAria: "Upload image from computer", separator: "or", urlPlaceholder: "https://...", urlAria: "Image URL", insertButton: "Insert", insertAria: "Insert image", imageAria: (t2, e2, n2) => {
|
|
58
|
+
const i2 = [t2 || "Image"];
|
|
59
|
+
return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} by ${n2} pixels`), i2.join(", ");
|
|
60
|
+
}, resetToNaturalSize: "Image reset to natural size.", uploadFailed: "Image upload failed." }, f = { en: h, de: { insertImage: "Bild einfügen", insertImageTooltip: "Bild einfügen", uploadFromComputer: "Vom Computer hochladen", uploadAria: "Bild vom Computer hochladen", separator: "oder", urlPlaceholder: "https://...", urlAria: "Bild-URL", insertButton: "Einfügen", insertAria: "Bild einfügen", imageAria: (t2, e2, n2) => {
|
|
61
|
+
const i2 = [t2 || "Bild"];
|
|
62
|
+
return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} mal ${n2} Pixel`), i2.join(", ");
|
|
63
|
+
}, resetToNaturalSize: "Bild auf Originalgröße zurückgesetzt.", uploadFailed: "Bild-Upload fehlgeschlagen." }, es: { insertImage: "Insertar imagen", insertImageTooltip: "Insertar imagen", uploadFromComputer: "Subir desde el ordenador", uploadAria: "Subir imagen desde el ordenador", separator: "o", urlPlaceholder: "https://...", urlAria: "URL de la imagen", insertButton: "Insertar", insertAria: "Insertar imagen", imageAria: (t2, e2, n2) => {
|
|
64
|
+
const i2 = [t2 || "Imagen"];
|
|
65
|
+
return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} por ${n2} píxeles`), i2.join(", ");
|
|
66
|
+
}, resetToNaturalSize: "Imagen restablecida a tamaño natural.", uploadFailed: "Error al subir la imagen." }, fr: { insertImage: "Insérer une image", insertImageTooltip: "Insérer une image", uploadFromComputer: "Télécharger depuis l’ordinateur", uploadAria: "Télécharger une image depuis l’ordinateur", separator: "ou", urlPlaceholder: "https://...", urlAria: "URL de l’image", insertButton: "Insérer", insertAria: "Insérer une image", imageAria: (t2, e2, n2) => {
|
|
67
|
+
const i2 = [t2 || "Image"];
|
|
68
|
+
return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} par ${n2} pixels`), i2.join(", ");
|
|
69
|
+
}, resetToNaturalSize: "Image rétablie à sa taille d’origine.", uploadFailed: "Échec du téléchargement de l’image." }, zh: { insertImage: "插入图片", insertImageTooltip: "插入图片", uploadFromComputer: "从电脑上传", uploadAria: "从电脑上传图片", separator: "或", urlPlaceholder: "https://...", urlAria: "图片链接", insertButton: "插入", insertAria: "插入图片", imageAria: (t2, e2, n2) => {
|
|
70
|
+
const i2 = [t2 || "图片"];
|
|
71
|
+
return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} x ${n2} 像素`), i2.join(",");
|
|
72
|
+
}, resetToNaturalSize: "图片已恢复原始大小。", uploadFailed: "图片上传失败。" }, ru: { insertImage: "Вставить изображение", insertImageTooltip: "Вставить изображение", uploadFromComputer: "Загрузить с компьютера", uploadAria: "Загрузить изображение с компьютера", separator: "или", urlPlaceholder: "https://...", urlAria: "URL изображения", insertButton: "Вставить", insertAria: "Вставить изображение", imageAria: (t2, e2, n2) => {
|
|
73
|
+
const i2 = [t2 || "Изображение"];
|
|
74
|
+
return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} на ${n2} пикселей`), i2.join(", ");
|
|
75
|
+
}, resetToNaturalSize: "Изображение сброшено до исходного размера.", uploadFailed: "Ошибка загрузки изображения." }, ar: { insertImage: "إدراج صورة", insertImageTooltip: "إدراج صورة", uploadFromComputer: "رفع من الحاسوب", uploadAria: "رفع صورة من الحاسوب", separator: "أو", urlPlaceholder: "https://...", urlAria: "رابط الصورة", insertButton: "إدراج", insertAria: "إدراج صورة", imageAria: (t2, e2, n2) => {
|
|
76
|
+
const i2 = [t2 || "صورة"];
|
|
77
|
+
return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} × ${n2} بكسل`), i2.join("، ");
|
|
78
|
+
}, resetToNaturalSize: "تمت إعادة الصورة إلى حجمها الطبيعي.", uploadFailed: "فشل رفع الصورة." }, hi: { insertImage: "चित्र डालें", insertImageTooltip: "चित्र डालें", uploadFromComputer: "कंप्यूटर से अपलोड करें", uploadAria: "कंप्यूटर से चित्र अपलोड करें", separator: "या", urlPlaceholder: "https://...", urlAria: "चित्र URL", insertButton: "डालें", insertAria: "चित्र डालें", imageAria: (t2, e2, n2) => {
|
|
79
|
+
const i2 = [t2 || "चित्र"];
|
|
80
|
+
return void 0 !== e2 && void 0 !== n2 && i2.push(`${e2} x ${n2} पिक्सेल`), i2.join(", ");
|
|
81
81
|
}, resetToNaturalSize: "चित्र मूल आकार में पुनर्स्थापित।", uploadFailed: "चित्र अपलोड विफल।" } }, b = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }, v = { nw: "nwse-resize", ne: "nesw-resize", sw: "nesw-resize", se: "nwse-resize" }, x = { nw: -1, ne: 1, sw: -1, se: 1 }, y = { nw: "Resize top-left", ne: "Resize top-right", sw: "Resize bottom-left", se: "Resize bottom-right" };
|
|
82
82
|
let I = null;
|
|
83
83
|
function z() {
|
|
84
84
|
I && (I.remove(), I = null);
|
|
85
85
|
}
|
|
86
|
-
function w(
|
|
86
|
+
function w(t2, e2, n2) {
|
|
87
87
|
return (i2, r2, o2) => {
|
|
88
88
|
const a2 = document.createElement("figure");
|
|
89
89
|
a2.className = "notectl-image", a2.setAttribute("data-block-id", i2.id), a2.setAttribute("data-void", "true"), a2.setAttribute("data-selectable", "true");
|
|
@@ -94,46 +94,46 @@ function w(e2, t2, n2) {
|
|
|
94
94
|
const d2 = document.createElement("div");
|
|
95
95
|
d2.className = "notectl-image__overlay", s2.appendChild(c2), s2.appendChild(d2), a2.appendChild(s2);
|
|
96
96
|
let g2 = i2.id, u2 = null;
|
|
97
|
-
function m2(
|
|
98
|
-
const n3 =
|
|
97
|
+
function m2(t3) {
|
|
98
|
+
const n3 = t3.attrs?.src ?? "", i3 = t3.attrs?.alt ?? "", r3 = t3.attrs?.width, o3 = t3.attrs?.height, s3 = t3.attrs?.align ?? "center";
|
|
99
99
|
c2.src !== n3 && (c2.src = n3), c2.alt = i3, c2.style.width = void 0 !== r3 ? `${r3}px` : "", c2.style.height = void 0 !== o3 ? `${o3}px` : "";
|
|
100
|
-
for (const
|
|
100
|
+
for (const t4 of Object.values(b)) a2.classList.remove(t4);
|
|
101
101
|
const l2 = b[s3];
|
|
102
102
|
l2 && a2.classList.add(l2);
|
|
103
|
-
const g3 =
|
|
104
|
-
d2.classList.toggle("notectl-image__overlay--uploading", u3), d2.classList.toggle("notectl-image__overlay--error", "error" === g3), d2.textContent = u3 ? "Uploading..." : "error" === g3 ? "Upload failed" : "", u3 ? a2.setAttribute("aria-busy", "true") : a2.removeAttribute("aria-busy"), (function(
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
})(
|
|
103
|
+
const g3 = e2.get(t3.id) ?? "idle", u3 = "uploading" === g3;
|
|
104
|
+
d2.classList.toggle("notectl-image__overlay--uploading", u3), d2.classList.toggle("notectl-image__overlay--error", "error" === g3), d2.textContent = u3 ? "Uploading..." : "error" === g3 ? "Upload failed" : "", u3 ? a2.setAttribute("aria-busy", "true") : a2.removeAttribute("aria-busy"), (function(t4) {
|
|
105
|
+
const e3 = t4.attrs?.alt ?? "", n4 = t4.attrs?.width, i4 = t4.attrs?.height, r4 = [];
|
|
106
|
+
e3 ? r4.push(e3) : r4.push("Image"), void 0 !== n4 && void 0 !== i4 && r4.push(`${n4} by ${i4} pixels`), a2.setAttribute("aria-label", r4.join(", "));
|
|
107
|
+
})(t3);
|
|
108
108
|
}
|
|
109
109
|
m2(i2);
|
|
110
110
|
let p2 = false;
|
|
111
|
-
function h2(
|
|
111
|
+
function h2(e3, n3, i3, s3) {
|
|
112
112
|
let l2 = 0, d3 = 0, g3 = 1;
|
|
113
|
-
const u3 = (
|
|
114
|
-
const i4 =
|
|
113
|
+
const u3 = (e4) => {
|
|
114
|
+
const i4 = e4.clientX - l2, r3 = (o3 = d3 + i4 * x[n3], Math.max(50, Math.min(t2.maxWidth, o3)));
|
|
115
115
|
var o3;
|
|
116
116
|
const a3 = Math.round(r3 / g3);
|
|
117
117
|
c2.style.width = `${r3}px`, c2.style.height = `${a3}px`, s3.textContent = `${Math.round(r3)} × ${a3}`;
|
|
118
|
-
}, m3 = (
|
|
118
|
+
}, m3 = (t3) => {
|
|
119
119
|
document.removeEventListener("pointermove", u3), document.removeEventListener("pointerup", m3), a2.classList.remove("notectl-image--resizing"), s3.classList.remove("notectl-image__size-indicator--visible"), z();
|
|
120
|
-
const
|
|
121
|
-
!(function(
|
|
122
|
-
const i4 = r2(), a3 = i4.getBlock(
|
|
120
|
+
const e4 = Math.round(c2.getBoundingClientRect().width), n4 = Math.round(e4 / g3);
|
|
121
|
+
!(function(t4, e5, n5) {
|
|
122
|
+
const i4 = r2(), a3 = i4.getBlock(t4);
|
|
123
123
|
if (!a3) return;
|
|
124
124
|
const s4 = a3.attrs?.width, l3 = a3.attrs?.height;
|
|
125
|
-
if (s4 ===
|
|
126
|
-
const c3 = i4.getNodePath(
|
|
125
|
+
if (s4 === e5 && l3 === n5) return;
|
|
126
|
+
const c3 = i4.getNodePath(t4);
|
|
127
127
|
if (!c3) return;
|
|
128
|
-
const d4 = { ...a3.attrs ?? {}, width:
|
|
128
|
+
const d4 = { ...a3.attrs ?? {}, width: e5, height: n5 }, g4 = i4.transaction("command").setNodeAttr(c3, d4).build();
|
|
129
129
|
o2(g4);
|
|
130
|
-
})(i3,
|
|
130
|
+
})(i3, e4, n4), t3.target?.releasePointerCapture?.(t3.pointerId);
|
|
131
131
|
};
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const
|
|
132
|
+
e3.addEventListener("pointerdown", (t3) => {
|
|
133
|
+
t3.preventDefault(), t3.stopPropagation(), l2 = t3.clientX, d3 = c2.getBoundingClientRect().width;
|
|
134
|
+
const e4 = c2.getBoundingClientRect().height;
|
|
135
135
|
var i4;
|
|
136
|
-
g3 =
|
|
136
|
+
g3 = e4 > 0 ? d3 / e4 : 1, a2.classList.add("notectl-image--resizing"), s3.textContent = `${Math.round(d3)} × ${Math.round(e4)}`, s3.classList.add("notectl-image__size-indicator--visible"), i4 = v[n3], z(), I = document.createElement("style"), I.textContent = `*{cursor:${i4}!important;user-select:none!important}`, document.head.appendChild(I), t3.target.setPointerCapture(t3.pointerId), document.addEventListener("pointermove", u3), document.addEventListener("pointerup", m3);
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
function f2() {
|
|
@@ -141,35 +141,35 @@ function w(e2, t2, n2) {
|
|
|
141
141
|
}
|
|
142
142
|
return c2.addEventListener("load", () => {
|
|
143
143
|
if (p2) return;
|
|
144
|
-
const
|
|
144
|
+
const e3 = r2(), n3 = e3.getBlock(g2);
|
|
145
145
|
if (!n3 || "image" !== n3.type) return;
|
|
146
146
|
const i3 = void 0 !== n3.attrs?.width, a3 = void 0 !== n3.attrs?.height;
|
|
147
147
|
if (i3 && a3) return void (p2 = true);
|
|
148
148
|
const s3 = c2.naturalWidth, l2 = c2.naturalHeight;
|
|
149
149
|
if (0 === s3 || 0 === l2) return;
|
|
150
|
-
const d3 = Math.min(s3,
|
|
150
|
+
const d3 = Math.min(s3, t2.maxWidth), u3 = s3 > 0 ? l2 / s3 : 1, m3 = Math.round(d3 * u3), h3 = e3.getNodePath(g2);
|
|
151
151
|
if (!h3) return;
|
|
152
|
-
const f3 = { ...n3.attrs ?? {}, width: d3, height: m3 }, b2 =
|
|
152
|
+
const f3 = { ...n3.attrs ?? {}, width: d3, height: m3 }, b2 = e3.transaction("command").setNodeAttr(h3, f3).build();
|
|
153
153
|
o2(b2), p2 = true;
|
|
154
|
-
}), { dom: a2, contentDOM: null, update: (
|
|
155
|
-
a2.classList.add("notectl-image--selected"), (function(
|
|
156
|
-
if (!
|
|
154
|
+
}), { dom: a2, contentDOM: null, update: (t3) => "image" === t3.type && (g2 = t3.id, a2.setAttribute("data-block-id", t3.id), m2(t3), true), selectNode() {
|
|
155
|
+
a2.classList.add("notectl-image--selected"), (function(e3) {
|
|
156
|
+
if (!t2.resizable || u2) return;
|
|
157
157
|
u2 = document.createElement("div"), u2.className = "notectl-image__resize-overlay", u2.setAttribute("data-notectl-no-print", "");
|
|
158
158
|
const i3 = document.createElement("div");
|
|
159
159
|
i3.className = "notectl-image__size-indicator", u2.appendChild(i3);
|
|
160
160
|
const r3 = ["nw", "ne", "sw", "se"];
|
|
161
|
-
for (const
|
|
161
|
+
for (const t3 of r3) {
|
|
162
162
|
const n3 = document.createElement("div");
|
|
163
|
-
n3.className = `notectl-image__resize-handle notectl-image__resize-handle--${
|
|
163
|
+
n3.className = `notectl-image__resize-handle notectl-image__resize-handle--${t3}`, n3.setAttribute("role", "separator"), n3.setAttribute("aria-label", y[t3]), h2(n3, t3, e3, i3), u2.appendChild(n3);
|
|
164
164
|
}
|
|
165
165
|
if (n2) {
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
return
|
|
166
|
+
const t3 = (function(t4) {
|
|
167
|
+
const e4 = t4.shrinkWidth ?? null, n3 = t4.growWidth ?? null;
|
|
168
|
+
return e4 && n3 ? `${l(e4)} / ${l(n3)} to resize` : "";
|
|
169
169
|
})(n2);
|
|
170
|
-
if (
|
|
171
|
-
const
|
|
172
|
-
|
|
170
|
+
if (t3) {
|
|
171
|
+
const e4 = document.createElement("div");
|
|
172
|
+
e4.className = "notectl-image__keyboard-hint", e4.setAttribute("aria-hidden", "true"), e4.textContent = t3, u2.appendChild(e4);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
s2.appendChild(u2);
|
|
@@ -181,7 +181,7 @@ function w(e2, t2, n2) {
|
|
|
181
181
|
} };
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
const A = new
|
|
184
|
+
const A = new t("image:upload"), _ = { growWidth: "Mod-Shift-ArrowRight", shrinkWidth: "Mod-Shift-ArrowLeft", growWidthLarge: "Mod-Shift-Alt-ArrowRight", shrinkWidthLarge: "Mod-Shift-Alt-ArrowLeft", resetSize: "Mod-Shift-0" }, S = { maxWidth: 800, maxFileSize: 10485760, acceptedTypes: ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"], resizable: true, resizeStep: 10, resizeStepLarge: 50 };
|
|
185
185
|
class k {
|
|
186
186
|
id = "image";
|
|
187
187
|
name = "Image";
|
|
@@ -192,157 +192,159 @@ class k {
|
|
|
192
192
|
blobUrls = /* @__PURE__ */ new Set();
|
|
193
193
|
context = null;
|
|
194
194
|
locale;
|
|
195
|
-
constructor(
|
|
196
|
-
this.config = { ...S, ...
|
|
195
|
+
constructor(t2) {
|
|
196
|
+
this.config = { ...S, ...t2 }, this.resolvedKeymap = { ..._, ...t2?.keymap };
|
|
197
197
|
}
|
|
198
|
-
init(
|
|
199
|
-
this.locale =
|
|
200
|
-
|
|
201
|
-
const
|
|
198
|
+
init(t2) {
|
|
199
|
+
this.locale = e(f, t2, this.config.locale), t2.registerStyleSheet("\n/* Image */\n.notectl-image {\n margin: 8px 0;\n user-select: none;\n line-height: 0;\n}\n\n.notectl-image--center {\n text-align: center;\n}\n\n.notectl-image--left {\n text-align: left;\n}\n\n.notectl-image--right {\n text-align: right;\n}\n\n.notectl-image__container {\n display: inline-block;\n position: relative;\n line-height: 0;\n}\n\n.notectl-image__img {\n display: block;\n max-width: 100%;\n border-radius: 4px;\n}\n\n.notectl-image--selected .notectl-image__container {\n outline: 2px solid var(--notectl-primary);\n outline-offset: 2px;\n border-radius: 6px;\n}\n\n/* Alignment toolbar (appears on image selection) */\n.notectl-image__align-toolbar {\n display: flex;\n gap: 2px;\n position: absolute;\n top: -36px;\n left: 50%;\n transform: translateX(-50%);\n background: var(--notectl-surface-overlay);\n border: 1px solid var(--notectl-border);\n border-radius: 6px;\n padding: 2px;\n box-shadow: 0 2px 8px var(--notectl-shadow);\n z-index: 10;\n}\n\n.notectl-image__align-btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n color: var(--notectl-fg);\n}\n\n.notectl-image__align-btn:hover {\n background: var(--notectl-hover-bg);\n}\n\n.notectl-image__align-btn--active {\n background: var(--notectl-active-bg);\n color: var(--notectl-primary-fg);\n}\n\n.notectl-image__align-btn svg {\n width: 16px;\n height: 16px;\n fill: currentColor;\n}\n\n/* Upload overlay */\n.notectl-image__overlay {\n position: absolute;\n inset: 0;\n display: none;\n align-items: center;\n justify-content: center;\n background: rgba(255, 255, 255, 0.8);\n border-radius: 4px;\n font-size: 13px;\n color: var(--notectl-fg-muted);\n}\n\n.notectl-image__overlay--uploading {\n display: flex;\n}\n\n.notectl-image__overlay--error {\n display: flex;\n background: var(--notectl-danger-muted);\n color: var(--notectl-danger);\n}\n\n/* Resize overlay + handles */\n.notectl-image__resize-overlay {\n position: absolute;\n inset: 0;\n pointer-events: none;\n}\n\n.notectl-image__resize-handle {\n position: absolute;\n width: 10px;\n height: 10px;\n background: var(--notectl-bg);\n border: 2px solid var(--notectl-primary);\n border-radius: 50%;\n pointer-events: all;\n z-index: 2;\n transition: transform 0.1s, background 0.1s;\n}\n\n.notectl-image__resize-handle:hover {\n background: var(--notectl-primary);\n transform: scale(1.3);\n}\n\n.notectl-image--resizing .notectl-image__resize-handle {\n background: var(--notectl-primary);\n}\n\n.notectl-image__resize-handle--nw {\n top: -5px;\n left: -5px;\n cursor: nwse-resize;\n}\n\n.notectl-image__resize-handle--ne {\n top: -5px;\n right: -5px;\n cursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--sw {\n bottom: -5px;\n left: -5px;\n cursor: nesw-resize;\n}\n\n.notectl-image__resize-handle--se {\n bottom: -5px;\n right: -5px;\n cursor: nwse-resize;\n}\n\n/* Size indicator tooltip */\n.notectl-image__size-indicator {\n position: absolute;\n bottom: -28px;\n left: 50%;\n transform: translateX(-50%);\n padding: 2px 8px;\n background: var(--notectl-tooltip-bg);\n color: var(--notectl-tooltip-fg);\n font-size: 11px;\n font-weight: 500;\n border-radius: 4px;\n white-space: nowrap;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.15s;\n z-index: 3;\n}\n\n.notectl-image__size-indicator--visible {\n opacity: 1;\n}\n\n/* Keyboard resize hint (shown on selection, hidden during drag) */\n.notectl-image__keyboard-hint {\n display: none;\n position: absolute;\n bottom: -28px;\n left: 50%;\n transform: translateX(-50%);\n padding: 2px 8px;\n font-size: 11px;\n color: var(--notectl-fg-muted);\n white-space: nowrap;\n pointer-events: none;\n z-index: 3;\n}\n\n.notectl-image--selected .notectl-image__keyboard-hint {\n display: block;\n}\n\n.notectl-image--resizing .notectl-image__keyboard-hint {\n display: none;\n}\n\n/* Resizing feedback */\n.notectl-image--resizing .notectl-image__img {\n opacity: 0.85;\n}\n"), this.context = t2, this.registerNodeSpec(t2), this.registerNodeView(t2), (function(t3) {
|
|
200
|
+
t3.registerCommand("insertImage", () => m(t3, { src: "" })), t3.registerCommand("removeImage", () => (function(t4) {
|
|
201
|
+
const e2 = t4.getState(), n2 = e2.selection;
|
|
202
202
|
if (!r(n2)) return false;
|
|
203
|
-
const i2 =
|
|
203
|
+
const i2 = e2.getBlock(n2.nodeId);
|
|
204
204
|
if (!i2 || "image" !== i2.type) return false;
|
|
205
|
-
const o2 =
|
|
205
|
+
const o2 = e2.getNodePath(n2.nodeId);
|
|
206
206
|
if (!o2 || 0 === o2.length) return false;
|
|
207
207
|
const s2 = o2.slice(0, -1);
|
|
208
208
|
let l2;
|
|
209
|
-
if (0 === s2.length) l2 =
|
|
209
|
+
if (0 === s2.length) l2 = e2.doc;
|
|
210
210
|
else {
|
|
211
|
-
const
|
|
212
|
-
l2 =
|
|
211
|
+
const t5 = s2[s2.length - 1];
|
|
212
|
+
l2 = t5 ? e2.getBlock(t5) : void 0;
|
|
213
213
|
}
|
|
214
214
|
if (!l2) return false;
|
|
215
|
-
const d2 = l2.children.findIndex((
|
|
215
|
+
const d2 = l2.children.findIndex((t5) => c(t5) && t5.id === n2.nodeId);
|
|
216
216
|
if (-1 === d2) return false;
|
|
217
|
-
const g2 = (function(
|
|
218
|
-
if (0 ===
|
|
219
|
-
const
|
|
217
|
+
const g2 = (function(t5, e3, n3) {
|
|
218
|
+
if (0 === e3.length) {
|
|
219
|
+
const e4 = t5.doc.children, i3 = e4.findIndex((t6) => t6.id === n3), r2 = e4[i3 + 1] ?? e4[i3 - 1];
|
|
220
220
|
return r2?.id;
|
|
221
221
|
}
|
|
222
|
-
return
|
|
223
|
-
})(
|
|
222
|
+
return e3[e3.length - 1];
|
|
223
|
+
})(e2, s2, n2.nodeId);
|
|
224
224
|
if (!g2) return false;
|
|
225
|
-
const u2 =
|
|
226
|
-
return
|
|
227
|
-
})(
|
|
228
|
-
})(
|
|
225
|
+
const u2 = e2.transaction("command").removeNode(s2, d2).setSelection(a(g2, 0)).build();
|
|
226
|
+
return t4.dispatch(u2), true;
|
|
227
|
+
})(t3));
|
|
228
|
+
})(t2), this.registerResizeCommands(t2), this.registerResizeKeymaps(t2), this.registerFileHandler(t2), this.registerToolbarItem(t2);
|
|
229
229
|
}
|
|
230
230
|
destroy() {
|
|
231
|
-
for (const
|
|
231
|
+
for (const t2 of this.blobUrls) URL.revokeObjectURL(t2);
|
|
232
232
|
this.blobUrls.clear(), this.uploadStates.clear(), this.context = null;
|
|
233
233
|
}
|
|
234
|
-
onStateChange(
|
|
234
|
+
onStateChange(t2, e2, n2) {
|
|
235
235
|
if (!this.context) return;
|
|
236
|
-
for (const
|
|
237
|
-
const i2 = this.isImageSelected(
|
|
238
|
-
!i2 && r2 && this.announceImageSelection(
|
|
236
|
+
for (const t3 of this.uploadStates.keys()) e2.getBlock(t3) || this.uploadStates.delete(t3);
|
|
237
|
+
const i2 = this.isImageSelected(t2), r2 = this.isImageSelected(e2);
|
|
238
|
+
!i2 && r2 && this.announceImageSelection(e2);
|
|
239
239
|
}
|
|
240
|
-
registerNodeSpec(
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
const n2 = i("figure",
|
|
240
|
+
registerNodeSpec(t2) {
|
|
241
|
+
const e2 = this.locale;
|
|
242
|
+
t2.registerNodeSpec({ type: "image", group: "block", isVoid: true, selectable: true, attrs: { src: { default: "" }, alt: { default: "" }, align: { default: "center" } }, toDOM(t3) {
|
|
243
|
+
const n2 = i("figure", t3.id);
|
|
244
244
|
n2.className = "notectl-image", n2.setAttribute("data-void", "true"), n2.setAttribute("data-selectable", "true");
|
|
245
245
|
const r2 = document.createElement("div");
|
|
246
246
|
r2.className = "notectl-image__container";
|
|
247
|
-
const o2 =
|
|
248
|
-
l2.className = "notectl-image__img", l2.src =
|
|
249
|
-
const c2 = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }[
|
|
250
|
-
return c2 && n2.classList.add(c2), n2.setAttribute("aria-label",
|
|
251
|
-
}, toHTML(
|
|
252
|
-
const
|
|
253
|
-
return `<figure
|
|
254
|
-
}, parseHTML: [{ tag: "figure", getAttrs(
|
|
255
|
-
const
|
|
256
|
-
if (!
|
|
257
|
-
const n2 = { src:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
247
|
+
const o2 = t3.attrs?.alt ?? "", a2 = t3.attrs?.width, s2 = t3.attrs?.height, l2 = document.createElement("img");
|
|
248
|
+
l2.className = "notectl-image__img", l2.src = t3.attrs?.src ?? "", l2.alt = o2, l2.draggable = false, void 0 !== a2 && (l2.style.width = `${a2}px`), void 0 !== s2 && (l2.style.height = `${s2}px`);
|
|
249
|
+
const c2 = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }[t3.attrs?.align ?? "center"];
|
|
250
|
+
return c2 && n2.classList.add(c2), n2.setAttribute("aria-label", e2.imageAria(o2, a2, s2)), r2.appendChild(l2), n2.appendChild(r2), n2;
|
|
251
|
+
}, toHTML(t3) {
|
|
252
|
+
const e3 = n(t3.attrs?.src ?? ""), i2 = n(t3.attrs?.alt ?? ""), r2 = t3.attrs?.width, o2 = t3.attrs?.height, a2 = t3.attrs?.align ?? "center", s2 = (void 0 !== r2 ? ` width="${r2}"` : "") + (void 0 !== o2 ? ` height="${o2}"` : "");
|
|
253
|
+
return `<figure${a2 ? ` style="text-align: ${n(a2)}"` : ""}><img src="${e3}" alt="${i2}"${s2}></figure>`;
|
|
254
|
+
}, parseHTML: [{ tag: "figure", getAttrs(t3) {
|
|
255
|
+
const e3 = t3.querySelector("img");
|
|
256
|
+
if (!e3) return false;
|
|
257
|
+
const n2 = { src: e3.getAttribute("src") ?? "", alt: e3.getAttribute("alt") ?? "", align: "center" }, i2 = e3.getAttribute("width"), r2 = e3.getAttribute("height");
|
|
258
|
+
i2 && (n2.width = Number.parseInt(i2, 10)), r2 && (n2.height = Number.parseInt(r2, 10));
|
|
259
|
+
const o2 = t3.style?.textAlign ?? "";
|
|
260
|
+
return "left" === o2 || "right" === o2 || "center" === o2 ? n2.align = o2 : t3.classList.contains("notectl-image--left") ? n2.align = "left" : t3.classList.contains("notectl-image--right") && (n2.align = "right"), n2;
|
|
261
|
+
} }, { tag: "img", getAttrs(t3) {
|
|
262
|
+
const e3 = { src: t3.getAttribute("src") ?? "", alt: t3.getAttribute("alt") ?? "", align: "center" }, n2 = t3.getAttribute("width"), i2 = t3.getAttribute("height");
|
|
263
|
+
return n2 && (e3.width = Number.parseInt(n2, 10)), i2 && (e3.height = Number.parseInt(i2, 10)), e3;
|
|
264
|
+
} }], sanitize: { tags: ["figure", "img"], attrs: ["src", "alt", "width", "height", "class", "style"] } });
|
|
263
265
|
}
|
|
264
|
-
registerNodeView(
|
|
265
|
-
|
|
266
|
+
registerNodeView(t2) {
|
|
267
|
+
t2.registerNodeView("image", w(this.config, this.uploadStates, this.resolvedKeymap));
|
|
266
268
|
}
|
|
267
|
-
registerResizeCommands(
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
const n3 = p(
|
|
271
|
-
return n3 && this.announceCurrentSize(
|
|
272
|
-
}),
|
|
273
|
-
const n3 = p(
|
|
274
|
-
return n3 && this.announceCurrentSize(
|
|
275
|
-
}),
|
|
276
|
-
const
|
|
277
|
-
return
|
|
278
|
-
}),
|
|
279
|
-
const
|
|
280
|
-
return
|
|
281
|
-
}),
|
|
282
|
-
const
|
|
283
|
-
const
|
|
269
|
+
registerResizeCommands(t2) {
|
|
270
|
+
const e2 = this.config.resizeStep ?? 10, n2 = this.config.resizeStepLarge ?? 50, i2 = this.config.maxWidth;
|
|
271
|
+
t2.registerCommand("resizeImageGrow", () => {
|
|
272
|
+
const n3 = p(t2, e2, i2);
|
|
273
|
+
return n3 && this.announceCurrentSize(t2), n3;
|
|
274
|
+
}), t2.registerCommand("resizeImageShrink", () => {
|
|
275
|
+
const n3 = p(t2, -e2, i2);
|
|
276
|
+
return n3 && this.announceCurrentSize(t2), n3;
|
|
277
|
+
}), t2.registerCommand("resizeImageGrowLarge", () => {
|
|
278
|
+
const e3 = p(t2, n2, i2);
|
|
279
|
+
return e3 && this.announceCurrentSize(t2), e3;
|
|
280
|
+
}), t2.registerCommand("resizeImageShrinkLarge", () => {
|
|
281
|
+
const e3 = p(t2, -n2, i2);
|
|
282
|
+
return e3 && this.announceCurrentSize(t2), e3;
|
|
283
|
+
}), t2.registerCommand("resetImageSize", () => {
|
|
284
|
+
const e3 = (function(t3) {
|
|
285
|
+
const e4 = t3.getState(), n3 = e4.selection;
|
|
284
286
|
if (!r(n3)) return false;
|
|
285
|
-
const i3 =
|
|
287
|
+
const i3 = e4.getBlock(n3.nodeId);
|
|
286
288
|
if (!i3 || "image" !== i3.type) return false;
|
|
287
|
-
const o2 =
|
|
289
|
+
const o2 = e4.getNodePath(n3.nodeId);
|
|
288
290
|
if (!o2) return false;
|
|
289
|
-
const a2 = { ...i3.attrs ?? {} }, s2 = Object.fromEntries(Object.entries(a2).filter(([
|
|
290
|
-
return
|
|
291
|
-
})(
|
|
292
|
-
return
|
|
291
|
+
const a2 = { ...i3.attrs ?? {} }, s2 = Object.fromEntries(Object.entries(a2).filter(([t4]) => "width" !== t4 && "height" !== t4)), l2 = e4.transaction("command").setNodeAttr(o2, s2).build();
|
|
292
|
+
return t3.dispatch(l2), true;
|
|
293
|
+
})(t2);
|
|
294
|
+
return e3 && t2.announce(this.locale.resetToNaturalSize), e3;
|
|
293
295
|
});
|
|
294
296
|
}
|
|
295
|
-
registerResizeKeymaps(
|
|
296
|
-
const
|
|
297
|
+
registerResizeKeymaps(t2) {
|
|
298
|
+
const e2 = {}, n2 = { growWidth: "resizeImageGrow", shrinkWidth: "resizeImageShrink", growWidthLarge: "resizeImageGrowLarge", shrinkWidthLarge: "resizeImageShrinkLarge", resetSize: "resetImageSize" };
|
|
297
299
|
for (const [i2, r2] of Object.entries(n2)) {
|
|
298
300
|
const n3 = this.resolvedKeymap[i2] ?? null;
|
|
299
|
-
n3 && (
|
|
301
|
+
n3 && (e2[n3] = () => t2.executeCommand(r2));
|
|
300
302
|
}
|
|
301
|
-
Object.keys(
|
|
303
|
+
Object.keys(e2).length > 0 && t2.registerKeymap(e2);
|
|
302
304
|
}
|
|
303
|
-
registerFileHandler(
|
|
304
|
-
|
|
305
|
+
registerFileHandler(t2) {
|
|
306
|
+
t2.registerFileHandler("image/*", async (e2, n2) => !!this.isAcceptedType(e2.type) && (this.handleFileInsert(t2, e2), true));
|
|
305
307
|
}
|
|
306
|
-
handleFileInsert(
|
|
307
|
-
if (
|
|
308
|
-
const n2 = URL.createObjectURL(
|
|
309
|
-
if (this.blobUrls.add(n2), !m(
|
|
310
|
-
const i2 =
|
|
308
|
+
handleFileInsert(t2, e2) {
|
|
309
|
+
if (e2.size > this.config.maxFileSize) return;
|
|
310
|
+
const n2 = URL.createObjectURL(e2);
|
|
311
|
+
if (this.blobUrls.add(n2), !m(t2, { src: n2 })) return URL.revokeObjectURL(n2), void this.blobUrls.delete(n2);
|
|
312
|
+
const i2 = t2.getState().selection;
|
|
311
313
|
if (!r(i2)) return;
|
|
312
314
|
const o2 = i2.nodeId;
|
|
313
|
-
this.uploadStates.set(o2, "uploading"),
|
|
315
|
+
this.uploadStates.set(o2, "uploading"), t2.getService(A) ? this.uploadFile(t2, e2, o2, n2) : this.uploadStates.set(o2, "complete");
|
|
314
316
|
}
|
|
315
|
-
async uploadFile(
|
|
316
|
-
const r2 =
|
|
317
|
+
async uploadFile(t2, e2, n2, i2) {
|
|
318
|
+
const r2 = t2.getService(A);
|
|
317
319
|
if (r2) try {
|
|
318
|
-
const o2 = await r2.upload(
|
|
320
|
+
const o2 = await r2.upload(e2);
|
|
319
321
|
this.uploadStates.set(n2, "complete");
|
|
320
|
-
const a2 =
|
|
322
|
+
const a2 = t2.getState(), s2 = a2.getBlock(n2);
|
|
321
323
|
if (!s2) return;
|
|
322
324
|
const l2 = a2.getNodePath(n2);
|
|
323
325
|
if (!l2) return;
|
|
324
326
|
const c2 = { ...s2.attrs ?? {}, src: o2.url, ...void 0 !== o2.width ? { width: o2.width } : {}, ...void 0 !== o2.height ? { height: o2.height } : {} }, d2 = a2.transaction("command").setNodeAttr(l2, c2).build();
|
|
325
|
-
|
|
327
|
+
t2.dispatch(d2), URL.revokeObjectURL(i2), this.blobUrls.delete(i2);
|
|
326
328
|
} catch {
|
|
327
|
-
this.uploadStates.set(n2, "error"),
|
|
329
|
+
this.uploadStates.set(n2, "error"), t2.announce(this.locale.uploadFailed);
|
|
328
330
|
}
|
|
329
331
|
}
|
|
330
|
-
registerToolbarItem(
|
|
331
|
-
|
|
332
|
-
this.renderImagePopup(
|
|
332
|
+
registerToolbarItem(t2) {
|
|
333
|
+
t2.registerToolbarItem({ id: "image", group: "insert", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>', label: this.locale.insertImage, tooltip: this.locale.insertImageTooltip, command: "insertImage", priority: 50, popupType: "custom", separatorAfter: this.config.separatorAfter, renderPopup: (t3, e2, n2) => {
|
|
334
|
+
this.renderImagePopup(t3, e2, n2);
|
|
333
335
|
} });
|
|
334
336
|
}
|
|
335
|
-
renderImagePopup(
|
|
336
|
-
|
|
337
|
+
renderImagePopup(t2, e2, n2) {
|
|
338
|
+
t2.style.padding = "8px", t2.style.minWidth = "240px";
|
|
337
339
|
const i2 = document.createElement("input");
|
|
338
340
|
i2.type = "file", i2.accept = this.config.acceptedTypes.join(","), i2.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;opacity:0;";
|
|
339
341
|
const r2 = document.createElement("button");
|
|
340
|
-
r2.type = "button", r2.textContent = this.locale.uploadFromComputer, r2.setAttribute("aria-label", this.locale.uploadAria), r2.style.cssText = "display:block;width:100%;padding:8px 12px;cursor:pointer;text-align:center;box-sizing:border-box;border:1px solid var(--notectl-border);border-radius:4px;background:var(--notectl-surface-raised);color:var(--notectl-fg);", r2.addEventListener("mousedown", (
|
|
341
|
-
|
|
342
|
+
r2.type = "button", r2.textContent = this.locale.uploadFromComputer, r2.setAttribute("aria-label", this.locale.uploadAria), r2.style.cssText = "display:block;width:100%;padding:8px 12px;cursor:pointer;text-align:center;box-sizing:border-box;border:1px solid var(--notectl-border);border-radius:4px;background:var(--notectl-surface-raised);color:var(--notectl-fg);", r2.addEventListener("mousedown", (t3) => {
|
|
343
|
+
t3.preventDefault(), t3.stopPropagation(), i2.click();
|
|
342
344
|
}), i2.addEventListener("change", () => {
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
}),
|
|
345
|
+
const t3 = i2.files?.[0];
|
|
346
|
+
t3 && (this.handleFileInsert(e2, t3), n2(), e2.getContainer().focus());
|
|
347
|
+
}), t2.appendChild(i2), t2.appendChild(r2);
|
|
346
348
|
const o2 = document.createElement("div");
|
|
347
349
|
o2.style.cssText = "display:flex;align-items:center;margin:8px 0;color:var(--notectl-fg-muted);font-size:12px;";
|
|
348
350
|
const a2 = document.createElement("span");
|
|
@@ -350,55 +352,55 @@ class k {
|
|
|
350
352
|
const s2 = document.createElement("span");
|
|
351
353
|
s2.textContent = this.locale.separator, s2.style.cssText = "padding:0 8px;";
|
|
352
354
|
const l2 = document.createElement("span");
|
|
353
|
-
l2.style.cssText = "flex:1;height:1px;background:var(--notectl-border);", o2.appendChild(a2), o2.appendChild(s2), o2.appendChild(l2),
|
|
355
|
+
l2.style.cssText = "flex:1;height:1px;background:var(--notectl-border);", o2.appendChild(a2), o2.appendChild(s2), o2.appendChild(l2), t2.appendChild(o2);
|
|
354
356
|
const c2 = document.createElement("input");
|
|
355
357
|
c2.type = "url", c2.placeholder = this.locale.urlPlaceholder, c2.setAttribute("aria-label", this.locale.urlAria), c2.style.cssText = "width:100%;padding:6px 8px;box-sizing:border-box;border:1px solid var(--notectl-border);border-radius:4px;background:var(--notectl-bg);color:var(--notectl-fg);";
|
|
356
358
|
const d2 = document.createElement("button");
|
|
357
359
|
d2.type = "button", d2.textContent = this.locale.insertButton, d2.setAttribute("aria-label", this.locale.insertAria), d2.style.cssText = "width:100%;padding:8px 12px;margin-top:4px;cursor:pointer;border:1px solid var(--notectl-border);border-radius:4px;background:var(--notectl-surface-raised);color:var(--notectl-fg);";
|
|
358
360
|
const g2 = () => {
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
+
const t3 = c2.value.trim();
|
|
362
|
+
t3 && (m(e2, { src: t3 }), n2(), e2.getContainer().focus());
|
|
361
363
|
};
|
|
362
|
-
d2.addEventListener("mousedown", (
|
|
363
|
-
|
|
364
|
-
}), c2.addEventListener("keydown", (
|
|
365
|
-
"Enter" ===
|
|
366
|
-
}),
|
|
364
|
+
d2.addEventListener("mousedown", (t3) => {
|
|
365
|
+
t3.preventDefault(), t3.stopPropagation(), g2();
|
|
366
|
+
}), c2.addEventListener("keydown", (t3) => {
|
|
367
|
+
"Enter" === t3.key && (t3.preventDefault(), g2());
|
|
368
|
+
}), t2.appendChild(c2), t2.appendChild(d2), requestAnimationFrame(() => c2.focus());
|
|
367
369
|
}
|
|
368
|
-
isAcceptedType(
|
|
369
|
-
return this.config.acceptedTypes.some((
|
|
370
|
+
isAcceptedType(t2) {
|
|
371
|
+
return this.config.acceptedTypes.some((e2) => e2 === t2 || e2.endsWith("/*") && t2.startsWith(e2.slice(0, -1)));
|
|
370
372
|
}
|
|
371
|
-
isImageSelected(
|
|
372
|
-
const
|
|
373
|
-
if (!r(
|
|
374
|
-
const n2 =
|
|
373
|
+
isImageSelected(t2) {
|
|
374
|
+
const e2 = t2.selection;
|
|
375
|
+
if (!r(e2)) return false;
|
|
376
|
+
const n2 = t2.getBlock(e2.nodeId);
|
|
375
377
|
return "image" === n2?.type;
|
|
376
378
|
}
|
|
377
|
-
announceImageSelection(
|
|
379
|
+
announceImageSelection(t2) {
|
|
378
380
|
if (!this.context) return;
|
|
379
|
-
const
|
|
380
|
-
if (!r(
|
|
381
|
-
const n2 =
|
|
381
|
+
const e2 = t2.selection;
|
|
382
|
+
if (!r(e2)) return;
|
|
383
|
+
const n2 = t2.getBlock(e2.nodeId);
|
|
382
384
|
if (!n2 || "image" !== n2.type) return;
|
|
383
385
|
const i2 = n2.attrs?.alt ?? "", o2 = n2.attrs?.width, a2 = n2.attrs?.height, s2 = ["Image selected."];
|
|
384
386
|
i2 && s2.push(`Alt text: ${i2}.`), void 0 !== o2 && void 0 !== a2 && s2.push(`Size: ${o2} by ${a2} pixels.`);
|
|
385
387
|
const c2 = this.resolvedKeymap.shrinkWidth ?? null, d2 = this.resolvedKeymap.growWidth ?? null;
|
|
386
388
|
c2 && d2 && s2.push(`${l(c2)} / ${l(d2)} to resize.`), this.context.announce(s2.join(" "));
|
|
387
389
|
}
|
|
388
|
-
announceCurrentSize(
|
|
389
|
-
const
|
|
390
|
+
announceCurrentSize(t2) {
|
|
391
|
+
const e2 = t2.getState(), n2 = e2.selection;
|
|
390
392
|
if (!r(n2)) return;
|
|
391
|
-
const i2 =
|
|
393
|
+
const i2 = e2.getBlock(n2.nodeId);
|
|
392
394
|
if (!i2 || "image" !== i2.type) return;
|
|
393
395
|
const o2 = i2.attrs?.width, a2 = i2.attrs?.height;
|
|
394
|
-
void 0 !== o2 && void 0 !== a2 &&
|
|
396
|
+
void 0 !== o2 && void 0 !== a2 && t2.announce(`Image resized to ${o2} by ${a2} pixels.`);
|
|
395
397
|
}
|
|
396
398
|
}
|
|
397
399
|
export {
|
|
398
400
|
_ as D,
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
401
|
+
k as I,
|
|
402
|
+
f as a,
|
|
403
|
+
h as b,
|
|
404
|
+
A as c
|
|
403
405
|
};
|
|
404
|
-
//# sourceMappingURL=index-
|
|
406
|
+
//# sourceMappingURL=index-yhz2qeeh.mjs.map
|