@tiptap/extension-drag-handle-vue-3 2.24.2 → 3.0.0-beta.10

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025, Tiptap GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs CHANGED
@@ -1,54 +1,86 @@
1
- 'use strict';
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
19
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var extensionDragHandle = require('@tiptap/extension-drag-handle');
6
- var vue = require('vue');
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ DragHandle: () => DragHandle,
24
+ default: () => index_default
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
7
27
 
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
- },
28
+ // src/DragHandle.ts
29
+ var import_extension_drag_handle = require("@tiptap/extension-drag-handle");
30
+ var import_vue = require("vue");
31
+ var DragHandle = (0, import_vue.defineComponent)({
32
+ name: "DragHandleVue",
33
+ props: {
34
+ pluginKey: {
35
+ type: [String, Object],
36
+ default: import_extension_drag_handle.dragHandlePluginDefaultKey
37
+ },
38
+ editor: {
39
+ type: Object,
40
+ required: true
31
41
  },
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)); };
42
+ computePositionConfig: {
43
+ type: Object,
44
+ default: () => ({})
49
45
  },
46
+ onNodeChange: {
47
+ type: Function,
48
+ default: null
49
+ },
50
+ class: {
51
+ type: String,
52
+ default: "drag-handle"
53
+ }
54
+ },
55
+ setup(props, { slots }) {
56
+ const root = (0, import_vue.ref)(null);
57
+ (0, import_vue.onMounted)(() => {
58
+ const { editor, pluginKey, onNodeChange, computePositionConfig } = props;
59
+ editor.registerPlugin(
60
+ (0, import_extension_drag_handle.DragHandlePlugin)({
61
+ editor,
62
+ element: root.value,
63
+ pluginKey,
64
+ computePositionConfig: { ...import_extension_drag_handle.defaultComputePositionConfig, ...computePositionConfig },
65
+ onNodeChange
66
+ }).plugin
67
+ );
68
+ });
69
+ (0, import_vue.onBeforeUnmount)(() => {
70
+ const { pluginKey, editor } = props;
71
+ editor.unregisterPlugin(pluginKey);
72
+ });
73
+ return () => {
74
+ var _a;
75
+ return (0, import_vue.h)("div", { ref: root, class: props.class }, (_a = slots.default) == null ? void 0 : _a.call(slots));
76
+ };
77
+ }
50
78
  });
51
79
 
52
- exports.DragHandle = DragHandle;
53
- exports.default = DragHandle;
54
- //# sourceMappingURL=index.cjs.map
80
+ // src/index.ts
81
+ var index_default = DragHandle;
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ DragHandle
85
+ });
86
+ //# sourceMappingURL=index.cjs.map
@@ -1 +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,CAA2C;AAChE,YAAA,OAAO,EAAEC,8CAA0B;AACpC,SAAA;AAED,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA6C;AACnD,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AAED,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE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le.js'\n\nexport * from './DragHandle.js'\n\nexport default DragHandle\n","import type { DragHandlePluginProps } from '@tiptap/extension-drag-handle'\nimport {\n defaultComputePositionConfig,\n DragHandlePlugin,\n dragHandlePluginDefaultKey,\n} from '@tiptap/extension-drag-handle'\nimport type { Editor } from '@tiptap/vue-3'\nimport type { PropType } from 'vue'\nimport { defineComponent, h, onBeforeUnmount, onMounted, ref } 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 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 setup(props, { slots }) {\n const root = ref<HTMLElement | null>(null)\n\n onMounted(() => {\n const { editor, pluginKey, onNodeChange, computePositionConfig } = props\n\n editor.registerPlugin(\n DragHandlePlugin({\n editor,\n element: root.value as HTMLElement,\n pluginKey,\n computePositionConfig: { ...defaultComputePositionConfig, ...computePositionConfig },\n onNodeChange,\n }).plugin,\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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,mCAIO;AAGP,iBAAoE;AAS7D,IAAM,iBAAa,4BAAgB;AAAA,EACxC,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,MAAM,OAAO,EAAE,MAAM,GAAG;AACtB,UAAM,WAAO,gBAAwB,IAAI;AAEzC,8BAAU,MAAM;AACd,YAAM,EAAE,QAAQ,WAAW,cAAc,sBAAsB,IAAI;AAEnE,aAAO;AAAA,YACL,+CAAiB;AAAA,UACf;AAAA,UACA,SAAS,KAAK;AAAA,UACd;AAAA,UACA,uBAAuB,EAAE,GAAG,2DAA8B,GAAG,sBAAsB;AAAA,UACnF;AAAA,QACF,CAAC,EAAE;AAAA,MACL;AAAA,IACF,CAAC;AAED,oCAAgB,MAAM;AACpB,YAAM,EAAE,WAAW,OAAO,IAAI;AAE9B,aAAO,iBAAiB,SAAmB;AAAA,IAC7C,CAAC;AAED,WAAO,MAAG;AAtEd;AAsEiB,+BAAE,OAAO,EAAE,KAAK,MAAM,OAAO,MAAM,MAAM,IAAG,WAAM,YAAN,8BAAiB;AAAA;AAAA,EAC5E;AACF,CAAC;;;ADpED,IAAO,gBAAQ;","names":[]}