@tiptap/vue-3 2.11.7 → 3.0.0-beta.1

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 (48) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +5 -1
  3. package/dist/index.cjs +562 -528
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +219 -0
  6. package/dist/index.d.ts +218 -10
  7. package/dist/index.js +526 -516
  8. package/dist/index.js.map +1 -1
  9. package/dist/menus/index.cjs +613 -0
  10. package/dist/menus/index.cjs.map +1 -0
  11. package/dist/menus/index.d.cts +257 -0
  12. package/dist/menus/index.d.ts +257 -0
  13. package/dist/menus/index.js +605 -0
  14. package/dist/menus/index.js.map +1 -0
  15. package/package.json +27 -16
  16. package/src/Editor.ts +6 -11
  17. package/src/EditorContent.ts +10 -20
  18. package/src/VueMarkViewRenderer.ts +114 -0
  19. package/src/VueNodeViewRenderer.ts +19 -30
  20. package/src/VueRenderer.ts +10 -11
  21. package/src/index.ts +1 -2
  22. package/src/menus/BubbleMenu.ts +78 -0
  23. package/src/menus/FloatingMenu.ts +68 -0
  24. package/src/menus/index.ts +2 -0
  25. package/src/useEditor.ts +1 -1
  26. package/dist/BubbleMenu.d.ts +0 -61
  27. package/dist/BubbleMenu.d.ts.map +0 -1
  28. package/dist/Editor.d.ts +0 -24
  29. package/dist/Editor.d.ts.map +0 -1
  30. package/dist/EditorContent.d.ts +0 -18
  31. package/dist/EditorContent.d.ts.map +0 -1
  32. package/dist/FloatingMenu.d.ts +0 -49
  33. package/dist/FloatingMenu.d.ts.map +0 -1
  34. package/dist/NodeViewContent.d.ts +0 -14
  35. package/dist/NodeViewContent.d.ts.map +0 -1
  36. package/dist/NodeViewWrapper.d.ts +0 -14
  37. package/dist/NodeViewWrapper.d.ts.map +0 -1
  38. package/dist/VueNodeViewRenderer.d.ts +0 -63
  39. package/dist/VueNodeViewRenderer.d.ts.map +0 -1
  40. package/dist/VueRenderer.d.ts +0 -37
  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 -570
  44. package/dist/index.umd.js.map +0 -1
  45. package/dist/useEditor.d.ts +0 -4
  46. package/dist/useEditor.d.ts.map +0 -1
  47. package/src/BubbleMenu.ts +0 -71
  48. package/src/FloatingMenu.ts +0 -66
package/src/BubbleMenu.ts DELETED
@@ -1,71 +0,0 @@
1
- import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'
2
- import {
3
- defineComponent,
4
- h,
5
- onBeforeUnmount,
6
- onMounted,
7
- PropType,
8
- ref,
9
- } from 'vue'
10
-
11
- export const BubbleMenu = defineComponent({
12
- name: 'BubbleMenu',
13
-
14
- props: {
15
- pluginKey: {
16
- type: [String, Object] as PropType<BubbleMenuPluginProps['pluginKey']>,
17
- default: 'bubbleMenu',
18
- },
19
-
20
- editor: {
21
- type: Object as PropType<BubbleMenuPluginProps['editor']>,
22
- required: true,
23
- },
24
-
25
- updateDelay: {
26
- type: Number as PropType<BubbleMenuPluginProps['updateDelay']>,
27
- default: undefined,
28
- },
29
-
30
- tippyOptions: {
31
- type: Object as PropType<BubbleMenuPluginProps['tippyOptions']>,
32
- default: () => ({}),
33
- },
34
-
35
- shouldShow: {
36
- type: Function as PropType<Exclude<Required<BubbleMenuPluginProps>['shouldShow'], null>>,
37
- default: null,
38
- },
39
- },
40
-
41
- setup(props, { slots }) {
42
- const root = ref<HTMLElement | null>(null)
43
-
44
- onMounted(() => {
45
- const {
46
- updateDelay,
47
- editor,
48
- pluginKey,
49
- shouldShow,
50
- tippyOptions,
51
- } = props
52
-
53
- editor.registerPlugin(BubbleMenuPlugin({
54
- updateDelay,
55
- editor,
56
- element: root.value as HTMLElement,
57
- pluginKey,
58
- shouldShow,
59
- tippyOptions,
60
- }))
61
- })
62
-
63
- onBeforeUnmount(() => {
64
- const { pluginKey, editor } = props
65
-
66
- editor.unregisterPlugin(pluginKey)
67
- })
68
-
69
- return () => h('div', { ref: root }, slots.default?.())
70
- },
71
- })
@@ -1,66 +0,0 @@
1
- import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'
2
- import {
3
- defineComponent,
4
- h,
5
- onBeforeUnmount,
6
- onMounted,
7
- PropType,
8
- ref,
9
- } from 'vue'
10
-
11
- export const FloatingMenu = defineComponent({
12
- name: 'FloatingMenu',
13
-
14
- props: {
15
- pluginKey: {
16
- // TODO: TypeScript breaks :(
17
- // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],
18
- type: null,
19
- default: 'floatingMenu',
20
- },
21
-
22
- editor: {
23
- type: Object as PropType<FloatingMenuPluginProps['editor']>,
24
- required: true,
25
- },
26
-
27
- tippyOptions: {
28
- type: Object as PropType<FloatingMenuPluginProps['tippyOptions']>,
29
- default: () => ({}),
30
- },
31
-
32
- shouldShow: {
33
- type: Function as PropType<Exclude<Required<FloatingMenuPluginProps>['shouldShow'], null>>,
34
- default: null,
35
- },
36
- },
37
-
38
- setup(props, { slots }) {
39
- const root = ref<HTMLElement | null>(null)
40
-
41
- onMounted(() => {
42
- const {
43
- pluginKey,
44
- editor,
45
- tippyOptions,
46
- shouldShow,
47
- } = props
48
-
49
- editor.registerPlugin(FloatingMenuPlugin({
50
- pluginKey,
51
- editor,
52
- element: root.value as HTMLElement,
53
- tippyOptions,
54
- shouldShow,
55
- }))
56
- })
57
-
58
- onBeforeUnmount(() => {
59
- const { pluginKey, editor } = props
60
-
61
- editor.unregisterPlugin(pluginKey)
62
- })
63
-
64
- return () => h('div', { ref: root }, slots.default?.())
65
- },
66
- })