@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 CHANGED
@@ -1,123 +1,103 @@
1
- "use strict";
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
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
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
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- DragHandle: () => DragHandle,
34
- default: () => index_default
35
- });
36
- module.exports = __toCommonJS(index_exports);
37
-
38
- // src/DragHandle.ts
39
- var import_extension_drag_handle = require("@tiptap/extension-drag-handle");
40
-
41
- // src/Vue.ts
42
- var import_vue = __toESM(require("vue"), 1);
43
- var Vue = import_vue.default;
44
-
45
- // src/DragHandle.ts
46
- var DragHandle = Vue.extend({
47
- name: "DragHandleVue",
48
- props: {
49
- pluginKey: {
50
- type: [String, Object],
51
- default: () => import_extension_drag_handle.dragHandlePluginDefaultKey
52
- },
53
- editor: {
54
- type: Object,
55
- required: true
56
- },
57
- computePositionConfig: {
58
- type: Object,
59
- default: () => ({})
60
- },
61
- onNodeChange: {
62
- type: Function,
63
- default: null
64
- },
65
- onElementDragStart: {
66
- type: Function,
67
- default: null
68
- },
69
- onElementDragEnd: {
70
- type: Function,
71
- default: null
72
- },
73
- class: {
74
- type: String,
75
- default: "drag-handle"
76
- },
77
- nested: {
78
- type: [Boolean, Object],
79
- default: false
80
- }
81
- },
82
- mounted() {
83
- const { editor, pluginKey, onNodeChange, onElementDragStart, onElementDragEnd, nested } = this.$props;
84
- const nestedOptions = (0, import_extension_drag_handle.normalizeNestedOptions)(nested);
85
- editor.registerPlugin(
86
- (0, import_extension_drag_handle.DragHandlePlugin)({
87
- editor,
88
- element: this.$el,
89
- pluginKey,
90
- computePositionConfig: { ...import_extension_drag_handle.defaultComputePositionConfig, ...this.computePositionConfig },
91
- onNodeChange,
92
- onElementDragStart,
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
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/DragHandle.ts","../src/Vue.ts"],"sourcesContent":["import { DragHandle } from './DragHandle.js'\n\nexport * from './DragHandle.js'\n\nexport default DragHandle\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 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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,mCAOO;;;ACPP,iBAAuB;AAMhB,IAAM,MAAsB,WAA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iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,MACA,KAAK,OAAO;AAAA,IACd;AAAA,EACF;AACF,CAAC;;;ADjHD,IAAO,gBAAQ;","names":["VueDefault"]}
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"}