@domternal/vue 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -8
- package/dist/index.js +206 -189
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -356,21 +356,21 @@ declare const DomternalEditor: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
356
356
|
}>> & Readonly<{
|
|
357
357
|
"onUpdate:modelValue"?: (_value: Content) => any;
|
|
358
358
|
}>, {
|
|
359
|
-
|
|
359
|
+
onCreate: (editor: _domternal_core.Editor) => void;
|
|
360
|
+
onUpdate: (props: {
|
|
360
361
|
editor: _domternal_core.Editor;
|
|
361
|
-
event: FocusEvent;
|
|
362
362
|
}) => void;
|
|
363
363
|
onFocus: (props: {
|
|
364
364
|
editor: _domternal_core.Editor;
|
|
365
365
|
event: FocusEvent;
|
|
366
366
|
}) => void;
|
|
367
|
-
|
|
368
|
-
onCreate: (editor: _domternal_core.Editor) => void;
|
|
369
|
-
onUpdate: (props: {
|
|
367
|
+
onBlur: (props: {
|
|
370
368
|
editor: _domternal_core.Editor;
|
|
369
|
+
event: FocusEvent;
|
|
371
370
|
}) => void;
|
|
372
371
|
onDestroy: () => void;
|
|
373
372
|
content: Content;
|
|
373
|
+
class: string;
|
|
374
374
|
onSelectionChange: (props: {
|
|
375
375
|
editor: _domternal_core.Editor;
|
|
376
376
|
}) => void;
|
|
@@ -459,8 +459,8 @@ declare const DomternalToolbar: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
459
459
|
};
|
|
460
460
|
}>> & Readonly<{}>, {
|
|
461
461
|
editor: Editor;
|
|
462
|
-
icons: IconSet;
|
|
463
462
|
layout: ToolbarLayoutEntry[];
|
|
463
|
+
icons: IconSet;
|
|
464
464
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
465
465
|
|
|
466
466
|
interface DomternalBubbleMenuProps {
|
|
@@ -534,6 +534,8 @@ declare const DomternalBubbleMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
534
534
|
};
|
|
535
535
|
}>> & Readonly<{}>, {
|
|
536
536
|
editor: Editor;
|
|
537
|
+
placement: "top" | "bottom";
|
|
538
|
+
items: string[];
|
|
537
539
|
shouldShow: (props: {
|
|
538
540
|
editor: Editor;
|
|
539
541
|
view: prosemirror_view.EditorView;
|
|
@@ -541,10 +543,8 @@ declare const DomternalBubbleMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
541
543
|
from: number;
|
|
542
544
|
to: number;
|
|
543
545
|
}) => boolean;
|
|
544
|
-
placement: "top" | "bottom";
|
|
545
546
|
offset: number;
|
|
546
547
|
updateDelay: number;
|
|
547
|
-
items: string[];
|
|
548
548
|
contexts: Record<string, true | string[] | null>;
|
|
549
549
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
550
550
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent,
|
|
2
|
-
import { PluginKey, ToolbarController, createFloatingMenuPlugin, Editor, Document, Paragraph, Text, BaseKeymap, History
|
|
1
|
+
import { defineComponent, h, computed, Fragment, ref, onMounted, watch, onScopeDispose, watchEffect, inject, shallowRef, provide, getCurrentInstance, customRef, markRaw, shallowReactive, render } from 'vue';
|
|
2
|
+
import { PluginKey, ToolbarController, createFloatingMenuPlugin, positionFloatingOnce, defaultIcons, createBubbleMenuPlugin, Editor, Document, Paragraph, Text, BaseKeymap, History } from '@domternal/core';
|
|
3
3
|
export { Editor, generateHTML, generateJSON, generateText } from '@domternal/core';
|
|
4
4
|
|
|
5
5
|
// src/useEditor.ts
|
|
@@ -259,189 +259,6 @@ function useCurrentEditor() {
|
|
|
259
259
|
const editor = inject(EDITOR_KEY, shallowRef(null));
|
|
260
260
|
return { editor };
|
|
261
261
|
}
|
|
262
|
-
var Domternal = defineComponent({
|
|
263
|
-
name: "Domternal",
|
|
264
|
-
props: {
|
|
265
|
-
extensions: { type: Array, default: void 0 },
|
|
266
|
-
content: { type: [String, Object], default: "" },
|
|
267
|
-
editable: { type: Boolean, default: true },
|
|
268
|
-
autofocus: { type: [Boolean, String, Number], default: false },
|
|
269
|
-
outputFormat: { type: String, default: "html" },
|
|
270
|
-
immediatelyRender: { type: Boolean, default: false },
|
|
271
|
-
onCreate: { type: Function, default: void 0 },
|
|
272
|
-
onUpdate: { type: Function, default: void 0 },
|
|
273
|
-
onSelectionChange: { type: Function, default: void 0 },
|
|
274
|
-
onFocus: { type: Function, default: void 0 },
|
|
275
|
-
onBlur: { type: Function, default: void 0 },
|
|
276
|
-
onDestroy: { type: Function, default: void 0 }
|
|
277
|
-
},
|
|
278
|
-
setup(props, { slots }) {
|
|
279
|
-
const { editor } = useEditor({
|
|
280
|
-
...props.extensions && { extensions: props.extensions },
|
|
281
|
-
content: props.content,
|
|
282
|
-
editable: props.editable,
|
|
283
|
-
autofocus: props.autofocus,
|
|
284
|
-
outputFormat: props.outputFormat,
|
|
285
|
-
immediatelyRender: props.immediatelyRender,
|
|
286
|
-
...props.onCreate && { onCreate: props.onCreate },
|
|
287
|
-
...props.onUpdate && { onUpdate: props.onUpdate },
|
|
288
|
-
...props.onSelectionChange && { onSelectionChange: props.onSelectionChange },
|
|
289
|
-
...props.onFocus && { onFocus: props.onFocus },
|
|
290
|
-
...props.onBlur && { onBlur: props.onBlur },
|
|
291
|
-
...props.onDestroy && { onDestroy: props.onDestroy }
|
|
292
|
-
});
|
|
293
|
-
provideEditor(editor);
|
|
294
|
-
return () => slots["default"]?.();
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
var DomternalContent = defineComponent({
|
|
298
|
-
name: "DomternalContent",
|
|
299
|
-
props: {
|
|
300
|
-
class: { type: String, default: void 0 }
|
|
301
|
-
},
|
|
302
|
-
setup(props) {
|
|
303
|
-
const { editor } = useCurrentEditor();
|
|
304
|
-
const containerRef = ref();
|
|
305
|
-
watchEffect(() => {
|
|
306
|
-
const container = containerRef.value;
|
|
307
|
-
const ed = editor.value;
|
|
308
|
-
if (!container || !ed || ed.isDestroyed) return;
|
|
309
|
-
const editorDom = ed.view.dom;
|
|
310
|
-
if (editorDom.parentElement !== container) {
|
|
311
|
-
container.appendChild(editorDom);
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
return () => {
|
|
315
|
-
const classes = props.class ? `dm-editor ${props.class}` : "dm-editor";
|
|
316
|
-
return h("div", { class: classes, "data-dm-editor-ui": "" }, [h("div", { ref: containerRef })]);
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
var DomternalLoading = defineComponent({
|
|
321
|
-
name: "DomternalLoading",
|
|
322
|
-
setup(_props, { slots }) {
|
|
323
|
-
const { editor } = useCurrentEditor();
|
|
324
|
-
return () => editor.value ? null : slots["default"]?.();
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
Domternal.Content = DomternalContent;
|
|
328
|
-
Domternal.Loading = DomternalLoading;
|
|
329
|
-
var DomternalEditor = defineComponent({
|
|
330
|
-
name: "DomternalEditor",
|
|
331
|
-
props: {
|
|
332
|
-
extensions: { type: Array, default: void 0 },
|
|
333
|
-
content: { type: [String, Object], default: void 0 },
|
|
334
|
-
editable: { type: Boolean, default: true },
|
|
335
|
-
autofocus: { type: [Boolean, String, Number], default: false },
|
|
336
|
-
immediatelyRender: { type: Boolean, default: false },
|
|
337
|
-
outputFormat: { type: String, default: "html" },
|
|
338
|
-
modelValue: { type: [String, Object], default: void 0 },
|
|
339
|
-
class: { type: String, default: void 0 },
|
|
340
|
-
onCreate: { type: Function, default: void 0 },
|
|
341
|
-
onUpdate: { type: Function, default: void 0 },
|
|
342
|
-
onSelectionChange: { type: Function, default: void 0 },
|
|
343
|
-
onFocus: { type: Function, default: void 0 },
|
|
344
|
-
onBlur: { type: Function, default: void 0 },
|
|
345
|
-
onDestroy: { type: Function, default: void 0 }
|
|
346
|
-
},
|
|
347
|
-
emits: {
|
|
348
|
-
"update:modelValue": (_value) => true
|
|
349
|
-
},
|
|
350
|
-
setup(props, { slots, emit, expose }) {
|
|
351
|
-
const { editor, editorRef } = useEditor({
|
|
352
|
-
...props.extensions && { extensions: props.extensions },
|
|
353
|
-
content: props.modelValue ?? props.content ?? "",
|
|
354
|
-
editable: props.editable,
|
|
355
|
-
autofocus: props.autofocus,
|
|
356
|
-
immediatelyRender: props.immediatelyRender,
|
|
357
|
-
outputFormat: props.outputFormat,
|
|
358
|
-
...props.onCreate && { onCreate: props.onCreate },
|
|
359
|
-
...props.onUpdate && { onUpdate: props.onUpdate },
|
|
360
|
-
...props.onSelectionChange && { onSelectionChange: props.onSelectionChange },
|
|
361
|
-
...props.onFocus && { onFocus: props.onFocus },
|
|
362
|
-
...props.onBlur && { onBlur: props.onBlur },
|
|
363
|
-
...props.onDestroy && { onDestroy: props.onDestroy }
|
|
364
|
-
});
|
|
365
|
-
const state = useEditorState(editor);
|
|
366
|
-
expose({
|
|
367
|
-
editor,
|
|
368
|
-
htmlContent: state.htmlContent,
|
|
369
|
-
jsonContent: state.jsonContent,
|
|
370
|
-
isEmpty: state.isEmpty,
|
|
371
|
-
isFocused: state.isFocused
|
|
372
|
-
});
|
|
373
|
-
provideEditor(editor);
|
|
374
|
-
const prevModelValue = ref(props.modelValue);
|
|
375
|
-
watch(
|
|
376
|
-
() => props.modelValue,
|
|
377
|
-
(newValue) => {
|
|
378
|
-
if (newValue === void 0) return;
|
|
379
|
-
const ed = editor.value;
|
|
380
|
-
if (!ed || ed.isDestroyed) return;
|
|
381
|
-
if (newValue === prevModelValue.value) return;
|
|
382
|
-
prevModelValue.value = newValue;
|
|
383
|
-
if (props.outputFormat === "html") {
|
|
384
|
-
if (newValue !== ed.getHTML()) {
|
|
385
|
-
ed.setContent(newValue, false);
|
|
386
|
-
}
|
|
387
|
-
} else {
|
|
388
|
-
if (JSON.stringify(newValue) !== JSON.stringify(ed.getJSON())) {
|
|
389
|
-
ed.setContent(newValue, false);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
},
|
|
393
|
-
{ flush: "post" }
|
|
394
|
-
);
|
|
395
|
-
watch(editor, (ed, _oldEd, onCleanup) => {
|
|
396
|
-
if (!ed || ed.isDestroyed) return;
|
|
397
|
-
const handler = () => {
|
|
398
|
-
const val = props.outputFormat === "html" ? ed.getHTML() : ed.getJSON();
|
|
399
|
-
prevModelValue.value = val;
|
|
400
|
-
emit("update:modelValue", val);
|
|
401
|
-
};
|
|
402
|
-
ed.on("update", handler);
|
|
403
|
-
onCleanup(() => {
|
|
404
|
-
ed.off("update", handler);
|
|
405
|
-
});
|
|
406
|
-
}, { immediate: true });
|
|
407
|
-
return () => {
|
|
408
|
-
const classes = props.class ? `dm-editor ${props.class}` : "dm-editor";
|
|
409
|
-
return [
|
|
410
|
-
h("div", { class: classes, "data-dm-editor-ui": "" }, [h("div", { ref: editorRef })]),
|
|
411
|
-
slots["default"]?.()
|
|
412
|
-
];
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
var EditorContent = defineComponent({
|
|
417
|
-
name: "EditorContent",
|
|
418
|
-
props: {
|
|
419
|
-
editor: {
|
|
420
|
-
type: Object,
|
|
421
|
-
default: null
|
|
422
|
-
},
|
|
423
|
-
class: {
|
|
424
|
-
type: String,
|
|
425
|
-
default: void 0
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
setup(props) {
|
|
429
|
-
const containerRef = ref();
|
|
430
|
-
watchEffect(() => {
|
|
431
|
-
const container = containerRef.value;
|
|
432
|
-
const editor = props.editor;
|
|
433
|
-
if (!container || !editor || editor.isDestroyed) return;
|
|
434
|
-
const editorDom = editor.view.dom;
|
|
435
|
-
if (editorDom.parentElement !== container) {
|
|
436
|
-
container.appendChild(editorDom);
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
return () => h("div", {
|
|
440
|
-
ref: containerRef,
|
|
441
|
-
class: props.class
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
262
|
function useToolbarController(editor, layout) {
|
|
446
263
|
const groups = shallowRef([]);
|
|
447
264
|
const focusedIndex = ref(0);
|
|
@@ -1855,6 +1672,210 @@ var DomternalEmojiPicker = defineComponent({
|
|
|
1855
1672
|
};
|
|
1856
1673
|
}
|
|
1857
1674
|
});
|
|
1675
|
+
|
|
1676
|
+
// src/Domternal.ts
|
|
1677
|
+
var Domternal = defineComponent({
|
|
1678
|
+
name: "Domternal",
|
|
1679
|
+
props: {
|
|
1680
|
+
extensions: { type: Array, default: void 0 },
|
|
1681
|
+
content: { type: [String, Object], default: "" },
|
|
1682
|
+
editable: { type: Boolean, default: true },
|
|
1683
|
+
autofocus: { type: [Boolean, String, Number], default: false },
|
|
1684
|
+
outputFormat: { type: String, default: "html" },
|
|
1685
|
+
immediatelyRender: { type: Boolean, default: false },
|
|
1686
|
+
onCreate: { type: Function, default: void 0 },
|
|
1687
|
+
onUpdate: { type: Function, default: void 0 },
|
|
1688
|
+
onSelectionChange: { type: Function, default: void 0 },
|
|
1689
|
+
onFocus: { type: Function, default: void 0 },
|
|
1690
|
+
onBlur: { type: Function, default: void 0 },
|
|
1691
|
+
onDestroy: { type: Function, default: void 0 }
|
|
1692
|
+
},
|
|
1693
|
+
setup(props, { slots }) {
|
|
1694
|
+
const { editor } = useEditor({
|
|
1695
|
+
...props.extensions && { extensions: props.extensions },
|
|
1696
|
+
content: props.content,
|
|
1697
|
+
editable: props.editable,
|
|
1698
|
+
autofocus: props.autofocus,
|
|
1699
|
+
outputFormat: props.outputFormat,
|
|
1700
|
+
immediatelyRender: props.immediatelyRender,
|
|
1701
|
+
...props.onCreate && { onCreate: props.onCreate },
|
|
1702
|
+
...props.onUpdate && { onUpdate: props.onUpdate },
|
|
1703
|
+
...props.onSelectionChange && { onSelectionChange: props.onSelectionChange },
|
|
1704
|
+
...props.onFocus && { onFocus: props.onFocus },
|
|
1705
|
+
...props.onBlur && { onBlur: props.onBlur },
|
|
1706
|
+
...props.onDestroy && { onDestroy: props.onDestroy }
|
|
1707
|
+
});
|
|
1708
|
+
provideEditor(editor);
|
|
1709
|
+
watch(
|
|
1710
|
+
() => props.editable,
|
|
1711
|
+
(newEditable) => {
|
|
1712
|
+
const ed = editor.value;
|
|
1713
|
+
if (ed && !ed.isDestroyed) ed.setEditable(newEditable);
|
|
1714
|
+
}
|
|
1715
|
+
);
|
|
1716
|
+
return () => slots["default"]?.();
|
|
1717
|
+
}
|
|
1718
|
+
});
|
|
1719
|
+
var DomternalContent = defineComponent({
|
|
1720
|
+
name: "DomternalContent",
|
|
1721
|
+
props: {
|
|
1722
|
+
class: { type: String, default: void 0 }
|
|
1723
|
+
},
|
|
1724
|
+
setup(props) {
|
|
1725
|
+
const { editor } = useCurrentEditor();
|
|
1726
|
+
const containerRef = ref();
|
|
1727
|
+
watchEffect(() => {
|
|
1728
|
+
const container = containerRef.value;
|
|
1729
|
+
const ed = editor.value;
|
|
1730
|
+
if (!container || !ed || ed.isDestroyed) return;
|
|
1731
|
+
const editorDom = ed.view.dom;
|
|
1732
|
+
if (editorDom.parentElement !== container) {
|
|
1733
|
+
container.appendChild(editorDom);
|
|
1734
|
+
}
|
|
1735
|
+
});
|
|
1736
|
+
return () => {
|
|
1737
|
+
const classes = props.class ? `dm-editor ${props.class}` : "dm-editor";
|
|
1738
|
+
return h("div", { class: classes, "data-dm-editor-ui": "" }, [h("div", { ref: containerRef })]);
|
|
1739
|
+
};
|
|
1740
|
+
}
|
|
1741
|
+
});
|
|
1742
|
+
var DomternalLoading = defineComponent({
|
|
1743
|
+
name: "DomternalLoading",
|
|
1744
|
+
setup(_props, { slots }) {
|
|
1745
|
+
const { editor } = useCurrentEditor();
|
|
1746
|
+
return () => editor.value ? null : slots["default"]?.();
|
|
1747
|
+
}
|
|
1748
|
+
});
|
|
1749
|
+
Domternal.Content = DomternalContent;
|
|
1750
|
+
Domternal.Loading = DomternalLoading;
|
|
1751
|
+
Domternal.Toolbar = DomternalToolbar;
|
|
1752
|
+
Domternal.BubbleMenu = DomternalBubbleMenu;
|
|
1753
|
+
Domternal.FloatingMenu = DomternalFloatingMenu;
|
|
1754
|
+
Domternal.EmojiPicker = DomternalEmojiPicker;
|
|
1755
|
+
var DomternalEditor = defineComponent({
|
|
1756
|
+
name: "DomternalEditor",
|
|
1757
|
+
props: {
|
|
1758
|
+
extensions: { type: Array, default: void 0 },
|
|
1759
|
+
content: { type: [String, Object], default: void 0 },
|
|
1760
|
+
editable: { type: Boolean, default: true },
|
|
1761
|
+
autofocus: { type: [Boolean, String, Number], default: false },
|
|
1762
|
+
immediatelyRender: { type: Boolean, default: false },
|
|
1763
|
+
outputFormat: { type: String, default: "html" },
|
|
1764
|
+
modelValue: { type: [String, Object], default: void 0 },
|
|
1765
|
+
class: { type: String, default: void 0 },
|
|
1766
|
+
onCreate: { type: Function, default: void 0 },
|
|
1767
|
+
onUpdate: { type: Function, default: void 0 },
|
|
1768
|
+
onSelectionChange: { type: Function, default: void 0 },
|
|
1769
|
+
onFocus: { type: Function, default: void 0 },
|
|
1770
|
+
onBlur: { type: Function, default: void 0 },
|
|
1771
|
+
onDestroy: { type: Function, default: void 0 }
|
|
1772
|
+
},
|
|
1773
|
+
emits: {
|
|
1774
|
+
"update:modelValue": (_value) => true
|
|
1775
|
+
},
|
|
1776
|
+
setup(props, { slots, emit, expose }) {
|
|
1777
|
+
const { editor, editorRef } = useEditor({
|
|
1778
|
+
...props.extensions && { extensions: props.extensions },
|
|
1779
|
+
content: props.modelValue ?? props.content ?? "",
|
|
1780
|
+
editable: props.editable,
|
|
1781
|
+
autofocus: props.autofocus,
|
|
1782
|
+
immediatelyRender: props.immediatelyRender,
|
|
1783
|
+
outputFormat: props.outputFormat,
|
|
1784
|
+
...props.onCreate && { onCreate: props.onCreate },
|
|
1785
|
+
...props.onUpdate && { onUpdate: props.onUpdate },
|
|
1786
|
+
...props.onSelectionChange && { onSelectionChange: props.onSelectionChange },
|
|
1787
|
+
...props.onFocus && { onFocus: props.onFocus },
|
|
1788
|
+
...props.onBlur && { onBlur: props.onBlur },
|
|
1789
|
+
...props.onDestroy && { onDestroy: props.onDestroy }
|
|
1790
|
+
});
|
|
1791
|
+
const state = useEditorState(editor);
|
|
1792
|
+
expose({
|
|
1793
|
+
editor,
|
|
1794
|
+
htmlContent: state.htmlContent,
|
|
1795
|
+
jsonContent: state.jsonContent,
|
|
1796
|
+
isEmpty: state.isEmpty,
|
|
1797
|
+
isFocused: state.isFocused
|
|
1798
|
+
});
|
|
1799
|
+
provideEditor(editor);
|
|
1800
|
+
watch(
|
|
1801
|
+
() => props.editable,
|
|
1802
|
+
(newEditable) => {
|
|
1803
|
+
const ed = editor.value;
|
|
1804
|
+
if (ed && !ed.isDestroyed) ed.setEditable(newEditable);
|
|
1805
|
+
}
|
|
1806
|
+
);
|
|
1807
|
+
const prevModelValue = ref(props.modelValue);
|
|
1808
|
+
watch(
|
|
1809
|
+
() => props.modelValue,
|
|
1810
|
+
(newValue) => {
|
|
1811
|
+
if (newValue === void 0) return;
|
|
1812
|
+
const ed = editor.value;
|
|
1813
|
+
if (!ed || ed.isDestroyed) return;
|
|
1814
|
+
if (newValue === prevModelValue.value) return;
|
|
1815
|
+
prevModelValue.value = newValue;
|
|
1816
|
+
if (props.outputFormat === "html") {
|
|
1817
|
+
if (newValue !== ed.getHTML()) {
|
|
1818
|
+
ed.setContent(newValue, false);
|
|
1819
|
+
}
|
|
1820
|
+
} else {
|
|
1821
|
+
if (JSON.stringify(newValue) !== JSON.stringify(ed.getJSON())) {
|
|
1822
|
+
ed.setContent(newValue, false);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
},
|
|
1826
|
+
{ flush: "post" }
|
|
1827
|
+
);
|
|
1828
|
+
watch(editor, (ed, _oldEd, onCleanup) => {
|
|
1829
|
+
if (!ed || ed.isDestroyed) return;
|
|
1830
|
+
const handler = () => {
|
|
1831
|
+
const val = props.outputFormat === "html" ? ed.getHTML() : ed.getJSON();
|
|
1832
|
+
prevModelValue.value = val;
|
|
1833
|
+
emit("update:modelValue", val);
|
|
1834
|
+
};
|
|
1835
|
+
ed.on("update", handler);
|
|
1836
|
+
onCleanup(() => {
|
|
1837
|
+
ed.off("update", handler);
|
|
1838
|
+
});
|
|
1839
|
+
}, { immediate: true });
|
|
1840
|
+
return () => {
|
|
1841
|
+
const classes = props.class ? `dm-editor ${props.class}` : "dm-editor";
|
|
1842
|
+
return [
|
|
1843
|
+
h("div", { class: classes, "data-dm-editor-ui": "" }, [h("div", { ref: editorRef })]),
|
|
1844
|
+
slots["default"]?.()
|
|
1845
|
+
];
|
|
1846
|
+
};
|
|
1847
|
+
}
|
|
1848
|
+
});
|
|
1849
|
+
var EditorContent = defineComponent({
|
|
1850
|
+
name: "EditorContent",
|
|
1851
|
+
props: {
|
|
1852
|
+
editor: {
|
|
1853
|
+
type: Object,
|
|
1854
|
+
default: null
|
|
1855
|
+
},
|
|
1856
|
+
class: {
|
|
1857
|
+
type: String,
|
|
1858
|
+
default: void 0
|
|
1859
|
+
}
|
|
1860
|
+
},
|
|
1861
|
+
setup(props) {
|
|
1862
|
+
const containerRef = ref();
|
|
1863
|
+
watchEffect(() => {
|
|
1864
|
+
const container = containerRef.value;
|
|
1865
|
+
const editor = props.editor;
|
|
1866
|
+
if (!container || !editor || editor.isDestroyed) return;
|
|
1867
|
+
const editorDom = editor.view.dom;
|
|
1868
|
+
if (editorDom.parentElement !== container) {
|
|
1869
|
+
container.appendChild(editorDom);
|
|
1870
|
+
}
|
|
1871
|
+
});
|
|
1872
|
+
return () => h("div", {
|
|
1873
|
+
ref: containerRef,
|
|
1874
|
+
class: props.class,
|
|
1875
|
+
"data-dm-editor-ui": ""
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
});
|
|
1858
1879
|
var NODE_VIEW_ON_DRAG_START = /* @__PURE__ */ Symbol("domternal-node-view-drag");
|
|
1859
1880
|
var NODE_VIEW_CONTENT_REF = /* @__PURE__ */ Symbol("domternal-node-view-content");
|
|
1860
1881
|
function useVueNodeView() {
|
|
@@ -2036,10 +2057,6 @@ var NodeViewContent = defineComponent({
|
|
|
2036
2057
|
};
|
|
2037
2058
|
}
|
|
2038
2059
|
});
|
|
2039
|
-
Domternal.Toolbar = DomternalToolbar;
|
|
2040
|
-
Domternal.BubbleMenu = DomternalBubbleMenu;
|
|
2041
|
-
Domternal.FloatingMenu = DomternalFloatingMenu;
|
|
2042
|
-
Domternal.EmojiPicker = DomternalEmojiPicker;
|
|
2043
2060
|
|
|
2044
2061
|
export { DEFAULT_EXTENSIONS, Domternal, DomternalBubbleMenu, DomternalEditor, DomternalEmojiPicker, DomternalFloatingMenu, DomternalToolbar, EDITOR_KEY, EditorContent, NodeViewContent, NodeViewWrapper, VueNodeViewRenderer, provideEditor, useCurrentEditor, useEditor, useEditorState, useVueNodeView };
|
|
2045
2062
|
//# sourceMappingURL=index.js.map
|