@tiptap/extension-drag-handle-vue-3 3.11.1 → 3.12.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.d.cts CHANGED
@@ -2,7 +2,7 @@ import * as _floating_ui_dom from '@floating-ui/dom';
2
2
  import { EditorState, Plugin, Transaction, PluginKey } from '@tiptap/pm/state';
3
3
  import { MarkType as MarkType$1, MarkSpec, Mark as Mark$1, DOMOutputSpec, NodeType as NodeType$1, NodeSpec, Node as Node$1, Slice, ParseOptions, Schema, ResolvedPos, Fragment } from '@tiptap/pm/model';
4
4
  import { EditorView, EditorProps, NodeView, MarkView, NodeViewConstructor, MarkViewConstructor } from '@tiptap/pm/view';
5
- import { Transform } from '@tiptap/pm/transform';
5
+ import { Transform, MapResult } from '@tiptap/pm/transform';
6
6
  import * as vue from 'vue';
7
7
  import { PropType } from 'vue';
8
8
  import { DragHandlePluginProps } from '@tiptap/extension-drag-handle';
@@ -1613,6 +1613,31 @@ type MarkdownRendererHelpers = {
1613
1613
  */
1614
1614
  indent: (content: string) => string;
1615
1615
  };
1616
+ type Utils = {
1617
+ /**
1618
+ * Returns the new position after applying a transaction.
1619
+ *
1620
+ * @param position The position to update. A MappablePosition instance.
1621
+ * @param transaction The transaction to apply.
1622
+ * @returns The new position after applying the transaction.
1623
+ *
1624
+ * @example
1625
+ * const position = editor.utils.createMappablePosition(10)
1626
+ * const {position, mapResult} = editor.utils.getUpdatedPosition(position, transaction)
1627
+ */
1628
+ getUpdatedPosition: (position: MappablePosition, transaction: Transaction) => GetUpdatedPositionResult;
1629
+ /**
1630
+ * Creates a MappablePosition from a position number. A mappable position can be used to track the
1631
+ * next position after applying a transaction.
1632
+ *
1633
+ * @param position The position (as a number) where the MappablePosition will be created.
1634
+ * @returns A new MappablePosition instance at the given position.
1635
+ *
1636
+ * @example
1637
+ * const position = editor.utils.createMappablePosition(10)
1638
+ */
1639
+ createMappablePosition: (position: number) => MappablePosition;
1640
+ };
1616
1641
 
1617
1642
  /**
1618
1643
  * Create a flattened array of extensions by traversing the `addExtensions` field.
@@ -1624,6 +1649,33 @@ declare function flattenExtensions(extensions: Extensions): Extensions;
1624
1649
  interface ExtensionConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, ExtensionConfig<Options, Storage>, null> {
1625
1650
  }
1626
1651
 
1652
+ /**
1653
+ * A class that represents a mappable position in the editor. It can be extended
1654
+ * by other extensions to add additional position mapping capabilities.
1655
+ */
1656
+ declare class MappablePosition {
1657
+ /**
1658
+ * The absolute position in the editor.
1659
+ */
1660
+ position: number;
1661
+ constructor(position: number);
1662
+ /**
1663
+ * Creates a MappablePosition from a JSON object.
1664
+ */
1665
+ static fromJSON(json: any): MappablePosition;
1666
+ /**
1667
+ * Converts the MappablePosition to a JSON object.
1668
+ */
1669
+ toJSON(): any;
1670
+ }
1671
+ /**
1672
+ * The result of the getUpdatedPosition function.
1673
+ */
1674
+ interface GetUpdatedPositionResult {
1675
+ position: MappablePosition;
1676
+ mapResult: MapResult | null;
1677
+ }
1678
+
1627
1679
  /**
1628
1680
  * Returns a flattened and sorted extension list while
1629
1681
  * also checking for duplicated extensions and warns the user.
@@ -2807,6 +2859,10 @@ declare class Editor extends EventEmitter<EditorEvents> {
2807
2859
  }): NodePos[] | null;
2808
2860
  $pos(pos: number): NodePos;
2809
2861
  get $doc(): NodePos;
2862
+ /**
2863
+ * Returns a set of utilities for working with positions and ranges.
2864
+ */
2865
+ utils: Utils;
2810
2866
  }
2811
2867
 
2812
2868
  interface Commands<ReturnType = any> {
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import * as _floating_ui_dom from '@floating-ui/dom';
2
2
  import { EditorState, Plugin, Transaction, PluginKey } from '@tiptap/pm/state';
3
3
  import { MarkType as MarkType$1, MarkSpec, Mark as Mark$1, DOMOutputSpec, NodeType as NodeType$1, NodeSpec, Node as Node$1, Slice, ParseOptions, Schema, ResolvedPos, Fragment } from '@tiptap/pm/model';
4
4
  import { EditorView, EditorProps, NodeView, MarkView, NodeViewConstructor, MarkViewConstructor } from '@tiptap/pm/view';
5
- import { Transform } from '@tiptap/pm/transform';
5
+ import { Transform, MapResult } from '@tiptap/pm/transform';
6
6
  import * as vue from 'vue';
7
7
  import { PropType } from 'vue';
8
8
  import { DragHandlePluginProps } from '@tiptap/extension-drag-handle';
@@ -1613,6 +1613,31 @@ type MarkdownRendererHelpers = {
1613
1613
  */
1614
1614
  indent: (content: string) => string;
1615
1615
  };
1616
+ type Utils = {
1617
+ /**
1618
+ * Returns the new position after applying a transaction.
1619
+ *
1620
+ * @param position The position to update. A MappablePosition instance.
1621
+ * @param transaction The transaction to apply.
1622
+ * @returns The new position after applying the transaction.
1623
+ *
1624
+ * @example
1625
+ * const position = editor.utils.createMappablePosition(10)
1626
+ * const {position, mapResult} = editor.utils.getUpdatedPosition(position, transaction)
1627
+ */
1628
+ getUpdatedPosition: (position: MappablePosition, transaction: Transaction) => GetUpdatedPositionResult;
1629
+ /**
1630
+ * Creates a MappablePosition from a position number. A mappable position can be used to track the
1631
+ * next position after applying a transaction.
1632
+ *
1633
+ * @param position The position (as a number) where the MappablePosition will be created.
1634
+ * @returns A new MappablePosition instance at the given position.
1635
+ *
1636
+ * @example
1637
+ * const position = editor.utils.createMappablePosition(10)
1638
+ */
1639
+ createMappablePosition: (position: number) => MappablePosition;
1640
+ };
1616
1641
 
1617
1642
  /**
1618
1643
  * Create a flattened array of extensions by traversing the `addExtensions` field.
@@ -1624,6 +1649,33 @@ declare function flattenExtensions(extensions: Extensions): Extensions;
1624
1649
  interface ExtensionConfig<Options = any, Storage = any> extends ExtendableConfig<Options, Storage, ExtensionConfig<Options, Storage>, null> {
1625
1650
  }
1626
1651
 
1652
+ /**
1653
+ * A class that represents a mappable position in the editor. It can be extended
1654
+ * by other extensions to add additional position mapping capabilities.
1655
+ */
1656
+ declare class MappablePosition {
1657
+ /**
1658
+ * The absolute position in the editor.
1659
+ */
1660
+ position: number;
1661
+ constructor(position: number);
1662
+ /**
1663
+ * Creates a MappablePosition from a JSON object.
1664
+ */
1665
+ static fromJSON(json: any): MappablePosition;
1666
+ /**
1667
+ * Converts the MappablePosition to a JSON object.
1668
+ */
1669
+ toJSON(): any;
1670
+ }
1671
+ /**
1672
+ * The result of the getUpdatedPosition function.
1673
+ */
1674
+ interface GetUpdatedPositionResult {
1675
+ position: MappablePosition;
1676
+ mapResult: MapResult | null;
1677
+ }
1678
+
1627
1679
  /**
1628
1680
  * Returns a flattened and sorted extension list while
1629
1681
  * also checking for duplicated extensions and warns the user.
@@ -2807,6 +2859,10 @@ declare class Editor extends EventEmitter<EditorEvents> {
2807
2859
  }): NodePos[] | null;
2808
2860
  $pos(pos: number): NodePos;
2809
2861
  get $doc(): NodePos;
2862
+ /**
2863
+ * Returns a set of utilities for working with positions and ranges.
2864
+ */
2865
+ utils: Utils;
2810
2866
  }
2811
2867
 
2812
2868
  interface Commands<ReturnType = any> {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-drag-handle-vue-3",
3
3
  "description": "drag handle extension for tiptap with vue 3",
4
- "version": "3.11.1",
4
+ "version": "3.12.0",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -37,15 +37,15 @@
37
37
  ],
38
38
  "peerDependencies": {
39
39
  "vue": "^3.0.0",
40
- "@tiptap/extension-drag-handle": "^3.11.1",
41
- "@tiptap/pm": "^3.11.1",
42
- "@tiptap/vue-3": "^3.11.1"
40
+ "@tiptap/extension-drag-handle": "^3.12.0",
41
+ "@tiptap/pm": "^3.12.0",
42
+ "@tiptap/vue-3": "^3.12.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "vue": "^3.0.0",
46
- "@tiptap/extension-drag-handle": "^3.11.1",
47
- "@tiptap/pm": "^3.11.1",
48
- "@tiptap/vue-3": "^3.11.1"
46
+ "@tiptap/extension-drag-handle": "^3.12.0",
47
+ "@tiptap/pm": "^3.12.0",
48
+ "@tiptap/vue-3": "^3.12.0"
49
49
  },
50
50
  "scripts": {
51
51
  "build": "tsup",