@notectl/core 1.0.6 → 1.0.8
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 +78 -56
- package/custom-elements.json +344 -0
- package/dist/chunks/{AttrRegistry-DTsHyDVA.mjs → AttrRegistry-D-przlzb.mjs} +4 -4
- package/dist/chunks/{AttrRegistry-DTsHyDVA.mjs.map → AttrRegistry-D-przlzb.mjs.map} +1 -1
- package/dist/chunks/ColorNames-iaWsSZx1.mjs +35 -0
- package/dist/chunks/ColorNames-iaWsSZx1.mjs.map +1 -0
- package/dist/chunks/ColorValidation-Dyy4Bye8.mjs +140 -0
- package/dist/chunks/ColorValidation-Dyy4Bye8.mjs.map +1 -0
- package/dist/chunks/{Commands-DLP85Mp5.mjs → Commands-CSpSwGXv.mjs} +13 -13
- package/dist/chunks/{Commands-DLP85Mp5.mjs.map → Commands-CSpSwGXv.mjs.map} +1 -1
- package/dist/chunks/ToolbarKeyboardNav-B32OMv8r.mjs +46 -0
- package/dist/chunks/ToolbarKeyboardNav-B32OMv8r.mjs.map +1 -0
- package/dist/chunks/{ToolbarPlugin-sJTiZr-S.mjs → ToolbarPlugin-DY2xaJiu.mjs} +63 -93
- package/dist/chunks/ToolbarPlugin-DY2xaJiu.mjs.map +1 -0
- package/dist/chunks/index-BAk1EG1x.mjs +541 -0
- package/dist/chunks/index-BAk1EG1x.mjs.map +1 -0
- package/dist/chunks/index-BRYzYOYC.mjs +63 -0
- package/dist/chunks/index-BRYzYOYC.mjs.map +1 -0
- package/dist/chunks/index-BSFLNveF.mjs +953 -0
- package/dist/chunks/index-BSFLNveF.mjs.map +1 -0
- package/dist/chunks/index-BYgspns5.mjs +209 -0
- package/dist/chunks/index-BYgspns5.mjs.map +1 -0
- package/dist/chunks/index-B_3qDrUN.mjs +64 -0
- package/dist/chunks/index-B_3qDrUN.mjs.map +1 -0
- package/dist/chunks/index-Bsp4LC5t.mjs +130 -0
- package/dist/chunks/index-Bsp4LC5t.mjs.map +1 -0
- package/dist/chunks/index-C-YWHOcC.mjs +100 -0
- package/dist/chunks/index-C-YWHOcC.mjs.map +1 -0
- package/dist/chunks/index-C2GQoHot.mjs +92 -0
- package/dist/chunks/index-C2GQoHot.mjs.map +1 -0
- package/dist/chunks/index-CT3HGdQt.mjs +39 -0
- package/dist/chunks/index-CT3HGdQt.mjs.map +1 -0
- package/dist/chunks/index-Ct0ivLhO.mjs +407 -0
- package/dist/chunks/index-Ct0ivLhO.mjs.map +1 -0
- package/dist/chunks/index-CxiWyUho.mjs +191 -0
- package/dist/chunks/index-CxiWyUho.mjs.map +1 -0
- package/dist/chunks/index-D3CQWJiw.mjs +200 -0
- package/dist/chunks/index-D3CQWJiw.mjs.map +1 -0
- package/dist/chunks/index-DC1EK22F.mjs +41 -0
- package/dist/chunks/index-DC1EK22F.mjs.map +1 -0
- package/dist/chunks/index-Dh76rR13.mjs +196 -0
- package/dist/chunks/index-Dh76rR13.mjs.map +1 -0
- package/dist/chunks/index-o6hDR07y.mjs +41 -0
- package/dist/chunks/index-o6hDR07y.mjs.map +1 -0
- package/dist/chunks/index-uTnc9y7M.mjs +62 -0
- package/dist/chunks/index-uTnc9y7M.mjs.map +1 -0
- package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs +34 -0
- package/dist/chunks/resolvePluginLocale-B4w1OkPy.mjs.map +1 -0
- package/dist/editor/NotectlEditor.d.ts +10 -0
- package/dist/editor/NotectlEditor.d.ts.map +1 -1
- package/dist/editor/PaperLayoutController.d.ts +27 -0
- package/dist/editor/PaperLayoutController.d.ts.map +1 -0
- package/dist/editor/PaperSize.d.ts +35 -0
- package/dist/editor/PaperSize.d.ts.map +1 -0
- package/dist/editor/styles/color-picker.d.ts +1 -1
- package/dist/editor/styles/color-picker.d.ts.map +1 -1
- package/dist/editor/styles/paper.d.ts +3 -0
- package/dist/editor/styles/paper.d.ts.map +1 -0
- package/dist/editor/styles/table.d.ts +1 -1
- package/dist/editor/styles/table.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/editor/styles.d.ts.map +1 -1
- package/dist/i18n/Locale.d.ts +17 -0
- package/dist/i18n/Locale.d.ts.map +1 -0
- package/dist/i18n/LocaleService.d.ts +8 -0
- package/dist/i18n/LocaleService.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/resolvePluginLocale.d.ts +3 -0
- package/dist/i18n/resolvePluginLocale.d.ts.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/input/ClipboardHandler.d.ts.map +1 -1
- package/dist/input/InputHandler.d.ts.map +1 -1
- package/dist/input/KeyboardHandler.d.ts.map +1 -1
- package/dist/input/PasteHandler.d.ts.map +1 -1
- package/dist/notectl-core.mjs +2126 -1952
- package/dist/notectl-core.mjs.map +1 -1
- package/dist/notectl-core.umd.js +2002 -1544
- package/dist/notectl-core.umd.js.map +1 -1
- package/dist/plugins/PluginManager.d.ts +5 -0
- package/dist/plugins/PluginManager.d.ts.map +1 -1
- package/dist/plugins/alignment/AlignmentLocale.d.ts +19 -0
- package/dist/plugins/alignment/AlignmentLocale.d.ts.map +1 -0
- package/dist/plugins/alignment/AlignmentPlugin.d.ts +4 -0
- package/dist/plugins/alignment/AlignmentPlugin.d.ts.map +1 -1
- package/dist/plugins/alignment.mjs +3 -89
- package/dist/plugins/alignment.mjs.map +1 -1
- package/dist/plugins/blockquote/BlockquoteLocale.d.ts +17 -0
- package/dist/plugins/blockquote/BlockquoteLocale.d.ts.map +1 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts +3 -0
- package/dist/plugins/blockquote/BlockquotePlugin.d.ts.map +1 -1
- package/dist/plugins/blockquote.mjs +2 -55
- package/dist/plugins/blockquote.mjs.map +1 -1
- package/dist/plugins/code-block/CodeBlockLocale.d.ts +17 -0
- package/dist/plugins/code-block/CodeBlockLocale.d.ts.map +1 -0
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts +1 -0
- package/dist/plugins/code-block/CodeBlockPlugin.d.ts.map +1 -1
- package/dist/plugins/code-block/CodeBlockTypes.d.ts +2 -0
- package/dist/plugins/code-block/CodeBlockTypes.d.ts.map +1 -1
- package/dist/plugins/code-block.mjs +3 -3
- package/dist/plugins/font/FontLocale.d.ts +15 -0
- package/dist/plugins/font/FontLocale.d.ts.map +1 -0
- package/dist/plugins/font/FontPlugin.d.ts +3 -0
- package/dist/plugins/font/FontPlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizeLocale.d.ts +17 -0
- package/dist/plugins/font-size/FontSizeLocale.d.ts.map +1 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts +3 -0
- package/dist/plugins/font-size/FontSizePlugin.d.ts.map +1 -1
- package/dist/plugins/font-size/FontSizePopup.d.ts +2 -0
- package/dist/plugins/font-size/FontSizePopup.d.ts.map +1 -1
- package/dist/plugins/font-size.mjs +2 -201
- package/dist/plugins/font-size.mjs.map +1 -1
- package/dist/plugins/font.mjs +2 -183
- package/dist/plugins/font.mjs.map +1 -1
- package/dist/plugins/hard-break.mjs +1 -1
- package/dist/plugins/heading/HeadingLocale.d.ts +26 -0
- package/dist/plugins/heading/HeadingLocale.d.ts.map +1 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts +4 -0
- package/dist/plugins/heading/HeadingPlugin.d.ts.map +1 -1
- package/dist/plugins/heading.mjs +1 -184
- package/dist/plugins/heading.mjs.map +1 -1
- package/dist/plugins/highlight/HighlightLocale.d.ts +17 -0
- package/dist/plugins/highlight/HighlightLocale.d.ts.map +1 -0
- package/dist/plugins/highlight/HighlightPlugin.d.ts +3 -5
- package/dist/plugins/highlight/HighlightPlugin.d.ts.map +1 -1
- package/dist/plugins/highlight.mjs +2 -123
- package/dist/plugins/highlight.mjs.map +1 -1
- package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts +15 -0
- package/dist/plugins/horizontal-rule/HorizontalRuleLocale.d.ts.map +1 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts +4 -0
- package/dist/plugins/horizontal-rule/HorizontalRulePlugin.d.ts.map +1 -1
- package/dist/plugins/horizontal-rule.mjs +2 -56
- package/dist/plugins/horizontal-rule.mjs.map +1 -1
- package/dist/plugins/image/ImageLocale.d.ts +25 -0
- package/dist/plugins/image/ImageLocale.d.ts.map +1 -0
- package/dist/plugins/image/ImagePlugin.d.ts +1 -0
- package/dist/plugins/image/ImagePlugin.d.ts.map +1 -1
- package/dist/plugins/image/ImageUpload.d.ts +3 -0
- package/dist/plugins/image/ImageUpload.d.ts.map +1 -1
- package/dist/plugins/image.mjs +4 -378
- package/dist/plugins/image.mjs.map +1 -1
- package/dist/plugins/link/LinkLocale.d.ts +23 -0
- package/dist/plugins/link/LinkLocale.d.ts.map +1 -0
- package/dist/plugins/link/LinkPlugin.d.ts +3 -0
- package/dist/plugins/link/LinkPlugin.d.ts.map +1 -1
- package/dist/plugins/link.mjs +2 -124
- package/dist/plugins/link.mjs.map +1 -1
- package/dist/plugins/list/ListLocale.d.ts +18 -0
- package/dist/plugins/list/ListLocale.d.ts.map +1 -0
- package/dist/plugins/list/ListPlugin.d.ts +4 -0
- package/dist/plugins/list/ListPlugin.d.ts.map +1 -1
- package/dist/plugins/list.mjs +2 -190
- package/dist/plugins/list.mjs.map +1 -1
- package/dist/plugins/print/PrintLocale.d.ts +16 -0
- package/dist/plugins/print/PrintLocale.d.ts.map +1 -0
- package/dist/plugins/print/PrintPlugin.d.ts +1 -0
- package/dist/plugins/print/PrintPlugin.d.ts.map +1 -1
- package/dist/plugins/print/PrintStyleCollector.d.ts +7 -0
- package/dist/plugins/print/PrintStyleCollector.d.ts.map +1 -1
- package/dist/plugins/print/PrintTypes.d.ts +5 -0
- package/dist/plugins/print/PrintTypes.d.ts.map +1 -1
- package/dist/plugins/shared/ColorMarkOperations.d.ts +28 -0
- package/dist/plugins/shared/ColorMarkOperations.d.ts.map +1 -0
- package/dist/plugins/shared/ColorNames.d.ts +22 -0
- package/dist/plugins/shared/ColorNames.d.ts.map +1 -0
- package/dist/plugins/shared/ColorPickerPopup.d.ts +31 -0
- package/dist/plugins/shared/ColorPickerPopup.d.ts.map +1 -0
- package/dist/plugins/shared/ColorValidation.d.ts +14 -0
- package/dist/plugins/shared/ColorValidation.d.ts.map +1 -0
- package/dist/plugins/strikethrough/StrikethroughLocale.d.ts +17 -0
- package/dist/plugins/strikethrough/StrikethroughLocale.d.ts.map +1 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts +3 -0
- package/dist/plugins/strikethrough/StrikethroughPlugin.d.ts.map +1 -1
- package/dist/plugins/strikethrough.mjs +2 -32
- package/dist/plugins/strikethrough.mjs.map +1 -1
- package/dist/plugins/super-sub/SuperSubLocale.d.ts +19 -0
- package/dist/plugins/super-sub/SuperSubLocale.d.ts.map +1 -0
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts +3 -0
- package/dist/plugins/super-sub/SuperSubPlugin.d.ts.map +1 -1
- package/dist/plugins/super-sub.mjs +2 -78
- package/dist/plugins/super-sub.mjs.map +1 -1
- package/dist/plugins/table/TableBorderColor.d.ts +24 -0
- package/dist/plugins/table/TableBorderColor.d.ts.map +1 -0
- package/dist/plugins/table/TableCommands.d.ts +9 -8
- package/dist/plugins/table/TableCommands.d.ts.map +1 -1
- package/dist/plugins/table/TableContextMenu.d.ts +14 -0
- package/dist/plugins/table/TableContextMenu.d.ts.map +1 -0
- package/dist/plugins/table/TableControls.d.ts +3 -1
- package/dist/plugins/table/TableControls.d.ts.map +1 -1
- package/dist/plugins/table/TableControlsDOM.d.ts +13 -1
- package/dist/plugins/table/TableControlsDOM.d.ts.map +1 -1
- package/dist/plugins/table/TableLocale.d.ts +48 -0
- package/dist/plugins/table/TableLocale.d.ts.map +1 -0
- package/dist/plugins/table/TableNavigation.d.ts +2 -1
- package/dist/plugins/table/TableNavigation.d.ts.map +1 -1
- package/dist/plugins/table/TableNodeViews.d.ts +3 -1
- package/dist/plugins/table/TableNodeViews.d.ts.map +1 -1
- package/dist/plugins/table/TablePlugin.d.ts +7 -1
- package/dist/plugins/table/TablePlugin.d.ts.map +1 -1
- package/dist/plugins/table/index.d.ts +3 -0
- package/dist/plugins/table/index.d.ts.map +1 -1
- package/dist/plugins/table.mjs +18 -660
- package/dist/plugins/table.mjs.map +1 -1
- package/dist/plugins/text-color/TextColorLocale.d.ts +17 -0
- package/dist/plugins/text-color/TextColorLocale.d.ts.map +1 -0
- package/dist/plugins/text-color/TextColorPlugin.d.ts +3 -5
- package/dist/plugins/text-color/TextColorPlugin.d.ts.map +1 -1
- package/dist/plugins/text-color.mjs +2 -123
- package/dist/plugins/text-color.mjs.map +1 -1
- package/dist/plugins/text-formatting/TextFormattingLocale.d.ts +18 -0
- package/dist/plugins/text-formatting/TextFormattingLocale.d.ts.map +1 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts +4 -0
- package/dist/plugins/text-formatting/TextFormattingPlugin.d.ts.map +1 -1
- package/dist/plugins/text-formatting.mjs +2 -49
- package/dist/plugins/text-formatting.mjs.map +1 -1
- package/dist/plugins/toolbar/ToolbarLocale.d.ts +14 -0
- package/dist/plugins/toolbar/ToolbarLocale.d.ts.map +1 -0
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts +1 -0
- package/dist/plugins/toolbar/ToolbarPlugin.d.ts.map +1 -1
- package/dist/plugins/toolbar.mjs +1 -1
- package/dist/state/EditorState.d.ts +4 -1
- package/dist/state/EditorState.d.ts.map +1 -1
- package/dist/view/EditorView.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/chunks/Plugin-B9OZ6Y4c.mjs +0 -15
- package/dist/chunks/Plugin-B9OZ6Y4c.mjs.map +0 -1
- package/dist/chunks/ToolbarPlugin-sJTiZr-S.mjs.map +0 -1
- package/dist/chunks/color-picker-Csf0wx5a.mjs +0 -5
- package/dist/chunks/color-picker-Csf0wx5a.mjs.map +0 -1
- package/dist/chunks/index-QvKiO9_4.mjs +0 -538
- package/dist/chunks/index-QvKiO9_4.mjs.map +0 -1
|
@@ -1,59 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as t } from "../chunks/NodeSpec-NZVvcCuH.mjs";
|
|
3
|
-
import { i as r, a as o, c as i } from "../chunks/Selection-D5ZjXoB7.mjs";
|
|
4
|
-
import { n } from "../chunks/TypeBrands-C09nE2qO.mjs";
|
|
5
|
-
import { f as s } from "../chunks/ToolbarItem-ugDymuXi.mjs";
|
|
6
|
-
const a = {};
|
|
7
|
-
function l(e2) {
|
|
8
|
-
const t2 = e2.selection;
|
|
9
|
-
return r(t2) ? -1 : e2.doc.children.findIndex((e3) => e3.id === t2.anchor.blockId);
|
|
10
|
-
}
|
|
11
|
-
class c {
|
|
12
|
-
id = "horizontal-rule";
|
|
13
|
-
name = "Horizontal Rule";
|
|
14
|
-
priority = 40;
|
|
15
|
-
config;
|
|
16
|
-
constructor(e2) {
|
|
17
|
-
this.config = { ...a, ...e2 };
|
|
18
|
-
}
|
|
19
|
-
init(e2) {
|
|
20
|
-
this.registerNodeSpec(e2), this.registerCommands(e2), this.registerKeymap(e2), this.registerInputRule(e2), this.registerToolbarItem(e2);
|
|
21
|
-
}
|
|
22
|
-
registerNodeSpec(e2) {
|
|
23
|
-
e2.registerNodeSpec({ type: "horizontal_rule", group: "block", isVoid: true, toDOM: (e3) => t("hr", e3.id), toHTML: () => "<hr>", parseHTML: [{ tag: "hr" }], sanitize: { tags: ["hr"] } });
|
|
24
|
-
}
|
|
25
|
-
registerCommands(e2) {
|
|
26
|
-
e2.registerCommand("insertHorizontalRule", () => this.insertHorizontalRule(e2));
|
|
27
|
-
}
|
|
28
|
-
registerKeymap(e2) {
|
|
29
|
-
e2.registerKeymap({ "Mod-Shift-H": () => e2.executeCommand("insertHorizontalRule") });
|
|
30
|
-
}
|
|
31
|
-
registerInputRule(t2) {
|
|
32
|
-
t2.registerInputRule({ pattern: /^-{3,} $/, handler(t3, s2, a2, c2) {
|
|
33
|
-
const u = t3.selection;
|
|
34
|
-
if (r(u)) return null;
|
|
35
|
-
if (!o(u)) return null;
|
|
36
|
-
const p = t3.getBlock(u.anchor.blockId);
|
|
37
|
-
if (!p || "paragraph" !== p.type) return null;
|
|
38
|
-
const d = l(t3);
|
|
39
|
-
if (-1 === d) return null;
|
|
40
|
-
const h = e(n("paragraph"));
|
|
41
|
-
return t3.transaction("input").deleteTextAt(u.anchor.blockId, 0, c2).setBlockType(u.anchor.blockId, n("horizontal_rule")).insertNode([], d + 1, h).setSelection(i(h.id, 0)).build();
|
|
42
|
-
} });
|
|
43
|
-
}
|
|
44
|
-
registerToolbarItem(e2) {
|
|
45
|
-
e2.registerToolbarItem({ id: "horizontal-rule", group: "block", icon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11h16v2H4z"/></svg>', label: "Horizontal Rule", tooltip: `Horizontal Rule (${s("Mod-Shift-H")})`, command: "insertHorizontalRule", priority: 60, separatorAfter: this.config.separatorAfter, isActive: () => false });
|
|
46
|
-
}
|
|
47
|
-
insertHorizontalRule(t2) {
|
|
48
|
-
const o2 = t2.getState();
|
|
49
|
-
if (r(o2.selection)) return false;
|
|
50
|
-
const s2 = l(o2);
|
|
51
|
-
if (-1 === s2) return false;
|
|
52
|
-
const a2 = e(n("horizontal_rule")), c2 = e(n("paragraph")), u = o2.transaction("command").insertNode([], s2 + 1, a2).insertNode([], s2 + 2, c2).setSelection(i(c2.id, 0)).build();
|
|
53
|
-
return t2.dispatch(u), true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
import { b } from "../chunks/index-BRYzYOYC.mjs";
|
|
56
2
|
export {
|
|
57
|
-
|
|
3
|
+
b as HorizontalRulePlugin
|
|
58
4
|
};
|
|
59
5
|
//# sourceMappingURL=horizontal-rule.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"horizontal-rule.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"horizontal-rule.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Locale interface and default English locale for the ImagePlugin. */
|
|
2
|
+
export interface ImageLocale {
|
|
3
|
+
readonly insertImage: string;
|
|
4
|
+
readonly insertImageTooltip: string;
|
|
5
|
+
readonly uploadFromComputer: string;
|
|
6
|
+
readonly uploadAria: string;
|
|
7
|
+
readonly separator: string;
|
|
8
|
+
readonly urlPlaceholder: string;
|
|
9
|
+
readonly urlAria: string;
|
|
10
|
+
readonly insertButton: string;
|
|
11
|
+
readonly insertAria: string;
|
|
12
|
+
readonly imageAria: (alt: string, width?: number, height?: number) => string;
|
|
13
|
+
readonly resetToNaturalSize: string;
|
|
14
|
+
readonly uploadFailed: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const IMAGE_LOCALE_EN: ImageLocale;
|
|
17
|
+
export declare const IMAGE_LOCALE_DE: ImageLocale;
|
|
18
|
+
export declare const IMAGE_LOCALE_ES: ImageLocale;
|
|
19
|
+
export declare const IMAGE_LOCALE_FR: ImageLocale;
|
|
20
|
+
export declare const IMAGE_LOCALE_ZH: ImageLocale;
|
|
21
|
+
export declare const IMAGE_LOCALE_RU: ImageLocale;
|
|
22
|
+
export declare const IMAGE_LOCALE_AR: ImageLocale;
|
|
23
|
+
export declare const IMAGE_LOCALE_HI: ImageLocale;
|
|
24
|
+
export declare const IMAGE_LOCALES: Record<string, ImageLocale>;
|
|
25
|
+
//# sourceMappingURL=ImageLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImageLocale.d.ts","sourceRoot":"","sources":["../../../src/plugins/image/ImageLocale.ts"],"names":[],"mappings":"AAAA,uEAAuE;AAIvE,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7E,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B;AAID,eAAO,MAAM,eAAe,EAAE,WAmB7B,CAAC;AAIF,eAAO,MAAM,eAAe,EAAE,WAmB7B,CAAC;AAIF,eAAO,MAAM,eAAe,EAAE,WAmB7B,CAAC;AAIF,eAAO,MAAM,eAAe,EAAE,WAmB7B,CAAC;AAIF,eAAO,MAAM,eAAe,EAAE,WAmB7B,CAAC;AAIF,eAAO,MAAM,eAAe,EAAE,WAmB7B,CAAC;AAIF,eAAO,MAAM,eAAe,EAAE,WAmB7B,CAAC;AAIF,eAAO,MAAM,eAAe,EAAE,WAmB7B,CAAC;AAIF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CASrD,CAAC"}
|
|
@@ -22,6 +22,7 @@ export declare class ImagePlugin implements Plugin {
|
|
|
22
22
|
private readonly uploadStates;
|
|
23
23
|
private readonly blobUrls;
|
|
24
24
|
private context;
|
|
25
|
+
private locale;
|
|
25
26
|
constructor(config?: Partial<ImagePluginConfig>);
|
|
26
27
|
init(context: PluginContext): void;
|
|
27
28
|
destroy(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImagePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/image/ImagePlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"ImagePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/image/ImagePlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAU1D,OAAO,EAKN,KAAK,iBAAiB,EAEtB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,QAAQ,6BAA6B,CAAC;IAC5C,UAAU,gBAAgB;QACzB,KAAK,EAAE;YACN,GAAG,EAAE,MAAM,CAAC;YACZ,GAAG,EAAE,MAAM,CAAC;YACZ,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;SACnC,CAAC;KACF;CACD;AAID,qBAAa,WAAY,YAAW,MAAM;IACzC,QAAQ,CAAC,EAAE,WAAW;IACtB,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,QAAQ,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqD;IACpF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmC;IAChE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,OAAO,CAA8B;IAC7C,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;IAK/C,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAalC,OAAO,IAAI,IAAI;IASf,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI;IAmBnF,OAAO,CAAC,gBAAgB;IAyGxB,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,sBAAsB;IAoC9B,OAAO,CAAC,qBAAqB;IAsB7B,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,gBAAgB;YA8BV,UAAU;IAwCxB,OAAO,CAAC,mBAAmB;IAoB3B,OAAO,CAAC,gBAAgB;IA0GxB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,sBAAsB;IA2B9B,OAAO,CAAC,mBAAmB;CAc3B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ServiceKey } from '../Plugin.js';
|
|
2
|
+
import { ImageLocale } from './ImageLocale.js';
|
|
2
3
|
export interface ImageAttrs {
|
|
3
4
|
readonly src: string;
|
|
4
5
|
readonly alt: string;
|
|
@@ -43,6 +44,8 @@ export interface ImagePluginConfig {
|
|
|
43
44
|
readonly resizeStepLarge?: number;
|
|
44
45
|
/** Customize keyboard bindings for image resize actions. */
|
|
45
46
|
readonly keymap?: ImageKeymap;
|
|
47
|
+
/** Locale override for user-facing strings. */
|
|
48
|
+
readonly locale?: ImageLocale;
|
|
46
49
|
}
|
|
47
50
|
export declare const DEFAULT_IMAGE_CONFIG: ImagePluginConfig;
|
|
48
51
|
//# sourceMappingURL=ImageUpload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageUpload.d.ts","sourceRoot":"","sources":["../../../src/plugins/image/ImageUpload.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ImageUpload.d.ts","sourceRoot":"","sources":["../../../src/plugins/image/ImageUpload.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CAC5C;AAID,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IAClC,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC/C;AAED,eAAO,MAAM,oBAAoB,gCAAqD,CAAC;AAEvF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAItE;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,WAAW,EAAE,MAAM,CAAC,CAM5E,CAAC;AAIF,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,eAAO,MAAM,oBAAoB,EAAE,iBAOlC,CAAC"}
|
package/dist/plugins/image.mjs
CHANGED
|
@@ -1,381 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as e } from "../chunks/NodeSpec-NZVvcCuH.mjs";
|
|
3
|
-
import { i as n, c as i, b as r } from "../chunks/Selection-D5ZjXoB7.mjs";
|
|
4
|
-
import { f as o } from "../chunks/ToolbarItem-ugDymuXi.mjs";
|
|
5
|
-
import { a, c as s, u as c } from "../chunks/Document-CI3iCwEP.mjs";
|
|
6
|
-
import { n as l } from "../chunks/TypeBrands-C09nE2qO.mjs";
|
|
7
|
-
import { S as d } from "../chunks/Plugin-B9OZ6Y4c.mjs";
|
|
8
|
-
function g(t2, e2) {
|
|
9
|
-
const i2 = t2.getState(), o2 = i2.selection, d2 = { src: e2.src, alt: e2.alt ?? "", align: e2.align ?? "center", ...void 0 !== e2.width ? { width: e2.width } : {}, ...void 0 !== e2.height ? { height: e2.height } : {} }, g2 = n(o2) ? o2.nodeId : o2.anchor.blockId, m2 = (function(t3, e3) {
|
|
10
|
-
const n2 = t3.getBlock(e3);
|
|
11
|
-
if ("table_cell" === n2?.type) return e3;
|
|
12
|
-
const i3 = t3.getNodePath(e3);
|
|
13
|
-
if (i3) for (const e4 of i3) {
|
|
14
|
-
const n3 = t3.getBlock(e4);
|
|
15
|
-
if ("table_cell" === n3?.type) return e4;
|
|
16
|
-
}
|
|
17
|
-
})(i2, g2);
|
|
18
|
-
return m2 ? (function(t3, e3, n2, i3) {
|
|
19
|
-
const o3 = t3.getNodePath(n2);
|
|
20
|
-
if (!o3) return false;
|
|
21
|
-
const d3 = s(l("image"), [], void 0, i3), g3 = t3.getBlock(n2);
|
|
22
|
-
if (!g3) return false;
|
|
23
|
-
const m3 = t3.transaction("command"), u2 = c(g3);
|
|
24
|
-
for (let t4 = u2.length - 1; t4 >= 0; t4--) {
|
|
25
|
-
const e4 = g3.children.findIndex((e5) => a(e5) && e5.id === u2[t4]?.id);
|
|
26
|
-
-1 !== e4 && m3.removeNode(o3, e4);
|
|
27
|
-
}
|
|
28
|
-
return m3.insertNode(o3, 0, d3), m3.setSelection(r(d3.id, [...o3, d3.id])), e3.dispatch(m3.build()), true;
|
|
29
|
-
})(i2, t2, m2, d2) : (function(t3, e3, n2, i3) {
|
|
30
|
-
const o3 = t3.doc.children.findIndex((t4) => t4.id === n2);
|
|
31
|
-
if (-1 === o3) return false;
|
|
32
|
-
const a2 = s(l("image"), [], void 0, i3), c2 = s(l("paragraph")), d3 = t3.transaction("command").insertNode([], o3 + 1, a2).insertNode([], o3 + 2, c2).setSelection(r(a2.id, [])).build();
|
|
33
|
-
return e3.dispatch(d3), true;
|
|
34
|
-
})(i2, t2, g2, d2);
|
|
35
|
-
}
|
|
36
|
-
function m(t2, e2, i2) {
|
|
37
|
-
const r2 = t2.getState(), o2 = r2.selection;
|
|
38
|
-
if (!n(o2)) return false;
|
|
39
|
-
const a2 = r2.getBlock(o2.nodeId);
|
|
40
|
-
if (!a2 || "image" !== a2.type) return false;
|
|
41
|
-
const s2 = a2.attrs?.width, c2 = a2.attrs?.height;
|
|
42
|
-
if (void 0 === s2 || void 0 === c2) return false;
|
|
43
|
-
const l2 = c2 > 0 ? s2 / c2 : 1, d2 = Math.max(50, Math.min(i2, s2 + e2)), g2 = Math.round(d2 / l2);
|
|
44
|
-
return (d2 !== s2 || g2 !== c2) && (function(t3, e3) {
|
|
45
|
-
const i3 = t3.getState(), r3 = i3.selection;
|
|
46
|
-
if (!n(r3)) return false;
|
|
47
|
-
const o3 = i3.getBlock(r3.nodeId);
|
|
48
|
-
if (!o3 || "image" !== o3.type) return false;
|
|
49
|
-
const a3 = i3.getNodePath(r3.nodeId);
|
|
50
|
-
if (!a3) return false;
|
|
51
|
-
const s3 = { ...o3.attrs ?? {}, ...e3 }, c3 = i3.transaction("command").setNodeAttr(a3, s3).build();
|
|
52
|
-
return t3.dispatch(c3), true;
|
|
53
|
-
})(t2, { width: d2, height: g2 });
|
|
54
|
-
}
|
|
55
|
-
const u = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }, h = { nw: "nwse-resize", ne: "nesw-resize", sw: "nesw-resize", se: "nwse-resize" }, p = { nw: -1, ne: 1, sw: -1, se: 1 }, f = { nw: "Resize top-left", ne: "Resize top-right", sw: "Resize bottom-left", se: "Resize bottom-right" };
|
|
56
|
-
let b = null;
|
|
57
|
-
function v() {
|
|
58
|
-
b && (b.remove(), b = null);
|
|
59
|
-
}
|
|
60
|
-
function x(t2, e2, n2) {
|
|
61
|
-
return (i2, r2, a2) => {
|
|
62
|
-
const s2 = document.createElement("figure");
|
|
63
|
-
s2.className = "notectl-image", s2.setAttribute("data-block-id", i2.id), s2.setAttribute("data-void", "true"), s2.setAttribute("data-selectable", "true");
|
|
64
|
-
const c2 = document.createElement("div");
|
|
65
|
-
c2.className = "notectl-image__container";
|
|
66
|
-
const l2 = document.createElement("img");
|
|
67
|
-
l2.className = "notectl-image__img", l2.draggable = false;
|
|
68
|
-
const d2 = document.createElement("div");
|
|
69
|
-
d2.className = "notectl-image__overlay", c2.appendChild(l2), c2.appendChild(d2), s2.appendChild(c2);
|
|
70
|
-
let g2 = i2.id, m2 = null;
|
|
71
|
-
function x2(t3) {
|
|
72
|
-
const n3 = t3.attrs?.src ?? "", i3 = t3.attrs?.alt ?? "", r3 = t3.attrs?.width, o2 = t3.attrs?.height, a3 = t3.attrs?.align ?? "center";
|
|
73
|
-
l2.src !== n3 && (l2.src = n3), l2.alt = i3, l2.style.width = void 0 !== r3 ? `${r3}px` : "", l2.style.height = void 0 !== o2 ? `${o2}px` : "";
|
|
74
|
-
for (const t4 of Object.values(u)) s2.classList.remove(t4);
|
|
75
|
-
const c3 = u[a3];
|
|
76
|
-
c3 && s2.classList.add(c3);
|
|
77
|
-
const g3 = e2.get(t3.id) ?? "idle", m3 = "uploading" === g3;
|
|
78
|
-
d2.classList.toggle("notectl-image__overlay--uploading", m3), d2.classList.toggle("notectl-image__overlay--error", "error" === g3), d2.textContent = m3 ? "Uploading..." : "error" === g3 ? "Upload failed" : "", m3 ? s2.setAttribute("aria-busy", "true") : s2.removeAttribute("aria-busy"), (function(t4) {
|
|
79
|
-
const e3 = t4.attrs?.alt ?? "", n4 = t4.attrs?.width, i4 = t4.attrs?.height, r4 = [];
|
|
80
|
-
e3 ? r4.push(e3) : r4.push("Image"), void 0 !== n4 && void 0 !== i4 && r4.push(`${n4} by ${i4} pixels`), s2.setAttribute("aria-label", r4.join(", "));
|
|
81
|
-
})(t3);
|
|
82
|
-
}
|
|
83
|
-
x2(i2);
|
|
84
|
-
let y2 = false;
|
|
85
|
-
function w2(e3, n3, i3, o2) {
|
|
86
|
-
let c3 = 0, d3 = 0, g3 = 1;
|
|
87
|
-
const m3 = (e4) => {
|
|
88
|
-
const i4 = e4.clientX - c3, r3 = (a3 = d3 + i4 * p[n3], Math.max(50, Math.min(t2.maxWidth, a3)));
|
|
89
|
-
var a3;
|
|
90
|
-
const s3 = Math.round(r3 / g3);
|
|
91
|
-
l2.style.width = `${r3}px`, l2.style.height = `${s3}px`, o2.textContent = `${Math.round(r3)} × ${s3}`;
|
|
92
|
-
}, u2 = (t3) => {
|
|
93
|
-
document.removeEventListener("pointermove", m3), document.removeEventListener("pointerup", u2), s2.classList.remove("notectl-image--resizing"), o2.classList.remove("notectl-image__size-indicator--visible"), v();
|
|
94
|
-
const e4 = Math.round(l2.getBoundingClientRect().width), n4 = Math.round(e4 / g3);
|
|
95
|
-
!(function(t4, e5, n5) {
|
|
96
|
-
const i4 = r2(), o3 = i4.getBlock(t4);
|
|
97
|
-
if (!o3) return;
|
|
98
|
-
const s3 = o3.attrs?.width, c4 = o3.attrs?.height;
|
|
99
|
-
if (s3 === e5 && c4 === n5) return;
|
|
100
|
-
const l3 = i4.getNodePath(t4);
|
|
101
|
-
if (!l3) return;
|
|
102
|
-
const d4 = { ...o3.attrs ?? {}, width: e5, height: n5 }, g4 = i4.transaction("command").setNodeAttr(l3, d4).build();
|
|
103
|
-
a2(g4);
|
|
104
|
-
})(i3, e4, n4), t3.target?.releasePointerCapture?.(t3.pointerId);
|
|
105
|
-
};
|
|
106
|
-
e3.addEventListener("pointerdown", (t3) => {
|
|
107
|
-
t3.preventDefault(), t3.stopPropagation(), c3 = t3.clientX, d3 = l2.getBoundingClientRect().width;
|
|
108
|
-
const e4 = l2.getBoundingClientRect().height;
|
|
109
|
-
var i4;
|
|
110
|
-
g3 = e4 > 0 ? d3 / e4 : 1, s2.classList.add("notectl-image--resizing"), o2.textContent = `${Math.round(d3)} × ${Math.round(e4)}`, o2.classList.add("notectl-image__size-indicator--visible"), i4 = h[n3], v(), b = document.createElement("style"), b.textContent = `*{cursor:${i4}!important;user-select:none!important}`, document.head.appendChild(b), t3.target.setPointerCapture(t3.pointerId), document.addEventListener("pointermove", m3), document.addEventListener("pointerup", u2);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function z2() {
|
|
114
|
-
v(), m2 && (m2.remove(), m2 = null);
|
|
115
|
-
}
|
|
116
|
-
return l2.addEventListener("load", () => {
|
|
117
|
-
if (y2) return;
|
|
118
|
-
const e3 = r2(), n3 = e3.getBlock(g2);
|
|
119
|
-
if (!n3 || "image" !== n3.type) return;
|
|
120
|
-
const i3 = void 0 !== n3.attrs?.width, o2 = void 0 !== n3.attrs?.height;
|
|
121
|
-
if (i3 && o2) return void (y2 = true);
|
|
122
|
-
const s3 = l2.naturalWidth, c3 = l2.naturalHeight;
|
|
123
|
-
if (0 === s3 || 0 === c3) return;
|
|
124
|
-
const d3 = Math.min(s3, t2.maxWidth), m3 = s3 > 0 ? c3 / s3 : 1, u2 = Math.round(d3 * m3), h2 = e3.getNodePath(g2);
|
|
125
|
-
if (!h2) return;
|
|
126
|
-
const p2 = { ...n3.attrs ?? {}, width: d3, height: u2 }, f2 = e3.transaction("command").setNodeAttr(h2, p2).build();
|
|
127
|
-
a2(f2), y2 = true;
|
|
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
|
-
s2.classList.add("notectl-image--selected"), (function(e3) {
|
|
130
|
-
if (!t2.resizable || m2) return;
|
|
131
|
-
m2 = document.createElement("div"), m2.className = "notectl-image__resize-overlay", m2.setAttribute("data-notectl-no-print", "");
|
|
132
|
-
const i3 = document.createElement("div");
|
|
133
|
-
i3.className = "notectl-image__size-indicator", m2.appendChild(i3);
|
|
134
|
-
const r3 = ["nw", "ne", "sw", "se"];
|
|
135
|
-
for (const t3 of r3) {
|
|
136
|
-
const n3 = document.createElement("div");
|
|
137
|
-
n3.className = `notectl-image__resize-handle notectl-image__resize-handle--${t3}`, n3.setAttribute("role", "separator"), n3.setAttribute("aria-label", f[t3]), w2(n3, t3, e3, i3), m2.appendChild(n3);
|
|
138
|
-
}
|
|
139
|
-
if (n2) {
|
|
140
|
-
const t3 = (function(t4) {
|
|
141
|
-
const e4 = t4.shrinkWidth ?? null, n3 = t4.growWidth ?? null;
|
|
142
|
-
return e4 && n3 ? `${o(e4)} / ${o(n3)} to resize` : "";
|
|
143
|
-
})(n2);
|
|
144
|
-
if (t3) {
|
|
145
|
-
const e4 = document.createElement("div");
|
|
146
|
-
e4.className = "notectl-image__keyboard-hint", e4.setAttribute("aria-hidden", "true"), e4.textContent = t3, m2.appendChild(e4);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
c2.appendChild(m2);
|
|
150
|
-
})(g2);
|
|
151
|
-
}, deselectNode() {
|
|
152
|
-
s2.classList.remove("notectl-image--selected"), z2();
|
|
153
|
-
}, destroy() {
|
|
154
|
-
z2();
|
|
155
|
-
} };
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
const y = new d("image:upload"), w = { growWidth: "Mod-Shift-ArrowRight", shrinkWidth: "Mod-Shift-ArrowLeft", growWidthLarge: "Mod-Shift-Alt-ArrowRight", shrinkWidthLarge: "Mod-Shift-Alt-ArrowLeft", resetSize: "Mod-Shift-0" }, z = { maxWidth: 800, maxFileSize: 10485760, acceptedTypes: ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"], resizable: true, resizeStep: 10, resizeStepLarge: 50 };
|
|
159
|
-
class _ {
|
|
160
|
-
id = "image";
|
|
161
|
-
name = "Image";
|
|
162
|
-
priority = 45;
|
|
163
|
-
config;
|
|
164
|
-
resolvedKeymap;
|
|
165
|
-
uploadStates = /* @__PURE__ */ new Map();
|
|
166
|
-
blobUrls = /* @__PURE__ */ new Set();
|
|
167
|
-
context = null;
|
|
168
|
-
constructor(t2) {
|
|
169
|
-
this.config = { ...z, ...t2 }, this.resolvedKeymap = { ...w, ...t2?.keymap };
|
|
170
|
-
}
|
|
171
|
-
init(t2) {
|
|
172
|
-
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) {
|
|
173
|
-
t3.registerCommand("insertImage", () => g(t3, { src: "" })), t3.registerCommand("removeImage", () => (function(t4) {
|
|
174
|
-
const e2 = t4.getState(), r2 = e2.selection;
|
|
175
|
-
if (!n(r2)) return false;
|
|
176
|
-
const o2 = e2.getBlock(r2.nodeId);
|
|
177
|
-
if (!o2 || "image" !== o2.type) return false;
|
|
178
|
-
const s2 = e2.getNodePath(r2.nodeId);
|
|
179
|
-
if (!s2 || 0 === s2.length) return false;
|
|
180
|
-
const c2 = s2.slice(0, -1);
|
|
181
|
-
let l2;
|
|
182
|
-
if (0 === c2.length) l2 = e2.doc;
|
|
183
|
-
else {
|
|
184
|
-
const t5 = c2[c2.length - 1];
|
|
185
|
-
l2 = t5 ? e2.getBlock(t5) : void 0;
|
|
186
|
-
}
|
|
187
|
-
if (!l2) return false;
|
|
188
|
-
const d2 = l2.children.findIndex((t5) => a(t5) && t5.id === r2.nodeId);
|
|
189
|
-
if (-1 === d2) return false;
|
|
190
|
-
const g2 = (function(t5, e3, n2) {
|
|
191
|
-
if (0 === e3.length) {
|
|
192
|
-
const e4 = t5.doc.children, i2 = e4.findIndex((t6) => t6.id === n2), r3 = e4[i2 + 1] ?? e4[i2 - 1];
|
|
193
|
-
return r3?.id;
|
|
194
|
-
}
|
|
195
|
-
return e3[e3.length - 1];
|
|
196
|
-
})(e2, c2, r2.nodeId);
|
|
197
|
-
if (!g2) return false;
|
|
198
|
-
const m2 = e2.transaction("command").removeNode(c2, d2).setSelection(i(g2, 0)).build();
|
|
199
|
-
return t4.dispatch(m2), true;
|
|
200
|
-
})(t3));
|
|
201
|
-
})(t2), this.registerResizeCommands(t2), this.registerResizeKeymaps(t2), this.registerFileHandler(t2), this.registerToolbarItem(t2);
|
|
202
|
-
}
|
|
203
|
-
destroy() {
|
|
204
|
-
for (const t2 of this.blobUrls) URL.revokeObjectURL(t2);
|
|
205
|
-
this.blobUrls.clear(), this.uploadStates.clear(), this.context = null;
|
|
206
|
-
}
|
|
207
|
-
onStateChange(t2, e2, n2) {
|
|
208
|
-
if (!this.context) return;
|
|
209
|
-
for (const t3 of this.uploadStates.keys()) e2.getBlock(t3) || this.uploadStates.delete(t3);
|
|
210
|
-
const i2 = this.isImageSelected(t2), r2 = this.isImageSelected(e2);
|
|
211
|
-
!i2 && r2 && this.announceImageSelection(e2);
|
|
212
|
-
}
|
|
213
|
-
registerNodeSpec(n2) {
|
|
214
|
-
n2.registerNodeSpec({ type: "image", group: "block", isVoid: true, selectable: true, attrs: { src: { default: "" }, alt: { default: "" }, align: { default: "center" } }, toDOM(t2) {
|
|
215
|
-
const n3 = e("figure", t2.id);
|
|
216
|
-
n3.className = "notectl-image", n3.setAttribute("data-void", "true"), n3.setAttribute("data-selectable", "true");
|
|
217
|
-
const i2 = document.createElement("div");
|
|
218
|
-
i2.className = "notectl-image__container";
|
|
219
|
-
const r2 = t2.attrs?.alt ?? "", o2 = t2.attrs?.width, a2 = t2.attrs?.height, s2 = document.createElement("img");
|
|
220
|
-
s2.className = "notectl-image__img", s2.src = t2.attrs?.src ?? "", s2.alt = r2, s2.draggable = false, void 0 !== o2 && (s2.style.width = `${o2}px`), void 0 !== a2 && (s2.style.height = `${a2}px`);
|
|
221
|
-
const c2 = { left: "notectl-image--left", center: "notectl-image--center", right: "notectl-image--right" }[t2.attrs?.align ?? "center"];
|
|
222
|
-
c2 && n3.classList.add(c2);
|
|
223
|
-
const l2 = [r2 || "Image"];
|
|
224
|
-
return void 0 !== o2 && void 0 !== a2 && l2.push(`${o2} by ${a2} pixels`), n3.setAttribute("aria-label", l2.join(", ")), i2.appendChild(s2), n3.appendChild(i2), n3;
|
|
225
|
-
}, toHTML(e2) {
|
|
226
|
-
const n3 = t(e2.attrs?.src ?? ""), i2 = t(e2.attrs?.alt ?? ""), r2 = e2.attrs?.width, o2 = e2.attrs?.height, a2 = e2.attrs?.align ?? "center", s2 = (void 0 !== r2 ? ` width="${r2}"` : "") + (void 0 !== o2 ? ` height="${o2}"` : "");
|
|
227
|
-
return `<figure class="notectl-image notectl-image--${t(a2)}"><img src="${n3}" alt="${i2}"${s2}></figure>`;
|
|
228
|
-
}, parseHTML: [{ tag: "figure", getAttrs(t2) {
|
|
229
|
-
const e2 = t2.querySelector("img");
|
|
230
|
-
if (!e2) return false;
|
|
231
|
-
const n3 = { src: e2.getAttribute("src") ?? "", alt: e2.getAttribute("alt") ?? "", align: "center" }, i2 = e2.getAttribute("width"), r2 = e2.getAttribute("height");
|
|
232
|
-
return i2 && (n3.width = Number.parseInt(i2, 10)), r2 && (n3.height = Number.parseInt(r2, 10)), t2.classList.contains("notectl-image--left") && (n3.align = "left"), t2.classList.contains("notectl-image--right") && (n3.align = "right"), n3;
|
|
233
|
-
} }, { tag: "img", getAttrs(t2) {
|
|
234
|
-
const e2 = { src: t2.getAttribute("src") ?? "", alt: t2.getAttribute("alt") ?? "", align: "center" }, n3 = t2.getAttribute("width"), i2 = t2.getAttribute("height");
|
|
235
|
-
return n3 && (e2.width = Number.parseInt(n3, 10)), i2 && (e2.height = Number.parseInt(i2, 10)), e2;
|
|
236
|
-
} }], sanitize: { tags: ["figure", "img"], attrs: ["src", "alt", "width", "height", "class"] } });
|
|
237
|
-
}
|
|
238
|
-
registerNodeView(t2) {
|
|
239
|
-
t2.registerNodeView("image", x(this.config, this.uploadStates, this.resolvedKeymap));
|
|
240
|
-
}
|
|
241
|
-
registerResizeCommands(t2) {
|
|
242
|
-
const e2 = this.config.resizeStep ?? 10, i2 = this.config.resizeStepLarge ?? 50, r2 = this.config.maxWidth;
|
|
243
|
-
t2.registerCommand("resizeImageGrow", () => {
|
|
244
|
-
const n2 = m(t2, e2, r2);
|
|
245
|
-
return n2 && this.announceCurrentSize(t2), n2;
|
|
246
|
-
}), t2.registerCommand("resizeImageShrink", () => {
|
|
247
|
-
const n2 = m(t2, -e2, r2);
|
|
248
|
-
return n2 && this.announceCurrentSize(t2), n2;
|
|
249
|
-
}), t2.registerCommand("resizeImageGrowLarge", () => {
|
|
250
|
-
const e3 = m(t2, i2, r2);
|
|
251
|
-
return e3 && this.announceCurrentSize(t2), e3;
|
|
252
|
-
}), t2.registerCommand("resizeImageShrinkLarge", () => {
|
|
253
|
-
const e3 = m(t2, -i2, r2);
|
|
254
|
-
return e3 && this.announceCurrentSize(t2), e3;
|
|
255
|
-
}), t2.registerCommand("resetImageSize", () => {
|
|
256
|
-
const e3 = (function(t3) {
|
|
257
|
-
const e4 = t3.getState(), i3 = e4.selection;
|
|
258
|
-
if (!n(i3)) return false;
|
|
259
|
-
const r3 = e4.getBlock(i3.nodeId);
|
|
260
|
-
if (!r3 || "image" !== r3.type) return false;
|
|
261
|
-
const o2 = e4.getNodePath(i3.nodeId);
|
|
262
|
-
if (!o2) return false;
|
|
263
|
-
const a2 = { ...r3.attrs ?? {} }, s2 = Object.fromEntries(Object.entries(a2).filter(([t4]) => "width" !== t4 && "height" !== t4)), c2 = e4.transaction("command").setNodeAttr(o2, s2).build();
|
|
264
|
-
return t3.dispatch(c2), true;
|
|
265
|
-
})(t2);
|
|
266
|
-
return e3 && t2.announce("Image reset to natural size."), e3;
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
registerResizeKeymaps(t2) {
|
|
270
|
-
const e2 = {}, n2 = { growWidth: "resizeImageGrow", shrinkWidth: "resizeImageShrink", growWidthLarge: "resizeImageGrowLarge", shrinkWidthLarge: "resizeImageShrinkLarge", resetSize: "resetImageSize" };
|
|
271
|
-
for (const [i2, r2] of Object.entries(n2)) {
|
|
272
|
-
const n3 = this.resolvedKeymap[i2] ?? null;
|
|
273
|
-
n3 && (e2[n3] = () => t2.executeCommand(r2));
|
|
274
|
-
}
|
|
275
|
-
Object.keys(e2).length > 0 && t2.registerKeymap(e2);
|
|
276
|
-
}
|
|
277
|
-
registerFileHandler(t2) {
|
|
278
|
-
t2.registerFileHandler("image/*", async (e2, n2) => {
|
|
279
|
-
const i2 = e2.filter((t3) => this.isAcceptedType(t3.type));
|
|
280
|
-
if (0 === i2.length) return false;
|
|
281
|
-
for (const e3 of i2) this.handleFileInsert(t2, e3);
|
|
282
|
-
return true;
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
handleFileInsert(t2, e2) {
|
|
286
|
-
if (e2.size > this.config.maxFileSize) return;
|
|
287
|
-
const i2 = URL.createObjectURL(e2);
|
|
288
|
-
if (this.blobUrls.add(i2), !g(t2, { src: i2 })) return URL.revokeObjectURL(i2), void this.blobUrls.delete(i2);
|
|
289
|
-
const r2 = t2.getState().selection;
|
|
290
|
-
if (!n(r2)) return;
|
|
291
|
-
const o2 = r2.nodeId;
|
|
292
|
-
this.uploadStates.set(o2, "uploading"), t2.getService(y) ? this.uploadFile(t2, e2, o2, i2) : this.uploadStates.set(o2, "complete");
|
|
293
|
-
}
|
|
294
|
-
async uploadFile(t2, e2, n2, i2) {
|
|
295
|
-
const r2 = t2.getService(y);
|
|
296
|
-
if (r2) try {
|
|
297
|
-
const o2 = await r2.upload(e2);
|
|
298
|
-
this.uploadStates.set(n2, "complete");
|
|
299
|
-
const a2 = t2.getState(), s2 = a2.getBlock(n2);
|
|
300
|
-
if (!s2) return;
|
|
301
|
-
const c2 = a2.getNodePath(n2);
|
|
302
|
-
if (!c2) return;
|
|
303
|
-
const l2 = { ...s2.attrs ?? {}, src: o2.url, ...void 0 !== o2.width ? { width: o2.width } : {}, ...void 0 !== o2.height ? { height: o2.height } : {} }, d2 = a2.transaction("command").setNodeAttr(c2, l2).build();
|
|
304
|
-
t2.dispatch(d2), URL.revokeObjectURL(i2), this.blobUrls.delete(i2);
|
|
305
|
-
} catch {
|
|
306
|
-
this.uploadStates.set(n2, "error"), t2.announce("Image upload failed.");
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
registerToolbarItem(t2) {
|
|
310
|
-
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: "Insert Image", tooltip: "Insert Image", command: "insertImage", priority: 50, popupType: "custom", separatorAfter: this.config.separatorAfter, renderPopup: (t3, e2, n2) => {
|
|
311
|
-
this.renderImagePopup(t3, e2, n2);
|
|
312
|
-
} });
|
|
313
|
-
}
|
|
314
|
-
renderImagePopup(t2, e2, n2) {
|
|
315
|
-
t2.style.padding = "8px", t2.style.minWidth = "240px";
|
|
316
|
-
const i2 = document.createElement("input");
|
|
317
|
-
i2.type = "file", i2.accept = this.config.acceptedTypes.join(","), i2.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;opacity:0;";
|
|
318
|
-
const r2 = document.createElement("button");
|
|
319
|
-
r2.type = "button", r2.textContent = "Upload from computer", r2.setAttribute("aria-label", "Upload image from computer"), 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) => {
|
|
320
|
-
t3.preventDefault(), t3.stopPropagation(), i2.click();
|
|
321
|
-
}), i2.addEventListener("change", () => {
|
|
322
|
-
const t3 = i2.files?.[0];
|
|
323
|
-
t3 && (this.handleFileInsert(e2, t3), n2(), e2.getContainer().focus());
|
|
324
|
-
}), t2.appendChild(i2), t2.appendChild(r2);
|
|
325
|
-
const o2 = document.createElement("div");
|
|
326
|
-
o2.style.cssText = "display:flex;align-items:center;margin:8px 0;color:var(--notectl-fg-muted);font-size:12px;";
|
|
327
|
-
const a2 = document.createElement("span");
|
|
328
|
-
a2.style.cssText = "flex:1;height:1px;background:var(--notectl-border);";
|
|
329
|
-
const s2 = document.createElement("span");
|
|
330
|
-
s2.textContent = "or", s2.style.cssText = "padding:0 8px;";
|
|
331
|
-
const c2 = document.createElement("span");
|
|
332
|
-
c2.style.cssText = "flex:1;height:1px;background:var(--notectl-border);", o2.appendChild(a2), o2.appendChild(s2), o2.appendChild(c2), t2.appendChild(o2);
|
|
333
|
-
const l2 = document.createElement("input");
|
|
334
|
-
l2.type = "url", l2.placeholder = "https://...", l2.setAttribute("aria-label", "Image URL"), l2.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);";
|
|
335
|
-
const d2 = document.createElement("button");
|
|
336
|
-
d2.type = "button", d2.textContent = "Insert", d2.setAttribute("aria-label", "Insert image"), 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);";
|
|
337
|
-
const m2 = () => {
|
|
338
|
-
const t3 = l2.value.trim();
|
|
339
|
-
t3 && (g(e2, { src: t3 }), n2(), e2.getContainer().focus());
|
|
340
|
-
};
|
|
341
|
-
d2.addEventListener("mousedown", (t3) => {
|
|
342
|
-
t3.preventDefault(), t3.stopPropagation(), m2();
|
|
343
|
-
}), l2.addEventListener("keydown", (t3) => {
|
|
344
|
-
"Enter" === t3.key && (t3.preventDefault(), m2());
|
|
345
|
-
}), t2.appendChild(l2), t2.appendChild(d2), requestAnimationFrame(() => l2.focus());
|
|
346
|
-
}
|
|
347
|
-
isAcceptedType(t2) {
|
|
348
|
-
return this.config.acceptedTypes.some((e2) => e2 === t2 || e2.endsWith("/*") && t2.startsWith(e2.slice(0, -1)));
|
|
349
|
-
}
|
|
350
|
-
isImageSelected(t2) {
|
|
351
|
-
const e2 = t2.selection;
|
|
352
|
-
if (!n(e2)) return false;
|
|
353
|
-
const i2 = t2.getBlock(e2.nodeId);
|
|
354
|
-
return "image" === i2?.type;
|
|
355
|
-
}
|
|
356
|
-
announceImageSelection(t2) {
|
|
357
|
-
if (!this.context) return;
|
|
358
|
-
const e2 = t2.selection;
|
|
359
|
-
if (!n(e2)) return;
|
|
360
|
-
const i2 = t2.getBlock(e2.nodeId);
|
|
361
|
-
if (!i2 || "image" !== i2.type) return;
|
|
362
|
-
const r2 = i2.attrs?.alt ?? "", a2 = i2.attrs?.width, s2 = i2.attrs?.height, c2 = ["Image selected."];
|
|
363
|
-
r2 && c2.push(`Alt text: ${r2}.`), void 0 !== a2 && void 0 !== s2 && c2.push(`Size: ${a2} by ${s2} pixels.`);
|
|
364
|
-
const l2 = this.resolvedKeymap.shrinkWidth ?? null, d2 = this.resolvedKeymap.growWidth ?? null;
|
|
365
|
-
l2 && d2 && c2.push(`${o(l2)} / ${o(d2)} to resize.`), this.context.announce(c2.join(" "));
|
|
366
|
-
}
|
|
367
|
-
announceCurrentSize(t2) {
|
|
368
|
-
const e2 = t2.getState(), i2 = e2.selection;
|
|
369
|
-
if (!n(i2)) return;
|
|
370
|
-
const r2 = e2.getBlock(i2.nodeId);
|
|
371
|
-
if (!r2 || "image" !== r2.type) return;
|
|
372
|
-
const o2 = r2.attrs?.width, a2 = r2.attrs?.height;
|
|
373
|
-
void 0 !== o2 && void 0 !== a2 && t2.announce(`Image resized to ${o2} by ${a2} pixels.`);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
1
|
+
import { D, b, c } from "../chunks/index-Ct0ivLhO.mjs";
|
|
376
2
|
export {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
3
|
+
D as DEFAULT_IMAGE_KEYMAP,
|
|
4
|
+
b as IMAGE_UPLOAD_SERVICE,
|
|
5
|
+
c as ImagePlugin
|
|
380
6
|
};
|
|
381
7
|
//# sourceMappingURL=image.mjs.map
|