@tiptap/vue-3 3.0.0-next.3 → 3.0.0-next.5
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 +148 -177
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -182
- package/dist/index.d.ts +98 -182
- package/dist/index.js +130 -189
- package/dist/index.js.map +1 -1
- package/dist/menus/index.cjs +613 -0
- package/dist/menus/index.cjs.map +1 -0
- package/dist/menus/index.d.cts +257 -0
- package/dist/menus/index.d.ts +257 -0
- package/dist/menus/index.js +605 -0
- package/dist/menus/index.js.map +1 -0
- package/package.json +27 -14
- package/src/Editor.ts +3 -10
- package/src/EditorContent.ts +6 -6
- package/src/VueMarkViewRenderer.ts +112 -0
- package/src/VueNodeViewRenderer.ts +25 -26
- package/src/VueRenderer.ts +7 -9
- package/src/index.ts +1 -2
- package/src/{BubbleMenu.ts → menus/BubbleMenu.ts} +13 -26
- package/src/{FloatingMenu.ts → menus/FloatingMenu.ts} +12 -24
- package/src/menus/index.ts +2 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,98 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as _tiptap_core from '@tiptap/core';
|
|
3
|
-
import { Editor as Editor$1, EditorOptions, NodeViewProps, NodeViewRendererOptions, NodeViewRenderer } from '@tiptap/core';
|
|
1
|
+
import { Editor as Editor$1, EditorOptions, Storage, MarkViewRendererOptions, MarkViewProps, MarkView, MarkViewRenderer, NodeViewProps, NodeViewRendererOptions, NodeViewRenderer } from '@tiptap/core';
|
|
4
2
|
export * from '@tiptap/core';
|
|
5
|
-
import * as _floating_ui_core from '@floating-ui/core';
|
|
6
|
-
import * as _floating_ui_dom from '@floating-ui/dom';
|
|
7
|
-
import * as _floating_ui_utils from '@floating-ui/utils';
|
|
8
|
-
import * as prosemirror_state from 'prosemirror-state';
|
|
9
|
-
import * as vue from 'vue';
|
|
10
|
-
import { PropType, AppContext, ComponentInternalInstance, ComponentPublicInstance, Ref, Component, h } from 'vue';
|
|
11
|
-
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
12
3
|
import { EditorState, Plugin, PluginKey } from '@tiptap/pm/state';
|
|
13
|
-
import
|
|
4
|
+
import * as vue from 'vue';
|
|
5
|
+
import { AppContext, ComponentInternalInstance, ComponentPublicInstance, PropType, Ref, Component, h } from 'vue';
|
|
14
6
|
import { Node } from '@tiptap/pm/model';
|
|
15
7
|
import { Decoration, DecorationSource } from '@tiptap/pm/view';
|
|
16
8
|
|
|
17
|
-
declare const BubbleMenu: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
18
|
-
pluginKey: {
|
|
19
|
-
type: PropType<BubbleMenuPluginProps["pluginKey"]>;
|
|
20
|
-
default: string;
|
|
21
|
-
};
|
|
22
|
-
editor: {
|
|
23
|
-
type: PropType<BubbleMenuPluginProps["editor"]>;
|
|
24
|
-
required: true;
|
|
25
|
-
};
|
|
26
|
-
updateDelay: {
|
|
27
|
-
type: PropType<BubbleMenuPluginProps["updateDelay"]>;
|
|
28
|
-
default: undefined;
|
|
29
|
-
};
|
|
30
|
-
resizeDelay: {
|
|
31
|
-
type: PropType<BubbleMenuPluginProps["resizeDelay"]>;
|
|
32
|
-
default: undefined;
|
|
33
|
-
};
|
|
34
|
-
options: {
|
|
35
|
-
type: PropType<BubbleMenuPluginProps["options"]>;
|
|
36
|
-
default: () => {};
|
|
37
|
-
};
|
|
38
|
-
shouldShow: {
|
|
39
|
-
type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
|
|
40
|
-
default: null;
|
|
41
|
-
};
|
|
42
|
-
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
43
|
-
[key: string]: any;
|
|
44
|
-
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
45
|
-
pluginKey: {
|
|
46
|
-
type: PropType<BubbleMenuPluginProps["pluginKey"]>;
|
|
47
|
-
default: string;
|
|
48
|
-
};
|
|
49
|
-
editor: {
|
|
50
|
-
type: PropType<BubbleMenuPluginProps["editor"]>;
|
|
51
|
-
required: true;
|
|
52
|
-
};
|
|
53
|
-
updateDelay: {
|
|
54
|
-
type: PropType<BubbleMenuPluginProps["updateDelay"]>;
|
|
55
|
-
default: undefined;
|
|
56
|
-
};
|
|
57
|
-
resizeDelay: {
|
|
58
|
-
type: PropType<BubbleMenuPluginProps["resizeDelay"]>;
|
|
59
|
-
default: undefined;
|
|
60
|
-
};
|
|
61
|
-
options: {
|
|
62
|
-
type: PropType<BubbleMenuPluginProps["options"]>;
|
|
63
|
-
default: () => {};
|
|
64
|
-
};
|
|
65
|
-
shouldShow: {
|
|
66
|
-
type: PropType<Exclude<Required<BubbleMenuPluginProps>["shouldShow"], null>>;
|
|
67
|
-
default: null;
|
|
68
|
-
};
|
|
69
|
-
}>> & Readonly<{}>, {
|
|
70
|
-
pluginKey: string | prosemirror_state.PluginKey<any>;
|
|
71
|
-
updateDelay: number | undefined;
|
|
72
|
-
resizeDelay: number | undefined;
|
|
73
|
-
options: {
|
|
74
|
-
strategy?: _floating_ui_utils.Strategy;
|
|
75
|
-
placement?: _floating_ui_utils.Placement;
|
|
76
|
-
offset?: _floating_ui_dom.OffsetOptions | boolean;
|
|
77
|
-
flip?: _floating_ui_dom.FlipOptions | boolean;
|
|
78
|
-
shift?: _floating_ui_dom.ShiftOptions | boolean;
|
|
79
|
-
arrow?: _floating_ui_dom.ArrowOptions | false;
|
|
80
|
-
size?: _floating_ui_dom.SizeOptions | boolean;
|
|
81
|
-
autoPlacement?: _floating_ui_dom.AutoPlacementOptions | boolean;
|
|
82
|
-
hide?: _floating_ui_dom.HideOptions | boolean;
|
|
83
|
-
inline?: _floating_ui_core.InlineOptions | boolean;
|
|
84
|
-
} | undefined;
|
|
85
|
-
shouldShow: (props: {
|
|
86
|
-
editor: _tiptap_core.Editor;
|
|
87
|
-
element: HTMLElement;
|
|
88
|
-
view: prosemirror_view.EditorView;
|
|
89
|
-
state: prosemirror_state.EditorState;
|
|
90
|
-
oldState?: prosemirror_state.EditorState;
|
|
91
|
-
from: number;
|
|
92
|
-
to: number;
|
|
93
|
-
}) => boolean;
|
|
94
|
-
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
95
|
-
|
|
96
9
|
type ContentComponent = ComponentInternalInstance & {
|
|
97
10
|
ctx: ComponentPublicInstance;
|
|
98
11
|
};
|
|
@@ -103,7 +16,7 @@ declare class Editor extends Editor$1 {
|
|
|
103
16
|
appContext: AppContext | null;
|
|
104
17
|
constructor(options?: Partial<EditorOptions>);
|
|
105
18
|
get state(): EditorState;
|
|
106
|
-
get storage():
|
|
19
|
+
get storage(): Storage;
|
|
107
20
|
/**
|
|
108
21
|
* Register a ProseMirror plugin.
|
|
109
22
|
*/
|
|
@@ -130,67 +43,21 @@ declare const EditorContent: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
130
43
|
editor: Editor;
|
|
131
44
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
132
45
|
|
|
133
|
-
declare const
|
|
134
|
-
|
|
135
|
-
type:
|
|
46
|
+
declare const NodeViewContent: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
47
|
+
as: {
|
|
48
|
+
type: StringConstructor;
|
|
136
49
|
default: string;
|
|
137
50
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
};
|
|
142
|
-
options: {
|
|
143
|
-
type: PropType<BubbleMenuPluginProps["options"]>;
|
|
144
|
-
default: () => {};
|
|
145
|
-
};
|
|
146
|
-
shouldShow: {
|
|
147
|
-
type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
|
|
148
|
-
default: null;
|
|
149
|
-
};
|
|
150
|
-
}>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
151
|
-
[key: string]: any;
|
|
152
|
-
}>, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
153
|
-
pluginKey: {
|
|
154
|
-
type: null;
|
|
51
|
+
}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
52
|
+
as: {
|
|
53
|
+
type: StringConstructor;
|
|
155
54
|
default: string;
|
|
156
55
|
};
|
|
157
|
-
editor: {
|
|
158
|
-
type: PropType<FloatingMenuPluginProps["editor"]>;
|
|
159
|
-
required: true;
|
|
160
|
-
};
|
|
161
|
-
options: {
|
|
162
|
-
type: PropType<BubbleMenuPluginProps["options"]>;
|
|
163
|
-
default: () => {};
|
|
164
|
-
};
|
|
165
|
-
shouldShow: {
|
|
166
|
-
type: PropType<Exclude<Required<FloatingMenuPluginProps>["shouldShow"], null>>;
|
|
167
|
-
default: null;
|
|
168
|
-
};
|
|
169
56
|
}>> & Readonly<{}>, {
|
|
170
|
-
|
|
171
|
-
options: {
|
|
172
|
-
strategy?: _floating_ui_utils.Strategy;
|
|
173
|
-
placement?: _floating_ui_utils.Placement;
|
|
174
|
-
offset?: _floating_ui_dom.OffsetOptions | boolean;
|
|
175
|
-
flip?: _floating_ui_dom.FlipOptions | boolean;
|
|
176
|
-
shift?: _floating_ui_dom.ShiftOptions | boolean;
|
|
177
|
-
arrow?: _floating_ui_dom.ArrowOptions | false;
|
|
178
|
-
size?: _floating_ui_dom.SizeOptions | boolean;
|
|
179
|
-
autoPlacement?: _floating_ui_dom.AutoPlacementOptions | boolean;
|
|
180
|
-
hide?: _floating_ui_dom.HideOptions | boolean;
|
|
181
|
-
inline?: _floating_ui_core.InlineOptions | boolean;
|
|
182
|
-
} | undefined;
|
|
183
|
-
shouldShow: (props: {
|
|
184
|
-
editor: _tiptap_core.Editor;
|
|
185
|
-
view: prosemirror_view.EditorView;
|
|
186
|
-
state: prosemirror_state.EditorState;
|
|
187
|
-
oldState?: prosemirror_state.EditorState;
|
|
188
|
-
from: number;
|
|
189
|
-
to: number;
|
|
190
|
-
}) => boolean;
|
|
57
|
+
as: string;
|
|
191
58
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
192
59
|
|
|
193
|
-
declare const
|
|
60
|
+
declare const NodeViewWrapper: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
194
61
|
as: {
|
|
195
62
|
type: StringConstructor;
|
|
196
63
|
default: string;
|
|
@@ -204,7 +71,71 @@ declare const NodeViewContent: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
204
71
|
as: string;
|
|
205
72
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
206
73
|
|
|
207
|
-
declare const
|
|
74
|
+
declare const useEditor: (options?: Partial<EditorOptions>) => vue.ShallowRef<Editor | undefined, Editor | undefined>;
|
|
75
|
+
|
|
76
|
+
interface VueRendererOptions {
|
|
77
|
+
editor: Editor$1;
|
|
78
|
+
props?: Record<string, any>;
|
|
79
|
+
}
|
|
80
|
+
type ExtendedVNode = ReturnType<typeof h> | null;
|
|
81
|
+
interface RenderedComponent {
|
|
82
|
+
vNode: ExtendedVNode;
|
|
83
|
+
destroy: () => void;
|
|
84
|
+
el: Element | null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* This class is used to render Vue components inside the editor.
|
|
88
|
+
*/
|
|
89
|
+
declare class VueRenderer {
|
|
90
|
+
renderedComponent: RenderedComponent;
|
|
91
|
+
editor: Editor;
|
|
92
|
+
component: Component;
|
|
93
|
+
el: Element | null;
|
|
94
|
+
props: Record<string, any>;
|
|
95
|
+
constructor(component: Component, { props, editor }: VueRendererOptions);
|
|
96
|
+
get element(): Element | null;
|
|
97
|
+
get ref(): any;
|
|
98
|
+
renderComponent(): {
|
|
99
|
+
vNode: vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
100
|
+
[key: string]: any;
|
|
101
|
+
}>;
|
|
102
|
+
destroy: () => void;
|
|
103
|
+
el: Element | null;
|
|
104
|
+
};
|
|
105
|
+
updateProps(props?: Record<string, any>): void;
|
|
106
|
+
destroy(): void;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface VueMarkViewRendererOptions extends MarkViewRendererOptions {
|
|
110
|
+
as?: string;
|
|
111
|
+
className?: string;
|
|
112
|
+
attrs?: {
|
|
113
|
+
[key: string]: string;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
declare const markViewProps: {
|
|
117
|
+
editor: {
|
|
118
|
+
type: PropType<MarkViewProps["editor"]>;
|
|
119
|
+
required: true;
|
|
120
|
+
};
|
|
121
|
+
mark: {
|
|
122
|
+
type: PropType<MarkViewProps["mark"]>;
|
|
123
|
+
required: true;
|
|
124
|
+
};
|
|
125
|
+
extension: {
|
|
126
|
+
type: PropType<MarkViewProps["extension"]>;
|
|
127
|
+
required: true;
|
|
128
|
+
};
|
|
129
|
+
inline: {
|
|
130
|
+
type: PropType<MarkViewProps["inline"]>;
|
|
131
|
+
required: true;
|
|
132
|
+
};
|
|
133
|
+
view: {
|
|
134
|
+
type: PropType<MarkViewProps["view"]>;
|
|
135
|
+
required: true;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
declare const MarkViewContent: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
208
139
|
as: {
|
|
209
140
|
type: StringConstructor;
|
|
210
141
|
default: string;
|
|
@@ -217,8 +148,14 @@ declare const NodeViewWrapper: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
217
148
|
}>> & Readonly<{}>, {
|
|
218
149
|
as: string;
|
|
219
150
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
220
|
-
|
|
221
|
-
|
|
151
|
+
declare class VueMarkView extends MarkView<Component, VueMarkViewRendererOptions> {
|
|
152
|
+
renderer: VueRenderer;
|
|
153
|
+
constructor(component: Component, props: MarkViewProps, options?: Partial<VueMarkViewRendererOptions>);
|
|
154
|
+
get dom(): HTMLElement;
|
|
155
|
+
get contentDOM(): HTMLElement | null;
|
|
156
|
+
destroy(): void;
|
|
157
|
+
}
|
|
158
|
+
declare function VueMarkViewRenderer(component: Component, options?: Partial<VueMarkViewRendererOptions>): MarkViewRenderer;
|
|
222
159
|
|
|
223
160
|
declare const nodeViewProps: {
|
|
224
161
|
editor: {
|
|
@@ -253,6 +190,18 @@ declare const nodeViewProps: {
|
|
|
253
190
|
type: PropType<NodeViewProps["deleteNode"]>;
|
|
254
191
|
required: true;
|
|
255
192
|
};
|
|
193
|
+
view: {
|
|
194
|
+
type: PropType<NodeViewProps["view"]>;
|
|
195
|
+
required: true;
|
|
196
|
+
};
|
|
197
|
+
innerDecorations: {
|
|
198
|
+
type: PropType<NodeViewProps["innerDecorations"]>;
|
|
199
|
+
required: true;
|
|
200
|
+
};
|
|
201
|
+
HTMLAttributes: {
|
|
202
|
+
type: PropType<NodeViewProps["HTMLAttributes"]>;
|
|
203
|
+
required: true;
|
|
204
|
+
};
|
|
256
205
|
};
|
|
257
206
|
interface VueNodeViewRendererOptions extends NodeViewRendererOptions {
|
|
258
207
|
update: ((props: {
|
|
@@ -267,37 +216,4 @@ interface VueNodeViewRendererOptions extends NodeViewRendererOptions {
|
|
|
267
216
|
}
|
|
268
217
|
declare function VueNodeViewRenderer(component: Component<NodeViewProps>, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer;
|
|
269
218
|
|
|
270
|
-
|
|
271
|
-
editor: Editor$1;
|
|
272
|
-
props?: Record<string, any>;
|
|
273
|
-
}
|
|
274
|
-
type ExtendedVNode = ReturnType<typeof h> | null;
|
|
275
|
-
interface RenderedComponent {
|
|
276
|
-
vNode: ExtendedVNode;
|
|
277
|
-
destroy: () => void;
|
|
278
|
-
el: Element | null;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* This class is used to render Vue components inside the editor.
|
|
282
|
-
*/
|
|
283
|
-
declare class VueRenderer {
|
|
284
|
-
renderedComponent: RenderedComponent;
|
|
285
|
-
editor: Editor;
|
|
286
|
-
component: Component;
|
|
287
|
-
el: Element | null;
|
|
288
|
-
props: Record<string, any>;
|
|
289
|
-
constructor(component: Component, { props, editor }: VueRendererOptions);
|
|
290
|
-
get element(): Element | null;
|
|
291
|
-
get ref(): any;
|
|
292
|
-
renderComponent(): {
|
|
293
|
-
vNode: vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
294
|
-
[key: string]: any;
|
|
295
|
-
}>;
|
|
296
|
-
destroy: () => void;
|
|
297
|
-
el: Element | null;
|
|
298
|
-
};
|
|
299
|
-
updateProps(props?: Record<string, any>): void;
|
|
300
|
-
destroy(): void;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
export { BubbleMenu, Editor, EditorContent, FloatingMenu, NodeViewContent, NodeViewWrapper, VueNodeViewRenderer, type VueNodeViewRendererOptions, VueRenderer, type VueRendererOptions, nodeViewProps, useEditor };
|
|
219
|
+
export { Editor, EditorContent, MarkViewContent, NodeViewContent, NodeViewWrapper, VueMarkView, VueMarkViewRenderer, type VueMarkViewRendererOptions, VueNodeViewRenderer, type VueNodeViewRendererOptions, VueRenderer, type VueRendererOptions, markViewProps, nodeViewProps, useEditor };
|