@tiptap/vue-2 2.11.6 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +5 -1
  3. package/dist/index.cjs +341 -407
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +79 -0
  6. package/dist/index.d.ts +78 -9
  7. package/dist/index.js +299 -391
  8. package/dist/index.js.map +1 -1
  9. package/dist/menus/index.cjs +2166 -0
  10. package/dist/menus/index.cjs.map +1 -0
  11. package/dist/menus/index.d.cts +131 -0
  12. package/dist/menus/index.d.ts +131 -0
  13. package/dist/menus/index.js +2138 -0
  14. package/dist/menus/index.js.map +1 -0
  15. package/package.json +25 -13
  16. package/src/Editor.ts +1 -1
  17. package/src/EditorContent.ts +7 -5
  18. package/src/NodeViewContent.ts +3 -2
  19. package/src/NodeViewWrapper.ts +6 -5
  20. package/src/VueNodeViewRenderer.ts +17 -26
  21. package/src/VueRenderer.ts +5 -7
  22. package/src/index.ts +0 -2
  23. package/src/menus/BubbleMenu.ts +85 -0
  24. package/src/{FloatingMenu.ts → menus/FloatingMenu.ts} +24 -15
  25. package/src/menus/index.ts +2 -0
  26. package/dist/BubbleMenu.d.ts +0 -11
  27. package/dist/BubbleMenu.d.ts.map +0 -1
  28. package/dist/Editor.d.ts +0 -6
  29. package/dist/Editor.d.ts.map +0 -1
  30. package/dist/EditorContent.d.ts +0 -7
  31. package/dist/EditorContent.d.ts.map +0 -1
  32. package/dist/FloatingMenu.d.ts +0 -10
  33. package/dist/FloatingMenu.d.ts.map +0 -1
  34. package/dist/NodeViewContent.d.ts +0 -6
  35. package/dist/NodeViewContent.d.ts.map +0 -1
  36. package/dist/NodeViewWrapper.d.ts +0 -10
  37. package/dist/NodeViewWrapper.d.ts.map +0 -1
  38. package/dist/VueNodeViewRenderer.d.ts +0 -40
  39. package/dist/VueNodeViewRenderer.d.ts.map +0 -1
  40. package/dist/VueRenderer.d.ts +0 -13
  41. package/dist/VueRenderer.d.ts.map +0 -1
  42. package/dist/index.d.ts.map +0 -1
  43. package/dist/index.umd.js +0 -433
  44. package/dist/index.umd.js.map +0 -1
  45. package/src/BubbleMenu.ts +0 -70
package/src/index.ts CHANGED
@@ -1,7 +1,5 @@
1
- export * from './BubbleMenu.js'
2
1
  export { Editor } from './Editor.js'
3
2
  export * from './EditorContent.js'
4
- export * from './FloatingMenu.js'
5
3
  export * from './NodeViewContent.js'
6
4
  export * from './NodeViewWrapper.js'
7
5
  export * from './VueNodeViewRenderer.js'
@@ -0,0 +1,85 @@
1
+ import type { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'
2
+ import { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu'
3
+ import type { Component, CreateElement, PropType } from 'vue'
4
+ import type Vue from 'vue'
5
+
6
+ export interface BubbleMenuInterface extends Vue {
7
+ pluginKey: BubbleMenuPluginProps['pluginKey']
8
+ editor: BubbleMenuPluginProps['editor']
9
+ updateDelay: BubbleMenuPluginProps['updateDelay']
10
+ resizeDelay: BubbleMenuPluginProps['resizeDelay']
11
+ shouldShow: BubbleMenuPluginProps['shouldShow']
12
+ options: BubbleMenuPluginProps['options']
13
+ }
14
+
15
+ export const BubbleMenu: Component = {
16
+ name: 'BubbleMenu',
17
+
18
+ props: {
19
+ pluginKey: {
20
+ type: [String, Object as PropType<Exclude<BubbleMenuPluginProps['pluginKey'], string>>],
21
+ default: 'bubbleMenu',
22
+ },
23
+
24
+ editor: {
25
+ type: Object as PropType<BubbleMenuPluginProps['editor']>,
26
+ required: true,
27
+ },
28
+
29
+ updateDelay: {
30
+ type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,
31
+ },
32
+
33
+ options: {
34
+ type: Object as PropType<BubbleMenuPluginProps['options']>,
35
+ default: {},
36
+ },
37
+
38
+ resizeDelay: {
39
+ type: Number as PropType<BubbleMenuPluginProps['resizeDelay']>,
40
+ },
41
+
42
+ shouldShow: {
43
+ type: Function as PropType<Exclude<BubbleMenuPluginProps['shouldShow'], null>>,
44
+ default: null,
45
+ },
46
+ },
47
+
48
+ watch: {
49
+ editor: {
50
+ immediate: true,
51
+ handler(this: BubbleMenuInterface, editor: BubbleMenuPluginProps['editor']) {
52
+ if (!editor) {
53
+ return
54
+ }
55
+
56
+ ;(this.$el as HTMLElement).style.visibility = 'hidden'
57
+ ;(this.$el as HTMLElement).style.position = 'absolute'
58
+
59
+ this.$el.remove()
60
+
61
+ this.$nextTick(() => {
62
+ editor.registerPlugin(
63
+ BubbleMenuPlugin({
64
+ updateDelay: this.updateDelay,
65
+ resizeDelay: this.resizeDelay,
66
+ options: this.options,
67
+ editor,
68
+ element: this.$el as HTMLElement,
69
+ pluginKey: this.pluginKey,
70
+ shouldShow: this.shouldShow,
71
+ }),
72
+ )
73
+ })
74
+ },
75
+ },
76
+ },
77
+
78
+ render(this: BubbleMenuInterface, createElement: CreateElement) {
79
+ return createElement('div', { style: { visibility: 'hidden' } }, this.$slots.default)
80
+ },
81
+
82
+ beforeDestroy(this: BubbleMenuInterface) {
83
+ this.editor.unregisterPlugin(this.pluginKey)
84
+ },
85
+ }
@@ -1,11 +1,13 @@
1
- import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'
2
- import Vue, { Component, CreateElement, PropType } from 'vue'
1
+ import type { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'
2
+ import { FloatingMenuPlugin } from '@tiptap/extension-floating-menu'
3
+ import type { Component, CreateElement, PropType } from 'vue'
4
+ import type Vue from 'vue'
3
5
 
4
6
  export interface FloatingMenuInterface extends Vue {
5
- pluginKey: FloatingMenuPluginProps['pluginKey'],
6
- tippyOptions: FloatingMenuPluginProps['tippyOptions'],
7
- editor: FloatingMenuPluginProps['editor'],
8
- shouldShow: FloatingMenuPluginProps['shouldShow'],
7
+ pluginKey: FloatingMenuPluginProps['pluginKey']
8
+ options: FloatingMenuPluginProps['options']
9
+ editor: FloatingMenuPluginProps['editor']
10
+ shouldShow: FloatingMenuPluginProps['shouldShow']
9
11
  }
10
12
 
11
13
  export const FloatingMenu: Component = {
@@ -22,8 +24,8 @@ export const FloatingMenu: Component = {
22
24
  required: true,
23
25
  },
24
26
 
25
- tippyOptions: {
26
- type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,
27
+ options: {
28
+ type: Object as PropType<FloatingMenuPluginProps['options']>,
27
29
  default: () => ({}),
28
30
  },
29
31
 
@@ -41,14 +43,21 @@ export const FloatingMenu: Component = {
41
43
  return
42
44
  }
43
45
 
46
+ ;(this.$el as HTMLElement).style.visibility = 'hidden'
47
+ ;(this.$el as HTMLElement).style.position = 'absolute'
48
+
49
+ this.$el.remove()
50
+
44
51
  this.$nextTick(() => {
45
- editor.registerPlugin(FloatingMenuPlugin({
46
- pluginKey: this.pluginKey,
47
- editor,
48
- element: this.$el as HTMLElement,
49
- tippyOptions: this.tippyOptions,
50
- shouldShow: this.shouldShow,
51
- }))
52
+ editor.registerPlugin(
53
+ FloatingMenuPlugin({
54
+ pluginKey: this.pluginKey,
55
+ editor,
56
+ element: this.$el as HTMLElement,
57
+ options: this.options,
58
+ shouldShow: this.shouldShow,
59
+ }),
60
+ )
52
61
  })
53
62
  },
54
63
  },
@@ -0,0 +1,2 @@
1
+ export * from './BubbleMenu.js'
2
+ export * from './FloatingMenu.js'
@@ -1,11 +0,0 @@
1
- import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
2
- import Vue, { Component } from 'vue';
3
- export interface BubbleMenuInterface extends Vue {
4
- pluginKey: BubbleMenuPluginProps['pluginKey'];
5
- editor: BubbleMenuPluginProps['editor'];
6
- tippyOptions: BubbleMenuPluginProps['tippyOptions'];
7
- updateDelay: BubbleMenuPluginProps['updateDelay'];
8
- shouldShow: BubbleMenuPluginProps['shouldShow'];
9
- }
10
- export declare const BubbleMenu: Component;
11
- //# sourceMappingURL=BubbleMenu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BubbleMenu.d.ts","sourceRoot":"","sources":["../src/BubbleMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AACvF,OAAO,GAAG,EAAE,EAAE,SAAS,EAA2B,MAAM,KAAK,CAAA;AAE7D,MAAM,WAAW,mBAAoB,SAAQ,GAAG;IAC9C,SAAS,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACxC,YAAY,EAAE,qBAAqB,CAAC,cAAc,CAAC,CAAC;IACpD,WAAW,EAAE,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAClD,UAAU,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAC;CACjD;AAED,eAAO,MAAM,UAAU,EAAE,SA0DxB,CAAA"}
package/dist/Editor.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Editor as CoreEditor } from '@tiptap/core';
2
- import Vue from 'vue';
3
- export declare class Editor extends CoreEditor {
4
- contentComponent: Vue | null;
5
- }
6
- //# sourceMappingURL=Editor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,GAAG,MAAM,KAAK,CAAA;AAErB,qBAAa,MAAO,SAAQ,UAAU;IAC7B,gBAAgB,EAAE,GAAG,GAAG,IAAI,CAAO;CAC3C"}
@@ -1,7 +0,0 @@
1
- import Vue, { Component } from 'vue';
2
- import { Editor } from './Editor.js';
3
- export interface EditorContentInterface extends Vue {
4
- editor: Editor;
5
- }
6
- export declare const EditorContent: Component;
7
- //# sourceMappingURL=EditorContent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EditorContent.d.ts","sourceRoot":"","sources":["../src/EditorContent.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAE,SAAS,EAA2B,MAAM,KAAK,CAAA;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,WAAW,sBAAuB,SAAQ,GAAG;IACjD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,EAAE,SAmE3B,CAAA"}
@@ -1,10 +0,0 @@
1
- import { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu';
2
- import Vue, { Component } from 'vue';
3
- export interface FloatingMenuInterface extends Vue {
4
- pluginKey: FloatingMenuPluginProps['pluginKey'];
5
- tippyOptions: FloatingMenuPluginProps['tippyOptions'];
6
- editor: FloatingMenuPluginProps['editor'];
7
- shouldShow: FloatingMenuPluginProps['shouldShow'];
8
- }
9
- export declare const FloatingMenu: Component;
10
- //# sourceMappingURL=FloatingMenu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FloatingMenu.d.ts","sourceRoot":"","sources":["../src/FloatingMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AAC7F,OAAO,GAAG,EAAE,EAAE,SAAS,EAA2B,MAAM,KAAK,CAAA;AAE7D,MAAM,WAAW,qBAAsB,SAAQ,GAAG;IAChD,SAAS,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAChD,YAAY,EAAE,uBAAuB,CAAC,cAAc,CAAC,CAAC;IACtD,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC1C,UAAU,EAAE,uBAAuB,CAAC,YAAY,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,YAAY,EAAE,SAqD1B,CAAA"}
@@ -1,6 +0,0 @@
1
- import Vue, { Component } from 'vue';
2
- export interface NodeViewContentInterface extends Vue {
3
- as: string;
4
- }
5
- export declare const NodeViewContent: Component;
6
- //# sourceMappingURL=NodeViewContent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeViewContent.d.ts","sourceRoot":"","sources":["../src/NodeViewContent.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAE,SAAS,EAAiB,MAAM,KAAK,CAAA;AAEnD,MAAM,WAAW,wBAAyB,SAAQ,GAAG;IACnD,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,eAAO,MAAM,eAAe,EAAE,SAkB7B,CAAA"}
@@ -1,10 +0,0 @@
1
- import Vue, { Component } from 'vue';
2
- export interface NodeViewWrapperInterface extends Vue {
3
- as: string;
4
- decorationClasses: {
5
- value: string;
6
- };
7
- onDragStart: () => void;
8
- }
9
- export declare const NodeViewWrapper: Component;
10
- //# sourceMappingURL=NodeViewWrapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NodeViewWrapper.d.ts","sourceRoot":"","sources":["../src/NodeViewWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,EAAE,EAAE,SAAS,EAAiB,MAAM,KAAK,CAAA;AAEnD,MAAM,WAAW,wBAAyB,SAAQ,GAAG;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,eAAe,EAAE,SA4B7B,CAAA"}
@@ -1,40 +0,0 @@
1
- import { DecorationWithType, NodeViewRenderer, NodeViewRendererOptions } from '@tiptap/core';
2
- import { Node as ProseMirrorNode } from '@tiptap/pm/model';
3
- import { Decoration, DecorationSource } from '@tiptap/pm/view';
4
- import Vue from 'vue';
5
- import { VueConstructor } from 'vue/types/umd';
6
- export declare const nodeViewProps: {
7
- editor: import("vue-ts-types/dist/types.js").RequiredPropOptions<import("@tiptap/core").Editor>;
8
- node: import("vue-ts-types/dist/types.js").RequiredPropOptions<ProseMirrorNode>;
9
- decorations: import("vue-ts-types/dist/types.js").RequiredPropOptions<readonly DecorationWithType[]>;
10
- selected: import("vue-ts-types/dist/types.js").RequiredPropOptions<boolean>;
11
- extension: import("vue-ts-types/dist/types.js").RequiredPropOptions<import("@tiptap/core").Node<any, any>>;
12
- getPos: import("vue-ts-types/dist/types.js").PropOptions<() => number> & {
13
- required: true;
14
- } & {
15
- default?: (() => () => number) | undefined;
16
- };
17
- updateAttributes: import("vue-ts-types/dist/types.js").PropOptions<(attributes: Record<string, any>) => void> & {
18
- required: true;
19
- } & {
20
- default?: (() => (attributes: Record<string, any>) => void) | undefined;
21
- };
22
- deleteNode: import("vue-ts-types/dist/types.js").PropOptions<() => void> & {
23
- required: true;
24
- } & {
25
- default?: (() => () => void) | undefined;
26
- };
27
- };
28
- export interface VueNodeViewRendererOptions extends NodeViewRendererOptions {
29
- update: ((props: {
30
- oldNode: ProseMirrorNode;
31
- oldDecorations: readonly Decoration[];
32
- oldInnerDecorations: DecorationSource;
33
- newNode: ProseMirrorNode;
34
- newDecorations: readonly Decoration[];
35
- innerDecorations: DecorationSource;
36
- updateProps: () => void;
37
- }) => boolean) | null;
38
- }
39
- export declare function VueNodeViewRenderer(component: Vue | VueConstructor, options?: Partial<VueNodeViewRendererOptions>): NodeViewRenderer;
40
- //# sourceMappingURL=VueNodeViewRenderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VueNodeViewRenderer.d.ts","sourceRoot":"","sources":["../src/VueNodeViewRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGlB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAmC,MAAM,iBAAiB,CAAA;AAC/F,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAM9C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;CASzB,CAAA;AAED,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACzE,MAAM,EACF,CAAC,CAAC,KAAK,EAAE;QACT,OAAO,EAAE,eAAe,CAAC;QACzB,cAAc,EAAE,SAAS,UAAU,EAAE,CAAC;QACtC,mBAAmB,EAAE,gBAAgB,CAAC;QACtC,OAAO,EAAE,eAAe,CAAC;QACzB,cAAc,EAAE,SAAS,UAAU,EAAE,CAAC;QACtC,gBAAgB,EAAE,gBAAgB,CAAC;QACnC,WAAW,EAAE,MAAM,IAAI,CAAC;KACvB,KAAK,OAAO,CAAC,GACd,IAAI,CAAC;CACV;AAkMD,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,GAAG,GAAG,cAAc,EAC/B,OAAO,CAAC,EAAE,OAAO,CAAC,0BAA0B,CAAC,GAC5C,gBAAgB,CAWlB"}
@@ -1,13 +0,0 @@
1
- import Vue from 'vue';
2
- import { VueConstructor } from 'vue/types/umd';
3
- /**
4
- * The VueRenderer class is responsible for rendering a Vue component as a ProseMirror node view.
5
- */
6
- export declare class VueRenderer {
7
- ref: Vue;
8
- constructor(component: Vue | VueConstructor, props: any);
9
- get element(): Element;
10
- updateProps(props?: Record<string, any>): void;
11
- destroy(): void;
12
- }
13
- //# sourceMappingURL=VueRenderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VueRenderer.d.ts","sourceRoot":"","sources":["../src/VueRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C;;GAEG;AACH,qBAAa,WAAW;IACtB,GAAG,EAAG,GAAG,CAAA;gBAEG,SAAS,EAAE,GAAG,GAAG,cAAc,EAAE,KAAK,EAAE,GAAG;IAMvD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,WAAW,CAAC,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,IAAI;IAqBlD,OAAO,IAAI,IAAI;CAGhB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA"}