@tiptap/vue-3 3.0.0 → 3.0.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/LICENSE.md +21 -0
- package/README.md +5 -1
- package/dist/index.cjs +577 -455
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +228 -0
- package/dist/index.d.ts +228 -0
- package/dist/index.js +541 -443
- package/dist/index.js.map +1 -1
- package/dist/menus/index.cjs +693 -0
- package/dist/menus/index.cjs.map +1 -0
- package/dist/menus/index.d.cts +279 -0
- package/dist/menus/index.d.ts +279 -0
- package/dist/menus/index.js +685 -0
- package/dist/menus/index.js.map +1 -0
- package/package.json +28 -17
- package/src/Editor.ts +23 -17
- package/src/EditorContent.ts +14 -44
- package/src/VueMarkViewRenderer.ts +130 -0
- package/src/VueNodeViewRenderer.ts +99 -36
- package/src/VueRenderer.ts +27 -18
- package/src/index.ts +1 -2
- package/src/menus/BubbleMenu.ts +78 -0
- package/src/menus/FloatingMenu.ts +68 -0
- package/src/menus/index.ts +2 -0
- package/src/useEditor.ts +7 -1
- package/dist/index.umd.js +0 -495
- package/dist/index.umd.js.map +0 -1
- package/dist/packages/core/src/CommandManager.d.ts +0 -20
- package/dist/packages/core/src/Editor.d.ts +0 -161
- package/dist/packages/core/src/EventEmitter.d.ts +0 -11
- package/dist/packages/core/src/Extension.d.ts +0 -343
- package/dist/packages/core/src/ExtensionManager.d.ts +0 -55
- package/dist/packages/core/src/InputRule.d.ts +0 -42
- package/dist/packages/core/src/Mark.d.ts +0 -451
- package/dist/packages/core/src/Node.d.ts +0 -611
- package/dist/packages/core/src/NodePos.d.ts +0 -44
- package/dist/packages/core/src/NodeView.d.ts +0 -31
- package/dist/packages/core/src/PasteRule.d.ts +0 -50
- package/dist/packages/core/src/Tracker.d.ts +0 -11
- package/dist/packages/core/src/commands/blur.d.ts +0 -13
- package/dist/packages/core/src/commands/clearContent.d.ts +0 -14
- package/dist/packages/core/src/commands/clearNodes.d.ts +0 -13
- package/dist/packages/core/src/commands/command.d.ts +0 -18
- package/dist/packages/core/src/commands/createParagraphNear.d.ts +0 -13
- package/dist/packages/core/src/commands/cut.d.ts +0 -20
- package/dist/packages/core/src/commands/deleteCurrentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/deleteNode.d.ts +0 -15
- package/dist/packages/core/src/commands/deleteRange.d.ts +0 -14
- package/dist/packages/core/src/commands/deleteSelection.d.ts +0 -13
- package/dist/packages/core/src/commands/enter.d.ts +0 -13
- package/dist/packages/core/src/commands/exitCode.d.ts +0 -13
- package/dist/packages/core/src/commands/extendMarkRange.d.ts +0 -25
- package/dist/packages/core/src/commands/first.d.ts +0 -14
- package/dist/packages/core/src/commands/focus.d.ts +0 -27
- package/dist/packages/core/src/commands/forEach.d.ts +0 -14
- package/dist/packages/core/src/commands/index.d.ts +0 -55
- package/dist/packages/core/src/commands/insertContent.d.ts +0 -34
- package/dist/packages/core/src/commands/insertContentAt.d.ts +0 -47
- package/dist/packages/core/src/commands/join.d.ts +0 -41
- package/dist/packages/core/src/commands/joinItemBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinItemForward.d.ts +0 -13
- package/dist/packages/core/src/commands/joinTextblockBackward.d.ts +0 -12
- package/dist/packages/core/src/commands/joinTextblockForward.d.ts +0 -12
- package/dist/packages/core/src/commands/keyboardShortcut.d.ts +0 -14
- package/dist/packages/core/src/commands/lift.d.ts +0 -17
- package/dist/packages/core/src/commands/liftEmptyBlock.d.ts +0 -13
- package/dist/packages/core/src/commands/liftListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/newlineInCode.d.ts +0 -13
- package/dist/packages/core/src/commands/resetAttributes.d.ts +0 -16
- package/dist/packages/core/src/commands/scrollIntoView.d.ts +0 -13
- package/dist/packages/core/src/commands/selectAll.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeBackward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectNodeForward.d.ts +0 -13
- package/dist/packages/core/src/commands/selectParentNode.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockEnd.d.ts +0 -13
- package/dist/packages/core/src/commands/selectTextblockStart.d.ts +0 -13
- package/dist/packages/core/src/commands/setContent.d.ts +0 -40
- package/dist/packages/core/src/commands/setMark.d.ts +0 -15
- package/dist/packages/core/src/commands/setMeta.d.ts +0 -15
- package/dist/packages/core/src/commands/setNode.d.ts +0 -16
- package/dist/packages/core/src/commands/setNodeSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/setTextSelection.d.ts +0 -14
- package/dist/packages/core/src/commands/sinkListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/splitBlock.d.ts +0 -17
- package/dist/packages/core/src/commands/splitListItem.d.ts +0 -15
- package/dist/packages/core/src/commands/toggleList.d.ts +0 -18
- package/dist/packages/core/src/commands/toggleMark.d.ts +0 -30
- package/dist/packages/core/src/commands/toggleNode.d.ts +0 -17
- package/dist/packages/core/src/commands/toggleWrap.d.ts +0 -16
- package/dist/packages/core/src/commands/undoInputRule.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetAllMarks.d.ts +0 -13
- package/dist/packages/core/src/commands/unsetMark.d.ts +0 -25
- package/dist/packages/core/src/commands/updateAttributes.d.ts +0 -24
- package/dist/packages/core/src/commands/wrapIn.d.ts +0 -16
- package/dist/packages/core/src/commands/wrapInList.d.ts +0 -16
- package/dist/packages/core/src/extensions/clipboardTextSerializer.d.ts +0 -5
- package/dist/packages/core/src/extensions/commands.d.ts +0 -3
- package/dist/packages/core/src/extensions/editable.d.ts +0 -2
- package/dist/packages/core/src/extensions/focusEvents.d.ts +0 -2
- package/dist/packages/core/src/extensions/index.d.ts +0 -6
- package/dist/packages/core/src/extensions/keymap.d.ts +0 -2
- package/dist/packages/core/src/extensions/tabindex.d.ts +0 -2
- package/dist/packages/core/src/helpers/combineTransactionSteps.d.ts +0 -10
- package/dist/packages/core/src/helpers/createChainableState.d.ts +0 -10
- package/dist/packages/core/src/helpers/createDocument.d.ts +0 -12
- package/dist/packages/core/src/helpers/createNodeFromContent.d.ts +0 -15
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +0 -7
- package/dist/packages/core/src/helpers/findChildren.d.ts +0 -9
- package/dist/packages/core/src/helpers/findChildrenInRange.d.ts +0 -10
- package/dist/packages/core/src/helpers/findParentNode.d.ts +0 -16
- package/dist/packages/core/src/helpers/findParentNodeClosestToPos.d.ts +0 -17
- package/dist/packages/core/src/helpers/generateHTML.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/generateText.d.ts +0 -12
- package/dist/packages/core/src/helpers/getAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getAttributesFromExtensions.d.ts +0 -6
- package/dist/packages/core/src/helpers/getChangedRanges.d.ts +0 -11
- package/dist/packages/core/src/helpers/getDebugJSON.d.ts +0 -8
- package/dist/packages/core/src/helpers/getExtensionField.d.ts +0 -9
- package/dist/packages/core/src/helpers/getHTMLFromFragment.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarkAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkRange.d.ts +0 -3
- package/dist/packages/core/src/helpers/getMarkType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getMarksBetween.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeAtPosition.d.ts +0 -11
- package/dist/packages/core/src/helpers/getNodeAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getNodeType.d.ts +0 -2
- package/dist/packages/core/src/helpers/getRenderedAttributes.d.ts +0 -3
- package/dist/packages/core/src/helpers/getSchema.d.ts +0 -4
- package/dist/packages/core/src/helpers/getSchemaByResolvedExtensions.d.ts +0 -10
- package/dist/packages/core/src/helpers/getSchemaTypeByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSchemaTypeNameByName.d.ts +0 -8
- package/dist/packages/core/src/helpers/getSplittedAttributes.d.ts +0 -9
- package/dist/packages/core/src/helpers/getText.d.ts +0 -15
- package/dist/packages/core/src/helpers/getTextBetween.d.ts +0 -14
- package/dist/packages/core/src/helpers/getTextContentFromNodes.d.ts +0 -8
- package/dist/packages/core/src/helpers/getTextSerializersFromSchema.d.ts +0 -8
- package/dist/packages/core/src/helpers/index.d.ts +0 -50
- package/dist/packages/core/src/helpers/injectExtensionAttributesToParseRule.d.ts +0 -9
- package/dist/packages/core/src/helpers/isActive.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtEndOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isAtStartOfNode.d.ts +0 -2
- package/dist/packages/core/src/helpers/isExtensionRulesEnabled.d.ts +0 -2
- package/dist/packages/core/src/helpers/isList.d.ts +0 -2
- package/dist/packages/core/src/helpers/isMarkActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeActive.d.ts +0 -3
- package/dist/packages/core/src/helpers/isNodeEmpty.d.ts +0 -2
- package/dist/packages/core/src/helpers/isNodeSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/isTextSelection.d.ts +0 -2
- package/dist/packages/core/src/helpers/posToDOMRect.d.ts +0 -2
- package/dist/packages/core/src/helpers/resolveFocusPosition.d.ts +0 -4
- package/dist/packages/core/src/helpers/selectionToInsertionEnd.d.ts +0 -2
- package/dist/packages/core/src/helpers/splitExtensions.d.ts +0 -9
- package/dist/packages/core/src/index.d.ts +0 -24
- package/dist/packages/core/src/inputRules/index.d.ts +0 -5
- package/dist/packages/core/src/inputRules/markInputRule.d.ts +0 -13
- package/dist/packages/core/src/inputRules/nodeInputRule.d.ts +0 -23
- package/dist/packages/core/src/inputRules/textInputRule.d.ts +0 -10
- package/dist/packages/core/src/inputRules/textblockTypeInputRule.d.ts +0 -15
- package/dist/packages/core/src/inputRules/wrappingInputRule.d.ts +0 -28
- package/dist/packages/core/src/pasteRules/index.d.ts +0 -3
- package/dist/packages/core/src/pasteRules/markPasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/nodePasteRule.d.ts +0 -13
- package/dist/packages/core/src/pasteRules/textPasteRule.d.ts +0 -10
- package/dist/packages/core/src/style.d.ts +0 -1
- package/dist/packages/core/src/types.d.ts +0 -255
- package/dist/packages/core/src/utilities/callOrReturn.d.ts +0 -9
- package/dist/packages/core/src/utilities/createStyleTag.d.ts +0 -1
- package/dist/packages/core/src/utilities/deleteProps.d.ts +0 -6
- package/dist/packages/core/src/utilities/elementFromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/escapeForRegEx.d.ts +0 -1
- package/dist/packages/core/src/utilities/findDuplicates.d.ts +0 -1
- package/dist/packages/core/src/utilities/fromString.d.ts +0 -1
- package/dist/packages/core/src/utilities/index.d.ts +0 -20
- package/dist/packages/core/src/utilities/isAndroid.d.ts +0 -1
- package/dist/packages/core/src/utilities/isEmptyObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isFunction.d.ts +0 -1
- package/dist/packages/core/src/utilities/isMacOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/isNumber.d.ts +0 -1
- package/dist/packages/core/src/utilities/isPlainObject.d.ts +0 -1
- package/dist/packages/core/src/utilities/isRegExp.d.ts +0 -1
- package/dist/packages/core/src/utilities/isString.d.ts +0 -1
- package/dist/packages/core/src/utilities/isiOS.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeAttributes.d.ts +0 -1
- package/dist/packages/core/src/utilities/mergeDeep.d.ts +0 -1
- package/dist/packages/core/src/utilities/minMax.d.ts +0 -1
- package/dist/packages/core/src/utilities/objectIncludes.d.ts +0 -8
- package/dist/packages/core/src/utilities/removeDuplicates.d.ts +0 -8
- package/dist/packages/extension-bubble-menu/src/bubble-menu-plugin.d.ts +0 -76
- package/dist/packages/extension-bubble-menu/src/bubble-menu.d.ts +0 -15
- package/dist/packages/extension-bubble-menu/src/index.d.ts +0 -4
- package/dist/packages/extension-floating-menu/src/floating-menu-plugin.d.ts +0 -66
- package/dist/packages/extension-floating-menu/src/floating-menu.d.ts +0 -15
- package/dist/packages/extension-floating-menu/src/index.d.ts +0 -4
- package/dist/packages/vue-3/src/BubbleMenu.d.ts +0 -59
- package/dist/packages/vue-3/src/Editor.d.ts +0 -23
- package/dist/packages/vue-3/src/EditorContent.d.ts +0 -17
- package/dist/packages/vue-3/src/FloatingMenu.d.ts +0 -48
- package/dist/packages/vue-3/src/NodeViewContent.d.ts +0 -13
- package/dist/packages/vue-3/src/NodeViewWrapper.d.ts +0 -13
- package/dist/packages/vue-3/src/VueNodeViewRenderer.d.ts +0 -48
- package/dist/packages/vue-3/src/VueRenderer.d.ts +0 -36
- package/dist/packages/vue-3/src/index.d.ts +0 -10
- package/dist/packages/vue-3/src/useEditor.d.ts +0 -3
- package/src/BubbleMenu.ts +0 -71
- package/src/FloatingMenu.ts +0 -66
package/dist/index.umd.js
DELETED
|
@@ -1,495 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/extension-bubble-menu'), require('vue'), require('@tiptap/core'), require('@tiptap/extension-floating-menu')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/extension-bubble-menu', 'vue', '@tiptap/core', '@tiptap/extension-floating-menu'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/vue-3"] = {}, global.extensionBubbleMenu, global.vue, global.core, global.extensionFloatingMenu));
|
|
5
|
-
})(this, (function (exports, extensionBubbleMenu, vue, core, extensionFloatingMenu) { 'use strict';
|
|
6
|
-
|
|
7
|
-
const BubbleMenu = vue.defineComponent({
|
|
8
|
-
name: 'BubbleMenu',
|
|
9
|
-
props: {
|
|
10
|
-
pluginKey: {
|
|
11
|
-
type: [String, Object],
|
|
12
|
-
default: 'bubbleMenu',
|
|
13
|
-
},
|
|
14
|
-
editor: {
|
|
15
|
-
type: Object,
|
|
16
|
-
required: true,
|
|
17
|
-
},
|
|
18
|
-
updateDelay: {
|
|
19
|
-
type: Number,
|
|
20
|
-
default: undefined,
|
|
21
|
-
},
|
|
22
|
-
tippyOptions: {
|
|
23
|
-
type: Object,
|
|
24
|
-
default: () => ({}),
|
|
25
|
-
},
|
|
26
|
-
shouldShow: {
|
|
27
|
-
type: Function,
|
|
28
|
-
default: null,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
setup(props, { slots }) {
|
|
32
|
-
const root = vue.ref(null);
|
|
33
|
-
vue.onMounted(() => {
|
|
34
|
-
const { updateDelay, editor, pluginKey, shouldShow, tippyOptions, } = props;
|
|
35
|
-
editor.registerPlugin(extensionBubbleMenu.BubbleMenuPlugin({
|
|
36
|
-
updateDelay,
|
|
37
|
-
editor,
|
|
38
|
-
element: root.value,
|
|
39
|
-
pluginKey,
|
|
40
|
-
shouldShow,
|
|
41
|
-
tippyOptions,
|
|
42
|
-
}));
|
|
43
|
-
});
|
|
44
|
-
vue.onBeforeUnmount(() => {
|
|
45
|
-
const { pluginKey, editor } = props;
|
|
46
|
-
editor.unregisterPlugin(pluginKey);
|
|
47
|
-
});
|
|
48
|
-
return () => { var _a; return vue.h('div', { ref: root }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); };
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
function useDebouncedRef(value) {
|
|
53
|
-
return vue.customRef((track, trigger) => {
|
|
54
|
-
return {
|
|
55
|
-
get() {
|
|
56
|
-
track();
|
|
57
|
-
return value;
|
|
58
|
-
},
|
|
59
|
-
set(newValue) {
|
|
60
|
-
// update state
|
|
61
|
-
value = newValue;
|
|
62
|
-
// update view as soon as possible
|
|
63
|
-
requestAnimationFrame(() => {
|
|
64
|
-
requestAnimationFrame(() => {
|
|
65
|
-
trigger();
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
class Editor extends core.Editor {
|
|
73
|
-
constructor(options = {}) {
|
|
74
|
-
super(options);
|
|
75
|
-
this.contentComponent = null;
|
|
76
|
-
this.appContext = null;
|
|
77
|
-
this.reactiveState = useDebouncedRef(this.view.state);
|
|
78
|
-
this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage);
|
|
79
|
-
this.on('beforeTransaction', ({ nextState }) => {
|
|
80
|
-
this.reactiveState.value = nextState;
|
|
81
|
-
this.reactiveExtensionStorage.value = this.extensionStorage;
|
|
82
|
-
});
|
|
83
|
-
return vue.markRaw(this); // eslint-disable-line
|
|
84
|
-
}
|
|
85
|
-
get state() {
|
|
86
|
-
return this.reactiveState ? this.reactiveState.value : this.view.state;
|
|
87
|
-
}
|
|
88
|
-
get storage() {
|
|
89
|
-
return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Register a ProseMirror plugin.
|
|
93
|
-
*/
|
|
94
|
-
registerPlugin(plugin, handlePlugins) {
|
|
95
|
-
super.registerPlugin(plugin, handlePlugins);
|
|
96
|
-
this.reactiveState.value = this.view.state;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Unregister a ProseMirror plugin.
|
|
100
|
-
*/
|
|
101
|
-
unregisterPlugin(nameOrPluginKey) {
|
|
102
|
-
super.unregisterPlugin(nameOrPluginKey);
|
|
103
|
-
this.reactiveState.value = this.view.state;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const EditorContent = vue.defineComponent({
|
|
108
|
-
name: 'EditorContent',
|
|
109
|
-
props: {
|
|
110
|
-
editor: {
|
|
111
|
-
default: null,
|
|
112
|
-
type: Object,
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
setup(props) {
|
|
116
|
-
const rootEl = vue.ref();
|
|
117
|
-
const instance = vue.getCurrentInstance();
|
|
118
|
-
vue.watchEffect(() => {
|
|
119
|
-
const editor = props.editor;
|
|
120
|
-
if (editor && editor.options.element && rootEl.value) {
|
|
121
|
-
vue.nextTick(() => {
|
|
122
|
-
if (!rootEl.value || !editor.options.element.firstChild) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const element = vue.unref(rootEl.value);
|
|
126
|
-
rootEl.value.append(...editor.options.element.childNodes);
|
|
127
|
-
// @ts-ignore
|
|
128
|
-
editor.contentComponent = instance.ctx._;
|
|
129
|
-
if (instance) {
|
|
130
|
-
editor.appContext = {
|
|
131
|
-
...instance.appContext,
|
|
132
|
-
provides: {
|
|
133
|
-
// @ts-ignore
|
|
134
|
-
...instance.provides,
|
|
135
|
-
...instance.appContext.provides,
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
editor.setOptions({
|
|
140
|
-
element,
|
|
141
|
-
});
|
|
142
|
-
editor.createNodeViews();
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
vue.onBeforeUnmount(() => {
|
|
147
|
-
const editor = props.editor;
|
|
148
|
-
if (!editor) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
// destroy nodeviews before vue removes dom element
|
|
152
|
-
if (!editor.isDestroyed) {
|
|
153
|
-
editor.view.setProps({
|
|
154
|
-
nodeViews: {},
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
editor.contentComponent = null;
|
|
158
|
-
editor.appContext = null;
|
|
159
|
-
if (!editor.options.element.firstChild) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
const newElement = document.createElement('div');
|
|
163
|
-
newElement.append(...editor.options.element.childNodes);
|
|
164
|
-
editor.setOptions({
|
|
165
|
-
element: newElement,
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
return { rootEl };
|
|
169
|
-
},
|
|
170
|
-
render() {
|
|
171
|
-
return vue.h('div', {
|
|
172
|
-
ref: (el) => { this.rootEl = el; },
|
|
173
|
-
});
|
|
174
|
-
},
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
const FloatingMenu = vue.defineComponent({
|
|
178
|
-
name: 'FloatingMenu',
|
|
179
|
-
props: {
|
|
180
|
-
pluginKey: {
|
|
181
|
-
// TODO: TypeScript breaks :(
|
|
182
|
-
// type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],
|
|
183
|
-
type: null,
|
|
184
|
-
default: 'floatingMenu',
|
|
185
|
-
},
|
|
186
|
-
editor: {
|
|
187
|
-
type: Object,
|
|
188
|
-
required: true,
|
|
189
|
-
},
|
|
190
|
-
tippyOptions: {
|
|
191
|
-
type: Object,
|
|
192
|
-
default: () => ({}),
|
|
193
|
-
},
|
|
194
|
-
shouldShow: {
|
|
195
|
-
type: Function,
|
|
196
|
-
default: null,
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
setup(props, { slots }) {
|
|
200
|
-
const root = vue.ref(null);
|
|
201
|
-
vue.onMounted(() => {
|
|
202
|
-
const { pluginKey, editor, tippyOptions, shouldShow, } = props;
|
|
203
|
-
editor.registerPlugin(extensionFloatingMenu.FloatingMenuPlugin({
|
|
204
|
-
pluginKey,
|
|
205
|
-
editor,
|
|
206
|
-
element: root.value,
|
|
207
|
-
tippyOptions,
|
|
208
|
-
shouldShow,
|
|
209
|
-
}));
|
|
210
|
-
});
|
|
211
|
-
vue.onBeforeUnmount(() => {
|
|
212
|
-
const { pluginKey, editor } = props;
|
|
213
|
-
editor.unregisterPlugin(pluginKey);
|
|
214
|
-
});
|
|
215
|
-
return () => { var _a; return vue.h('div', { ref: root }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); };
|
|
216
|
-
},
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
const NodeViewContent = vue.defineComponent({
|
|
220
|
-
name: 'NodeViewContent',
|
|
221
|
-
props: {
|
|
222
|
-
as: {
|
|
223
|
-
type: String,
|
|
224
|
-
default: 'div',
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
render() {
|
|
228
|
-
return vue.h(this.as, {
|
|
229
|
-
style: {
|
|
230
|
-
whiteSpace: 'pre-wrap',
|
|
231
|
-
},
|
|
232
|
-
'data-node-view-content': '',
|
|
233
|
-
});
|
|
234
|
-
},
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
const NodeViewWrapper = vue.defineComponent({
|
|
238
|
-
name: 'NodeViewWrapper',
|
|
239
|
-
props: {
|
|
240
|
-
as: {
|
|
241
|
-
type: String,
|
|
242
|
-
default: 'div',
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
inject: ['onDragStart', 'decorationClasses'],
|
|
246
|
-
render() {
|
|
247
|
-
var _a, _b;
|
|
248
|
-
return vue.h(this.as, {
|
|
249
|
-
// @ts-ignore
|
|
250
|
-
class: this.decorationClasses,
|
|
251
|
-
style: {
|
|
252
|
-
whiteSpace: 'normal',
|
|
253
|
-
},
|
|
254
|
-
'data-node-view-wrapper': '',
|
|
255
|
-
// @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)
|
|
256
|
-
onDragstart: this.onDragStart,
|
|
257
|
-
}, (_b = (_a = this.$slots).default) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
258
|
-
},
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
const useEditor = (options = {}) => {
|
|
262
|
-
const editor = vue.shallowRef();
|
|
263
|
-
vue.onMounted(() => {
|
|
264
|
-
editor.value = new Editor(options);
|
|
265
|
-
});
|
|
266
|
-
vue.onBeforeUnmount(() => {
|
|
267
|
-
var _a;
|
|
268
|
-
(_a = editor.value) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
269
|
-
});
|
|
270
|
-
return editor;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* This class is used to render Vue components inside the editor.
|
|
275
|
-
*/
|
|
276
|
-
class VueRenderer {
|
|
277
|
-
constructor(component, { props = {}, editor }) {
|
|
278
|
-
this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString();
|
|
279
|
-
this.editor = editor;
|
|
280
|
-
this.component = vue.markRaw(component);
|
|
281
|
-
this.el = document.createElement('div');
|
|
282
|
-
this.props = vue.reactive(props);
|
|
283
|
-
this.renderedComponent = this.renderComponent();
|
|
284
|
-
}
|
|
285
|
-
get element() {
|
|
286
|
-
return this.renderedComponent.el;
|
|
287
|
-
}
|
|
288
|
-
renderComponent() {
|
|
289
|
-
let vNode = vue.h(this.component, this.props);
|
|
290
|
-
if (typeof document !== 'undefined' && this.el) {
|
|
291
|
-
vue.render(vNode, this.el);
|
|
292
|
-
}
|
|
293
|
-
const destroy = () => {
|
|
294
|
-
if (this.el) {
|
|
295
|
-
vue.render(null, this.el);
|
|
296
|
-
}
|
|
297
|
-
this.el = null;
|
|
298
|
-
vNode = null;
|
|
299
|
-
};
|
|
300
|
-
return { vNode, destroy, el: this.el ? this.el.firstElementChild : null };
|
|
301
|
-
}
|
|
302
|
-
updateProps(props = {}) {
|
|
303
|
-
Object
|
|
304
|
-
.entries(props)
|
|
305
|
-
.forEach(([key, value]) => {
|
|
306
|
-
this.props[key] = value;
|
|
307
|
-
});
|
|
308
|
-
this.renderComponent();
|
|
309
|
-
}
|
|
310
|
-
destroy() {
|
|
311
|
-
this.renderedComponent.destroy();
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
const nodeViewProps = {
|
|
316
|
-
editor: {
|
|
317
|
-
type: Object,
|
|
318
|
-
required: true,
|
|
319
|
-
},
|
|
320
|
-
node: {
|
|
321
|
-
type: Object,
|
|
322
|
-
required: true,
|
|
323
|
-
},
|
|
324
|
-
decorations: {
|
|
325
|
-
type: Object,
|
|
326
|
-
required: true,
|
|
327
|
-
},
|
|
328
|
-
selected: {
|
|
329
|
-
type: Boolean,
|
|
330
|
-
required: true,
|
|
331
|
-
},
|
|
332
|
-
extension: {
|
|
333
|
-
type: Object,
|
|
334
|
-
required: true,
|
|
335
|
-
},
|
|
336
|
-
getPos: {
|
|
337
|
-
type: Function,
|
|
338
|
-
required: true,
|
|
339
|
-
},
|
|
340
|
-
updateAttributes: {
|
|
341
|
-
type: Function,
|
|
342
|
-
required: true,
|
|
343
|
-
},
|
|
344
|
-
deleteNode: {
|
|
345
|
-
type: Function,
|
|
346
|
-
required: true,
|
|
347
|
-
},
|
|
348
|
-
};
|
|
349
|
-
class VueNodeView extends core.NodeView {
|
|
350
|
-
mount() {
|
|
351
|
-
const props = {
|
|
352
|
-
editor: this.editor,
|
|
353
|
-
node: this.node,
|
|
354
|
-
decorations: this.decorations,
|
|
355
|
-
selected: false,
|
|
356
|
-
extension: this.extension,
|
|
357
|
-
getPos: () => this.getPos(),
|
|
358
|
-
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
|
|
359
|
-
deleteNode: () => this.deleteNode(),
|
|
360
|
-
};
|
|
361
|
-
const onDragStart = this.onDragStart.bind(this);
|
|
362
|
-
this.decorationClasses = vue.ref(this.getDecorationClasses());
|
|
363
|
-
const extendedComponent = vue.defineComponent({
|
|
364
|
-
extends: { ...this.component },
|
|
365
|
-
props: Object.keys(props),
|
|
366
|
-
template: this.component.template,
|
|
367
|
-
setup: reactiveProps => {
|
|
368
|
-
var _a, _b;
|
|
369
|
-
vue.provide('onDragStart', onDragStart);
|
|
370
|
-
vue.provide('decorationClasses', this.decorationClasses);
|
|
371
|
-
return (_b = (_a = this.component).setup) === null || _b === void 0 ? void 0 : _b.call(_a, reactiveProps, {
|
|
372
|
-
expose: () => undefined,
|
|
373
|
-
});
|
|
374
|
-
},
|
|
375
|
-
// add support for scoped styles
|
|
376
|
-
// @ts-ignore
|
|
377
|
-
// eslint-disable-next-line
|
|
378
|
-
__scopeId: this.component.__scopeId,
|
|
379
|
-
// add support for CSS Modules
|
|
380
|
-
// @ts-ignore
|
|
381
|
-
// eslint-disable-next-line
|
|
382
|
-
__cssModules: this.component.__cssModules,
|
|
383
|
-
// add support for vue devtools
|
|
384
|
-
// @ts-ignore
|
|
385
|
-
// eslint-disable-next-line
|
|
386
|
-
__name: this.component.__name,
|
|
387
|
-
// @ts-ignore
|
|
388
|
-
// eslint-disable-next-line
|
|
389
|
-
__file: this.component.__file,
|
|
390
|
-
});
|
|
391
|
-
this.renderer = new VueRenderer(extendedComponent, {
|
|
392
|
-
editor: this.editor,
|
|
393
|
-
props,
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
get dom() {
|
|
397
|
-
if (!this.renderer.element || !this.renderer.element.hasAttribute('data-node-view-wrapper')) {
|
|
398
|
-
throw Error('Please use the NodeViewWrapper component for your node view.');
|
|
399
|
-
}
|
|
400
|
-
return this.renderer.element;
|
|
401
|
-
}
|
|
402
|
-
get contentDOM() {
|
|
403
|
-
if (this.node.isLeaf) {
|
|
404
|
-
return null;
|
|
405
|
-
}
|
|
406
|
-
const contentElement = this.dom.querySelector('[data-node-view-content]');
|
|
407
|
-
return (contentElement || this.dom);
|
|
408
|
-
}
|
|
409
|
-
update(node, decorations) {
|
|
410
|
-
const updateProps = (props) => {
|
|
411
|
-
this.decorationClasses.value = this.getDecorationClasses();
|
|
412
|
-
this.renderer.updateProps(props);
|
|
413
|
-
};
|
|
414
|
-
if (typeof this.options.update === 'function') {
|
|
415
|
-
const oldNode = this.node;
|
|
416
|
-
const oldDecorations = this.decorations;
|
|
417
|
-
this.node = node;
|
|
418
|
-
this.decorations = decorations;
|
|
419
|
-
return this.options.update({
|
|
420
|
-
oldNode,
|
|
421
|
-
oldDecorations,
|
|
422
|
-
newNode: node,
|
|
423
|
-
newDecorations: decorations,
|
|
424
|
-
updateProps: () => updateProps({ node, decorations }),
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
if (node.type !== this.node.type) {
|
|
428
|
-
return false;
|
|
429
|
-
}
|
|
430
|
-
if (node === this.node && this.decorations === decorations) {
|
|
431
|
-
return true;
|
|
432
|
-
}
|
|
433
|
-
this.node = node;
|
|
434
|
-
this.decorations = decorations;
|
|
435
|
-
updateProps({ node, decorations });
|
|
436
|
-
return true;
|
|
437
|
-
}
|
|
438
|
-
selectNode() {
|
|
439
|
-
this.renderer.updateProps({
|
|
440
|
-
selected: true,
|
|
441
|
-
});
|
|
442
|
-
if (this.renderer.element) {
|
|
443
|
-
this.renderer.element.classList.add('ProseMirror-selectednode');
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
deselectNode() {
|
|
447
|
-
this.renderer.updateProps({
|
|
448
|
-
selected: false,
|
|
449
|
-
});
|
|
450
|
-
if (this.renderer.element) {
|
|
451
|
-
this.renderer.element.classList.remove('ProseMirror-selectednode');
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
getDecorationClasses() {
|
|
455
|
-
return (this.decorations
|
|
456
|
-
// @ts-ignore
|
|
457
|
-
.map(item => item.type.attrs.class)
|
|
458
|
-
.flat()
|
|
459
|
-
.join(' '));
|
|
460
|
-
}
|
|
461
|
-
destroy() {
|
|
462
|
-
this.renderer.destroy();
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
function VueNodeViewRenderer(component, options) {
|
|
466
|
-
return (props) => {
|
|
467
|
-
// try to get the parent component
|
|
468
|
-
// this is important for vue devtools to show the component hierarchy correctly
|
|
469
|
-
// maybe it’s `undefined` because <editor-content> isn’t rendered yet
|
|
470
|
-
if (!props.editor.contentComponent) {
|
|
471
|
-
return {};
|
|
472
|
-
}
|
|
473
|
-
return new VueNodeView(component, props, options);
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
exports.BubbleMenu = BubbleMenu;
|
|
478
|
-
exports.Editor = Editor;
|
|
479
|
-
exports.EditorContent = EditorContent;
|
|
480
|
-
exports.FloatingMenu = FloatingMenu;
|
|
481
|
-
exports.NodeViewContent = NodeViewContent;
|
|
482
|
-
exports.NodeViewWrapper = NodeViewWrapper;
|
|
483
|
-
exports.VueNodeViewRenderer = VueNodeViewRenderer;
|
|
484
|
-
exports.VueRenderer = VueRenderer;
|
|
485
|
-
exports.nodeViewProps = nodeViewProps;
|
|
486
|
-
exports.useEditor = useEditor;
|
|
487
|
-
Object.keys(core).forEach(function (k) {
|
|
488
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
489
|
-
enumerable: true,
|
|
490
|
-
get: function () { return core[k]; }
|
|
491
|
-
});
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
}));
|
|
495
|
-
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/BubbleMenu.ts","../src/Editor.ts","../src/EditorContent.ts","../src/FloatingMenu.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\n} from 'vue'\n\nexport const BubbleMenu = defineComponent({\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,\n default: 'bubbleMenu',\n },\n\n editor: {\n type: Object as PropType<BubbleMenuPluginProps['editor']>,\n required: true,\n },\n\n updateDelay: {\n type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,\n default: undefined,\n },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n updateDelay,\n editor,\n pluginKey,\n shouldShow,\n tippyOptions,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay,\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n shouldShow,\n tippyOptions,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { Editor as CoreEditor, EditorOptions } from '@tiptap/core'\nimport { EditorState, Plugin, PluginKey } from '@tiptap/pm/state'\nimport {\n AppContext,\n ComponentInternalInstance,\n ComponentPublicInstance,\n customRef,\n markRaw,\n Ref,\n} from 'vue'\n\nfunction useDebouncedRef<T>(value: T) {\n return customRef<T>((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref<EditorState>\n\n private reactiveExtensionStorage: Ref<Record<string, any>>\n\n public contentComponent: ContentComponent | null = null\n\n public appContext: AppContext | null = null\n\n constructor(options: Partial<EditorOptions> = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('beforeTransaction', ({ nextState }) => {\n this.reactiveState.value = nextState\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this) // eslint-disable-line\n }\n\n get state() {\n return this.reactiveState ? this.reactiveState.value : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(\n plugin: Plugin,\n handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[],\n ): void {\n super.registerPlugin(plugin, handlePlugins)\n this.reactiveState.value = this.view.state\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {\n super.unregisterPlugin(nameOrPluginKey)\n this.reactiveState.value = this.view.state\n }\n}\n","import {\n defineComponent,\n getCurrentInstance,\n h,\n nextTick,\n onBeforeUnmount,\n PropType,\n Ref,\n ref,\n unref,\n watchEffect,\n} from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n setup(props) {\n const rootEl: Ref<Element | undefined> = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.options.element.firstChild) {\n return\n }\n\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.options.element.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n if (instance) {\n editor.appContext = {\n ...instance.appContext,\n provides: {\n // @ts-ignore\n ...instance.provides,\n ...instance.appContext.provides,\n },\n }\n }\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n // destroy nodeviews before vue removes dom element\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n editor.appContext = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n })\n\n return { rootEl }\n },\n\n render() {\n return h(\n 'div',\n {\n ref: (el: any) => { this.rootEl = el },\n },\n )\n },\n})\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n PropType,\n ref,\n} from 'vue'\n\nexport const FloatingMenu = defineComponent({\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n // TODO: TypeScript breaks :(\n // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\n type: null,\n default: 'floatingMenu',\n },\n\n editor: {\n type: Object as PropType<FloatingMenuPluginProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,\n default: null,\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n pluginKey,\n editor,\n tippyOptions,\n shouldShow,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: root.value as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey)\n })\n\n return () => h('div', { ref: root }, slots.default?.())\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n name: 'NodeViewContent',\n\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render() {\n return h(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n })\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n name: 'NodeViewWrapper',\n\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as,\n {\n // @ts-ignore\n class: this.decorationClasses,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import { EditorOptions } from '@tiptap/core'\nimport { onBeforeUnmount, onMounted, shallowRef } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport const useEditor = (options: Partial<EditorOptions> = {}) => {\n const editor = shallowRef<Editor>()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import { Editor } from '@tiptap/core'\nimport {\n Component, DefineComponent, h, markRaw, reactive, render,\n} from 'vue'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nexport interface VueRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n}\n\ntype ExtendedVNode = ReturnType<typeof h> | null\n\ninterface RenderedComponent {\n vNode: ExtendedVNode\n destroy: () => void\n el: Element | null\n}\n\n/**\n * This class is used to render Vue components inside the editor.\n */\nexport class VueRenderer {\n id: string\n\n renderedComponent!: RenderedComponent\n\n editor: ExtendedEditor\n\n component: Component\n\n el: Element | null\n\n props: Record<string, any>\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.el = document.createElement('div')\n this.props = reactive(props)\n this.renderedComponent = this.renderComponent()\n }\n\n get element(): Element | null {\n return this.renderedComponent.el\n }\n\n renderComponent() {\n let vNode: ExtendedVNode = h(this.component as DefineComponent, this.props)\n\n if (typeof document !== 'undefined' && this.el) { render(vNode, this.el) }\n\n const destroy = () => {\n if (this.el) { render(null, this.el) }\n this.el = null\n vNode = null\n }\n\n return { vNode, destroy, el: this.el ? this.el.firstElementChild : null }\n }\n\n updateProps(props: Record<string, any> = {}): void {\n\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.props[key] = value\n })\n this.renderComponent()\n }\n\n destroy(): void {\n this.renderedComponent.destroy()\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport {\n Component,\n defineComponent,\n PropType,\n provide,\n Ref,\n ref,\n} from 'vue'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType<NodeViewProps['editor']>,\n required: true as const,\n },\n node: {\n type: Object as PropType<NodeViewProps['node']>,\n required: true as const,\n },\n decorations: {\n type: Object as PropType<NodeViewProps['decorations']>,\n required: true as const,\n },\n selected: {\n type: Boolean as PropType<NodeViewProps['selected']>,\n required: true as const,\n },\n extension: {\n type: Object as PropType<NodeViewProps['extension']>,\n required: true as const,\n },\n getPos: {\n type: Function as PropType<NodeViewProps['getPos']>,\n required: true as const,\n },\n updateAttributes: {\n type: Function as PropType<NodeViewProps['updateAttributes']>,\n required: true as const,\n },\n deleteNode: {\n type: Function as PropType<NodeViewProps['deleteNode']>,\n required: true as const,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n}\n\nclass VueNodeView extends NodeView<Component, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: Ref<string>\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // eslint-disable-next-line\n __scopeId: this.component.__scopeId,\n // add support for CSS Modules\n // @ts-ignore\n // eslint-disable-next-line\n __cssModules: this.component.__cssModules,\n // add support for vue devtools\n // @ts-ignore\n // eslint-disable-next-line\n __name: this.component.__name,\n // @ts-ignore\n // eslint-disable-next-line\n __file: this.component.__file,\n })\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element || !this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return (contentElement || this.dom) as HTMLElement | null\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .map(item => item.type.attrs.class)\n .flat()\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Component,\n options?: Partial<VueNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new VueNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["defineComponent","ref","onMounted","BubbleMenuPlugin","onBeforeUnmount","h","customRef","CoreEditor","markRaw","getCurrentInstance","watchEffect","nextTick","unref","FloatingMenuPlugin","shallowRef","reactive","render","NodeView","provide"],"mappings":";;;;;;AAUO,QAAM,UAAU,GAAGA,mBAAe,CAAC;EACxC,IAAA,IAAI,EAAE,YAAY;EAElB,IAAA,KAAK,EAAE;EACL,QAAA,SAAS,EAAE;EACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAiD;EACtE,YAAA,OAAO,EAAE,YAAY;EACtB,SAAA;EAED,QAAA,MAAM,EAAE;EACN,YAAA,IAAI,EAAE,MAAmD;EACzD,YAAA,QAAQ,EAAE,IAAI;EACf,SAAA;EAED,QAAA,WAAW,EAAE;EACX,YAAA,IAAI,EAAE,MAAwD;EAC9D,YAAA,OAAO,EAAE,SAAS;EACnB,SAAA;EAED,QAAA,YAAY,EAAE;EACZ,YAAA,IAAI,EAAE,MAAyD;EAC/D,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;EACpB,SAAA;EAED,QAAA,UAAU,EAAE;EACV,YAAA,IAAI,EAAE,QAAkF;EACxF,YAAA,OAAO,EAAE,IAAI;EACd,SAAA;EACF,KAAA;EAED,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAA;EACpB,QAAA,MAAM,IAAI,GAAGC,OAAG,CAAqB,IAAI,CAAC,CAAA;UAE1CC,aAAS,CAAC,MAAK;EACb,YAAA,MAAM,EACJ,WAAW,EACX,MAAM,EACN,SAAS,EACT,UAAU,EACV,YAAY,GACb,GAAG,KAAK,CAAA;EAET,YAAA,MAAM,CAAC,cAAc,CAACC,oCAAgB,CAAC;kBACrC,WAAW;kBACX,MAAM;kBACN,OAAO,EAAE,IAAI,CAAC,KAAoB;kBAClC,SAAS;kBACT,UAAU;kBACV,YA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C,CAAA;EACF,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;cACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;WAChE;OACF;MAED,YAAY,GAAA;EACV,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;EACxB,YAAA,QAAQ,EAAE,KAAK;EAChB,SAAA,CAAC,CAAA;EACF,QAAA,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;cACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAA;WACnE;OACF;MAED,oBAAoB,GAAA;UAClB,QACE,IAAI,CAAC,WAAW;;EAEb,aAAA,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;EAClC,aAAA,IAAI,EAAE;EACN,aAAA,IAAI,CAAC,GAAG,CAAC,EACb;OACF;MAED,OAAO,GAAA;EACL,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;OACxB;EACF,CAAA;EAEe,SAAA,mBAAmB,CACjC,SAAoB,EACpB,OAA6C,EAAA;MAE7C,OAAO,CAAC,KAA4B,KAAI;;;;EAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;EAC9C,YAAA,OAAO,EAAE,CAAA;WACV;UAED,OAAO,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;EACrF,KAAC,CAAA;EACH;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { EditorState, Transaction } from '@tiptap/pm/state';
|
|
2
|
-
import { Editor } from './Editor.js';
|
|
3
|
-
import { AnyCommands, CanCommands, ChainedCommands, CommandProps, SingleCommands } from './types.js';
|
|
4
|
-
export declare class CommandManager {
|
|
5
|
-
editor: Editor;
|
|
6
|
-
rawCommands: AnyCommands;
|
|
7
|
-
customState?: EditorState;
|
|
8
|
-
constructor(props: {
|
|
9
|
-
editor: Editor;
|
|
10
|
-
state?: EditorState;
|
|
11
|
-
});
|
|
12
|
-
get hasCustomState(): boolean;
|
|
13
|
-
get state(): EditorState;
|
|
14
|
-
get commands(): SingleCommands;
|
|
15
|
-
get chain(): () => ChainedCommands;
|
|
16
|
-
get can(): () => CanCommands;
|
|
17
|
-
createChain(startTr?: Transaction, shouldDispatch?: boolean): ChainedCommands;
|
|
18
|
-
createCan(startTr?: Transaction): CanCommands;
|
|
19
|
-
buildProps(tr: Transaction, shouldDispatch?: boolean): CommandProps;
|
|
20
|
-
}
|