miyuan-editor 0.0.3

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.
Files changed (58) hide show
  1. package/README.md +525 -0
  2. package/dist/core/index.cjs.js +40 -0
  3. package/dist/core/index.esm.js +4 -0
  4. package/dist/dist-5Q_Z9Ell.js +6390 -0
  5. package/dist/dist-5Q_Z9Ell.js.map +1 -0
  6. package/dist/dist-CMM6n8DO.cjs +4629 -0
  7. package/dist/dist-CMM6n8DO.cjs.map +1 -0
  8. package/dist/dist-CRSJDo2G.cjs +6617 -0
  9. package/dist/dist-CRSJDo2G.cjs.map +1 -0
  10. package/dist/dist-CZw77IJK.js +4612 -0
  11. package/dist/dist-CZw77IJK.js.map +1 -0
  12. package/dist/dist-CnVrDtsI.js +556 -0
  13. package/dist/dist-CnVrDtsI.js.map +1 -0
  14. package/dist/dist-rItBfhNb.cjs +591 -0
  15. package/dist/dist-rItBfhNb.cjs.map +1 -0
  16. package/dist/export-utils-CYaNoyVg.cjs +167 -0
  17. package/dist/export-utils-CYaNoyVg.cjs.map +1 -0
  18. package/dist/export-utils-DN0Gu8Vu.js +144 -0
  19. package/dist/export-utils-DN0Gu8Vu.js.map +1 -0
  20. package/dist/extension-BPFuYyzN.cjs +338 -0
  21. package/dist/extension-BPFuYyzN.cjs.map +1 -0
  22. package/dist/extension-Cl6x5MDR.js +321 -0
  23. package/dist/extension-Cl6x5MDR.js.map +1 -0
  24. package/dist/extensions/index.cjs.js +3462 -0
  25. package/dist/extensions/index.cjs.js.map +1 -0
  26. package/dist/extensions/index.esm.js +3412 -0
  27. package/dist/extensions/index.esm.js.map +1 -0
  28. package/dist/prompt-B4AOP8f_.js +24143 -0
  29. package/dist/prompt-B4AOP8f_.js.map +1 -0
  30. package/dist/prompt-CGLw2O21.cjs +25530 -0
  31. package/dist/prompt-CGLw2O21.cjs.map +1 -0
  32. package/dist/react/index.cjs.js +839 -0
  33. package/dist/react/index.cjs.js.map +1 -0
  34. package/dist/react/index.esm.js +820 -0
  35. package/dist/react/index.esm.js.map +1 -0
  36. package/dist/shortcut-panel-BskGXV8n.js +49468 -0
  37. package/dist/shortcut-panel-BskGXV8n.js.map +1 -0
  38. package/dist/shortcut-panel-yP4RPTFt.cjs +49563 -0
  39. package/dist/shortcut-panel-yP4RPTFt.cjs.map +1 -0
  40. package/dist/toc-extension-BESc0uEW.js +150 -0
  41. package/dist/toc-extension-BESc0uEW.js.map +1 -0
  42. package/dist/toc-extension-SRvSuskn.cjs +173 -0
  43. package/dist/toc-extension-SRvSuskn.cjs.map +1 -0
  44. package/dist/toolbar-config-Cgc9mV2v.js +243 -0
  45. package/dist/toolbar-config-Cgc9mV2v.js.map +1 -0
  46. package/dist/toolbar-config-Cjt_fPMi.cjs +260 -0
  47. package/dist/toolbar-config-Cjt_fPMi.cjs.map +1 -0
  48. package/dist/ui/index.cjs.js +18 -0
  49. package/dist/ui/index.esm.js +3 -0
  50. package/dist/vue/index.cjs.js +323 -0
  51. package/dist/vue/index.cjs.js.map +1 -0
  52. package/dist/vue/index.esm.js +307 -0
  53. package/dist/vue/index.esm.js.map +1 -0
  54. package/dist/vue2/index.cjs.js +323 -0
  55. package/dist/vue2/index.cjs.js.map +1 -0
  56. package/dist/vue2/index.esm.js +307 -0
  57. package/dist/vue2/index.esm.js.map +1 -0
  58. package/package.json +116 -0
@@ -0,0 +1,260 @@
1
+ //#region src/ui/toolbar-config.ts
2
+ var DEFAULT_TOOLBAR_CONFIG = { groups: [
3
+ [
4
+ {
5
+ type: "button",
6
+ name: "bold",
7
+ label: "B",
8
+ tip: "加粗 (Ctrl+B)",
9
+ command: "bold"
10
+ },
11
+ {
12
+ type: "button",
13
+ name: "italic",
14
+ label: "I",
15
+ tip: "斜体 (Ctrl+I)",
16
+ command: "italic"
17
+ },
18
+ {
19
+ type: "button",
20
+ name: "underline",
21
+ label: "U",
22
+ tip: "下划线 (Ctrl+U)",
23
+ command: "underline"
24
+ },
25
+ {
26
+ type: "button",
27
+ name: "strike",
28
+ label: "S",
29
+ tip: "删除线",
30
+ command: "strike"
31
+ },
32
+ {
33
+ type: "button",
34
+ name: "code",
35
+ label: "<>",
36
+ tip: "行内代码 (Ctrl+E)",
37
+ command: "code"
38
+ }
39
+ ],
40
+ [{
41
+ type: "button",
42
+ name: "textColor",
43
+ label: "A",
44
+ tip: "文字颜色",
45
+ command: "setTextColor"
46
+ }, {
47
+ type: "button",
48
+ name: "backgroundColor",
49
+ label: "🖊",
50
+ tip: "背景颜色",
51
+ command: "setBackgroundColor"
52
+ }],
53
+ [
54
+ {
55
+ type: "button",
56
+ name: "h1",
57
+ label: "H1",
58
+ tip: "标题 1 (Ctrl+Alt+1)",
59
+ command: "heading",
60
+ args: [1]
61
+ },
62
+ {
63
+ type: "button",
64
+ name: "h2",
65
+ label: "H2",
66
+ tip: "标题 2 (Ctrl+Alt+2)",
67
+ command: "heading",
68
+ args: [2]
69
+ },
70
+ {
71
+ type: "button",
72
+ name: "h3",
73
+ label: "H3",
74
+ tip: "标题 3 (Ctrl+Alt+3)",
75
+ command: "heading",
76
+ args: [3]
77
+ }
78
+ ],
79
+ [{
80
+ type: "select",
81
+ name: "fontSize"
82
+ }],
83
+ [
84
+ {
85
+ type: "button",
86
+ name: "blockquote",
87
+ label: "❝",
88
+ tip: "引用块 (Ctrl+Shift+B)",
89
+ command: "blockquote"
90
+ },
91
+ {
92
+ type: "button",
93
+ name: "bulletList",
94
+ label: "≡",
95
+ tip: "无序列表",
96
+ command: "bulletList"
97
+ },
98
+ {
99
+ type: "button",
100
+ name: "orderedList",
101
+ label: "≡.",
102
+ tip: "有序列表",
103
+ command: "orderedList"
104
+ },
105
+ {
106
+ type: "button",
107
+ name: "taskList",
108
+ label: "☑",
109
+ tip: "任务列表",
110
+ command: "taskList"
111
+ },
112
+ {
113
+ type: "button",
114
+ name: "codeBlock",
115
+ label: "{}",
116
+ tip: "代码块 (Ctrl+Shift+C)",
117
+ command: "codeBlock"
118
+ },
119
+ {
120
+ type: "button",
121
+ name: "horizontalRule",
122
+ label: "—",
123
+ tip: "分割线",
124
+ command: "horizontalRule"
125
+ }
126
+ ],
127
+ [{
128
+ type: "button",
129
+ name: "outdent",
130
+ label: "⇤",
131
+ tip: "减少缩进 (Shift+Tab)",
132
+ command: "outdent"
133
+ }, {
134
+ type: "button",
135
+ name: "indent",
136
+ label: "⇥",
137
+ tip: "增加缩进 (Tab)",
138
+ command: "indent"
139
+ }],
140
+ [
141
+ {
142
+ type: "button",
143
+ name: "alignLeft",
144
+ label: "☰",
145
+ tip: "左对齐",
146
+ command: "setTextAlign",
147
+ args: ["left"]
148
+ },
149
+ {
150
+ type: "button",
151
+ name: "alignCenter",
152
+ label: "☷",
153
+ tip: "居中",
154
+ command: "setTextAlign",
155
+ args: ["center"]
156
+ },
157
+ {
158
+ type: "button",
159
+ name: "alignRight",
160
+ label: "☵",
161
+ tip: "右对齐",
162
+ command: "setTextAlign",
163
+ args: ["right"]
164
+ }
165
+ ],
166
+ [{
167
+ type: "select",
168
+ name: "lineHeight"
169
+ }],
170
+ [{
171
+ type: "button",
172
+ name: "image",
173
+ label: "📷",
174
+ tip: "插入图片",
175
+ command: "insertImage"
176
+ }],
177
+ [{
178
+ type: "button",
179
+ name: "table",
180
+ label: "⊞",
181
+ tip: "插入表格 (Ctrl+Alt+T)",
182
+ command: "insertTable",
183
+ args: [3, 3]
184
+ }],
185
+ [{
186
+ type: "button",
187
+ name: "undo",
188
+ label: "↩",
189
+ tip: "撤销 (Ctrl+Z)",
190
+ command: "undo"
191
+ }, {
192
+ type: "button",
193
+ name: "redo",
194
+ label: "↪",
195
+ tip: "重做 (Ctrl+Y)",
196
+ command: "redo"
197
+ }]
198
+ ] };
199
+ var OPTIONAL_TOOLBAR_ITEMS = {
200
+ productCard: {
201
+ type: "button",
202
+ name: "productCard",
203
+ label: "🛍️",
204
+ tip: "商品卡片"
205
+ },
206
+ aiPolish: {
207
+ type: "button",
208
+ name: "aiPolish",
209
+ label: "AI润色",
210
+ tip: "AI 助手 (Ctrl+J)"
211
+ },
212
+ aiWriter: {
213
+ type: "button",
214
+ name: "aiWriter",
215
+ label: "AI写作",
216
+ tip: "AI 写作 (Ctrl+Shift+W)"
217
+ },
218
+ htmlImport: {
219
+ type: "button",
220
+ name: "htmlImport",
221
+ label: "📥",
222
+ tip: "导入 HTML"
223
+ }
224
+ };
225
+ function createToolbarConfig(options = {}) {
226
+ const groups = [...{ ...DEFAULT_TOOLBAR_CONFIG }.groups];
227
+ if (options.includeProductCard || options.includeAI || options.includeHtmlImport) {
228
+ const extraButtons = [];
229
+ if (options.includeHtmlImport) extraButtons.push(OPTIONAL_TOOLBAR_ITEMS.htmlImport);
230
+ if (options.includeProductCard) extraButtons.push(OPTIONAL_TOOLBAR_ITEMS.productCard);
231
+ if (options.includeAI) {
232
+ extraButtons.push(OPTIONAL_TOOLBAR_ITEMS.aiPolish);
233
+ extraButtons.push(OPTIONAL_TOOLBAR_ITEMS.aiWriter);
234
+ }
235
+ if (extraButtons.length > 0) groups.push(extraButtons);
236
+ }
237
+ if (options.customGroups) groups.push(...options.customGroups);
238
+ return { groups };
239
+ }
240
+ //#endregion
241
+ Object.defineProperty(exports, "DEFAULT_TOOLBAR_CONFIG", {
242
+ enumerable: true,
243
+ get: function() {
244
+ return DEFAULT_TOOLBAR_CONFIG;
245
+ }
246
+ });
247
+ Object.defineProperty(exports, "OPTIONAL_TOOLBAR_ITEMS", {
248
+ enumerable: true,
249
+ get: function() {
250
+ return OPTIONAL_TOOLBAR_ITEMS;
251
+ }
252
+ });
253
+ Object.defineProperty(exports, "createToolbarConfig", {
254
+ enumerable: true,
255
+ get: function() {
256
+ return createToolbarConfig;
257
+ }
258
+ });
259
+
260
+ //# sourceMappingURL=toolbar-config-Cjt_fPMi.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbar-config-Cjt_fPMi.cjs","names":[],"sources":["../src/ui/toolbar-config.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Toolbar Configuration\n// ---------------------------------------------------------------------------\n\nexport interface ToolbarButton {\n type: 'button' | 'select' | 'divider' | 'custom'\n name?: string\n label?: string\n icon?: string\n tip?: string\n command?: string\n args?: unknown[]\n active?: boolean | ((state: unknown) => boolean)\n}\n\nexport interface ToolbarConfig {\n groups: ToolbarButton[][]\n}\n\n// ---------------------------------------------------------------------------\n// Default Toolbar Configuration\n// ---------------------------------------------------------------------------\n\nexport const DEFAULT_TOOLBAR_CONFIG: ToolbarConfig = {\n groups: [\n // Format marks\n [\n { type: 'button', name: 'bold', label: 'B', tip: '加粗 (Ctrl+B)', command: 'bold' },\n { type: 'button', name: 'italic', label: 'I', tip: '斜体 (Ctrl+I)', command: 'italic' },\n { type: 'button', name: 'underline', label: 'U', tip: '下划线 (Ctrl+U)', command: 'underline' },\n { type: 'button', name: 'strike', label: 'S', tip: '删除线', command: 'strike' },\n { type: 'button', name: 'code', label: '<>', tip: '行内代码 (Ctrl+E)', command: 'code' },\n ],\n // Colors\n [\n { type: 'button', name: 'textColor', label: 'A', tip: '文字颜色', command: 'setTextColor' },\n { type: 'button', name: 'backgroundColor', label: '🖊', tip: '背景颜色', command: 'setBackgroundColor' },\n ],\n // Headings\n [\n { type: 'button', name: 'h1', label: 'H1', tip: '标题 1 (Ctrl+Alt+1)', command: 'heading', args: [1] },\n { type: 'button', name: 'h2', label: 'H2', tip: '标题 2 (Ctrl+Alt+2)', command: 'heading', args: [2] },\n { type: 'button', name: 'h3', label: 'H3', tip: '标题 3 (Ctrl+Alt+3)', command: 'heading', args: [3] },\n ],\n // Font size\n [\n { type: 'select', name: 'fontSize' },\n ],\n // Block elements\n [\n { type: 'button', name: 'blockquote', label: '❝', tip: '引用块 (Ctrl+Shift+B)', command: 'blockquote' },\n { type: 'button', name: 'bulletList', label: '≡', tip: '无序列表', command: 'bulletList' },\n { type: 'button', name: 'orderedList', label: '≡.', tip: '有序列表', command: 'orderedList' },\n { type: 'button', name: 'taskList', label: '☑', tip: '任务列表', command: 'taskList' },\n { type: 'button', name: 'codeBlock', label: '{}', tip: '代码块 (Ctrl+Shift+C)', command: 'codeBlock' },\n { type: 'button', name: 'horizontalRule', label: '—', tip: '分割线', command: 'horizontalRule' },\n ],\n // Indent\n [\n { type: 'button', name: 'outdent', label: '⇤', tip: '减少缩进 (Shift+Tab)', command: 'outdent' },\n { type: 'button', name: 'indent', label: '⇥', tip: '增加缩进 (Tab)', command: 'indent' },\n ],\n // Alignment\n [\n { type: 'button', name: 'alignLeft', label: '☰', tip: '左对齐', command: 'setTextAlign', args: ['left'] },\n { type: 'button', name: 'alignCenter', label: '☷', tip: '居中', command: 'setTextAlign', args: ['center'] },\n { type: 'button', name: 'alignRight', label: '☵', tip: '右对齐', command: 'setTextAlign', args: ['right'] },\n ],\n // Line height\n [\n { type: 'select', name: 'lineHeight' },\n ],\n // Image\n [\n { type: 'button', name: 'image', label: '📷', tip: '插入图片', command: 'insertImage' },\n ],\n // Table\n [\n { type: 'button', name: 'table', label: '⊞', tip: '插入表格 (Ctrl+Alt+T)', command: 'insertTable', args: [3, 3] },\n ],\n // History\n [\n { type: 'button', name: 'undo', label: '↩', tip: '撤销 (Ctrl+Z)', command: 'undo' },\n { type: 'button', name: 'redo', label: '↪', tip: '重做 (Ctrl+Y)', command: 'redo' },\n ],\n ],\n}\n\n// ---------------------------------------------------------------------------\n// Optional Toolbar Items\n// ---------------------------------------------------------------------------\n\nexport const OPTIONAL_TOOLBAR_ITEMS = {\n productCard: { type: 'button' as const, name: 'productCard', label: '🛍️', tip: '商品卡片' },\n aiPolish: { type: 'button' as const, name: 'aiPolish', label: 'AI润色', tip: 'AI 助手 (Ctrl+J)' },\n aiWriter: { type: 'button' as const, name: 'aiWriter', label: 'AI写作', tip: 'AI 写作 (Ctrl+Shift+W)' },\n htmlImport: { type: 'button' as const, name: 'htmlImport', label: '📥', tip: '导入 HTML' },\n}\n\n// ---------------------------------------------------------------------------\n// Helper Functions\n// ---------------------------------------------------------------------------\n\nexport function createToolbarConfig(options: {\n includeProductCard?: boolean\n includeAI?: boolean\n includeHtmlImport?: boolean\n customGroups?: ToolbarButton[][]\n} = {}): ToolbarConfig {\n const config = { ...DEFAULT_TOOLBAR_CONFIG }\n const groups = [...config.groups]\n\n if (options.includeProductCard || options.includeAI || options.includeHtmlImport) {\n const extraButtons: ToolbarButton[] = []\n \n if (options.includeHtmlImport) {\n extraButtons.push(OPTIONAL_TOOLBAR_ITEMS.htmlImport)\n }\n \n if (options.includeProductCard) {\n extraButtons.push(OPTIONAL_TOOLBAR_ITEMS.productCard)\n }\n \n if (options.includeAI) {\n extraButtons.push(OPTIONAL_TOOLBAR_ITEMS.aiPolish)\n extraButtons.push(OPTIONAL_TOOLBAR_ITEMS.aiWriter)\n }\n \n if (extraButtons.length > 0) {\n groups.push(extraButtons)\n }\n }\n\n if (options.customGroups) {\n groups.push(...options.customGroups)\n }\n\n return { groups }\n}\n"],"mappings":";AAuBA,IAAa,yBAAwC,EACnD,QAAQ;CAEN;EACE;GAAE,MAAM;GAAU,MAAM;GAAQ,OAAO;GAAK,KAAK;GAAe,SAAS;EAAO;EAChF;GAAE,MAAM;GAAU,MAAM;GAAU,OAAO;GAAK,KAAK;GAAe,SAAS;EAAS;EACpF;GAAE,MAAM;GAAU,MAAM;GAAa,OAAO;GAAK,KAAK;GAAgB,SAAS;EAAY;EAC3F;GAAE,MAAM;GAAU,MAAM;GAAU,OAAO;GAAK,KAAK;GAAO,SAAS;EAAS;EAC5E;GAAE,MAAM;GAAU,MAAM;GAAQ,OAAO;GAAM,KAAK;GAAiB,SAAS;EAAO;CACrF;CAEA,CACE;EAAE,MAAM;EAAU,MAAM;EAAa,OAAO;EAAK,KAAK;EAAQ,SAAS;CAAe,GACtF;EAAE,MAAM;EAAU,MAAM;EAAmB,OAAO;EAAM,KAAK;EAAQ,SAAS;CAAqB,CACrG;CAEA;EACE;GAAE,MAAM;GAAU,MAAM;GAAM,OAAO;GAAM,KAAK;GAAqB,SAAS;GAAW,MAAM,CAAC,CAAC;EA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ringTag, { value: "Module" });
2
+ require("../prompt-CGLw2O21.cjs");
3
+ const require_shortcut_panel = require("../shortcut-panel-yP4RPTFt.cjs");
4
+ const require_toolbar_config = require("../toolbar-config-Cjt_fPMi.cjs");
5
+ exports.AIMenu = require_shortcut_panel.AIMenu;
6
+ exports.AIWriter = require_shortcut_panel.AIWriter;
7
+ exports.BubbleMenu = require_shortcut_panel.BubbleMenu;
8
+ exports.DEFAULT_TOOLBAR_CONFIG = require_toolbar_config.DEFAULT_TOOLBAR_CONFIG;
9
+ exports.DragHandle = require_shortcut_panel.DragHandle;
10
+ exports.EDITOR_STYLES = require_shortcut_panel.EDITOR_STYLES;
11
+ exports.OPTIONAL_TOOLBAR_ITEMS = require_toolbar_config.OPTIONAL_TOOLBAR_ITEMS;
12
+ exports.ShortcutPanel = require_shortcut_panel.ShortcutPanel;
13
+ exports.TocPanel = require_shortcut_panel.TocPanel;
14
+ exports.Toolbar = require_shortcut_panel.Toolbar;
15
+ exports.UIComponent = require_shortcut_panel.UIComponent;
16
+ exports.WordCountDisplay = require_shortcut_panel.WordCountDisplay;
17
+ exports.createToolbarConfig = require_toolbar_config.createToolbarConfig;
18
+ exports.ensureStylesInjected = require_shortcut_panel.ensureStylesInjected;
@@ -0,0 +1,3 @@
1
+ import { a as AIMenu, d as BubbleMenu, f as Toolbar, g as UIComponent, h as ensureStylesInjected, i as AIWriter, m as EDITOR_STYLES, n as TocPanel, r as WordCountDisplay, t as ShortcutPanel, u as DragHandle } from "../shortcut-panel-BskGXV8n.js";
2
+ import { n as OPTIONAL_TOOLBAR_ITEMS, r as createToolbarConfig, t as DEFAULT_TOOLBAR_CONFIG } from "../toolbar-config-Cgc9mV2v.js";
3
+ export { AIMenu, AIWriter, BubbleMenu, DEFAULT_TOOLBAR_CONFIG, DragHandle, EDITOR_STYLES, OPTIONAL_TOOLBAR_ITEMS, ShortcutPanel, TocPanel, Toolbar, UIComponent, WordCountDisplay, createToolbarConfig, ensureStylesInjected };
@@ -0,0 +1,323 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ require("../prompt-CGLw2O21.cjs");
3
+ const require_dist = require("../dist-CRSJDo2G.cjs");
4
+ const require_extension = require("../extension-BPFuYyzN.cjs");
5
+ const require_shortcut_panel = require("../shortcut-panel-yP4RPTFt.cjs");
6
+ const require_export_utils = require("../export-utils-CYaNoyVg.cjs");
7
+ let vue = require("vue");
8
+ //#region src/vue/use-editor.ts
9
+ function useEditor(options = {}) {
10
+ const { extensions = [], content, onUpdate, onSelectionChange } = options;
11
+ const manager = new require_extension.ExtensionManager(extensions);
12
+ const schema = manager.schema;
13
+ let initialDoc;
14
+ if (content) try {
15
+ const container = document.createElement("div");
16
+ container.innerHTML = content;
17
+ initialDoc = require_dist.DOMParser.fromSchema(schema).parse(container);
18
+ } catch {}
19
+ const initialState = require_dist.EditorState.create({
20
+ schema,
21
+ doc: initialDoc,
22
+ plugins: manager.plugins
23
+ });
24
+ const viewRef = (0, vue.shallowRef)(null);
25
+ const stateRef = (0, vue.shallowRef)(initialState);
26
+ const version = (0, vue.shallowRef)(0);
27
+ const forceUpdate = () => {
28
+ version.value++;
29
+ };
30
+ const dispatchTransaction = (tr) => {
31
+ const view = viewRef.value;
32
+ if (!view) return;
33
+ const newState = view.state.apply(tr);
34
+ view.updateState(newState);
35
+ stateRef.value = newState;
36
+ if (onUpdate) onUpdate(newState);
37
+ if (onSelectionChange) onSelectionChange(newState);
38
+ forceUpdate();
39
+ };
40
+ const createView = (element) => {
41
+ if (viewRef.value) return;
42
+ const editableVal = typeof options.editable === "object" ? options.editable.value : options.editable ?? true;
43
+ const view = new require_extension.EditorView({
44
+ state: stateRef.value,
45
+ element,
46
+ editable: editableVal,
47
+ dispatchTransaction
48
+ });
49
+ viewRef.value = view;
50
+ stateRef.value = view.state;
51
+ forceUpdate();
52
+ };
53
+ (0, vue.onBeforeUnmount)(() => {
54
+ if (viewRef.value) {
55
+ viewRef.value.destroy();
56
+ viewRef.value = null;
57
+ }
58
+ });
59
+ if (typeof options.editable === "object") (0, vue.watch)(options.editable, () => {
60
+ forceUpdate();
61
+ });
62
+ return {
63
+ view: viewRef,
64
+ state: stateRef,
65
+ schema,
66
+ commands: manager.commands,
67
+ forceUpdate,
68
+ _createView: createView
69
+ };
70
+ }
71
+ //#endregion
72
+ //#region src/vue/components.ts
73
+ function createEditorAdapter(editor) {
74
+ return {
75
+ getView: () => editor.view.value,
76
+ getState: () => editor.state.value,
77
+ getSchema: () => editor.schema,
78
+ getCommands: () => editor.commands
79
+ };
80
+ }
81
+ var EditorContent = (0, vue.defineComponent)({
82
+ name: "EditorContent",
83
+ props: { editor: {
84
+ type: Object,
85
+ required: true
86
+ } },
87
+ setup(props) {
88
+ (0, vue.onMounted)(() => {
89
+ require_shortcut_panel.ensureStylesInjected();
90
+ });
91
+ return () => (0, vue.h)("div", { ref: (el) => {
92
+ if (el && el instanceof HTMLElement) props.editor._createView(el);
93
+ } });
94
+ }
95
+ });
96
+ var Toolbar = (0, vue.defineComponent)({
97
+ name: "MiToolbar",
98
+ props: { editor: {
99
+ type: Object,
100
+ required: true
101
+ } },
102
+ setup(props) {
103
+ const containerRef = (0, vue.ref)(null);
104
+ let comp = null;
105
+ (0, vue.onMounted)(() => {
106
+ if (!containerRef.value) return;
107
+ comp = new require_shortcut_panel.Toolbar(createEditorAdapter(props.editor));
108
+ comp.mount(containerRef.value);
109
+ });
110
+ (0, vue.onBeforeUnmount)(() => {
111
+ comp?.destroy();
112
+ });
113
+ return () => (0, vue.h)("div", { ref: (el) => {
114
+ if (el instanceof HTMLElement) containerRef.value = el;
115
+ } });
116
+ }
117
+ });
118
+ var BubbleMenu = (0, vue.defineComponent)({
119
+ name: "MiBubbleMenu",
120
+ props: { editor: {
121
+ type: Object,
122
+ required: true
123
+ } },
124
+ setup(props) {
125
+ const containerRef = (0, vue.ref)(null);
126
+ let comp = null;
127
+ (0, vue.onMounted)(() => {
128
+ if (!containerRef.value) return;
129
+ comp = new require_shortcut_panel.BubbleMenu(createEditorAdapter(props.editor));
130
+ comp.mount(containerRef.value);
131
+ });
132
+ (0, vue.onBeforeUnmount)(() => {
133
+ comp?.destroy();
134
+ });
135
+ return () => (0, vue.h)("div", { ref: (el) => {
136
+ if (el instanceof HTMLElement) containerRef.value = el;
137
+ } });
138
+ }
139
+ });
140
+ var DragHandle = (0, vue.defineComponent)({
141
+ name: "MiDragHandle",
142
+ props: { editor: {
143
+ type: Object,
144
+ required: true
145
+ } },
146
+ setup(props) {
147
+ const containerRef = (0, vue.ref)(null);
148
+ let comp = null;
149
+ (0, vue.onMounted)(() => {
150
+ if (!containerRef.value) return;
151
+ comp = new require_shortcut_panel.DragHandle(createEditorAdapter(props.editor));
152
+ comp.mount(containerRef.value);
153
+ });
154
+ (0, vue.onBeforeUnmount)(() => {
155
+ comp?.destroy();
156
+ });
157
+ return () => (0, vue.h)("div", { ref: (el) => {
158
+ if (el instanceof HTMLElement) containerRef.value = el;
159
+ } });
160
+ }
161
+ });
162
+ var WordCountDisplay = (0, vue.defineComponent)({
163
+ name: "MiWordCountDisplay",
164
+ props: {
165
+ editor: {
166
+ type: Object,
167
+ required: true
168
+ },
169
+ showDetails: {
170
+ type: Boolean,
171
+ default: false
172
+ }
173
+ },
174
+ setup(props) {
175
+ const containerRef = (0, vue.ref)(null);
176
+ let comp = null;
177
+ (0, vue.onMounted)(() => {
178
+ if (!containerRef.value) return;
179
+ comp = new require_shortcut_panel.WordCountDisplay(createEditorAdapter(props.editor), { showDetails: props.showDetails });
180
+ comp.mount(containerRef.value);
181
+ });
182
+ (0, vue.onBeforeUnmount)(() => {
183
+ comp?.destroy();
184
+ });
185
+ return () => (0, vue.h)("div", { ref: (el) => {
186
+ if (el instanceof HTMLElement) containerRef.value = el;
187
+ } });
188
+ }
189
+ });
190
+ var TocPanel = (0, vue.defineComponent)({
191
+ name: "MiTocPanel",
192
+ props: {
193
+ editor: {
194
+ type: Object,
195
+ required: true
196
+ },
197
+ title: {
198
+ type: String,
199
+ default: void 0
200
+ },
201
+ onItemClick: {
202
+ type: Function,
203
+ default: void 0
204
+ }
205
+ },
206
+ setup(props) {
207
+ const containerRef = (0, vue.ref)(null);
208
+ let comp = null;
209
+ (0, vue.onMounted)(() => {
210
+ if (!containerRef.value) return;
211
+ comp = new require_shortcut_panel.TocPanel(createEditorAdapter(props.editor), {
212
+ title: props.title,
213
+ onItemClick: props.onItemClick
214
+ });
215
+ comp.mount(containerRef.value);
216
+ });
217
+ (0, vue.onBeforeUnmount)(() => {
218
+ comp?.destroy();
219
+ });
220
+ return () => (0, vue.h)("div", { ref: (el) => {
221
+ if (el instanceof HTMLElement) containerRef.value = el;
222
+ } });
223
+ }
224
+ });
225
+ var ShortcutPanel = (0, vue.defineComponent)({
226
+ name: "MiShortcutPanel",
227
+ props: {
228
+ editor: {
229
+ type: Object,
230
+ required: true
231
+ },
232
+ shortcuts: {
233
+ type: Array,
234
+ default: void 0
235
+ }
236
+ },
237
+ setup(props, { expose }) {
238
+ const containerRef = (0, vue.ref)(null);
239
+ let comp = null;
240
+ (0, vue.onMounted)(() => {
241
+ if (!containerRef.value) return;
242
+ comp = new require_shortcut_panel.ShortcutPanel(createEditorAdapter(props.editor), { shortcuts: props.shortcuts });
243
+ comp.mount(containerRef.value);
244
+ });
245
+ (0, vue.onBeforeUnmount)(() => {
246
+ comp?.destroy();
247
+ });
248
+ expose({
249
+ open: () => comp?.open(),
250
+ close: () => comp?.close()
251
+ });
252
+ return () => (0, vue.h)("div", { ref: (el) => {
253
+ if (el instanceof HTMLElement) containerRef.value = el;
254
+ } });
255
+ }
256
+ });
257
+ var AIMenu = (0, vue.defineComponent)({
258
+ name: "MiAIMenu",
259
+ props: { editor: {
260
+ type: Object,
261
+ required: true
262
+ } },
263
+ setup(props, { expose }) {
264
+ const containerRef = (0, vue.ref)(null);
265
+ let comp = null;
266
+ (0, vue.onMounted)(() => {
267
+ if (!containerRef.value) return;
268
+ comp = new require_shortcut_panel.AIMenu(createEditorAdapter(props.editor));
269
+ comp.mount(containerRef.value);
270
+ });
271
+ (0, vue.onBeforeUnmount)(() => {
272
+ comp?.destroy();
273
+ });
274
+ expose({ open: () => comp?.open() });
275
+ return () => (0, vue.h)("div", { ref: (el) => {
276
+ if (el instanceof HTMLElement) containerRef.value = el;
277
+ } });
278
+ }
279
+ });
280
+ var AIWriter = (0, vue.defineComponent)({
281
+ name: "MiAIWriter",
282
+ props: { editor: {
283
+ type: Object,
284
+ required: true
285
+ } },
286
+ setup(props, { expose }) {
287
+ const containerRef = (0, vue.ref)(null);
288
+ let comp = null;
289
+ (0, vue.onMounted)(() => {
290
+ if (!containerRef.value) return;
291
+ comp = new require_shortcut_panel.AIWriter(createEditorAdapter(props.editor));
292
+ comp.mount(containerRef.value);
293
+ });
294
+ (0, vue.onBeforeUnmount)(() => {
295
+ comp?.destroy();
296
+ });
297
+ expose({
298
+ open: () => comp?.open(),
299
+ openProductCard: () => comp?.openProductCard()
300
+ });
301
+ return () => (0, vue.h)("div", { ref: (el) => {
302
+ if (el instanceof HTMLElement) containerRef.value = el;
303
+ } });
304
+ }
305
+ });
306
+ //#endregion
307
+ exports.AIMenu = AIMenu;
308
+ exports.AIWriter = AIWriter;
309
+ exports.BubbleMenu = BubbleMenu;
310
+ exports.DragHandle = DragHandle;
311
+ exports.EditorContent = EditorContent;
312
+ exports.ShortcutPanel = ShortcutPanel;
313
+ exports.TocPanel = TocPanel;
314
+ exports.Toolbar = Toolbar;
315
+ exports.WordCountDisplay = WordCountDisplay;
316
+ exports.createEditorAdapter = createEditorAdapter;
317
+ exports.exportAsHTML = require_export_utils.exportAsHTML;
318
+ exports.exportAsJSON = require_export_utils.exportAsJSON;
319
+ exports.exportAsMarkdown = require_export_utils.exportAsMarkdown;
320
+ exports.exportAsPlainText = require_export_utils.exportAsPlainText;
321
+ exports.useEditor = useEditor;
322
+
323
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","names":[],"sources":["../../src/vue/use-editor.ts","../../src/vue/components.ts"],"sourcesContent":["import { ref, shallowRef, onBeforeUnmount, watch, type Ref, type ShallowRef } from 'vue'\nimport { EditorState } from 'prosemirror-state'\nimport { DOMParser as PMDOMParser } from 'prosemirror-model'\nimport type { Schema } from 'prosemirror-model'\nimport type { Transaction } from 'prosemirror-state'\nimport type { Command } from 'prosemirror-state'\nimport { EditorView } from '../core/editor-view'\nimport { ExtensionManager } from '../core/extension'\nimport type { Extension } from '../core/extension'\n\nexport interface UseEditorOptions {\n extensions?: Extension[]\n content?: string\n editable?: boolean | Ref<boolean>\n onUpdate?: (state: EditorState) => void\n onSelectionChange?: (state: EditorState) => void\n}\n\nexport interface EditorHandle {\n view: ShallowRef<EditorView | null>\n state: ShallowRef<EditorState | null>\n schema: Schema\n commands: Record<string, (...args: unknown[]) => Command>\n forceUpdate: () => void\n _createView: (element: HTMLElement) => void\n}\n\nexport function useEditor(options: UseEditorOptions = {}): EditorHandle {\n const { extensions = [], content, onUpdate, onSelectionChange } = options\n\n const manager = new ExtensionManager(extensions)\n const schema = manager.schema\n\n let initialDoc\n if (content) {\n try {\n const container = document.createElement('div')\n container.innerHTML = content\n initialDoc = PMDOMParser.fromSchema(schema).parse(container)\n } catch {\n // fall through\n }\n }\n\n const initialState = EditorState.create({\n schema,\n doc: initialDoc,\n plugins: manager.plugins,\n })\n\n const viewRef = shallowRef<EditorView | null>(null)\n const stateRef = shallowRef<EditorState | null>(initialState)\n const version = shallowRef(0)\n\n const forceUpdate = () => {\n version.value++\n }\n\n const dispatchTransaction = (tr: Transaction) => {\n const view = viewRef.value\n if (!view) return\n\n const newState = view.state.apply(tr)\n view.updateState(newState)\n stateRef.value = newState\n\n if (onUpdate) onUpdate(newState)\n if (onSelectionChange) onSelectionChange(newState)\n\n forceUpdate()\n }\n\n const createView = (element: HTMLElement) => {\n if (viewRef.value) return\n\n const editableVal = typeof options.editable === 'object'\n ? (options.editable as Ref<boolean>).value\n : (options.editable ?? true)\n\n const view = new EditorView({\n state: stateRef.value!,\n element,\n editable: editableVal,\n dispatchTransaction,\n })\n\n viewRef.value = view\n stateRef.value = view.state\n forceUpdate()\n }\n\n onBeforeUnmount(() => {\n if (viewRef.value) {\n viewRef.value.destroy()\n viewRef.value = null\n }\n })\n\n if (typeof options.editable === 'object') {\n watch(options.editable as Ref<boolean>, () => {\n forceUpdate()\n })\n }\n\n return {\n view: viewRef,\n state: stateRef,\n schema,\n commands: manager.commands,\n forceUpdate,\n _createView: createView,\n }\n}\n","import { defineComponent, h, onMounted, onBeforeUnmount, ref, type PropType, type ShallowRef } from 'vue'\nimport type { EditorHandle } from './use-editor'\nimport type { EditorLike } from '../ui/types'\nimport { ensureStylesInjected } from '../ui/editor-styles'\nimport { Toolbar as ToolbarClass } from '../ui/toolbar'\nimport { BubbleMenu as BubbleMenuClass } from '../ui/bubble-menu'\nimport { DragHandle as DragHandleClass } from '../ui/drag-handle'\nimport { AIMenu as AIMenuClass } from '../ui/ai-menu'\nimport { AIWriter as AIWriterClass } from '../ui/ai-writer'\nimport { WordCountDisplay as WordCountClass } from '../ui/word-count'\nimport { TocPanel as TocPanelClass } from '../ui/toc-panel'\nimport { ShortcutPanel as ShortcutPanelClass } from '../ui/shortcut-panel'\nimport type { TocItem } from '../extensions/toc-extension'\nimport type { ShortcutItem } from '../ui/shortcut-panel'\n\nexport function createEditorAdapter(editor: EditorHandle): EditorLike {\n return {\n getView: () => editor.view.value,\n getState: () => editor.state.value,\n getSchema: () => editor.schema,\n getCommands: () => editor.commands,\n }\n}\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n props: {\n editor: { type: Object as PropType<EditorHandle>, required: true },\n },\n setup(props) {\n onMounted(() => { ensureStylesInjected() })\n return () => h('div', {\n ref: (el: unknown) => {\n if (el && el instanceof HTMLElement) props.editor._createView(el)\n },\n })\n },\n})\n\nexport const Toolbar = defineComponent({\n name: 'MiToolbar',\n props: { editor: { type: Object as PropType<EditorHandle>, required: true } },\n setup(props) {\n const containerRef = ref<HTMLElement | null>(null)\n let comp: ToolbarClass | null = null\n onMounted(() => {\n if (!containerRef.value) return\n comp = new ToolbarClass(createEditorAdapter(props.editor))\n comp.mount(containerRef.value)\n })\n onBeforeUnmount(() => { comp?.destroy() })\n return () => h('div', { ref: (el: unknown) => { if (el instanceof HTMLElement) containerRef.value = el } })\n },\n})\n\nexport const BubbleMenu = defineComponent({\n name: 'MiBubbleMenu',\n props: { editor: { type: Object as PropType<EditorHandle>, required: true } },\n setup(props) {\n const containerRef = ref<HTMLElement | null>(null)\n let comp: BubbleMenuClass | null = null\n onMounted(() => {\n if (!containerRef.value) return\n comp = new BubbleMenuClass(createEditorAdapter(props.editor))\n comp.mount(containerRef.value)\n })\n onBeforeUnmount(() => { comp?.destroy() })\n return () => h('div', { ref: (el: unknown) => { if (el instanceof HTMLElement) containerRef.value = el } })\n },\n})\n\nexport const DragHandle = defineComponent({\n name: 'MiDragHandle',\n props: { editor: { type: Object as PropType<EditorHandle>, required: true } },\n setup(props) {\n const containerRef = ref<HTMLElement | null>(null)\n let comp: DragHandleClass | null = null\n onMounted(() => {\n if (!containerRef.value) return\n comp = new DragHandleClass(createEditorAdapter(props.editor))\n comp.mount(containerRef.value)\n })\n onBeforeUnmount(() => { comp?.destroy() })\n return () => h('div', { ref: (el: unknown) => { if (el instanceof HTMLElement) containerRef.value = el } })\n },\n})\n\nexport const WordCountDisplay = defineComponent({\n name: 'MiWordCountDisplay',\n props: {\n editor: { type: Object as PropType<EditorHandle>, required: true },\n showDetails: { type: Boolean, default: false },\n },\n setup(props) {\n const containerRef = ref<HTMLElement | null>(null)\n let comp: WordCountClass | null = null\n onMounted(() => {\n if (!containerRef.value) return\n comp = new WordCountClass(createEditorAdapter(props.editor), { showDetails: props.showDetails })\n comp.mount(containerRef.value)\n })\n onBeforeUnmount(() => { comp?.destroy() })\n return () => h('div', { ref: (el: unknown) => { if (el instanceof HTMLElement) containerRef.value = el } })\n },\n})\n\nexport const TocPanel = defineComponent({\n name: 'MiTocPanel',\n props: {\n editor: { type: Object as PropType<EditorHandle>, required: true },\n title: { type: String, default: undefined },\n onItemClick: { type: Function as PropType<(item: TocItem) => void>, default: undefined },\n },\n setup(props) {\n const containerRef = ref<HTMLElement | null>(null)\n let comp: TocPanelClass | null = null\n onMounted(() => {\n if (!containerRef.value) return\n comp = new TocPanelClass(createEditorAdapter(props.editor), { title: props.title, onItemClick: props.onItemClick })\n comp.mount(containerRef.value)\n })\n onBeforeUnmount(() => { comp?.destroy() })\n return () => h('div', { ref: (el: unknown) => { if (el instanceof HTMLElement) containerRef.value = el } })\n },\n})\n\nexport const ShortcutPanel = defineComponent({\n name: 'MiShortcutPanel',\n props: {\n editor: { type: Object as PropType<EditorHandle>, required: true },\n shortcuts: { type: Array as PropType<ShortcutItem[]>, default: undefined },\n },\n setup(props, { expose }) {\n const containerRef = ref<HTMLElement | null>(null)\n let comp: ShortcutPanelClass | null = null\n onMounted(() => {\n if (!containerRef.value) return\n comp = new ShortcutPanelClass(createEditorAdapter(props.editor), { shortcuts: props.shortcuts })\n comp.mount(containerRef.value)\n })\n onBeforeUnmount(() => { comp?.destroy() })\n expose({\n open: () => comp?.open(),\n close: () => comp?.close(),\n })\n return () => h('div', { ref: (el: unknown) => { if (el instanceof HTMLElement) containerRef.value = el } })\n },\n})\n\nexport const AIMenu = defineComponent({\n name: 'MiAIMenu',\n props: { editor: { type: Object as PropType<EditorHandle>, required: true } },\n setup(props, { expose }) {\n const containerRef = ref<HTMLElement | null>(null)\n let comp: AIMenuClass | null = null\n onMounted(() => {\n if (!containerRef.value) return\n comp = new AIMenuClass(createEditorAdapter(props.editor))\n comp.mount(containerRef.value)\n })\n onBeforeUnmount(() => { comp?.destroy() })\n expose({ open: () => comp?.open() })\n return () => h('div', { ref: (el: unknown) => { if (el instanceof HTMLElement) containerRef.value = el } })\n },\n})\n\nexport const AIWriter = defineComponent({\n name: 'MiAIWriter',\n props: { editor: { type: Object as PropType<EditorHandle>, required: true } },\n setup(props, { expose }) {\n const containerRef = ref<HTMLElement | null>(null)\n let comp: AIWriterClass | null = null\n onMounted(() => {\n if (!containerRef.value) return\n comp = new AIWriterClass(createEditorAdapter(props.editor))\n comp.mount(containerRef.value)\n })\n onBeforeUnmount(() => { comp?.destroy() })\n expose({\n open: () => comp?.open(),\n openProductCard: () => comp?.openProductCard(),\n })\n return () => h('div', { ref: (el: unknown) => { if (el instanceof HTMLElement) containerRef.value = el } })\n },\n})\n"],"mappings":";;;;;;;;AA2BA,SAAgB,UAAU,UAA4B,CAAC,GAAiB;CACtE,MAAM,EAAE,aAAa,CAAC,GAAG,SAAS,UAAU,sBAAsB;CAElE,MAAM,UAAU,IAAI,kBAAA,iBAAiB,UAAU;CAC/C,MAAM,SAAS,QAAQ;CAEvB,IAAI;CACJ,IAAI,SACF,IAAI;EACF,MAAM,YAAY,SAAS,cAAc,KAAK;EAC9C,UAAU,YAAY;EACtB,aAAa,aAAA,UAAY,WAAW,MAAM,CAAC,CAAC,MAAM,SAAS;CAC7D,QAAQ,CAER;CAGF,MAAM,eAAe,aAAA,YAAY,OAAO;EACtC;EACA,KAAK;EACL,SAAS,QAAQ;CACnB,CAAC;CAED,MAAM,WAAA,GAAA,IAAA,WAAA,CAAwC,IAAI;CAClD,MAAM,YAAA,GAAA,IAAA,WAAA,CAA0C,YAAY;CAC5D,MAAM,WAAA,GAAA,IAAA,WAAA,CAAqB,CAAC;CAE5B,MAAM,oBAAoB;EACxB,QAAQ;CACV;CAEA,MAAM,uBAAuB,OAAoB;EAC/C,MAAM,OAAO,QAAQ;EACrB,IAAI,CAAC,MAAM;EAEX,MAAM,WAAW,KAAK,MAAM,MAAM,EAAE;EACpC,KAAK,YAAY,QAAQ;EACzB,SAAS,QAAQ;EAEjB,IAAI,UAAU,SAAS,QAAQ;EAC/B,IAAI,mBAAmB,kBAAkB,QAAQ;EAEjD,YAAY;CACd;CAEA,MAAM,cAAc,YAAyB;EAC3C,IAAI,QAAQ,OAAO;EAEnB,MAAM,cAAc,OAAO,QAAQ,aAA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