@tiptap/extension-drag-handle-vue-2 2.24.2 → 3.0.0-beta.11
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/dist/index.cjs +91 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2566 -0
- package/dist/index.d.ts +2566 -4
- package/dist/index.js +60 -45
- package/dist/index.js.map +1 -1
- package/package.json +16 -14
- package/src/DragHandle.ts +27 -25
- package/dist/DragHandle.d.ts +0 -29
- package/dist/DragHandle.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.umd.js +0 -59
- package/dist/index.umd.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,51 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
},
|
|
1
|
+
// src/DragHandle.ts
|
|
2
|
+
import {
|
|
3
|
+
defaultComputePositionConfig,
|
|
4
|
+
DragHandlePlugin,
|
|
5
|
+
dragHandlePluginDefaultKey
|
|
6
|
+
} from "@tiptap/extension-drag-handle";
|
|
7
|
+
import Vue from "vue";
|
|
8
|
+
var DragHandle = Vue.extend({
|
|
9
|
+
name: "DragHandleVue",
|
|
10
|
+
props: {
|
|
11
|
+
pluginKey: {
|
|
12
|
+
type: [String, Object],
|
|
13
|
+
default: dragHandlePluginDefaultKey
|
|
27
14
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
editor,
|
|
32
|
-
element: this.$el,
|
|
33
|
-
pluginKey,
|
|
34
|
-
tippyOptions,
|
|
35
|
-
onNodeChange,
|
|
36
|
-
}));
|
|
15
|
+
editor: {
|
|
16
|
+
type: Object,
|
|
17
|
+
required: true
|
|
37
18
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
editor.unregisterPlugin(pluginKey);
|
|
19
|
+
computePositionConfig: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => ({})
|
|
42
22
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}, this.$slots.default);
|
|
23
|
+
onNodeChange: {
|
|
24
|
+
type: Function,
|
|
25
|
+
default: null
|
|
47
26
|
},
|
|
27
|
+
class: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "drag-handle"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
mounted() {
|
|
33
|
+
const { editor, pluginKey, onNodeChange } = this.$props;
|
|
34
|
+
editor.registerPlugin(
|
|
35
|
+
DragHandlePlugin({
|
|
36
|
+
editor,
|
|
37
|
+
element: this.$el,
|
|
38
|
+
pluginKey,
|
|
39
|
+
computePositionConfig: { ...defaultComputePositionConfig, ...this.computePositionConfig },
|
|
40
|
+
onNodeChange
|
|
41
|
+
}).plugin
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
// eslint-disable-next-line vue/no-deprecated-destroyed-lifecycle
|
|
45
|
+
beforeDestroy() {
|
|
46
|
+
const { pluginKey, editor } = this.$props;
|
|
47
|
+
editor.unregisterPlugin(pluginKey);
|
|
48
|
+
},
|
|
49
|
+
render(h) {
|
|
50
|
+
return h(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
class: this.class
|
|
54
|
+
},
|
|
55
|
+
this.$slots.default
|
|
56
|
+
);
|
|
57
|
+
}
|
|
48
58
|
});
|
|
49
59
|
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
// src/index.ts
|
|
61
|
+
var index_default = DragHandle;
|
|
62
|
+
export {
|
|
63
|
+
DragHandle,
|
|
64
|
+
index_default as default
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/DragHandle.ts","../src/index.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport {\n type DragHandlePluginProps,\n defaultComputePositionConfig,\n DragHandlePlugin,\n dragHandlePluginDefaultKey,\n} from '@tiptap/extension-drag-handle'\nimport Vue, { type PropType } 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 = Vue.extend({\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 computePositionConfig: {\n type: Object as PropType<DragHandleProps['computePositionConfig']>,\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 mounted() {\n const { editor, pluginKey, onNodeChange } = this.$props\n\n editor.registerPlugin(\n DragHandlePlugin({\n editor,\n element: this.$el as HTMLElement,\n pluginKey,\n computePositionConfig: { ...defaultComputePositionConfig, ...this.computePositionConfig },\n onNodeChange,\n }).plugin,\n )\n },\n\n // eslint-disable-next-line vue/no-deprecated-destroyed-lifecycle\n beforeDestroy() {\n const { pluginKey, editor } = this.$props\n\n editor.unregisterPlugin(pluginKey as string)\n },\n\n render(h) {\n return h(\n 'div',\n {\n class: this.class,\n },\n this.$slots.default,\n )\n },\n})\n","import { DragHandle } from './DragHandle.js'\n\nexport * from './DragHandle.js'\n\nexport default DragHandle\n"],"mappings":";AACA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,SAA4B;AAS5B,IAAM,aAAa,IAAI,OAAO;AAAA,EACnC,MAAM;AAAA,EAEN,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS;AAAA,IACX;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IAEA,uBAAuB;AAAA,MACrB,MAAM;AAAA,MACN,SAAS,OAAO,CAAC;AAAA,IACnB;AAAA,IAEA,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IAEA,OAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EAEA,UAAU;AACR,UAAM,EAAE,QAAQ,WAAW,aAAa,IAAI,KAAK;AAEjD,WAAO;AAAA,MACL,iBAAiB;AAAA,QACf;AAAA,QACA,SAAS,KAAK;AAAA,QACd;AAAA,QACA,uBAAuB,EAAE,GAAG,8BAA8B,GAAG,KAAK,sBAAsB;AAAA,QACxF;AAAA,MACF,CAAC,EAAE;AAAA,IACL;AAAA,EACF;AAAA;AAAA,EAGA,gBAAgB;AACd,UAAM,EAAE,WAAW,OAAO,IAAI,KAAK;AAEnC,WAAO,iBAAiB,SAAmB;AAAA,EAC7C;AAAA,EAEA,OAAO,GAAG;AACR,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,OAAO,KAAK;AAAA,MACd;AAAA,MACA,KAAK,OAAO;AAAA,IACd;AAAA,EACF;AACF,CAAC;;;ACxED,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-drag-handle-vue-2",
|
|
3
3
|
"description": "drag handle extension for tiptap with vue 2",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0-beta.11",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -20,34 +20,36 @@
|
|
|
20
20
|
"type": "module",
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
|
-
"types":
|
|
23
|
+
"types": {
|
|
24
|
+
"import": "./dist/index.d.ts",
|
|
25
|
+
"require": "./dist/index.d.cts"
|
|
26
|
+
},
|
|
24
27
|
"import": "./dist/index.js",
|
|
25
28
|
"require": "./dist/index.cjs"
|
|
26
29
|
}
|
|
27
30
|
},
|
|
28
31
|
"main": "dist/index.cjs",
|
|
29
32
|
"module": "dist/index.js",
|
|
30
|
-
"umd": "dist/index.umd.js",
|
|
31
33
|
"types": "dist/index.d.ts",
|
|
32
34
|
"files": [
|
|
33
35
|
"src",
|
|
34
36
|
"dist"
|
|
35
37
|
],
|
|
36
38
|
"peerDependencies": {
|
|
37
|
-
"
|
|
38
|
-
"@tiptap/
|
|
39
|
-
"@tiptap/
|
|
40
|
-
"vue": "
|
|
39
|
+
"vue": "^2.0.0",
|
|
40
|
+
"@tiptap/extension-drag-handle": "3.0.0-beta.11",
|
|
41
|
+
"@tiptap/pm": "3.0.0-beta.11",
|
|
42
|
+
"@tiptap/vue-2": "3.0.0-beta.11"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
|
-
"@tiptap/extension-drag-handle": "^2.24.2",
|
|
44
|
-
"@tiptap/pm": "^2.24.2",
|
|
45
|
-
"@tiptap/vue-2": "^2.24.2",
|
|
46
45
|
"vue": "^2.0.0",
|
|
47
|
-
"vue-ts-types": "1.6.2"
|
|
46
|
+
"vue-ts-types": "1.6.2",
|
|
47
|
+
"@tiptap/vue-2": "3.0.0-beta.11",
|
|
48
|
+
"@tiptap/extension-drag-handle": "3.0.0-beta.11",
|
|
49
|
+
"@tiptap/pm": "3.0.0-beta.11"
|
|
48
50
|
},
|
|
49
51
|
"scripts": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
+
"build": "tsup",
|
|
53
|
+
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
|
|
52
54
|
}
|
|
53
|
-
}
|
|
55
|
+
}
|
package/src/DragHandle.ts
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/core'
|
|
1
|
+
import type { Editor } from '@tiptap/core'
|
|
2
2
|
import {
|
|
3
|
+
type DragHandlePluginProps,
|
|
4
|
+
defaultComputePositionConfig,
|
|
3
5
|
DragHandlePlugin,
|
|
4
6
|
dragHandlePluginDefaultKey,
|
|
5
|
-
DragHandlePluginProps,
|
|
6
7
|
} from '@tiptap/extension-drag-handle'
|
|
7
|
-
import Vue, { PropType } from 'vue'
|
|
8
|
+
import Vue, { type PropType } from 'vue'
|
|
8
9
|
|
|
9
|
-
type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K
|
|
10
|
+
type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>
|
|
10
11
|
|
|
11
12
|
export type DragHandleProps = Omit<Optional<DragHandlePluginProps, 'pluginKey'>, 'element'> & {
|
|
12
|
-
class?: string
|
|
13
|
-
onNodeChange?: (data: { node: Node | null; editor: Editor; pos: number }) => void
|
|
14
|
-
}
|
|
13
|
+
class?: string
|
|
14
|
+
onNodeChange?: (data: { node: Node | null; editor: Editor; pos: number }) => void
|
|
15
|
+
}
|
|
15
16
|
|
|
16
17
|
export const DragHandle = Vue.extend({
|
|
17
18
|
name: 'DragHandleVue',
|
|
@@ -27,8 +28,8 @@ export const DragHandle = Vue.extend({
|
|
|
27
28
|
required: true,
|
|
28
29
|
},
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
type: Object as PropType<DragHandleProps['
|
|
31
|
+
computePositionConfig: {
|
|
32
|
+
type: Object as PropType<DragHandleProps['computePositionConfig']>,
|
|
32
33
|
default: () => ({}),
|
|
33
34
|
},
|
|
34
35
|
|
|
@@ -44,20 +45,17 @@ export const DragHandle = Vue.extend({
|
|
|
44
45
|
},
|
|
45
46
|
|
|
46
47
|
mounted() {
|
|
47
|
-
const {
|
|
48
|
-
editor,
|
|
49
|
-
pluginKey,
|
|
50
|
-
onNodeChange,
|
|
51
|
-
tippyOptions,
|
|
52
|
-
} = this.$props
|
|
48
|
+
const { editor, pluginKey, onNodeChange } = this.$props
|
|
53
49
|
|
|
54
|
-
editor.registerPlugin(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
editor.registerPlugin(
|
|
51
|
+
DragHandlePlugin({
|
|
52
|
+
editor,
|
|
53
|
+
element: this.$el as HTMLElement,
|
|
54
|
+
pluginKey,
|
|
55
|
+
computePositionConfig: { ...defaultComputePositionConfig, ...this.computePositionConfig },
|
|
56
|
+
onNodeChange,
|
|
57
|
+
}).plugin,
|
|
58
|
+
)
|
|
61
59
|
},
|
|
62
60
|
|
|
63
61
|
// eslint-disable-next-line vue/no-deprecated-destroyed-lifecycle
|
|
@@ -68,8 +66,12 @@ export const DragHandle = Vue.extend({
|
|
|
68
66
|
},
|
|
69
67
|
|
|
70
68
|
render(h) {
|
|
71
|
-
return h(
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
return h(
|
|
70
|
+
'div',
|
|
71
|
+
{
|
|
72
|
+
class: this.class,
|
|
73
|
+
},
|
|
74
|
+
this.$slots.default,
|
|
75
|
+
)
|
|
74
76
|
},
|
|
75
77
|
})
|
package/dist/DragHandle.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/core';
|
|
2
|
-
import { DragHandlePluginProps } from '@tiptap/extension-drag-handle';
|
|
3
|
-
import Vue 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/types/vue").ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue>, unknown, unknown, unknown, {
|
|
14
|
-
pluginKey: string | import("prosemirror-state").PluginKey<any> | undefined;
|
|
15
|
-
editor: Editor;
|
|
16
|
-
tippyOptions: {} | undefined;
|
|
17
|
-
onNodeChange: (((data: {
|
|
18
|
-
editor: Editor;
|
|
19
|
-
node: import("prosemirror-model").Node | null;
|
|
20
|
-
pos: number;
|
|
21
|
-
}) => void) & ((data: {
|
|
22
|
-
node: Node | null;
|
|
23
|
-
editor: Editor;
|
|
24
|
-
pos: number;
|
|
25
|
-
}) => void)) | undefined;
|
|
26
|
-
class: string | undefined;
|
|
27
|
-
}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin>;
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=DragHandle.d.ts.map
|
package/dist/DragHandle.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DragHandle.d.ts","sourceRoot":"","sources":["../src/DragHandle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAGL,qBAAqB,EACtB,MAAM,+BAA+B,CAAA;AACtC,OAAO,GAAiB,MAAM,KAAK,CAAA;AAEnC,KAAK,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEvE,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,WAAW,CAAC,EAAE,SAAS,CAAC,GAAG;IAC5F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACnF,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;0BAHC;QAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;gFA8DjF,CAAA"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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.umd.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
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-2"] = {}, global.extensionDragHandle, global.Vue));
|
|
5
|
-
})(this, (function (exports, extensionDragHandle, Vue) { 'use strict';
|
|
6
|
-
|
|
7
|
-
const DragHandle = Vue.extend({
|
|
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
|
-
mounted() {
|
|
32
|
-
const { editor, pluginKey, onNodeChange, tippyOptions, } = this.$props;
|
|
33
|
-
editor.registerPlugin(extensionDragHandle.DragHandlePlugin({
|
|
34
|
-
editor,
|
|
35
|
-
element: this.$el,
|
|
36
|
-
pluginKey,
|
|
37
|
-
tippyOptions,
|
|
38
|
-
onNodeChange,
|
|
39
|
-
}));
|
|
40
|
-
},
|
|
41
|
-
// eslint-disable-next-line vue/no-deprecated-destroyed-lifecycle
|
|
42
|
-
beforeDestroy() {
|
|
43
|
-
const { pluginKey, editor } = this.$props;
|
|
44
|
-
editor.unregisterPlugin(pluginKey);
|
|
45
|
-
},
|
|
46
|
-
render(h) {
|
|
47
|
-
return h('div', {
|
|
48
|
-
class: this.class,
|
|
49
|
-
}, this.$slots.default);
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
exports.DragHandle = DragHandle;
|
|
54
|
-
exports.default = DragHandle;
|
|
55
|
-
|
|
56
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
57
|
-
|
|
58
|
-
}));
|
|
59
|
-
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/DragHandle.ts"],"sourcesContent":["import { Editor } from '@tiptap/core'\nimport {\n DragHandlePlugin,\n dragHandlePluginDefaultKey,\n DragHandlePluginProps,\n} from '@tiptap/extension-drag-handle'\nimport Vue, { PropType } 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 = Vue.extend({\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 mounted() {\n const {\n editor,\n pluginKey,\n onNodeChange,\n tippyOptions,\n } = this.$props\n\n editor.registerPlugin(DragHandlePlugin({\n editor,\n element: this.$el as HTMLElement,\n pluginKey,\n tippyOptions,\n onNodeChange,\n }))\n },\n\n // eslint-disable-next-line vue/no-deprecated-destroyed-lifecycle\n beforeDestroy() {\n const { pluginKey, editor } = this.$props\n\n editor.unregisterPlugin(pluginKey as string)\n },\n\n render(h) {\n return h('div', {\n class: this.class,\n }, this.$slots.default)\n },\n})\n"],"names":["dragHandlePluginDefaultKey","DragHandlePlugin"],"mappings":";;;;;;AAea,QAAA,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC;EACnC,IAAA,IAAI,EAAE,eAAe;EAErB,IAAA,KAAK,EAAE;EACL,QAAA,SAAS,EAAE;EACT,YAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAA2C;EAChE,YAAA,OAAO,EAAEA,8CAA0B;EACpC,SAAA;EAED,QAAA,MAAM,EAAE;EACN,YAAA,IAAI,EAAE,MAA6C;EACnD,YAAA,QAAQ,EAAE,IAAI;EACf,SAAA;EAED,QAAA,YAAY,EAAE;EACZ,YAAA,IAAI,EAAE,MAAmD;EACzD,YAAA,OAAO,EAAE,OAAO,EAAE,CAAC;EACpB,SAAA;EAED,QAAA,YAAY,EAAE;EACZ,YAAA,IAAI,EAAE,QAAqD;EAC3D,YAAA,OAAO,EAAE,IAAI;EACd,SAAA;EAED,QAAA,KAAK,EAAE;EACL,YAAA,IAAI,EAAE,MAA4C;EAClD,YAAA,OAAO,EAAE,aAAa;EACvB,SAAA;EACF,KAAA;MAED,OAAO,GAAA;EACL,QAAA,MAAM,EACJ,MAAM,EACN,SAAS,EACT,YAAY,EACZ,YAAY,GACb,GAAG,IAAI,CAAC,MAAM;EAEf,QAAA,MAAM,CAAC,cAAc,CAACC,oCAAgB,CAAC;cACrC,MAAM;cACN,OAAO,EAAE,IAAI,CAAC,GAAkB;cAChC,SAAS;cACT,YAAY;cACZ,YAAY;EACb,SAAA,CAAC,CAAC;OACJ;;MAGD,aAAa,GAAA;UACX,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM;EAEzC,QAAA,MAAM,CAAC,gBAAgB,CAAC,SAAmB,CAAC;OAC7C;EAED,IAAA,MAAM,CAAC,CAAC,EAAA;UACN,OAAO,CAAC,CAAC,KAAK,EAAE;cACd,KAAK,EAAE,IAAI,CAAC,KAAK;EAClB,SAAA,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;OACxB;EACF,CAAA;;;;;;;;;;;"}
|