@tiptap/extension-drag-handle-vue-2 3.14.0 → 3.15.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
@@ -858,6 +858,27 @@ interface ExtendableConfig<Options = any, Storage = any, Config extends Extensio
858
858
  type: PMType;
859
859
  parent: ParentConfig<Config>['onDestroy'];
860
860
  }, event: EditorEvents['destroy']) => void) | null;
861
+ /**
862
+ * This hook allows you to intercept and modify transactions before they are dispatched.
863
+ *
864
+ * Example
865
+ * ```ts
866
+ * dispatchTransaction({ transaction, next }) {
867
+ * console.log('Dispatching transaction:', transaction)
868
+ * next(transaction)
869
+ * }
870
+ * ```
871
+ *
872
+ * @param props - The dispatch transaction props
873
+ */
874
+ dispatchTransaction?: ((this: {
875
+ name: string;
876
+ options: Options;
877
+ storage: Storage;
878
+ editor: Editor;
879
+ type: PMType;
880
+ parent: ParentConfig<Config>['dispatchTransaction'];
881
+ }, props: DispatchTransactionProps) => void) | null;
861
882
  }
862
883
  declare class Extendable<Options = any, Storage = any, Config = ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>> {
863
884
  type: string;
@@ -1092,6 +1113,22 @@ interface EditorEvents {
1092
1113
  mark: Mark$1;
1093
1114
  });
1094
1115
  }
1116
+ /**
1117
+ * Props passed to the `dispatchTransaction` hook in extensions.
1118
+ */
1119
+ type DispatchTransactionProps = {
1120
+ /**
1121
+ * The transaction that is about to be dispatched.
1122
+ */
1123
+ transaction: Transaction;
1124
+ /**
1125
+ * A function that should be called to pass the transaction down to the next extension
1126
+ * (or eventually to the editor).
1127
+ *
1128
+ * @param transaction The transaction to dispatch
1129
+ */
1130
+ next: (transaction: Transaction) => void;
1131
+ };
1095
1132
  type EnableRules = (AnyExtension | string)[] | boolean;
1096
1133
  interface EditorOptions {
1097
1134
  /**
@@ -1263,6 +1300,17 @@ interface EditorOptions {
1263
1300
  * Called when content is deleted from the editor.
1264
1301
  */
1265
1302
  onDelete: (props: EditorEvents['delete']) => void;
1303
+ /**
1304
+ * Whether to enable extension-level dispatching of transactions.
1305
+ * If `false`, extensions cannot define their own `dispatchTransaction` hook.
1306
+ *
1307
+ * @default true
1308
+ * @example
1309
+ * new Editor({
1310
+ * enableExtensionDispatchTransaction: false,
1311
+ * })
1312
+ */
1313
+ enableExtensionDispatchTransaction?: boolean;
1266
1314
  }
1267
1315
  /**
1268
1316
  * The editor's content as HTML
@@ -1727,6 +1775,12 @@ declare class ExtensionManager {
1727
1775
  * @returns An object with all node views where the key is the node name and the value is the node view function
1728
1776
  */
1729
1777
  get nodeViews(): Record<string, NodeViewConstructor>;
1778
+ /**
1779
+ * Get the composed dispatchTransaction function from all extensions.
1780
+ * @param baseDispatch The base dispatch function (e.g. from the editor or user props)
1781
+ * @returns A composed dispatch function
1782
+ */
1783
+ dispatchTransaction(baseDispatch: (tr: Transaction) => void): (tr: Transaction) => void;
1730
1784
  get markViews(): Record<string, MarkViewConstructor>;
1731
1785
  /**
1732
1786
  * Go through all extensions, create extension storages & setup marks
package/dist/index.d.ts CHANGED
@@ -858,6 +858,27 @@ interface ExtendableConfig<Options = any, Storage = any, Config extends Extensio
858
858
  type: PMType;
859
859
  parent: ParentConfig<Config>['onDestroy'];
860
860
  }, event: EditorEvents['destroy']) => void) | null;
861
+ /**
862
+ * This hook allows you to intercept and modify transactions before they are dispatched.
863
+ *
864
+ * Example
865
+ * ```ts
866
+ * dispatchTransaction({ transaction, next }) {
867
+ * console.log('Dispatching transaction:', transaction)
868
+ * next(transaction)
869
+ * }
870
+ * ```
871
+ *
872
+ * @param props - The dispatch transaction props
873
+ */
874
+ dispatchTransaction?: ((this: {
875
+ name: string;
876
+ options: Options;
877
+ storage: Storage;
878
+ editor: Editor;
879
+ type: PMType;
880
+ parent: ParentConfig<Config>['dispatchTransaction'];
881
+ }, props: DispatchTransactionProps) => void) | null;
861
882
  }
862
883
  declare class Extendable<Options = any, Storage = any, Config = ExtensionConfig<Options, Storage> | NodeConfig<Options, Storage> | MarkConfig<Options, Storage>> {
863
884
  type: string;
@@ -1092,6 +1113,22 @@ interface EditorEvents {
1092
1113
  mark: Mark$1;
1093
1114
  });
1094
1115
  }
1116
+ /**
1117
+ * Props passed to the `dispatchTransaction` hook in extensions.
1118
+ */
1119
+ type DispatchTransactionProps = {
1120
+ /**
1121
+ * The transaction that is about to be dispatched.
1122
+ */
1123
+ transaction: Transaction;
1124
+ /**
1125
+ * A function that should be called to pass the transaction down to the next extension
1126
+ * (or eventually to the editor).
1127
+ *
1128
+ * @param transaction The transaction to dispatch
1129
+ */
1130
+ next: (transaction: Transaction) => void;
1131
+ };
1095
1132
  type EnableRules = (AnyExtension | string)[] | boolean;
1096
1133
  interface EditorOptions {
1097
1134
  /**
@@ -1263,6 +1300,17 @@ interface EditorOptions {
1263
1300
  * Called when content is deleted from the editor.
1264
1301
  */
1265
1302
  onDelete: (props: EditorEvents['delete']) => void;
1303
+ /**
1304
+ * Whether to enable extension-level dispatching of transactions.
1305
+ * If `false`, extensions cannot define their own `dispatchTransaction` hook.
1306
+ *
1307
+ * @default true
1308
+ * @example
1309
+ * new Editor({
1310
+ * enableExtensionDispatchTransaction: false,
1311
+ * })
1312
+ */
1313
+ enableExtensionDispatchTransaction?: boolean;
1266
1314
  }
1267
1315
  /**
1268
1316
  * The editor's content as HTML
@@ -1727,6 +1775,12 @@ declare class ExtensionManager {
1727
1775
  * @returns An object with all node views where the key is the node name and the value is the node view function
1728
1776
  */
1729
1777
  get nodeViews(): Record<string, NodeViewConstructor>;
1778
+ /**
1779
+ * Get the composed dispatchTransaction function from all extensions.
1780
+ * @param baseDispatch The base dispatch function (e.g. from the editor or user props)
1781
+ * @returns A composed dispatch function
1782
+ */
1783
+ dispatchTransaction(baseDispatch: (tr: Transaction) => void): (tr: Transaction) => void;
1730
1784
  get markViews(): Record<string, MarkViewConstructor>;
1731
1785
  /**
1732
1786
  * Go through all extensions, create extension storages & setup marks
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.14.0",
4
+ "version": "3.15.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.14.0",
41
- "@tiptap/pm": "^3.14.0",
42
- "@tiptap/vue-2": "^3.14.0"
40
+ "@tiptap/extension-drag-handle": "^3.15.0",
41
+ "@tiptap/pm": "^3.15.0",
42
+ "@tiptap/vue-2": "^3.15.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.14.0",
48
- "@tiptap/pm": "^3.14.0",
49
- "@tiptap/vue-2": "^3.14.0"
47
+ "@tiptap/extension-drag-handle": "^3.15.0",
48
+ "@tiptap/pm": "^3.15.0",
49
+ "@tiptap/vue-2": "^3.15.0"
50
50
  },
51
51
  "scripts": {
52
52
  "build": "tsup",