@tiptap/extension-drag-handle-vue-2 3.10.7 → 3.11.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/dist/index.cjs +6 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +163 -70
- package/dist/index.d.ts +163 -70
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/DragHandle.ts +4 -2
- package/src/Vue.ts +8 -0
package/dist/index.cjs
CHANGED
|
@@ -37,8 +37,13 @@ module.exports = __toCommonJS(index_exports);
|
|
|
37
37
|
|
|
38
38
|
// src/DragHandle.ts
|
|
39
39
|
var import_extension_drag_handle = require("@tiptap/extension-drag-handle");
|
|
40
|
+
|
|
41
|
+
// src/Vue.ts
|
|
40
42
|
var import_vue = __toESM(require("vue"), 1);
|
|
41
|
-
var
|
|
43
|
+
var Vue = import_vue.default;
|
|
44
|
+
|
|
45
|
+
// src/DragHandle.ts
|
|
46
|
+
var DragHandle = Vue.extend({
|
|
42
47
|
name: "DragHandleVue",
|
|
43
48
|
props: {
|
|
44
49
|
pluginKey: {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/DragHandle.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 defaultComputePositionConfig,\n DragHandlePlugin,\n dragHandlePluginDefaultKey,\n} from '@tiptap/extension-drag-handle'\nimport
|
|
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 defaultComputePositionConfig,\n DragHandlePlugin,\n dragHandlePluginDefaultKey,\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<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 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\n mounted() {\n const { editor, pluginKey, onNodeChange, onElementDragStart, onElementDragEnd } = 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 onElementDragStart,\n onElementDragEnd,\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: Vue.CreateElement) {\n return h(\n 'div',\n {\n class: this.class,\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,mCAKO;;;ACLP,iBAAuB;AAMhB,IAAM,MAAsB,WAAAA;;;ADW5B,IAAM,aAAa,IAAI,OAAO;AAAA,EACnC,MAAM;AAAA,EAEN,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS,MAAM;AAAA,IACjB;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,oBAAoB;AAAA,MAClB,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IAEA,kBAAkB;AAAA,MAChB,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,cAAc,oBAAoB,iBAAiB,IAAI,KAAK;AAEvF,WAAO;AAAA,UACL,+CAAiB;AAAA,QACf;AAAA,QACA,SAAS,KAAK;AAAA,QACd;AAAA,QACA,uBAAuB,EAAE,GAAG,2DAA8B,GAAG,KAAK,sBAAsB;AAAA,QACxF;AAAA,QACA;AAAA,QACA;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,GAAsB;AAC3B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,OAAO,KAAK;AAAA,MACd;AAAA,MACA,KAAK,OAAO;AAAA,IACd;AAAA,EACF;AACF,CAAC;;;ADtFD,IAAO,gBAAQ;","names":["VueDefault"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as vue_types_vue from 'vue/types/vue';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { EditorView, EditorProps, NodeViewConstructor, MarkViewConstructor, NodeView, MarkView } from '@tiptap/pm/view';
|
|
2
|
+
import * as prosemirror_model from 'prosemirror-model';
|
|
3
|
+
import * as prosemirror_state from 'prosemirror-state';
|
|
4
|
+
import * as vue from 'vue';
|
|
5
|
+
import { MarkType as MarkType$1, MarkSpec, Mark as Mark$1, DOMOutputSpec, NodeType as NodeType$1, NodeSpec, Node as Node$2, Slice, ParseOptions, Schema, ResolvedPos, Fragment } from '@tiptap/pm/model';
|
|
6
|
+
import { EditorState, Plugin, Transaction, PluginKey } from '@tiptap/pm/state';
|
|
7
|
+
import { EditorView, EditorProps, NodeView, MarkView, NodeViewConstructor, MarkViewConstructor } from '@tiptap/pm/view';
|
|
9
8
|
import { Transform } from '@tiptap/pm/transform';
|
|
10
9
|
import { DragHandlePluginProps } from '@tiptap/extension-drag-handle';
|
|
11
10
|
|
|
@@ -156,7 +155,7 @@ interface MarkConfig<Options = any, Storage = any> extends ExtendableConfig<Opti
|
|
|
156
155
|
storage: Storage;
|
|
157
156
|
parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
|
|
158
157
|
editor?: Editor;
|
|
159
|
-
}) => Attributes
|
|
158
|
+
}) => Attributes | {};
|
|
160
159
|
}
|
|
161
160
|
/**
|
|
162
161
|
* The Mark class is used to create custom mark extensions.
|
|
@@ -453,7 +452,7 @@ interface NodeConfig<Options = any, Storage = any> extends ExtendableConfig<Opti
|
|
|
453
452
|
storage: Storage;
|
|
454
453
|
parent: ParentConfig<NodeConfig<Options, Storage>>['addAttributes'];
|
|
455
454
|
editor?: Editor;
|
|
456
|
-
}) => Attributes
|
|
455
|
+
}) => Attributes | {};
|
|
457
456
|
}
|
|
458
457
|
/**
|
|
459
458
|
* The Node class is used to create custom node extensions.
|
|
@@ -872,6 +871,7 @@ declare class Extendable<Options = any, Storage = any, Config = ExtensionConfig<
|
|
|
872
871
|
configure(options?: Partial<Options>): Extendable<Options, Storage, ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>>;
|
|
873
872
|
extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = ExtensionConfig<ExtendedOptions, ExtendedStorage> | NodeConfig<ExtendedOptions, ExtendedStorage> | MarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: Partial<ExtendedConfig>): Extendable<ExtendedOptions, ExtendedStorage>;
|
|
874
873
|
}
|
|
874
|
+
|
|
875
875
|
type AnyExtension = Extendable;
|
|
876
876
|
type Extensions = AnyExtension[];
|
|
877
877
|
type ParentConfig<T> = Partial<{
|
|
@@ -1128,6 +1128,14 @@ interface EditorOptions {
|
|
|
1128
1128
|
* Whether the editor is editable
|
|
1129
1129
|
*/
|
|
1130
1130
|
editable: boolean;
|
|
1131
|
+
/**
|
|
1132
|
+
* The default text direction for all content in the editor.
|
|
1133
|
+
* When set to 'ltr' or 'rtl', all nodes will have the corresponding dir attribute.
|
|
1134
|
+
* When set to 'auto', the dir attribute will be set based on content detection.
|
|
1135
|
+
* When undefined, no dir attribute will be added.
|
|
1136
|
+
* @default undefined
|
|
1137
|
+
*/
|
|
1138
|
+
textDirection?: 'ltr' | 'rtl' | 'auto';
|
|
1131
1139
|
/**
|
|
1132
1140
|
* The editor's props
|
|
1133
1141
|
*/
|
|
@@ -1181,7 +1189,7 @@ interface EditorOptions {
|
|
|
1181
1189
|
*
|
|
1182
1190
|
* @default true
|
|
1183
1191
|
*/
|
|
1184
|
-
enableCoreExtensions?: boolean | Partial<Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex' | 'drop' | 'paste' | 'delete', false>>;
|
|
1192
|
+
enableCoreExtensions?: boolean | Partial<Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex' | 'drop' | 'paste' | 'delete' | 'textDirection', false>>;
|
|
1185
1193
|
/**
|
|
1186
1194
|
* If `true`, the editor will check the content for errors on initialization.
|
|
1187
1195
|
* Emitting the `contentError` event if the content is invalid.
|
|
@@ -1261,17 +1269,71 @@ interface EditorOptions {
|
|
|
1261
1269
|
*/
|
|
1262
1270
|
type HTMLContent = string;
|
|
1263
1271
|
/**
|
|
1264
|
-
*
|
|
1272
|
+
* A Tiptap JSON node or document. Tiptap JSON is the standard format for
|
|
1273
|
+
* storing and manipulating Tiptap content. It is equivalent to the JSON
|
|
1274
|
+
* representation of a Prosemirror node.
|
|
1275
|
+
*
|
|
1276
|
+
* Tiptap JSON documents are trees of nodes. The root node is usually of type
|
|
1277
|
+
* `doc`. Nodes can have other nodes as children. Nodes can also have marks and
|
|
1278
|
+
* attributes. Text nodes (nodes with type `text`) have a `text` property and no
|
|
1279
|
+
* children.
|
|
1280
|
+
*
|
|
1281
|
+
* @example
|
|
1282
|
+
* ```ts
|
|
1283
|
+
* const content: JSONContent = {
|
|
1284
|
+
* type: 'doc',
|
|
1285
|
+
* content: [
|
|
1286
|
+
* {
|
|
1287
|
+
* type: 'paragraph',
|
|
1288
|
+
* content: [
|
|
1289
|
+
* {
|
|
1290
|
+
* type: 'text',
|
|
1291
|
+
* text: 'Hello ',
|
|
1292
|
+
* },
|
|
1293
|
+
* {
|
|
1294
|
+
* type: 'text',
|
|
1295
|
+
* text: 'world',
|
|
1296
|
+
* marks: [{ type: 'bold' }],
|
|
1297
|
+
* },
|
|
1298
|
+
* ],
|
|
1299
|
+
* },
|
|
1300
|
+
* ],
|
|
1301
|
+
* }
|
|
1302
|
+
* ```
|
|
1265
1303
|
*/
|
|
1266
1304
|
type JSONContent = {
|
|
1305
|
+
/**
|
|
1306
|
+
* The type of the node
|
|
1307
|
+
*/
|
|
1267
1308
|
type?: string;
|
|
1309
|
+
/**
|
|
1310
|
+
* The attributes of the node. Attributes can have any JSON-serializable value.
|
|
1311
|
+
*/
|
|
1268
1312
|
attrs?: Record<string, any> | undefined;
|
|
1313
|
+
/**
|
|
1314
|
+
* The children of the node. A node can have other nodes as children.
|
|
1315
|
+
*/
|
|
1269
1316
|
content?: JSONContent[];
|
|
1317
|
+
/**
|
|
1318
|
+
* A list of marks of the node. Inline nodes can have marks.
|
|
1319
|
+
*/
|
|
1270
1320
|
marks?: {
|
|
1321
|
+
/**
|
|
1322
|
+
* The type of the mark
|
|
1323
|
+
*/
|
|
1271
1324
|
type: string;
|
|
1325
|
+
/**
|
|
1326
|
+
* The attributes of the mark. Attributes can have any JSON-serializable value.
|
|
1327
|
+
*/
|
|
1272
1328
|
attrs?: Record<string, any>;
|
|
1273
1329
|
[key: string]: any;
|
|
1274
1330
|
}[];
|
|
1331
|
+
/**
|
|
1332
|
+
* The text content of the node. This property is only present on text nodes
|
|
1333
|
+
* (i.e. nodes with `type: 'text'`).
|
|
1334
|
+
*
|
|
1335
|
+
* Text nodes cannot have children, but they can have marks.
|
|
1336
|
+
*/
|
|
1275
1337
|
text?: string;
|
|
1276
1338
|
[key: string]: any;
|
|
1277
1339
|
};
|
|
@@ -1333,7 +1395,7 @@ type Attribute = {
|
|
|
1333
1395
|
keepOnSplit?: boolean;
|
|
1334
1396
|
isRequired?: boolean;
|
|
1335
1397
|
};
|
|
1336
|
-
type Attributes
|
|
1398
|
+
type Attributes = {
|
|
1337
1399
|
[key: string]: Attribute;
|
|
1338
1400
|
};
|
|
1339
1401
|
type ExtensionAttribute = {
|
|
@@ -1484,7 +1546,6 @@ type MarkdownParseHelpers = {
|
|
|
1484
1546
|
attrs?: any;
|
|
1485
1547
|
};
|
|
1486
1548
|
};
|
|
1487
|
-
|
|
1488
1549
|
/**
|
|
1489
1550
|
* Return shape for parser-level `parse` handlers.
|
|
1490
1551
|
* - a single JSON-like node
|
|
@@ -1664,59 +1725,6 @@ declare class NodePos {
|
|
|
1664
1725
|
}): void;
|
|
1665
1726
|
}
|
|
1666
1727
|
|
|
1667
|
-
interface InsertContentOptions {
|
|
1668
|
-
/**
|
|
1669
|
-
* Options for parsing the content.
|
|
1670
|
-
*/
|
|
1671
|
-
parseOptions?: ParseOptions;
|
|
1672
|
-
/**
|
|
1673
|
-
* Whether to update the selection after inserting the content.
|
|
1674
|
-
*/
|
|
1675
|
-
updateSelection?: boolean;
|
|
1676
|
-
applyInputRules?: boolean;
|
|
1677
|
-
applyPasteRules?: boolean;
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
interface InsertContentAtOptions {
|
|
1681
|
-
/**
|
|
1682
|
-
* Options for parsing the content.
|
|
1683
|
-
*/
|
|
1684
|
-
parseOptions?: ParseOptions;
|
|
1685
|
-
/**
|
|
1686
|
-
* Whether to update the selection after inserting the content.
|
|
1687
|
-
*/
|
|
1688
|
-
updateSelection?: boolean;
|
|
1689
|
-
/**
|
|
1690
|
-
* Whether to apply input rules after inserting the content.
|
|
1691
|
-
*/
|
|
1692
|
-
applyInputRules?: boolean;
|
|
1693
|
-
/**
|
|
1694
|
-
* Whether to apply paste rules after inserting the content.
|
|
1695
|
-
*/
|
|
1696
|
-
applyPasteRules?: boolean;
|
|
1697
|
-
/**
|
|
1698
|
-
* Whether to throw an error if the content is invalid.
|
|
1699
|
-
*/
|
|
1700
|
-
errorOnInvalidContent?: boolean;
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
interface SetContentOptions {
|
|
1704
|
-
/**
|
|
1705
|
-
* Options for parsing the content.
|
|
1706
|
-
* @default {}
|
|
1707
|
-
*/
|
|
1708
|
-
parseOptions?: ParseOptions;
|
|
1709
|
-
/**
|
|
1710
|
-
* Whether to throw an error if the content is invalid.
|
|
1711
|
-
*/
|
|
1712
|
-
errorOnInvalidContent?: boolean;
|
|
1713
|
-
/**
|
|
1714
|
-
* Whether to emit an update event.
|
|
1715
|
-
* @default true
|
|
1716
|
-
*/
|
|
1717
|
-
emitUpdate?: boolean;
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
1728
|
declare module '@tiptap/core' {
|
|
1721
1729
|
interface Commands<ReturnType> {
|
|
1722
1730
|
blur: {
|
|
@@ -1954,6 +1962,19 @@ declare module '@tiptap/core' {
|
|
|
1954
1962
|
};
|
|
1955
1963
|
}
|
|
1956
1964
|
}
|
|
1965
|
+
|
|
1966
|
+
interface InsertContentOptions {
|
|
1967
|
+
/**
|
|
1968
|
+
* Options for parsing the content.
|
|
1969
|
+
*/
|
|
1970
|
+
parseOptions?: ParseOptions;
|
|
1971
|
+
/**
|
|
1972
|
+
* Whether to update the selection after inserting the content.
|
|
1973
|
+
*/
|
|
1974
|
+
updateSelection?: boolean;
|
|
1975
|
+
applyInputRules?: boolean;
|
|
1976
|
+
applyPasteRules?: boolean;
|
|
1977
|
+
}
|
|
1957
1978
|
declare module '@tiptap/core' {
|
|
1958
1979
|
interface Commands<ReturnType> {
|
|
1959
1980
|
insertContent: {
|
|
@@ -1974,6 +1995,29 @@ declare module '@tiptap/core' {
|
|
|
1974
1995
|
};
|
|
1975
1996
|
}
|
|
1976
1997
|
}
|
|
1998
|
+
|
|
1999
|
+
interface InsertContentAtOptions {
|
|
2000
|
+
/**
|
|
2001
|
+
* Options for parsing the content.
|
|
2002
|
+
*/
|
|
2003
|
+
parseOptions?: ParseOptions;
|
|
2004
|
+
/**
|
|
2005
|
+
* Whether to update the selection after inserting the content.
|
|
2006
|
+
*/
|
|
2007
|
+
updateSelection?: boolean;
|
|
2008
|
+
/**
|
|
2009
|
+
* Whether to apply input rules after inserting the content.
|
|
2010
|
+
*/
|
|
2011
|
+
applyInputRules?: boolean;
|
|
2012
|
+
/**
|
|
2013
|
+
* Whether to apply paste rules after inserting the content.
|
|
2014
|
+
*/
|
|
2015
|
+
applyPasteRules?: boolean;
|
|
2016
|
+
/**
|
|
2017
|
+
* Whether to throw an error if the content is invalid.
|
|
2018
|
+
*/
|
|
2019
|
+
errorOnInvalidContent?: boolean;
|
|
2020
|
+
}
|
|
1977
2021
|
declare module '@tiptap/core' {
|
|
1978
2022
|
interface Commands<ReturnType> {
|
|
1979
2023
|
insertContentAt: {
|
|
@@ -2243,6 +2287,23 @@ declare module '@tiptap/core' {
|
|
|
2243
2287
|
};
|
|
2244
2288
|
}
|
|
2245
2289
|
}
|
|
2290
|
+
|
|
2291
|
+
interface SetContentOptions {
|
|
2292
|
+
/**
|
|
2293
|
+
* Options for parsing the content.
|
|
2294
|
+
* @default {}
|
|
2295
|
+
*/
|
|
2296
|
+
parseOptions?: ParseOptions;
|
|
2297
|
+
/**
|
|
2298
|
+
* Whether to throw an error if the content is invalid.
|
|
2299
|
+
*/
|
|
2300
|
+
errorOnInvalidContent?: boolean;
|
|
2301
|
+
/**
|
|
2302
|
+
* Whether to emit an update event.
|
|
2303
|
+
* @default true
|
|
2304
|
+
*/
|
|
2305
|
+
emitUpdate?: boolean;
|
|
2306
|
+
}
|
|
2246
2307
|
declare module '@tiptap/core' {
|
|
2247
2308
|
interface Commands<ReturnType> {
|
|
2248
2309
|
setContent: {
|
|
@@ -2320,6 +2381,22 @@ declare module '@tiptap/core' {
|
|
|
2320
2381
|
}
|
|
2321
2382
|
}
|
|
2322
2383
|
|
|
2384
|
+
declare module '@tiptap/core' {
|
|
2385
|
+
interface Commands<ReturnType> {
|
|
2386
|
+
setTextDirection: {
|
|
2387
|
+
/**
|
|
2388
|
+
* Set the text direction for nodes.
|
|
2389
|
+
* If no position is provided, it will use the current selection.
|
|
2390
|
+
* @param direction The text direction to set ('ltr', 'rtl', or 'auto')
|
|
2391
|
+
* @param position Optional position or range to apply the direction to
|
|
2392
|
+
* @example editor.commands.setTextDirection('rtl')
|
|
2393
|
+
* @example editor.commands.setTextDirection('ltr', { from: 0, to: 10 })
|
|
2394
|
+
*/
|
|
2395
|
+
setTextDirection: (direction: 'ltr' | 'rtl' | 'auto', position?: number | Range) => ReturnType;
|
|
2396
|
+
};
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2323
2400
|
declare module '@tiptap/core' {
|
|
2324
2401
|
interface Commands<ReturnType> {
|
|
2325
2402
|
setTextSelection: {
|
|
@@ -2496,6 +2573,21 @@ declare module '@tiptap/core' {
|
|
|
2496
2573
|
}
|
|
2497
2574
|
}
|
|
2498
2575
|
|
|
2576
|
+
declare module '@tiptap/core' {
|
|
2577
|
+
interface Commands<ReturnType> {
|
|
2578
|
+
unsetTextDirection: {
|
|
2579
|
+
/**
|
|
2580
|
+
* Remove the text direction attribute from nodes.
|
|
2581
|
+
* If no position is provided, it will use the current selection.
|
|
2582
|
+
* @param position Optional position or range to remove the direction from
|
|
2583
|
+
* @example editor.commands.unsetTextDirection()
|
|
2584
|
+
* @example editor.commands.unsetTextDirection({ from: 0, to: 10 })
|
|
2585
|
+
*/
|
|
2586
|
+
unsetTextDirection: (position?: number | Range) => ReturnType;
|
|
2587
|
+
};
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2499
2591
|
declare module '@tiptap/core' {
|
|
2500
2592
|
interface Commands<ReturnType> {
|
|
2501
2593
|
updateAttributes: {
|
|
@@ -2545,6 +2637,7 @@ declare module '@tiptap/core' {
|
|
|
2545
2637
|
};
|
|
2546
2638
|
}
|
|
2547
2639
|
}
|
|
2640
|
+
|
|
2548
2641
|
declare class Editor extends EventEmitter<EditorEvents> {
|
|
2549
2642
|
private commandManager;
|
|
2550
2643
|
extensionManager: ExtensionManager;
|
|
@@ -2730,13 +2823,13 @@ type DragHandleProps = Omit<Optional<DragHandlePluginProps, 'pluginKey'>, 'eleme
|
|
|
2730
2823
|
pos: number;
|
|
2731
2824
|
}) => void;
|
|
2732
2825
|
};
|
|
2733
|
-
declare const DragHandle: vue_types_vue.ExtendedVue<
|
|
2734
|
-
pluginKey: string | PluginKey
|
|
2826
|
+
declare const DragHandle: vue_types_vue.ExtendedVue<vue.default<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => vue.default>, unknown, unknown, unknown, {
|
|
2827
|
+
pluginKey: string | prosemirror_state.PluginKey<any> | undefined;
|
|
2735
2828
|
editor: Editor;
|
|
2736
2829
|
computePositionConfig: {} | undefined;
|
|
2737
2830
|
onNodeChange: (((data: {
|
|
2738
2831
|
editor: Editor;
|
|
2739
|
-
node: Node
|
|
2832
|
+
node: prosemirror_model.Node | null;
|
|
2740
2833
|
pos: number;
|
|
2741
2834
|
}) => void) & ((data: {
|
|
2742
2835
|
node: Node | null;
|
|
@@ -2746,6 +2839,6 @@ declare const DragHandle: vue_types_vue.ExtendedVue<Vue__default<Record<string,
|
|
|
2746
2839
|
onElementDragStart: ((e: DragEvent) => void) | undefined;
|
|
2747
2840
|
onElementDragEnd: ((e: DragEvent) => void) | undefined;
|
|
2748
2841
|
class: string | undefined;
|
|
2749
|
-
}, {},
|
|
2842
|
+
}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin>;
|
|
2750
2843
|
|
|
2751
2844
|
export { DragHandle, type DragHandleProps, DragHandle as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as vue_types_vue from 'vue/types/vue';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { EditorView, EditorProps, NodeViewConstructor, MarkViewConstructor, NodeView, MarkView } from '@tiptap/pm/view';
|
|
2
|
+
import * as prosemirror_model from 'prosemirror-model';
|
|
3
|
+
import * as prosemirror_state from 'prosemirror-state';
|
|
4
|
+
import * as vue from 'vue';
|
|
5
|
+
import { MarkType as MarkType$1, MarkSpec, Mark as Mark$1, DOMOutputSpec, NodeType as NodeType$1, NodeSpec, Node as Node$2, Slice, ParseOptions, Schema, ResolvedPos, Fragment } from '@tiptap/pm/model';
|
|
6
|
+
import { EditorState, Plugin, Transaction, PluginKey } from '@tiptap/pm/state';
|
|
7
|
+
import { EditorView, EditorProps, NodeView, MarkView, NodeViewConstructor, MarkViewConstructor } from '@tiptap/pm/view';
|
|
9
8
|
import { Transform } from '@tiptap/pm/transform';
|
|
10
9
|
import { DragHandlePluginProps } from '@tiptap/extension-drag-handle';
|
|
11
10
|
|
|
@@ -156,7 +155,7 @@ interface MarkConfig<Options = any, Storage = any> extends ExtendableConfig<Opti
|
|
|
156
155
|
storage: Storage;
|
|
157
156
|
parent: ParentConfig<MarkConfig<Options, Storage>>['addAttributes'];
|
|
158
157
|
editor?: Editor;
|
|
159
|
-
}) => Attributes
|
|
158
|
+
}) => Attributes | {};
|
|
160
159
|
}
|
|
161
160
|
/**
|
|
162
161
|
* The Mark class is used to create custom mark extensions.
|
|
@@ -453,7 +452,7 @@ interface NodeConfig<Options = any, Storage = any> extends ExtendableConfig<Opti
|
|
|
453
452
|
storage: Storage;
|
|
454
453
|
parent: ParentConfig<NodeConfig<Options, Storage>>['addAttributes'];
|
|
455
454
|
editor?: Editor;
|
|
456
|
-
}) => Attributes
|
|
455
|
+
}) => Attributes | {};
|
|
457
456
|
}
|
|
458
457
|
/**
|
|
459
458
|
* The Node class is used to create custom node extensions.
|
|
@@ -872,6 +871,7 @@ declare class Extendable<Options = any, Storage = any, Config = ExtensionConfig<
|
|
|
872
871
|
configure(options?: Partial<Options>): Extendable<Options, Storage, ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>>;
|
|
873
872
|
extend<ExtendedOptions = Options, ExtendedStorage = Storage, ExtendedConfig = ExtensionConfig<ExtendedOptions, ExtendedStorage> | NodeConfig<ExtendedOptions, ExtendedStorage> | MarkConfig<ExtendedOptions, ExtendedStorage>>(extendedConfig?: Partial<ExtendedConfig>): Extendable<ExtendedOptions, ExtendedStorage>;
|
|
874
873
|
}
|
|
874
|
+
|
|
875
875
|
type AnyExtension = Extendable;
|
|
876
876
|
type Extensions = AnyExtension[];
|
|
877
877
|
type ParentConfig<T> = Partial<{
|
|
@@ -1128,6 +1128,14 @@ interface EditorOptions {
|
|
|
1128
1128
|
* Whether the editor is editable
|
|
1129
1129
|
*/
|
|
1130
1130
|
editable: boolean;
|
|
1131
|
+
/**
|
|
1132
|
+
* The default text direction for all content in the editor.
|
|
1133
|
+
* When set to 'ltr' or 'rtl', all nodes will have the corresponding dir attribute.
|
|
1134
|
+
* When set to 'auto', the dir attribute will be set based on content detection.
|
|
1135
|
+
* When undefined, no dir attribute will be added.
|
|
1136
|
+
* @default undefined
|
|
1137
|
+
*/
|
|
1138
|
+
textDirection?: 'ltr' | 'rtl' | 'auto';
|
|
1131
1139
|
/**
|
|
1132
1140
|
* The editor's props
|
|
1133
1141
|
*/
|
|
@@ -1181,7 +1189,7 @@ interface EditorOptions {
|
|
|
1181
1189
|
*
|
|
1182
1190
|
* @default true
|
|
1183
1191
|
*/
|
|
1184
|
-
enableCoreExtensions?: boolean | Partial<Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex' | 'drop' | 'paste' | 'delete', false>>;
|
|
1192
|
+
enableCoreExtensions?: boolean | Partial<Record<'editable' | 'clipboardTextSerializer' | 'commands' | 'focusEvents' | 'keymap' | 'tabindex' | 'drop' | 'paste' | 'delete' | 'textDirection', false>>;
|
|
1185
1193
|
/**
|
|
1186
1194
|
* If `true`, the editor will check the content for errors on initialization.
|
|
1187
1195
|
* Emitting the `contentError` event if the content is invalid.
|
|
@@ -1261,17 +1269,71 @@ interface EditorOptions {
|
|
|
1261
1269
|
*/
|
|
1262
1270
|
type HTMLContent = string;
|
|
1263
1271
|
/**
|
|
1264
|
-
*
|
|
1272
|
+
* A Tiptap JSON node or document. Tiptap JSON is the standard format for
|
|
1273
|
+
* storing and manipulating Tiptap content. It is equivalent to the JSON
|
|
1274
|
+
* representation of a Prosemirror node.
|
|
1275
|
+
*
|
|
1276
|
+
* Tiptap JSON documents are trees of nodes. The root node is usually of type
|
|
1277
|
+
* `doc`. Nodes can have other nodes as children. Nodes can also have marks and
|
|
1278
|
+
* attributes. Text nodes (nodes with type `text`) have a `text` property and no
|
|
1279
|
+
* children.
|
|
1280
|
+
*
|
|
1281
|
+
* @example
|
|
1282
|
+
* ```ts
|
|
1283
|
+
* const content: JSONContent = {
|
|
1284
|
+
* type: 'doc',
|
|
1285
|
+
* content: [
|
|
1286
|
+
* {
|
|
1287
|
+
* type: 'paragraph',
|
|
1288
|
+
* content: [
|
|
1289
|
+
* {
|
|
1290
|
+
* type: 'text',
|
|
1291
|
+
* text: 'Hello ',
|
|
1292
|
+
* },
|
|
1293
|
+
* {
|
|
1294
|
+
* type: 'text',
|
|
1295
|
+
* text: 'world',
|
|
1296
|
+
* marks: [{ type: 'bold' }],
|
|
1297
|
+
* },
|
|
1298
|
+
* ],
|
|
1299
|
+
* },
|
|
1300
|
+
* ],
|
|
1301
|
+
* }
|
|
1302
|
+
* ```
|
|
1265
1303
|
*/
|
|
1266
1304
|
type JSONContent = {
|
|
1305
|
+
/**
|
|
1306
|
+
* The type of the node
|
|
1307
|
+
*/
|
|
1267
1308
|
type?: string;
|
|
1309
|
+
/**
|
|
1310
|
+
* The attributes of the node. Attributes can have any JSON-serializable value.
|
|
1311
|
+
*/
|
|
1268
1312
|
attrs?: Record<string, any> | undefined;
|
|
1313
|
+
/**
|
|
1314
|
+
* The children of the node. A node can have other nodes as children.
|
|
1315
|
+
*/
|
|
1269
1316
|
content?: JSONContent[];
|
|
1317
|
+
/**
|
|
1318
|
+
* A list of marks of the node. Inline nodes can have marks.
|
|
1319
|
+
*/
|
|
1270
1320
|
marks?: {
|
|
1321
|
+
/**
|
|
1322
|
+
* The type of the mark
|
|
1323
|
+
*/
|
|
1271
1324
|
type: string;
|
|
1325
|
+
/**
|
|
1326
|
+
* The attributes of the mark. Attributes can have any JSON-serializable value.
|
|
1327
|
+
*/
|
|
1272
1328
|
attrs?: Record<string, any>;
|
|
1273
1329
|
[key: string]: any;
|
|
1274
1330
|
}[];
|
|
1331
|
+
/**
|
|
1332
|
+
* The text content of the node. This property is only present on text nodes
|
|
1333
|
+
* (i.e. nodes with `type: 'text'`).
|
|
1334
|
+
*
|
|
1335
|
+
* Text nodes cannot have children, but they can have marks.
|
|
1336
|
+
*/
|
|
1275
1337
|
text?: string;
|
|
1276
1338
|
[key: string]: any;
|
|
1277
1339
|
};
|
|
@@ -1333,7 +1395,7 @@ type Attribute = {
|
|
|
1333
1395
|
keepOnSplit?: boolean;
|
|
1334
1396
|
isRequired?: boolean;
|
|
1335
1397
|
};
|
|
1336
|
-
type Attributes
|
|
1398
|
+
type Attributes = {
|
|
1337
1399
|
[key: string]: Attribute;
|
|
1338
1400
|
};
|
|
1339
1401
|
type ExtensionAttribute = {
|
|
@@ -1484,7 +1546,6 @@ type MarkdownParseHelpers = {
|
|
|
1484
1546
|
attrs?: any;
|
|
1485
1547
|
};
|
|
1486
1548
|
};
|
|
1487
|
-
|
|
1488
1549
|
/**
|
|
1489
1550
|
* Return shape for parser-level `parse` handlers.
|
|
1490
1551
|
* - a single JSON-like node
|
|
@@ -1664,59 +1725,6 @@ declare class NodePos {
|
|
|
1664
1725
|
}): void;
|
|
1665
1726
|
}
|
|
1666
1727
|
|
|
1667
|
-
interface InsertContentOptions {
|
|
1668
|
-
/**
|
|
1669
|
-
* Options for parsing the content.
|
|
1670
|
-
*/
|
|
1671
|
-
parseOptions?: ParseOptions;
|
|
1672
|
-
/**
|
|
1673
|
-
* Whether to update the selection after inserting the content.
|
|
1674
|
-
*/
|
|
1675
|
-
updateSelection?: boolean;
|
|
1676
|
-
applyInputRules?: boolean;
|
|
1677
|
-
applyPasteRules?: boolean;
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
interface InsertContentAtOptions {
|
|
1681
|
-
/**
|
|
1682
|
-
* Options for parsing the content.
|
|
1683
|
-
*/
|
|
1684
|
-
parseOptions?: ParseOptions;
|
|
1685
|
-
/**
|
|
1686
|
-
* Whether to update the selection after inserting the content.
|
|
1687
|
-
*/
|
|
1688
|
-
updateSelection?: boolean;
|
|
1689
|
-
/**
|
|
1690
|
-
* Whether to apply input rules after inserting the content.
|
|
1691
|
-
*/
|
|
1692
|
-
applyInputRules?: boolean;
|
|
1693
|
-
/**
|
|
1694
|
-
* Whether to apply paste rules after inserting the content.
|
|
1695
|
-
*/
|
|
1696
|
-
applyPasteRules?: boolean;
|
|
1697
|
-
/**
|
|
1698
|
-
* Whether to throw an error if the content is invalid.
|
|
1699
|
-
*/
|
|
1700
|
-
errorOnInvalidContent?: boolean;
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
interface SetContentOptions {
|
|
1704
|
-
/**
|
|
1705
|
-
* Options for parsing the content.
|
|
1706
|
-
* @default {}
|
|
1707
|
-
*/
|
|
1708
|
-
parseOptions?: ParseOptions;
|
|
1709
|
-
/**
|
|
1710
|
-
* Whether to throw an error if the content is invalid.
|
|
1711
|
-
*/
|
|
1712
|
-
errorOnInvalidContent?: boolean;
|
|
1713
|
-
/**
|
|
1714
|
-
* Whether to emit an update event.
|
|
1715
|
-
* @default true
|
|
1716
|
-
*/
|
|
1717
|
-
emitUpdate?: boolean;
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
1728
|
declare module '@tiptap/core' {
|
|
1721
1729
|
interface Commands<ReturnType> {
|
|
1722
1730
|
blur: {
|
|
@@ -1954,6 +1962,19 @@ declare module '@tiptap/core' {
|
|
|
1954
1962
|
};
|
|
1955
1963
|
}
|
|
1956
1964
|
}
|
|
1965
|
+
|
|
1966
|
+
interface InsertContentOptions {
|
|
1967
|
+
/**
|
|
1968
|
+
* Options for parsing the content.
|
|
1969
|
+
*/
|
|
1970
|
+
parseOptions?: ParseOptions;
|
|
1971
|
+
/**
|
|
1972
|
+
* Whether to update the selection after inserting the content.
|
|
1973
|
+
*/
|
|
1974
|
+
updateSelection?: boolean;
|
|
1975
|
+
applyInputRules?: boolean;
|
|
1976
|
+
applyPasteRules?: boolean;
|
|
1977
|
+
}
|
|
1957
1978
|
declare module '@tiptap/core' {
|
|
1958
1979
|
interface Commands<ReturnType> {
|
|
1959
1980
|
insertContent: {
|
|
@@ -1974,6 +1995,29 @@ declare module '@tiptap/core' {
|
|
|
1974
1995
|
};
|
|
1975
1996
|
}
|
|
1976
1997
|
}
|
|
1998
|
+
|
|
1999
|
+
interface InsertContentAtOptions {
|
|
2000
|
+
/**
|
|
2001
|
+
* Options for parsing the content.
|
|
2002
|
+
*/
|
|
2003
|
+
parseOptions?: ParseOptions;
|
|
2004
|
+
/**
|
|
2005
|
+
* Whether to update the selection after inserting the content.
|
|
2006
|
+
*/
|
|
2007
|
+
updateSelection?: boolean;
|
|
2008
|
+
/**
|
|
2009
|
+
* Whether to apply input rules after inserting the content.
|
|
2010
|
+
*/
|
|
2011
|
+
applyInputRules?: boolean;
|
|
2012
|
+
/**
|
|
2013
|
+
* Whether to apply paste rules after inserting the content.
|
|
2014
|
+
*/
|
|
2015
|
+
applyPasteRules?: boolean;
|
|
2016
|
+
/**
|
|
2017
|
+
* Whether to throw an error if the content is invalid.
|
|
2018
|
+
*/
|
|
2019
|
+
errorOnInvalidContent?: boolean;
|
|
2020
|
+
}
|
|
1977
2021
|
declare module '@tiptap/core' {
|
|
1978
2022
|
interface Commands<ReturnType> {
|
|
1979
2023
|
insertContentAt: {
|
|
@@ -2243,6 +2287,23 @@ declare module '@tiptap/core' {
|
|
|
2243
2287
|
};
|
|
2244
2288
|
}
|
|
2245
2289
|
}
|
|
2290
|
+
|
|
2291
|
+
interface SetContentOptions {
|
|
2292
|
+
/**
|
|
2293
|
+
* Options for parsing the content.
|
|
2294
|
+
* @default {}
|
|
2295
|
+
*/
|
|
2296
|
+
parseOptions?: ParseOptions;
|
|
2297
|
+
/**
|
|
2298
|
+
* Whether to throw an error if the content is invalid.
|
|
2299
|
+
*/
|
|
2300
|
+
errorOnInvalidContent?: boolean;
|
|
2301
|
+
/**
|
|
2302
|
+
* Whether to emit an update event.
|
|
2303
|
+
* @default true
|
|
2304
|
+
*/
|
|
2305
|
+
emitUpdate?: boolean;
|
|
2306
|
+
}
|
|
2246
2307
|
declare module '@tiptap/core' {
|
|
2247
2308
|
interface Commands<ReturnType> {
|
|
2248
2309
|
setContent: {
|
|
@@ -2320,6 +2381,22 @@ declare module '@tiptap/core' {
|
|
|
2320
2381
|
}
|
|
2321
2382
|
}
|
|
2322
2383
|
|
|
2384
|
+
declare module '@tiptap/core' {
|
|
2385
|
+
interface Commands<ReturnType> {
|
|
2386
|
+
setTextDirection: {
|
|
2387
|
+
/**
|
|
2388
|
+
* Set the text direction for nodes.
|
|
2389
|
+
* If no position is provided, it will use the current selection.
|
|
2390
|
+
* @param direction The text direction to set ('ltr', 'rtl', or 'auto')
|
|
2391
|
+
* @param position Optional position or range to apply the direction to
|
|
2392
|
+
* @example editor.commands.setTextDirection('rtl')
|
|
2393
|
+
* @example editor.commands.setTextDirection('ltr', { from: 0, to: 10 })
|
|
2394
|
+
*/
|
|
2395
|
+
setTextDirection: (direction: 'ltr' | 'rtl' | 'auto', position?: number | Range) => ReturnType;
|
|
2396
|
+
};
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2323
2400
|
declare module '@tiptap/core' {
|
|
2324
2401
|
interface Commands<ReturnType> {
|
|
2325
2402
|
setTextSelection: {
|
|
@@ -2496,6 +2573,21 @@ declare module '@tiptap/core' {
|
|
|
2496
2573
|
}
|
|
2497
2574
|
}
|
|
2498
2575
|
|
|
2576
|
+
declare module '@tiptap/core' {
|
|
2577
|
+
interface Commands<ReturnType> {
|
|
2578
|
+
unsetTextDirection: {
|
|
2579
|
+
/**
|
|
2580
|
+
* Remove the text direction attribute from nodes.
|
|
2581
|
+
* If no position is provided, it will use the current selection.
|
|
2582
|
+
* @param position Optional position or range to remove the direction from
|
|
2583
|
+
* @example editor.commands.unsetTextDirection()
|
|
2584
|
+
* @example editor.commands.unsetTextDirection({ from: 0, to: 10 })
|
|
2585
|
+
*/
|
|
2586
|
+
unsetTextDirection: (position?: number | Range) => ReturnType;
|
|
2587
|
+
};
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2499
2591
|
declare module '@tiptap/core' {
|
|
2500
2592
|
interface Commands<ReturnType> {
|
|
2501
2593
|
updateAttributes: {
|
|
@@ -2545,6 +2637,7 @@ declare module '@tiptap/core' {
|
|
|
2545
2637
|
};
|
|
2546
2638
|
}
|
|
2547
2639
|
}
|
|
2640
|
+
|
|
2548
2641
|
declare class Editor extends EventEmitter<EditorEvents> {
|
|
2549
2642
|
private commandManager;
|
|
2550
2643
|
extensionManager: ExtensionManager;
|
|
@@ -2730,13 +2823,13 @@ type DragHandleProps = Omit<Optional<DragHandlePluginProps, 'pluginKey'>, 'eleme
|
|
|
2730
2823
|
pos: number;
|
|
2731
2824
|
}) => void;
|
|
2732
2825
|
};
|
|
2733
|
-
declare const DragHandle: vue_types_vue.ExtendedVue<
|
|
2734
|
-
pluginKey: string | PluginKey
|
|
2826
|
+
declare const DragHandle: vue_types_vue.ExtendedVue<vue.default<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => vue.default>, unknown, unknown, unknown, {
|
|
2827
|
+
pluginKey: string | prosemirror_state.PluginKey<any> | undefined;
|
|
2735
2828
|
editor: Editor;
|
|
2736
2829
|
computePositionConfig: {} | undefined;
|
|
2737
2830
|
onNodeChange: (((data: {
|
|
2738
2831
|
editor: Editor;
|
|
2739
|
-
node: Node
|
|
2832
|
+
node: prosemirror_model.Node | null;
|
|
2740
2833
|
pos: number;
|
|
2741
2834
|
}) => void) & ((data: {
|
|
2742
2835
|
node: Node | null;
|
|
@@ -2746,6 +2839,6 @@ declare const DragHandle: vue_types_vue.ExtendedVue<Vue__default<Record<string,
|
|
|
2746
2839
|
onElementDragStart: ((e: DragEvent) => void) | undefined;
|
|
2747
2840
|
onElementDragEnd: ((e: DragEvent) => void) | undefined;
|
|
2748
2841
|
class: string | undefined;
|
|
2749
|
-
}, {},
|
|
2842
|
+
}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin>;
|
|
2750
2843
|
|
|
2751
2844
|
export { DragHandle, type DragHandleProps, DragHandle as default };
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,12 @@ import {
|
|
|
4
4
|
DragHandlePlugin,
|
|
5
5
|
dragHandlePluginDefaultKey
|
|
6
6
|
} from "@tiptap/extension-drag-handle";
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
// src/Vue.ts
|
|
9
|
+
import VueDefault from "vue";
|
|
10
|
+
var Vue = VueDefault;
|
|
11
|
+
|
|
12
|
+
// src/DragHandle.ts
|
|
8
13
|
var DragHandle = Vue.extend({
|
|
9
14
|
name: "DragHandleVue",
|
|
10
15
|
props: {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
1
|
+
{"version":3,"sources":["../src/DragHandle.ts","../src/Vue.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 { 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<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 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\n mounted() {\n const { editor, pluginKey, onNodeChange, onElementDragStart, onElementDragEnd } = 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 onElementDragStart,\n onElementDragEnd,\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: Vue.CreateElement) {\n return h(\n 'div',\n {\n class: this.class,\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","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;;;ACLP,OAAO,gBAAgB;AAMhB,IAAM,MAAsB;;;ADW5B,IAAM,aAAa,IAAI,OAAO;AAAA,EACnC,MAAM;AAAA,EAEN,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM,CAAC,QAAQ,MAAM;AAAA,MACrB,SAAS,MAAM;AAAA,IACjB;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,oBAAoB;AAAA,MAClB,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA,IAEA,kBAAkB;AAAA,MAChB,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,cAAc,oBAAoB,iBAAiB,IAAI,KAAK;AAEvF,WAAO;AAAA,MACL,iBAAiB;AAAA,QACf;AAAA,QACA,SAAS,KAAK;AAAA,QACd;AAAA,QACA,uBAAuB,EAAE,GAAG,8BAA8B,GAAG,KAAK,sBAAsB;AAAA,QACxF;AAAA,QACA;AAAA,QACA;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,GAAsB;AAC3B,WAAO;AAAA,MACL;AAAA,MACA;AAAA,QACE,OAAO,KAAK;AAAA,MACd;AAAA,MACA,KAAK,OAAO;AAAA,IACd;AAAA,EACF;AACF,CAAC;;;AEtFD,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": "3.
|
|
4
|
+
"version": "3.11.0",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
],
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"vue": "^2.0.0",
|
|
40
|
-
"@tiptap/extension-drag-handle": "^3.
|
|
41
|
-
"@tiptap/pm": "^3.
|
|
42
|
-
"@tiptap/vue-2": "^3.
|
|
40
|
+
"@tiptap/extension-drag-handle": "^3.11.0",
|
|
41
|
+
"@tiptap/pm": "^3.11.0",
|
|
42
|
+
"@tiptap/vue-2": "^3.11.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"vue": "^2.0.0",
|
|
46
46
|
"vue-ts-types": "1.6.2",
|
|
47
|
-
"@tiptap/extension-drag-handle": "^3.
|
|
48
|
-
"@tiptap/pm": "^3.
|
|
49
|
-
"@tiptap/vue-2": "^3.
|
|
47
|
+
"@tiptap/extension-drag-handle": "^3.11.0",
|
|
48
|
+
"@tiptap/pm": "^3.11.0",
|
|
49
|
+
"@tiptap/vue-2": "^3.11.0"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "tsup",
|
package/src/DragHandle.ts
CHANGED
|
@@ -5,7 +5,9 @@ import {
|
|
|
5
5
|
DragHandlePlugin,
|
|
6
6
|
dragHandlePluginDefaultKey,
|
|
7
7
|
} from '@tiptap/extension-drag-handle'
|
|
8
|
-
import
|
|
8
|
+
import { type PropType } from 'vue'
|
|
9
|
+
|
|
10
|
+
import { Vue } from './Vue.js'
|
|
9
11
|
|
|
10
12
|
type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>
|
|
11
13
|
|
|
@@ -77,7 +79,7 @@ export const DragHandle = Vue.extend({
|
|
|
77
79
|
editor.unregisterPlugin(pluginKey as string)
|
|
78
80
|
},
|
|
79
81
|
|
|
80
|
-
render(h) {
|
|
82
|
+
render(h: Vue.CreateElement) {
|
|
81
83
|
return h(
|
|
82
84
|
'div',
|
|
83
85
|
{
|
package/src/Vue.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VueConstructor } from 'vue'
|
|
2
|
+
import VueDefault from 'vue'
|
|
3
|
+
|
|
4
|
+
// With nodenext module resolution, TypeScript treats the default import as the module type.
|
|
5
|
+
// We need to explicitly type it as VueConstructor to access static methods like extend and observable.
|
|
6
|
+
// This is necessary because Vue 2's type definitions export Vue as VueConstructor, but nodenext
|
|
7
|
+
// doesn't correctly infer the default export type.
|
|
8
|
+
export const Vue: VueConstructor = VueDefault as unknown as VueConstructor
|