@tiptap/extension-drag-handle-vue-2 3.30.2 → 3.30.3
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/dist/index.cjs +92 -112
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3117 -3055
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +3117 -3055
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -87
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -1,123 +1,103 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
2
6
|
var __create = Object.create;
|
|
3
7
|
var __defProp = Object.defineProperty;
|
|
4
8
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
9
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
10
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
11
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
12
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
19
21
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
onElementDragEnd,
|
|
94
|
-
nestedOptions
|
|
95
|
-
}).plugin
|
|
96
|
-
);
|
|
97
|
-
},
|
|
98
|
-
// oxlint-disable-next-line vue/no-deprecated-destroyed-lifecycle
|
|
99
|
-
beforeDestroy() {
|
|
100
|
-
const { pluginKey, editor } = this.$props;
|
|
101
|
-
editor.unregisterPlugin(pluginKey);
|
|
102
|
-
},
|
|
103
|
-
render(h) {
|
|
104
|
-
return h(
|
|
105
|
-
"div",
|
|
106
|
-
{
|
|
107
|
-
class: this.class,
|
|
108
|
-
attrs: {
|
|
109
|
-
"data-dragging": "false"
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
this.$slots.default
|
|
113
|
-
);
|
|
114
|
-
}
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
//#endregion
|
|
27
|
+
let _tiptap_extension_drag_handle = require("@tiptap/extension-drag-handle");
|
|
28
|
+
let vue = require("vue");
|
|
29
|
+
vue = __toESM(vue, 1);
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/DragHandle.ts
|
|
32
|
+
const DragHandle = vue.default.extend({
|
|
33
|
+
name: "DragHandleVue",
|
|
34
|
+
props: {
|
|
35
|
+
pluginKey: {
|
|
36
|
+
type: [String, Object],
|
|
37
|
+
default: () => _tiptap_extension_drag_handle.dragHandlePluginDefaultKey
|
|
38
|
+
},
|
|
39
|
+
editor: {
|
|
40
|
+
type: Object,
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
computePositionConfig: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: () => ({})
|
|
46
|
+
},
|
|
47
|
+
onNodeChange: {
|
|
48
|
+
type: Function,
|
|
49
|
+
default: null
|
|
50
|
+
},
|
|
51
|
+
onElementDragStart: {
|
|
52
|
+
type: Function,
|
|
53
|
+
default: null
|
|
54
|
+
},
|
|
55
|
+
onElementDragEnd: {
|
|
56
|
+
type: Function,
|
|
57
|
+
default: null
|
|
58
|
+
},
|
|
59
|
+
class: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "drag-handle"
|
|
62
|
+
},
|
|
63
|
+
nested: {
|
|
64
|
+
type: [Boolean, Object],
|
|
65
|
+
default: false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
mounted() {
|
|
69
|
+
const { editor, pluginKey, onNodeChange, onElementDragStart, onElementDragEnd, nested } = this.$props;
|
|
70
|
+
const nestedOptions = (0, _tiptap_extension_drag_handle.normalizeNestedOptions)(nested);
|
|
71
|
+
editor.registerPlugin((0, _tiptap_extension_drag_handle.DragHandlePlugin)({
|
|
72
|
+
editor,
|
|
73
|
+
element: this.$el,
|
|
74
|
+
pluginKey,
|
|
75
|
+
computePositionConfig: {
|
|
76
|
+
..._tiptap_extension_drag_handle.defaultComputePositionConfig,
|
|
77
|
+
...this.computePositionConfig
|
|
78
|
+
},
|
|
79
|
+
onNodeChange,
|
|
80
|
+
onElementDragStart,
|
|
81
|
+
onElementDragEnd,
|
|
82
|
+
nestedOptions
|
|
83
|
+
}).plugin);
|
|
84
|
+
},
|
|
85
|
+
beforeDestroy() {
|
|
86
|
+
const { pluginKey, editor } = this.$props;
|
|
87
|
+
editor.unregisterPlugin(pluginKey);
|
|
88
|
+
},
|
|
89
|
+
render(h) {
|
|
90
|
+
return h("div", {
|
|
91
|
+
class: this.class,
|
|
92
|
+
attrs: { "data-dragging": "false" }
|
|
93
|
+
}, this.$slots.default);
|
|
94
|
+
}
|
|
115
95
|
});
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/index.ts
|
|
98
|
+
var src_default = DragHandle;
|
|
99
|
+
//#endregion
|
|
100
|
+
exports.DragHandle = DragHandle;
|
|
101
|
+
exports.default = src_default;
|
|
116
102
|
|
|
117
|
-
// src/index.ts
|
|
118
|
-
var index_default = DragHandle;
|
|
119
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
120
|
-
0 && (module.exports = {
|
|
121
|
-
DragHandle
|
|
122
|
-
});
|
|
123
103
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["VueDefault","dragHandlePluginDefaultKey","defaultComputePositionConfig"],"sources":["../src/Vue.ts","../src/DragHandle.ts","../src/index.ts"],"sourcesContent":["import type { VueConstructor } from 'vue'\nimport VueDefault from 'vue'\n\n// With nodenext module resolution, TypeScript treats the default import as the module type.\n// We need to explicitly type it as VueConstructor to access static methods like extend and observable.\n// This is necessary because Vue 2's type definitions export Vue as VueConstructor, but nodenext\n// doesn't correctly infer the default export type.\nexport const Vue: VueConstructor = VueDefault as unknown as VueConstructor\n","import type { Editor } from '@tiptap/core'\nimport {\n type DragHandlePluginProps,\n type NestedOptions,\n defaultComputePositionConfig,\n DragHandlePlugin,\n dragHandlePluginDefaultKey,\n normalizeNestedOptions,\n} from '@tiptap/extension-drag-handle'\nimport { type PropType } from 'vue'\n\nimport { Vue } from './Vue.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type DragHandleProps = Omit<\n Optional<DragHandlePluginProps, 'pluginKey'>,\n 'element' | 'nestedOptions'\n> & {\n class?: string\n onNodeChange?: (data: { node: Node | null; editor: Editor; pos: number }) => void\n /**\n * Enable drag handles for nested content (list items, blockquotes, etc.).\n *\n * When enabled, the drag handle will appear for nested blocks, not just\n * top-level blocks. A rule-based scoring system determines which node\n * to target based on cursor position and configured rules.\n *\n * @default false\n */\n nested?: boolean | NestedOptions\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 onElementDragStart: {\n type: Function as PropType<DragHandleProps['onElementDragStart']>,\n default: null,\n },\n\n onElementDragEnd: {\n type: Function as PropType<DragHandleProps['onElementDragEnd']>,\n default: null,\n },\n\n class: {\n type: String as PropType<DragHandleProps['class']>,\n default: 'drag-handle',\n },\n\n nested: {\n type: [Boolean, Object] as PropType<DragHandleProps['nested']>,\n default: false,\n },\n },\n\n mounted() {\n const { editor, pluginKey, onNodeChange, onElementDragStart, onElementDragEnd, nested } =\n this.$props\n\n const nestedOptions = normalizeNestedOptions(nested)\n\n editor.registerPlugin(\n DragHandlePlugin({\n editor,\n element: this.$el as HTMLElement,\n pluginKey,\n computePositionConfig: { ...defaultComputePositionConfig, ...this.computePositionConfig },\n onNodeChange,\n onElementDragStart,\n onElementDragEnd,\n nestedOptions,\n }).plugin,\n )\n },\n\n // oxlint-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: Vue.CreateElement) {\n return h(\n 'div',\n {\n class: this.class,\n attrs: {\n 'data-dragging': 'false',\n },\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACiCA,MAAa,aD1BsBA,IAAAA,QC0BL,OAAO;CACnC,MAAM;CAEN,OAAO;EACL,WAAW;GACT,MAAM,CAAC,QAAQ,MAAM;GACrB,eAAeC,8BAAAA;EACjB;EAEA,QAAQ;GACN,MAAM;GACN,UAAU;EACZ;EAEA,uBAAuB;GACrB,MAAM;GACN,gBAAgB,CAAC;EACnB;EAEA,cAAc;GACZ,MAAM;GACN,SAAS;EACX;EAEA,oBAAoB;GAClB,MAAM;GACN,SAAS;EACX;EAEA,kBAAkB;GAChB,MAAM;GACN,SAAS;EACX;EAEA,OAAO;GACL,MAAM;GACN,SAAS;EACX;EAEA,QAAQ;GACN,MAAM,CAAC,SAAS,MAAM;GACtB,SAAS;EACX;CACF;CAEA,UAAU;EACR,MAAM,EAAE,QAAQ,WAAW,cAAc,oBAAoB,kBAAkB,WAC7E,KAAK;EAEP,MAAM,iBAAA,GAAA,8BAAA,uBAAA,CAAuC,MAAM;EAEnD,OAAO,gBAAA,GAAA,8BAAA,iBAAA,CACY;GACf;GACA,SAAS,KAAK;GACd;GACA,uBAAuB;IAAE,GAAGC,8BAAAA;IAA8B,GAAG,KAAK;GAAsB;GACxF;GACA;GACA;GACA;EACF,CAAC,CAAC,CAAC,MACL;CACF;CAGA,gBAAgB;EACd,MAAM,EAAE,WAAW,WAAW,KAAK;EAEnC,OAAO,iBAAiB,SAAmB;CAC7C;CAEA,OAAO,GAAsB;EAC3B,OAAO,EACL,OACA;GACE,OAAO,KAAK;GACZ,OAAO,EACL,iBAAiB,QACnB;EACF,GACA,KAAK,OAAO,OACd;CACF;AACF,CAAC;;;ACjHD,IAAA,cAAe"}
|