@tiptap/vue-2 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 +340 -349
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +79 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +298 -337
- package/dist/index.js.map +1 -1
- package/dist/menus/index.cjs +2274 -0
- package/dist/menus/index.cjs.map +1 -0
- package/dist/menus/index.d.cts +145 -0
- package/dist/menus/index.d.ts +145 -0
- package/dist/menus/index.js +2246 -0
- package/dist/menus/index.js.map +1 -0
- package/package.json +28 -16
- package/src/Editor.ts +1 -1
- package/src/EditorContent.ts +7 -5
- package/src/NodeViewContent.ts +3 -2
- package/src/NodeViewWrapper.ts +6 -5
- package/src/VueNodeViewRenderer.ts +80 -27
- package/src/VueRenderer.ts +5 -7
- package/src/index.ts +0 -2
- package/src/menus/BubbleMenu.ts +85 -0
- package/src/{FloatingMenu.ts → menus/FloatingMenu.ts} +24 -15
- package/src/menus/index.ts +2 -0
- package/dist/index.umd.js +0 -379
- 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-2/src/BubbleMenu.d.ts +0 -10
- package/dist/packages/vue-2/src/Editor.d.ts +0 -5
- package/dist/packages/vue-2/src/EditorContent.d.ts +0 -6
- package/dist/packages/vue-2/src/FloatingMenu.d.ts +0 -9
- package/dist/packages/vue-2/src/NodeViewContent.d.ts +0 -5
- package/dist/packages/vue-2/src/NodeViewWrapper.d.ts +0 -9
- package/dist/packages/vue-2/src/VueNodeViewRenderer.d.ts +0 -37
- package/dist/packages/vue-2/src/VueRenderer.d.ts +0 -12
- package/dist/packages/vue-2/src/index.d.ts +0 -9
- package/src/BubbleMenu.ts +0 -70
package/dist/index.umd.js
DELETED
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/extension-bubble-menu'), require('@tiptap/core'), require('@tiptap/extension-floating-menu'), require('vue'), require('vue-ts-types')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/extension-bubble-menu', '@tiptap/core', '@tiptap/extension-floating-menu', 'vue', 'vue-ts-types'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/vue-2"] = {}, global.extensionBubbleMenu, global.core, global.extensionFloatingMenu, global.Vue, global.vueTsTypes));
|
|
5
|
-
})(this, (function (exports, extensionBubbleMenu, core, extensionFloatingMenu, Vue, vueTsTypes) { 'use strict';
|
|
6
|
-
|
|
7
|
-
const BubbleMenu = {
|
|
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
|
-
},
|
|
21
|
-
tippyOptions: {
|
|
22
|
-
type: Object,
|
|
23
|
-
default: () => ({}),
|
|
24
|
-
},
|
|
25
|
-
shouldShow: {
|
|
26
|
-
type: Function,
|
|
27
|
-
default: null,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
watch: {
|
|
31
|
-
editor: {
|
|
32
|
-
immediate: true,
|
|
33
|
-
handler(editor) {
|
|
34
|
-
if (!editor) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
this.$nextTick(() => {
|
|
38
|
-
editor.registerPlugin(extensionBubbleMenu.BubbleMenuPlugin({
|
|
39
|
-
updateDelay: this.updateDelay,
|
|
40
|
-
editor,
|
|
41
|
-
element: this.$el,
|
|
42
|
-
pluginKey: this.pluginKey,
|
|
43
|
-
shouldShow: this.shouldShow,
|
|
44
|
-
tippyOptions: this.tippyOptions,
|
|
45
|
-
}));
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
render(createElement) {
|
|
51
|
-
return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default);
|
|
52
|
-
},
|
|
53
|
-
beforeDestroy() {
|
|
54
|
-
this.editor.unregisterPlugin(this.pluginKey);
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
class Editor extends core.Editor {
|
|
59
|
-
constructor() {
|
|
60
|
-
super(...arguments);
|
|
61
|
-
this.contentComponent = null;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const EditorContent = {
|
|
66
|
-
name: 'EditorContent',
|
|
67
|
-
props: {
|
|
68
|
-
editor: {
|
|
69
|
-
default: null,
|
|
70
|
-
type: Object,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
watch: {
|
|
74
|
-
editor: {
|
|
75
|
-
immediate: true,
|
|
76
|
-
handler(editor) {
|
|
77
|
-
if (editor && editor.options.element) {
|
|
78
|
-
this.$nextTick(() => {
|
|
79
|
-
const element = this.$el;
|
|
80
|
-
if (!element || !editor.options.element.firstChild) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
element.append(...editor.options.element.childNodes);
|
|
84
|
-
editor.contentComponent = this;
|
|
85
|
-
editor.setOptions({
|
|
86
|
-
element,
|
|
87
|
-
});
|
|
88
|
-
editor.createNodeViews();
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
render(createElement) {
|
|
95
|
-
return createElement('div');
|
|
96
|
-
},
|
|
97
|
-
beforeDestroy() {
|
|
98
|
-
const { editor } = this;
|
|
99
|
-
if (!editor) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (!editor.isDestroyed) {
|
|
103
|
-
editor.view.setProps({
|
|
104
|
-
nodeViews: {},
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
editor.contentComponent = null;
|
|
108
|
-
if (!editor.options.element.firstChild) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
const newElement = document.createElement('div');
|
|
112
|
-
newElement.append(...editor.options.element.childNodes);
|
|
113
|
-
editor.setOptions({
|
|
114
|
-
element: newElement,
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const FloatingMenu = {
|
|
120
|
-
name: 'FloatingMenu',
|
|
121
|
-
props: {
|
|
122
|
-
pluginKey: {
|
|
123
|
-
type: [String, Object],
|
|
124
|
-
default: 'floatingMenu',
|
|
125
|
-
},
|
|
126
|
-
editor: {
|
|
127
|
-
type: Object,
|
|
128
|
-
required: true,
|
|
129
|
-
},
|
|
130
|
-
tippyOptions: {
|
|
131
|
-
type: Object,
|
|
132
|
-
default: () => ({}),
|
|
133
|
-
},
|
|
134
|
-
shouldShow: {
|
|
135
|
-
type: Function,
|
|
136
|
-
default: null,
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
watch: {
|
|
140
|
-
editor: {
|
|
141
|
-
immediate: true,
|
|
142
|
-
handler(editor) {
|
|
143
|
-
if (!editor) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
this.$nextTick(() => {
|
|
147
|
-
editor.registerPlugin(extensionFloatingMenu.FloatingMenuPlugin({
|
|
148
|
-
pluginKey: this.pluginKey,
|
|
149
|
-
editor,
|
|
150
|
-
element: this.$el,
|
|
151
|
-
tippyOptions: this.tippyOptions,
|
|
152
|
-
shouldShow: this.shouldShow,
|
|
153
|
-
}));
|
|
154
|
-
});
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
render(createElement) {
|
|
159
|
-
return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default);
|
|
160
|
-
},
|
|
161
|
-
beforeDestroy() {
|
|
162
|
-
this.editor.unregisterPlugin(this.pluginKey);
|
|
163
|
-
},
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
const NodeViewContent = {
|
|
167
|
-
props: {
|
|
168
|
-
as: {
|
|
169
|
-
type: String,
|
|
170
|
-
default: 'div',
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
render(createElement) {
|
|
174
|
-
return createElement(this.as, {
|
|
175
|
-
style: {
|
|
176
|
-
whiteSpace: 'pre-wrap',
|
|
177
|
-
},
|
|
178
|
-
attrs: {
|
|
179
|
-
'data-node-view-content': '',
|
|
180
|
-
},
|
|
181
|
-
});
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
const NodeViewWrapper = {
|
|
186
|
-
props: {
|
|
187
|
-
as: {
|
|
188
|
-
type: String,
|
|
189
|
-
default: 'div',
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
inject: ['onDragStart', 'decorationClasses'],
|
|
193
|
-
render(createElement) {
|
|
194
|
-
return createElement(this.as, {
|
|
195
|
-
class: this.decorationClasses.value,
|
|
196
|
-
style: {
|
|
197
|
-
whiteSpace: 'normal',
|
|
198
|
-
},
|
|
199
|
-
attrs: {
|
|
200
|
-
'data-node-view-wrapper': '',
|
|
201
|
-
},
|
|
202
|
-
on: {
|
|
203
|
-
dragstart: this.onDragStart,
|
|
204
|
-
},
|
|
205
|
-
}, this.$slots.default);
|
|
206
|
-
},
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.
|
|
211
|
-
*/
|
|
212
|
-
class VueRenderer {
|
|
213
|
-
constructor(component, props) {
|
|
214
|
-
const Component = (typeof component === 'function') ? component : Vue.extend(component);
|
|
215
|
-
this.ref = new Component(props).$mount();
|
|
216
|
-
}
|
|
217
|
-
get element() {
|
|
218
|
-
return this.ref.$el;
|
|
219
|
-
}
|
|
220
|
-
updateProps(props = {}) {
|
|
221
|
-
var _a, _b, _c;
|
|
222
|
-
if (!this.ref.$props) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
// prevents `Avoid mutating a prop directly` error message
|
|
226
|
-
// Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working
|
|
227
|
-
const currentVueConstructor = (_c = (_b = (_a = this.ref.$props.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) === null || _b === void 0 ? void 0 : _b.$options._base) !== null && _c !== void 0 ? _c : Vue; // eslint-disable-line
|
|
228
|
-
const originalSilent = currentVueConstructor.config.silent;
|
|
229
|
-
currentVueConstructor.config.silent = true;
|
|
230
|
-
Object
|
|
231
|
-
.entries(props)
|
|
232
|
-
.forEach(([key, value]) => {
|
|
233
|
-
this.ref.$props[key] = value;
|
|
234
|
-
});
|
|
235
|
-
currentVueConstructor.config.silent = originalSilent;
|
|
236
|
-
}
|
|
237
|
-
destroy() {
|
|
238
|
-
this.ref.$destroy();
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const nodeViewProps = {
|
|
243
|
-
editor: vueTsTypes.objectProp().required,
|
|
244
|
-
node: vueTsTypes.objectProp().required,
|
|
245
|
-
decorations: vueTsTypes.objectProp().required,
|
|
246
|
-
selected: vueTsTypes.booleanProp().required,
|
|
247
|
-
extension: vueTsTypes.objectProp().required,
|
|
248
|
-
getPos: vueTsTypes.functionProp().required,
|
|
249
|
-
updateAttributes: vueTsTypes.functionProp().required,
|
|
250
|
-
deleteNode: vueTsTypes.functionProp().required,
|
|
251
|
-
};
|
|
252
|
-
class VueNodeView extends core.NodeView {
|
|
253
|
-
mount() {
|
|
254
|
-
var _a, _b;
|
|
255
|
-
const props = {
|
|
256
|
-
editor: this.editor,
|
|
257
|
-
node: this.node,
|
|
258
|
-
decorations: this.decorations,
|
|
259
|
-
selected: false,
|
|
260
|
-
extension: this.extension,
|
|
261
|
-
getPos: () => this.getPos(),
|
|
262
|
-
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
|
|
263
|
-
deleteNode: () => this.deleteNode(),
|
|
264
|
-
};
|
|
265
|
-
const onDragStart = this.onDragStart.bind(this);
|
|
266
|
-
this.decorationClasses = Vue.observable({
|
|
267
|
-
value: this.getDecorationClasses(),
|
|
268
|
-
});
|
|
269
|
-
// @ts-ignore
|
|
270
|
-
const vue = (_b = (_a = this.editor.contentComponent) === null || _a === void 0 ? void 0 : _a.$options._base) !== null && _b !== void 0 ? _b : Vue; // eslint-disable-line
|
|
271
|
-
const Component = vue.extend(this.component).extend({
|
|
272
|
-
props: Object.keys(props),
|
|
273
|
-
provide: () => {
|
|
274
|
-
return {
|
|
275
|
-
onDragStart,
|
|
276
|
-
decorationClasses: this.decorationClasses,
|
|
277
|
-
};
|
|
278
|
-
},
|
|
279
|
-
});
|
|
280
|
-
this.renderer = new VueRenderer(Component, {
|
|
281
|
-
parent: this.editor.contentComponent,
|
|
282
|
-
propsData: props,
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
get dom() {
|
|
286
|
-
if (!this.renderer.element.hasAttribute('data-node-view-wrapper')) {
|
|
287
|
-
throw Error('Please use the NodeViewWrapper component for your node view.');
|
|
288
|
-
}
|
|
289
|
-
return this.renderer.element;
|
|
290
|
-
}
|
|
291
|
-
get contentDOM() {
|
|
292
|
-
if (this.node.isLeaf) {
|
|
293
|
-
return null;
|
|
294
|
-
}
|
|
295
|
-
const contentElement = this.dom.querySelector('[data-node-view-content]');
|
|
296
|
-
return (contentElement || this.dom);
|
|
297
|
-
}
|
|
298
|
-
update(node, decorations) {
|
|
299
|
-
const updateProps = (props) => {
|
|
300
|
-
this.decorationClasses.value = this.getDecorationClasses();
|
|
301
|
-
this.renderer.updateProps(props);
|
|
302
|
-
};
|
|
303
|
-
if (typeof this.options.update === 'function') {
|
|
304
|
-
const oldNode = this.node;
|
|
305
|
-
const oldDecorations = this.decorations;
|
|
306
|
-
this.node = node;
|
|
307
|
-
this.decorations = decorations;
|
|
308
|
-
return this.options.update({
|
|
309
|
-
oldNode,
|
|
310
|
-
oldDecorations,
|
|
311
|
-
newNode: node,
|
|
312
|
-
newDecorations: decorations,
|
|
313
|
-
updateProps: () => updateProps({ node, decorations }),
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
if (node.type !== this.node.type) {
|
|
317
|
-
return false;
|
|
318
|
-
}
|
|
319
|
-
if (node === this.node && this.decorations === decorations) {
|
|
320
|
-
return true;
|
|
321
|
-
}
|
|
322
|
-
this.node = node;
|
|
323
|
-
this.decorations = decorations;
|
|
324
|
-
updateProps({ node, decorations });
|
|
325
|
-
return true;
|
|
326
|
-
}
|
|
327
|
-
selectNode() {
|
|
328
|
-
this.renderer.updateProps({
|
|
329
|
-
selected: true,
|
|
330
|
-
});
|
|
331
|
-
this.renderer.element.classList.add('ProseMirror-selectednode');
|
|
332
|
-
}
|
|
333
|
-
deselectNode() {
|
|
334
|
-
this.renderer.updateProps({
|
|
335
|
-
selected: false,
|
|
336
|
-
});
|
|
337
|
-
this.renderer.element.classList.remove('ProseMirror-selectednode');
|
|
338
|
-
}
|
|
339
|
-
getDecorationClasses() {
|
|
340
|
-
return (this.decorations
|
|
341
|
-
// @ts-ignore
|
|
342
|
-
.map(item => item.type.attrs.class)
|
|
343
|
-
.flat()
|
|
344
|
-
.join(' '));
|
|
345
|
-
}
|
|
346
|
-
destroy() {
|
|
347
|
-
this.renderer.destroy();
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
function VueNodeViewRenderer(component, options) {
|
|
351
|
-
return (props) => {
|
|
352
|
-
// try to get the parent component
|
|
353
|
-
// this is important for vue devtools to show the component hierarchy correctly
|
|
354
|
-
// maybe it’s `undefined` because <editor-content> isn’t rendered yet
|
|
355
|
-
if (!props.editor.contentComponent) {
|
|
356
|
-
return {};
|
|
357
|
-
}
|
|
358
|
-
return new VueNodeView(component, props, options);
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
exports.BubbleMenu = BubbleMenu;
|
|
363
|
-
exports.Editor = Editor;
|
|
364
|
-
exports.EditorContent = EditorContent;
|
|
365
|
-
exports.FloatingMenu = FloatingMenu;
|
|
366
|
-
exports.NodeViewContent = NodeViewContent;
|
|
367
|
-
exports.NodeViewWrapper = NodeViewWrapper;
|
|
368
|
-
exports.VueNodeViewRenderer = VueNodeViewRenderer;
|
|
369
|
-
exports.VueRenderer = VueRenderer;
|
|
370
|
-
exports.nodeViewProps = nodeViewProps;
|
|
371
|
-
Object.keys(core).forEach(function (k) {
|
|
372
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
373
|
-
enumerable: true,
|
|
374
|
-
get: function () { return core[k]; }
|
|
375
|
-
});
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
}));
|
|
379
|
-
//# 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/VueRenderer.ts","../src/VueNodeViewRenderer.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface BubbleMenuInterface extends Vue {\n pluginKey: BubbleMenuPluginProps['pluginKey'],\n editor: BubbleMenuPluginProps['editor'],\n tippyOptions: BubbleMenuPluginProps['tippyOptions'],\n updateDelay: BubbleMenuPluginProps['updateDelay'],\n shouldShow: BubbleMenuPluginProps['shouldShow'],\n}\n\nexport const BubbleMenu: Component = {\n name: 'BubbleMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],\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 },\n\n tippyOptions: {\n type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,\n default: () => ({}),\n },\n\n shouldShow: {\n type: Function as PropType<Exclude<BubbleMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(BubbleMenuPlugin({\n updateDelay: this.updateDelay,\n editor,\n element: this.$el as HTMLElement,\n pluginKey: this.pluginKey,\n shouldShow: this.shouldShow,\n tippyOptions: this.tippyOptions,\n }))\n })\n },\n },\n },\n\n render(this: BubbleMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: BubbleMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport Vue from 'vue'\n\nexport class Editor extends CoreEditor {\n public contentComponent: Vue | null = null\n}\n","import Vue, { Component, CreateElement, PropType } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport interface EditorContentInterface extends Vue {\n editor: Editor,\n}\n\nexport const EditorContent: Component = {\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType<Editor>,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: EditorContentInterface, editor: Editor) {\n if (editor && editor.options.element) {\n this.$nextTick(() => {\n const element = this.$el\n\n if (!element || !editor.options.element.firstChild) {\n return\n }\n\n element.append(...editor.options.element.childNodes)\n editor.contentComponent = this\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n },\n },\n },\n\n render(createElement: CreateElement) {\n return createElement('div')\n },\n\n beforeDestroy(this: EditorContentInterface) {\n const { editor } = this\n\n if (!editor) {\n return\n }\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = 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","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport Vue, { Component, CreateElement, PropType } from 'vue'\n\nexport interface FloatingMenuInterface extends Vue {\n pluginKey: FloatingMenuPluginProps['pluginKey'],\n tippyOptions: FloatingMenuPluginProps['tippyOptions'],\n editor: FloatingMenuPluginProps['editor'],\n shouldShow: FloatingMenuPluginProps['shouldShow'],\n}\n\nexport const FloatingMenu: Component = {\n name: 'FloatingMenu',\n\n props: {\n pluginKey: {\n type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],\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<FloatingMenuPluginProps['shouldShow'], null>>,\n default: null,\n },\n },\n\n watch: {\n editor: {\n immediate: true,\n handler(this: FloatingMenuInterface, editor: FloatingMenuPluginProps['editor']) {\n if (!editor) {\n return\n }\n\n this.$nextTick(() => {\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey: this.pluginKey,\n editor,\n element: this.$el as HTMLElement,\n tippyOptions: this.tippyOptions,\n shouldShow: this.shouldShow,\n }))\n })\n },\n },\n },\n\n render(this: FloatingMenuInterface, createElement: CreateElement) {\n return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)\n },\n\n beforeDestroy(this: FloatingMenuInterface) {\n this.editor.unregisterPlugin(this.pluginKey)\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewContentInterface extends Vue {\n as: string,\n}\n\nexport const NodeViewContent: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n render(this: NodeViewContentInterface, createElement: CreateElement) {\n return createElement(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n attrs: {\n 'data-node-view-content': '',\n },\n })\n },\n}\n","import Vue, { Component, CreateElement } from 'vue'\n\nexport interface NodeViewWrapperInterface extends Vue {\n as: string,\n decorationClasses: {\n value: string,\n },\n onDragStart: Function,\n}\n\nexport const NodeViewWrapper: Component = {\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render(this: NodeViewWrapperInterface, createElement: CreateElement) {\n return createElement(\n this.as,\n {\n class: this.decorationClasses.value,\n style: {\n whiteSpace: 'normal',\n },\n attrs: {\n 'data-node-view-wrapper': '',\n },\n on: {\n dragstart: this.onDragStart,\n },\n },\n this.$slots.default,\n )\n },\n}\n","import Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\n\n/**\n * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.\n */\nexport class VueRenderer {\n ref!: Vue\n\n constructor(component: Vue | VueConstructor, props: any) {\n const Component = (typeof component === 'function') ? component : Vue.extend(component)\n\n this.ref = new Component(props).$mount()\n }\n\n get element(): Element {\n return this.ref.$el\n }\n\n updateProps(props: Record<string, any> = {}): void {\n if (!this.ref.$props) {\n return\n }\n\n // prevents `Avoid mutating a prop directly` error message\n // Fix: `VueNodeViewRenderer` change vue Constructor `config.silent` not working\n const currentVueConstructor = this.ref.$props.editor?.contentComponent?.$options._base ?? Vue // eslint-disable-line\n const originalSilent = currentVueConstructor.config.silent\n\n currentVueConstructor.config.silent = true\n\n Object\n .entries(props)\n .forEach(([key, value]) => {\n this.ref.$props[key] = value\n })\n\n currentVueConstructor.config.silent = originalSilent\n }\n\n destroy(): void {\n this.ref.$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 Vue from 'vue'\nimport { VueConstructor } from 'vue/types/umd'\nimport { booleanProp, functionProp, objectProp } from 'vue-ts-types'\n\nimport { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: objectProp<NodeViewProps['editor']>().required,\n node: objectProp<NodeViewProps['node']>().required,\n decorations: objectProp<NodeViewProps['decorations']>().required,\n selected: booleanProp().required,\n extension: objectProp<NodeViewProps['extension']>().required,\n getPos: functionProp<NodeViewProps['getPos']>().required,\n updateAttributes: functionProp<NodeViewProps['updateAttributes']>().required,\n deleteNode: functionProp<NodeViewProps['deleteNode']>().required,\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<Vue | VueConstructor, Editor, VueNodeViewRendererOptions> {\n renderer!: VueRenderer\n\n decorationClasses!: {\n value: string\n }\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 = Vue.observable({\n value: this.getDecorationClasses(),\n })\n\n // @ts-ignore\n const vue = this.editor.contentComponent?.$options._base ?? Vue // eslint-disable-line\n\n const Component = vue.extend(this.component).extend({\n props: Object.keys(props),\n provide: () => {\n return {\n onDragStart,\n decorationClasses: this.decorationClasses,\n }\n },\n })\n\n this.renderer = new VueRenderer(Component, {\n parent: this.editor.contentComponent,\n propsData: props,\n })\n }\n\n get dom() {\n if (!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 this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\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: Vue | VueConstructor,\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":["BubbleMenuPlugin","CoreEditor","FloatingMenuPlugin","objectProp","booleanProp","functionProp","NodeView"],"mappings":";;;;;;AAWa,QAAA,UAAU,GAAc;EACnC,IAAA,IAAI,EAAE,YAAY;EAElB,IAAA,KAAK,EAAE;EACL,QAAA,SAAS,EAAE;EACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAuE,CAAC;EACvF,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;EAC/D,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,QAAwE;EAC9E,YAAA,OAAO,EAAE,IAAI;EACd,SAAA;EACF,KAAA;EAED,IAAA,KAAK,EAAE;EACL,QAAA,MAAM,EAAE;EACN,YAAA,SAAS,EAAE,IAAI;EACf,YAAA,OAAO,CAA4B,MAAuC,EAAA;kBACxE,IAAI,CAAC,MAAM,EAAE;sBACX,OAAM;mBACP;EAED,gBA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EAAE,KAAK;EAChB,SAAA,CAAC,CAAA;UACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAA;OACnE;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,SAA+B,EAC/B,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
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { MarkType, NodeType, Schema } from '@tiptap/pm/model';
|
|
2
|
-
import { EditorState, Plugin, PluginKey, Transaction } from '@tiptap/pm/state';
|
|
3
|
-
import { EditorView } from '@tiptap/pm/view';
|
|
4
|
-
import { EventEmitter } from './EventEmitter.js';
|
|
5
|
-
import { ExtensionManager } from './ExtensionManager.js';
|
|
6
|
-
import { NodePos } from './NodePos.js';
|
|
7
|
-
import { CanCommands, ChainedCommands, EditorEvents, EditorOptions, JSONContent, SingleCommands, TextSerializer } from './types.js';
|
|
8
|
-
export * as extensions from './extensions/index.js';
|
|
9
|
-
declare global {
|
|
10
|
-
interface HTMLElement {
|
|
11
|
-
editor?: Editor;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export declare class Editor extends EventEmitter<EditorEvents> {
|
|
15
|
-
private commandManager;
|
|
16
|
-
extensionManager: ExtensionManager;
|
|
17
|
-
private css;
|
|
18
|
-
schema: Schema;
|
|
19
|
-
view: EditorView;
|
|
20
|
-
isFocused: boolean;
|
|
21
|
-
extensionStorage: Record<string, any>;
|
|
22
|
-
options: EditorOptions;
|
|
23
|
-
constructor(options?: Partial<EditorOptions>);
|
|
24
|
-
/**
|
|
25
|
-
* Returns the editor storage.
|
|
26
|
-
*/
|
|
27
|
-
get storage(): Record<string, any>;
|
|
28
|
-
/**
|
|
29
|
-
* An object of all registered commands.
|
|
30
|
-
*/
|
|
31
|
-
get commands(): SingleCommands;
|
|
32
|
-
/**
|
|
33
|
-
* Create a command chain to call multiple commands at once.
|
|
34
|
-
*/
|
|
35
|
-
chain(): ChainedCommands;
|
|
36
|
-
/**
|
|
37
|
-
* Check if a command or a command chain can be executed. Without executing it.
|
|
38
|
-
*/
|
|
39
|
-
can(): CanCommands;
|
|
40
|
-
/**
|
|
41
|
-
* Inject CSS styles.
|
|
42
|
-
*/
|
|
43
|
-
private injectCSS;
|
|
44
|
-
/**
|
|
45
|
-
* Update editor options.
|
|
46
|
-
*
|
|
47
|
-
* @param options A list of options
|
|
48
|
-
*/
|
|
49
|
-
setOptions(options?: Partial<EditorOptions>): void;
|
|
50
|
-
/**
|
|
51
|
-
* Update editable state of the editor.
|
|
52
|
-
*/
|
|
53
|
-
setEditable(editable: boolean, emitUpdate?: boolean): void;
|
|
54
|
-
/**
|
|
55
|
-
* Returns whether the editor is editable.
|
|
56
|
-
*/
|
|
57
|
-
get isEditable(): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Returns the editor state.
|
|
60
|
-
*/
|
|
61
|
-
get state(): EditorState;
|
|
62
|
-
/**
|
|
63
|
-
* Register a ProseMirror plugin.
|
|
64
|
-
*
|
|
65
|
-
* @param plugin A ProseMirror plugin
|
|
66
|
-
* @param handlePlugins Control how to merge the plugin into the existing plugins.
|
|
67
|
-
*/
|
|
68
|
-
registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void;
|
|
69
|
-
/**
|
|
70
|
-
* Unregister a ProseMirror plugin.
|
|
71
|
-
*
|
|
72
|
-
* @param nameOrPluginKey The plugins name
|
|
73
|
-
*/
|
|
74
|
-
unregisterPlugin(nameOrPluginKey: string | PluginKey): void;
|
|
75
|
-
/**
|
|
76
|
-
* Creates an extension manager.
|
|
77
|
-
*/
|
|
78
|
-
private createExtensionManager;
|
|
79
|
-
/**
|
|
80
|
-
* Creates an command manager.
|
|
81
|
-
*/
|
|
82
|
-
private createCommandManager;
|
|
83
|
-
/**
|
|
84
|
-
* Creates a ProseMirror schema.
|
|
85
|
-
*/
|
|
86
|
-
private createSchema;
|
|
87
|
-
/**
|
|
88
|
-
* Creates a ProseMirror view.
|
|
89
|
-
*/
|
|
90
|
-
private createView;
|
|
91
|
-
/**
|
|
92
|
-
* Creates all node views.
|
|
93
|
-
*/
|
|
94
|
-
createNodeViews(): void;
|
|
95
|
-
/**
|
|
96
|
-
* Prepend class name to element.
|
|
97
|
-
*/
|
|
98
|
-
prependClass(): void;
|
|
99
|
-
isCapturingTransaction: boolean;
|
|
100
|
-
private capturedTransaction;
|
|
101
|
-
captureTransaction(fn: Function): Transaction | null;
|
|
102
|
-
/**
|
|
103
|
-
* The callback over which to send transactions (state updates) produced by the view.
|
|
104
|
-
*
|
|
105
|
-
* @param transaction An editor state transaction
|
|
106
|
-
*/
|
|
107
|
-
private dispatchTransaction;
|
|
108
|
-
/**
|
|
109
|
-
* Get attributes of the currently selected node or mark.
|
|
110
|
-
*/
|
|
111
|
-
getAttributes(nameOrType: string | NodeType | MarkType): Record<string, any>;
|
|
112
|
-
/**
|
|
113
|
-
* Returns if the currently selected node or mark is active.
|
|
114
|
-
*
|
|
115
|
-
* @param name Name of the node or mark
|
|
116
|
-
* @param attributes Attributes of the node or mark
|
|
117
|
-
*/
|
|
118
|
-
isActive(name: string, attributes?: {}): boolean;
|
|
119
|
-
isActive(attributes: {}): boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Get the document as JSON.
|
|
122
|
-
*/
|
|
123
|
-
getJSON(): JSONContent;
|
|
124
|
-
/**
|
|
125
|
-
* Get the document as HTML.
|
|
126
|
-
*/
|
|
127
|
-
getHTML(): string;
|
|
128
|
-
/**
|
|
129
|
-
* Get the document as text.
|
|
130
|
-
*/
|
|
131
|
-
getText(options?: {
|
|
132
|
-
blockSeparator?: string;
|
|
133
|
-
textSerializers?: Record<string, TextSerializer>;
|
|
134
|
-
}): string;
|
|
135
|
-
/**
|
|
136
|
-
* Check if there is no content.
|
|
137
|
-
*/
|
|
138
|
-
get isEmpty(): boolean;
|
|
139
|
-
/**
|
|
140
|
-
* Get the number of characters for the current document.
|
|
141
|
-
*
|
|
142
|
-
* @deprecated
|
|
143
|
-
*/
|
|
144
|
-
getCharacterCount(): number;
|
|
145
|
-
/**
|
|
146
|
-
* Destroy the editor.
|
|
147
|
-
*/
|
|
148
|
-
destroy(): void;
|
|
149
|
-
/**
|
|
150
|
-
* Check if the editor is already destroyed.
|
|
151
|
-
*/
|
|
152
|
-
get isDestroyed(): boolean;
|
|
153
|
-
$node(selector: string, attributes?: {
|
|
154
|
-
[key: string]: any;
|
|
155
|
-
}): NodePos | null;
|
|
156
|
-
$nodes(selector: string, attributes?: {
|
|
157
|
-
[key: string]: any;
|
|
158
|
-
}): NodePos[] | null;
|
|
159
|
-
$pos(pos: number): NodePos;
|
|
160
|
-
get $doc(): NodePos;
|
|
161
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type StringKeyOf<T> = Extract<keyof T, string>;
|
|
2
|
-
type CallbackType<T extends Record<string, any>, EventName extends StringKeyOf<T>> = T[EventName] extends any[] ? T[EventName] : [T[EventName]];
|
|
3
|
-
type CallbackFunction<T extends Record<string, any>, EventName extends StringKeyOf<T>> = (...props: CallbackType<T, EventName>) => any;
|
|
4
|
-
export declare class EventEmitter<T extends Record<string, any>> {
|
|
5
|
-
private callbacks;
|
|
6
|
-
on<EventName extends StringKeyOf<T>>(event: EventName, fn: CallbackFunction<T, EventName>): this;
|
|
7
|
-
emit<EventName extends StringKeyOf<T>>(event: EventName, ...args: CallbackType<T, EventName>): this;
|
|
8
|
-
off<EventName extends StringKeyOf<T>>(event: EventName, fn?: CallbackFunction<T, EventName>): this;
|
|
9
|
-
removeAllListeners(): void;
|
|
10
|
-
}
|
|
11
|
-
export {};
|