@tiptap/extension-drag-handle-vue-3 2.22.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.
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # @tiptap/extension-drag-handle-vue3
2
+ [![Version](https://img.shields.io/npm/v/@tiptap/extension-drag-handle-vue3.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-drag-handle-vue3)
3
+ [![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-drag-handle-vue3.svg)](https://npmcharts.com/compare/tiptap?minimal=true)
4
+ [![License](https://img.shields.io/npm/l/@tiptap/extension-drag-handle-vue3.svg)](https://www.npmjs.com/package/@tiptap/extension-drag-handle-vue3)
5
+ [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
6
+
7
+ ## Introduction
8
+ Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.
9
+
10
+ ## Official Documentation
11
+ Documentation can be found on the [Tiptap website](https://tiptap.dev).
12
+
13
+ ## License
14
+ Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
@@ -0,0 +1,72 @@
1
+ import { DragHandlePluginProps } from '@tiptap/extension-drag-handle';
2
+ import { Editor } from '@tiptap/vue-3';
3
+ import { PropType } from 'vue';
4
+ type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
5
+ export type DragHandleProps = Omit<Optional<DragHandlePluginProps, 'pluginKey'>, 'element'> & {
6
+ class?: string;
7
+ onNodeChange?: (data: {
8
+ node: Node | null;
9
+ editor: Editor;
10
+ pos: number;
11
+ }) => void;
12
+ };
13
+ export declare const DragHandle: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
14
+ pluginKey: {
15
+ type: PropType<DragHandleProps["pluginKey"]>;
16
+ default: import("prosemirror-state").PluginKey<any>;
17
+ };
18
+ editor: {
19
+ type: PropType<DragHandleProps["editor"]>;
20
+ required: true;
21
+ };
22
+ tippyOptions: {
23
+ type: PropType<DragHandleProps["tippyOptions"]>;
24
+ default: () => {};
25
+ };
26
+ onNodeChange: {
27
+ type: PropType<DragHandleProps["onNodeChange"]>;
28
+ default: null;
29
+ };
30
+ class: {
31
+ type: PropType<DragHandleProps["class"]>;
32
+ default: string;
33
+ };
34
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
35
+ [key: string]: any;
36
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
37
+ pluginKey: {
38
+ type: PropType<DragHandleProps["pluginKey"]>;
39
+ default: import("prosemirror-state").PluginKey<any>;
40
+ };
41
+ editor: {
42
+ type: PropType<DragHandleProps["editor"]>;
43
+ required: true;
44
+ };
45
+ tippyOptions: {
46
+ type: PropType<DragHandleProps["tippyOptions"]>;
47
+ default: () => {};
48
+ };
49
+ onNodeChange: {
50
+ type: PropType<DragHandleProps["onNodeChange"]>;
51
+ default: null;
52
+ };
53
+ class: {
54
+ type: PropType<DragHandleProps["class"]>;
55
+ default: string;
56
+ };
57
+ }>> & Readonly<{}>, {
58
+ pluginKey: string | import("prosemirror-state").PluginKey<any> | undefined;
59
+ onNodeChange: (((data: {
60
+ editor: import("@tiptap/core").Editor;
61
+ node: import("prosemirror-model").Node | null;
62
+ pos: number;
63
+ }) => void) & ((data: {
64
+ node: Node | null;
65
+ editor: Editor;
66
+ pos: number;
67
+ }) => void)) | undefined;
68
+ tippyOptions: Partial<import("tippy.js").Props> | undefined;
69
+ class: string | undefined;
70
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
71
+ export {};
72
+ //# sourceMappingURL=DragHandle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragH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CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;;;;;;;;;0BA5BhC;QAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;4EA4DjF,CAAA"}
package/dist/index.cjs ADDED
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var extensionDragHandle = require('@tiptap/extension-drag-handle');
6
+ var vue = require('vue');
7
+
8
+ const DragHandle = vue.defineComponent({
9
+ name: 'DragHandleVue',
10
+ props: {
11
+ pluginKey: {
12
+ type: [String, Object],
13
+ default: extensionDragHandle.dragHandlePluginDefaultKey,
14
+ },
15
+ editor: {
16
+ type: Object,
17
+ required: true,
18
+ },
19
+ tippyOptions: {
20
+ type: Object,
21
+ default: () => ({}),
22
+ },
23
+ onNodeChange: {
24
+ type: Function,
25
+ default: null,
26
+ },
27
+ class: {
28
+ type: String,
29
+ default: 'drag-handle',
30
+ },
31
+ },
32
+ setup(props, { slots }) {
33
+ const root = vue.ref(null);
34
+ vue.onMounted(() => {
35
+ const { editor, pluginKey, onNodeChange, tippyOptions, } = props;
36
+ editor.registerPlugin(extensionDragHandle.DragHandlePlugin({
37
+ editor,
38
+ element: root.value,
39
+ pluginKey,
40
+ tippyOptions,
41
+ onNodeChange,
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, class: props.class }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); };
49
+ },
50
+ });
51
+
52
+ exports.DragHandle = DragHandle;
53
+ exports.default = DragHandle;
54
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/DragHandle.ts"],"sourcesContent":["import {\n DragHandlePlugin,\n dragHandlePluginDefaultKey,\n DragHandlePluginProps,\n} from '@tiptap/extension-drag-handle'\nimport { Editor } from '@tiptap/vue-3'\nimport {\n defineComponent, h, onBeforeUnmount, onMounted, PropType, ref,\n} from 'vue'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type DragHandleProps = Omit<Optional<DragHandlePluginProps, 'pluginKey'>, 'element'> & {\n class?: string;\n onNodeChange?: (data: { node: Node | null; editor: Editor; pos: number }) => void;\n};\n\nexport const DragHandle = defineComponent({\n name: 'DragHandleVue',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<DragHandleProps['pluginKey']>,\n default: dragHandlePluginDefaultKey,\n },\n\n editor: {\n type: Object as PropType<DragHandleProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<DragHandleProps['tippyOptions']>,\n default: () => ({}),\n },\n\n onNodeChange: {\n type: Function as PropType<DragHandleProps['onNodeChange']>,\n default: null,\n },\n\n class: {\n type: String as PropType<DragHandleProps['class']>,\n default: 'drag-handle',\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n editor, pluginKey, onNodeChange, tippyOptions,\n } = props\n\n editor.registerPlugin(\n DragHandlePlugin({\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n tippyOptions,\n onNodeChange,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey as string)\n })\n\n return () => h('div', { ref: root, class: props.class }, slots.default?.())\n },\n})\n"],"names":["defineComponent","dragHandlePluginDefaultKey","ref","onMounted","DragHandlePlugin","onBeforeUnmount","h"],"mappings":";;;;;;;AAiBO,MAAM,UAAU,GAAGA,mBAAe,CAAC;AACxC,IAAA,IAAI,EAAE,eAAe;AAErB,IAAA,KAAK,EAAE;AACL,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,C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AAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAC,CAAA,EAAA;KAC5E;AACF,CAAA;;;;;"}
@@ -0,0 +1,4 @@
1
+ import { DragHandle } from './DragHandle.js';
2
+ export * from './DragHandle.js';
3
+ export default DragHandle;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,cAAc,iBAAiB,CAAA;AAE/B,eAAe,UAAU,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,49 @@
1
+ import { dragHandlePluginDefaultKey, DragHandlePlugin } from '@tiptap/extension-drag-handle';
2
+ import { defineComponent, ref, onMounted, onBeforeUnmount, h } from 'vue';
3
+
4
+ const DragHandle = defineComponent({
5
+ name: 'DragHandleVue',
6
+ props: {
7
+ pluginKey: {
8
+ type: [String, Object],
9
+ default: dragHandlePluginDefaultKey,
10
+ },
11
+ editor: {
12
+ type: Object,
13
+ required: true,
14
+ },
15
+ tippyOptions: {
16
+ type: Object,
17
+ default: () => ({}),
18
+ },
19
+ onNodeChange: {
20
+ type: Function,
21
+ default: null,
22
+ },
23
+ class: {
24
+ type: String,
25
+ default: 'drag-handle',
26
+ },
27
+ },
28
+ setup(props, { slots }) {
29
+ const root = ref(null);
30
+ onMounted(() => {
31
+ const { editor, pluginKey, onNodeChange, tippyOptions, } = props;
32
+ editor.registerPlugin(DragHandlePlugin({
33
+ editor,
34
+ element: root.value,
35
+ pluginKey,
36
+ tippyOptions,
37
+ onNodeChange,
38
+ }));
39
+ });
40
+ onBeforeUnmount(() => {
41
+ const { pluginKey, editor } = props;
42
+ editor.unregisterPlugin(pluginKey);
43
+ });
44
+ return () => { var _a; return h('div', { ref: root, class: props.class }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); };
45
+ },
46
+ });
47
+
48
+ export { DragHandle, DragHandle as default };
49
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/DragHandle.ts"],"sourcesContent":["import {\n DragHandlePlugin,\n dragHandlePluginDefaultKey,\n DragHandlePluginProps,\n} from '@tiptap/extension-drag-handle'\nimport { Editor } from '@tiptap/vue-3'\nimport {\n defineComponent, h, onBeforeUnmount, onMounted, PropType, ref,\n} from 'vue'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type DragHandleProps = Omit<Optional<DragHandlePluginProps, 'pluginKey'>, 'element'> & {\n class?: string;\n onNodeChange?: (data: { node: Node | null; editor: Editor; pos: number }) => void;\n};\n\nexport const DragHandle = defineComponent({\n name: 'DragHandleVue',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<DragHandleProps['pluginKey']>,\n default: dragHandlePluginDefaultKey,\n },\n\n editor: {\n type: Object as PropType<DragHandleProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<DragHandleProps['tippyOptions']>,\n default: () => ({}),\n },\n\n onNodeChange: {\n type: Function as PropType<DragHandleProps['onNodeChange']>,\n default: null,\n },\n\n class: {\n type: String as PropType<DragHandleProps['class']>,\n default: 'drag-handle',\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n editor, pluginKey, onNodeChange, tippyOptions,\n } = props\n\n editor.registerPlugin(\n DragHandlePlugin({\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n tippyOptions,\n onNodeChange,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey as string)\n })\n\n return () => h('div', { ref: root, class: props.class }, slots.default?.())\n },\n})\n"],"names":[],"mappings":";;;AAiBO,MAAM,UAAU,GAAG,eAAe,CAAC;AACxC,IAAA,IAAI,EAAE,eAAe;AAErB,IAA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AK,EAAE,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,OAAO,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAC,CAAA,EAAA;KAC5E;AACF,CAAA;;;;"}
@@ -0,0 +1,57 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/extension-drag-handle'), require('vue')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@tiptap/extension-drag-handle', 'vue'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-drag-handle-vue-3"] = {}, global.extensionDragHandle, global.vue));
5
+ })(this, (function (exports, extensionDragHandle, vue) { 'use strict';
6
+
7
+ const DragHandle = vue.defineComponent({
8
+ name: 'DragHandleVue',
9
+ props: {
10
+ pluginKey: {
11
+ type: [String, Object],
12
+ default: extensionDragHandle.dragHandlePluginDefaultKey,
13
+ },
14
+ editor: {
15
+ type: Object,
16
+ required: true,
17
+ },
18
+ tippyOptions: {
19
+ type: Object,
20
+ default: () => ({}),
21
+ },
22
+ onNodeChange: {
23
+ type: Function,
24
+ default: null,
25
+ },
26
+ class: {
27
+ type: String,
28
+ default: 'drag-handle',
29
+ },
30
+ },
31
+ setup(props, { slots }) {
32
+ const root = vue.ref(null);
33
+ vue.onMounted(() => {
34
+ const { editor, pluginKey, onNodeChange, tippyOptions, } = props;
35
+ editor.registerPlugin(extensionDragHandle.DragHandlePlugin({
36
+ editor,
37
+ element: root.value,
38
+ pluginKey,
39
+ tippyOptions,
40
+ onNodeChange,
41
+ }));
42
+ });
43
+ vue.onBeforeUnmount(() => {
44
+ const { pluginKey, editor } = props;
45
+ editor.unregisterPlugin(pluginKey);
46
+ });
47
+ return () => { var _a; return vue.h('div', { ref: root, class: props.class }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)); };
48
+ },
49
+ });
50
+
51
+ exports.DragHandle = DragHandle;
52
+ exports.default = DragHandle;
53
+
54
+ Object.defineProperty(exports, '__esModule', { value: true });
55
+
56
+ }));
57
+ //# sourceMappingURL=index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.js","sources":["../src/DragHandle.ts"],"sourcesContent":["import {\n DragHandlePlugin,\n dragHandlePluginDefaultKey,\n DragHandlePluginProps,\n} from '@tiptap/extension-drag-handle'\nimport { Editor } from '@tiptap/vue-3'\nimport {\n defineComponent, h, onBeforeUnmount, onMounted, PropType, ref,\n} from 'vue'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type DragHandleProps = Omit<Optional<DragHandlePluginProps, 'pluginKey'>, 'element'> & {\n class?: string;\n onNodeChange?: (data: { node: Node | null; editor: Editor; pos: number }) => void;\n};\n\nexport const DragHandle = defineComponent({\n name: 'DragHandleVue',\n\n props: {\n pluginKey: {\n type: [String, Object] as PropType<DragHandleProps['pluginKey']>,\n default: dragHandlePluginDefaultKey,\n },\n\n editor: {\n type: Object as PropType<DragHandleProps['editor']>,\n required: true,\n },\n\n tippyOptions: {\n type: Object as PropType<DragHandleProps['tippyOptions']>,\n default: () => ({}),\n },\n\n onNodeChange: {\n type: Function as PropType<DragHandleProps['onNodeChange']>,\n default: null,\n },\n\n class: {\n type: String as PropType<DragHandleProps['class']>,\n default: 'drag-handle',\n },\n },\n\n setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const {\n editor, pluginKey, onNodeChange, tippyOptions,\n } = props\n\n editor.registerPlugin(\n DragHandlePlugin({\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n tippyOptions,\n onNodeChange,\n }),\n )\n })\n\n onBeforeUnmount(() => {\n const { pluginKey, editor } = props\n\n editor.unregisterPlugin(pluginKey as string)\n })\n\n return () => h('div', { ref: root, class: props.class }, slots.default?.())\n },\n})\n"],"names":["defineComponent","dragHandlePluginDefaultKey","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F,QAAA,OAAO,MAAM,EAAA,IAAA,EAAA,CAAA,CAAA,OAAAC,KAAC,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,OAAO,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAC,CAAA,EAAA;OAC5E;EACF,CAAA;;;;;;;;;;;"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@tiptap/extension-drag-handle-vue-3",
3
+ "description": "drag handle extension for tiptap with vue 3",
4
+ "version": "2.22.0",
5
+ "homepage": "https://tiptap.dev",
6
+ "keywords": [
7
+ "tiptap",
8
+ "tiptap extension"
9
+ ],
10
+ "license": "MIT",
11
+ "funding": {
12
+ "type": "github",
13
+ "url": "https://github.com/sponsors/ueberdosis"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/ueberdosis/tiptap",
18
+ "directory": "packages/extension-drag-handle-vue-3"
19
+ },
20
+ "type": "module",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js",
25
+ "require": "./dist/index.cjs"
26
+ }
27
+ },
28
+ "main": "dist/index.cjs",
29
+ "module": "dist/index.js",
30
+ "umd": "dist/index.umd.js",
31
+ "types": "dist/index.d.ts",
32
+ "files": [
33
+ "src",
34
+ "dist"
35
+ ],
36
+ "peerDependencies": {
37
+ "@tiptap/extension-drag-handle": "^2.14.0",
38
+ "@tiptap/pm": "^2.7.0",
39
+ "@tiptap/vue-3": "^2.7.0",
40
+ "vue": "^3.0.0"
41
+ },
42
+ "devDependencies": {
43
+ "@tiptap/extension-drag-handle": "^2.22.0",
44
+ "@tiptap/pm": "^2.22.0",
45
+ "@tiptap/vue-3": "^2.22.0",
46
+ "vue": "^3.0.0"
47
+ },
48
+ "scripts": {
49
+ "clean": "rm -rf dist",
50
+ "build": "npm run clean && rollup -c"
51
+ }
52
+ }
@@ -0,0 +1,75 @@
1
+ import {
2
+ DragHandlePlugin,
3
+ dragHandlePluginDefaultKey,
4
+ DragHandlePluginProps,
5
+ } from '@tiptap/extension-drag-handle'
6
+ import { Editor } from '@tiptap/vue-3'
7
+ import {
8
+ defineComponent, h, onBeforeUnmount, onMounted, PropType, ref,
9
+ } from 'vue'
10
+
11
+ type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
12
+
13
+ export type DragHandleProps = Omit<Optional<DragHandlePluginProps, 'pluginKey'>, 'element'> & {
14
+ class?: string;
15
+ onNodeChange?: (data: { node: Node | null; editor: Editor; pos: number }) => void;
16
+ };
17
+
18
+ export const DragHandle = defineComponent({
19
+ name: 'DragHandleVue',
20
+
21
+ props: {
22
+ pluginKey: {
23
+ type: [String, Object] as PropType<DragHandleProps['pluginKey']>,
24
+ default: dragHandlePluginDefaultKey,
25
+ },
26
+
27
+ editor: {
28
+ type: Object as PropType<DragHandleProps['editor']>,
29
+ required: true,
30
+ },
31
+
32
+ tippyOptions: {
33
+ type: Object as PropType<DragHandleProps['tippyOptions']>,
34
+ default: () => ({}),
35
+ },
36
+
37
+ onNodeChange: {
38
+ type: Function as PropType<DragHandleProps['onNodeChange']>,
39
+ default: null,
40
+ },
41
+
42
+ class: {
43
+ type: String as PropType<DragHandleProps['class']>,
44
+ default: 'drag-handle',
45
+ },
46
+ },
47
+
48
+ setup(props, { slots }) {
49
+ const root = ref<HTMLElement | null>(null)
50
+
51
+ onMounted(() => {
52
+ const {
53
+ editor, pluginKey, onNodeChange, tippyOptions,
54
+ } = props
55
+
56
+ editor.registerPlugin(
57
+ DragHandlePlugin({
58
+ editor,
59
+ element: root.value as HTMLElement,
60
+ pluginKey,
61
+ tippyOptions,
62
+ onNodeChange,
63
+ }),
64
+ )
65
+ })
66
+
67
+ onBeforeUnmount(() => {
68
+ const { pluginKey, editor } = props
69
+
70
+ editor.unregisterPlugin(pluginKey as string)
71
+ })
72
+
73
+ return () => h('div', { ref: root, class: props.class }, slots.default?.())
74
+ },
75
+ })
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { DragHandle } from './DragHandle.js'
2
+
3
+ export * from './DragHandle.js'
4
+
5
+ export default DragHandle