@tiptap/extension-unique-id 2.0.0-beta.4 → 2.22.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.
Files changed (31) hide show
  1. package/README.md +14 -0
  2. package/dist/helpers/findDuplicates.d.ts +5 -0
  3. package/dist/helpers/findDuplicates.d.ts.map +1 -0
  4. package/dist/helpers/removeDuplicates.d.ts +9 -0
  5. package/dist/helpers/removeDuplicates.d.ts.map +1 -0
  6. package/dist/{tiptap-extension-unique-id.cjs.js → index.cjs} +253 -282
  7. package/dist/index.cjs.map +1 -0
  8. package/dist/index.d.ts +4 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/{tiptap-extension-unique-id.esm.js → index.js} +253 -282
  11. package/dist/index.js.map +1 -0
  12. package/dist/{tiptap-extension-unique-id.umd.js → index.umd.js} +255 -283
  13. package/dist/index.umd.js.map +1 -0
  14. package/dist/{tiptap-pro/packages/extension-unique-id/src/unique-id.d.ts → unique-id.d.ts} +10 -9
  15. package/dist/unique-id.d.ts.map +1 -0
  16. package/package.json +31 -13
  17. package/src/helpers/findDuplicates.ts +2 -2
  18. package/src/helpers/removeDuplicates.ts +1 -1
  19. package/src/index.ts +2 -2
  20. package/src/unique-id.ts +97 -33
  21. package/dist/tiptap-extension-unique-id.cjs.js.map +0 -1
  22. package/dist/tiptap-extension-unique-id.esm.js.map +0 -1
  23. package/dist/tiptap-extension-unique-id.umd.js.map +0 -1
  24. package/dist/tiptap-pro/packages/extension-unique-id/src/helpers/combineTransactionSteps.d.ts +0 -7
  25. package/dist/tiptap-pro/packages/extension-unique-id/src/helpers/findDuplicates.d.ts +0 -4
  26. package/dist/tiptap-pro/packages/extension-unique-id/src/helpers/getChangedRanges.d.ts +0 -12
  27. package/dist/tiptap-pro/packages/extension-unique-id/src/helpers/removeDuplicates.d.ts +0 -8
  28. package/dist/tiptap-pro/packages/extension-unique-id/src/index.d.ts +0 -3
  29. package/src/helpers/arrayDifference.ts +0 -35
  30. package/src/helpers/combineTransactionSteps.ts +0 -18
  31. package/src/helpers/getChangedRanges.ts +0 -78
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/helpers/removeDuplicates.ts","../src/helpers/findDuplicates.ts","../src/unique-id.ts"],"sourcesContent":["/**\n * Removes duplicated values within an array.\n * Supports numbers, strings and objects.\n */\nexport function removeDuplicates<T>(array: T[], by = JSON.stringify): T[] {\n const seen: Record<any, any> = {}\n\n return array.filter(item => {\n const key = by(item)\n\n return Object.prototype.hasOwnProperty.call(seen, key)\n ? false\n : (seen[key] = true)\n })\n}\n","import { removeDuplicates } from './removeDuplicates.js'\n\n/**\n * Returns a list of duplicated items within an array.\n */\nexport function findDuplicates(items: any[]): any[] {\n const filtered = items.filter((el, index) => items.indexOf(el) !== index)\n const duplicates = removeDuplicates(filtered)\n\n return duplicates\n}\n","import {\n combineTransactionSteps,\n Extension,\n findChildren,\n findChildrenInRange,\n getChangedRanges,\n} from '@tiptap/core'\nimport { Fragment, Node as ProseMirrorNode, Slice } from '@tiptap/pm/model'\nimport { Plugin, PluginKey, Transaction } from '@tiptap/pm/state'\nimport { v4 as uuidv4 } from 'uuid'\n\nimport { findDuplicates } from './helpers/findDuplicates.js'\n\nexport interface UniqueIDOptions {\n attributeName: string,\n types: string[],\n generateID: () => any,\n filterTransaction: ((transaction: Transaction) => boolean) | null,\n}\n\nexport const UniqueID = Extension.create<UniqueIDOptions>({\n name: 'uniqueID',\n\n // we’ll set a very high priority to make sure this runs first\n // and is compatible with `appendTransaction` hooks of other extensions\n priority: 10000,\n\n addOptions() {\n return {\n attributeName: 'id',\n types: [],\n generateID: () => uuidv4(),\n filterTransaction: null,\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n [this.options.attributeName]: {\n default: null,\n parseHTML: element => element.getAttribute(`data-${this.options.attributeName}`),\n renderHTML: attributes => {\n if (!attributes[this.options.attributeName]) {\n return {}\n }\n\n return {\n [`data-${this.options.attributeName}`]: attributes[this.options.attributeName],\n }\n },\n },\n },\n },\n ]\n },\n\n // check initial content for missing ids\n onCreate() {\n const collab = this.editor.extensionManager.extensions.find(ext => ext.name === 'collaboration')\n const provider = collab?.options ? collab.options.provider : undefined\n\n const createIds = () => {\n const { view, state } = this.editor\n const { tr, doc } = state\n const { types, attributeName, generateID } = this.options\n const nodesWithoutId = findChildren(doc, node => {\n return types.includes(node.type.name) && node.attrs[attributeName] === null\n })\n\n nodesWithoutId.forEach(({ node, pos }) => {\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n [attributeName]: generateID(),\n })\n })\n\n tr.setMeta('addToHistory', false)\n\n view.dispatch(tr)\n\n if (provider) {\n provider.off('synced', createIds)\n }\n }\n\n /**\n * We need to handle collaboration a bit different here\n * because we can't automatically add IDs when the provider is not yet synced\n * otherwise we end up with empty paragraphs\n */\n if (collab) {\n if (!provider) {\n return createIds()\n }\n\n provider.on('synced', createIds)\n } else {\n return createIds()\n }\n },\n\n addProseMirrorPlugins() {\n let dragSourceElement: Element | null = null\n let transformPasted = false\n\n return [\n new Plugin({\n key: new PluginKey('uniqueID'),\n\n appendTransaction: (transactions, oldState, newState) => {\n const hasDocChanges = transactions.some(transaction => transaction.docChanged)\n && !oldState.doc.eq(newState.doc)\n const filterTransactions = this.options.filterTransaction\n && transactions.some(tr => !this.options.filterTransaction?.(tr))\n\n const isCollabTransaction = transactions.find(tr => tr.getMeta('y-sync$'))\n\n if (isCollabTransaction) {\n return\n }\n\n if (!hasDocChanges || filterTransactions) {\n return\n }\n\n const { tr } = newState\n\n const { types, attributeName, generateID } = this.options\n const transform = combineTransactionSteps(oldState.doc, transactions as Transaction[])\n const { mapping } = transform\n\n // get changed ranges based on the old state\n const changes = getChangedRanges(transform)\n\n changes.forEach(({ newRange }) => {\n const newNodes = findChildrenInRange(newState.doc, newRange, node => {\n return types.includes(node.type.name)\n })\n\n const newIds = newNodes\n .map(({ node }) => node.attrs[attributeName])\n .filter(id => id !== null)\n\n newNodes.forEach(({ node, pos }, i) => {\n // instead of checking `node.attrs[attributeName]` directly\n // we look at the current state of the node within `tr.doc`.\n // this helps to prevent adding new ids to the same node\n // if the node changed multiple times within one transaction\n const id = tr.doc.nodeAt(pos)?.attrs[attributeName]\n\n if (id === null) {\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n [attributeName]: generateID(),\n })\n\n return\n }\n\n const nextNode = newNodes[i + 1]\n\n if (nextNode && node.content.size === 0) {\n tr.setNodeMarkup(nextNode.pos, undefined, {\n ...nextNode.node.attrs,\n [attributeName]: id,\n })\n newIds[i + 1] = id\n\n if (nextNode.node.attrs[attributeName]) {\n return\n }\n\n const generatedId = generateID()\n\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n [attributeName]: generatedId,\n })\n newIds[i] = generatedId\n\n return tr\n }\n\n const duplicatedNewIds = findDuplicates(newIds)\n\n // check if the node doesn’t exist in the old state\n const { deleted } = mapping.invert().mapResult(pos)\n\n const newNode = deleted && duplicatedNewIds.includes(id)\n\n if (newNode) {\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n [attributeName]: generateID(),\n })\n }\n })\n\n })\n\n if (!tr.steps.length) {\n return\n }\n\n // `tr.setNodeMarkup` resets the stored marks\n // so we’ll restore them if they exist\n tr.setStoredMarks(newState.tr.storedMarks)\n\n return tr\n },\n\n // we register a global drag handler to track the current drag source element\n view(view) {\n const handleDragstart = (event: DragEvent) => {\n dragSourceElement = view.dom.parentElement?.contains(event.target as Element)\n ? view.dom.parentElement\n : null\n }\n\n window.addEventListener('dragstart', handleDragstart)\n\n return {\n destroy() {\n window.removeEventListener('dragstart', handleDragstart)\n },\n }\n },\n\n props: {\n // `handleDOMEvents` is called before `transformPasted`\n // so we can do some checks before\n handleDOMEvents: {\n // only create new ids for dropped content\n // or dropped content while holding `alt`\n // or content is dragged from another editor\n drop: (view, event) => {\n if (\n dragSourceElement !== view.dom.parentElement\n || event.dataTransfer?.effectAllowed === 'copyMove'\n || event.dataTransfer?.effectAllowed === 'copy'\n ) {\n dragSourceElement = null\n transformPasted = true\n }\n\n return false\n },\n // always create new ids on pasted content\n paste: () => {\n transformPasted = true\n\n return false\n },\n },\n\n // we’ll remove ids for every pasted node\n // so we can create a new one within `appendTransaction`\n transformPasted: slice => {\n if (!transformPasted) {\n return slice\n }\n\n const { types, attributeName } = this.options\n const removeId = (fragment: Fragment): Fragment => {\n const list: ProseMirrorNode[] = []\n\n fragment.forEach(node => {\n // don’t touch text nodes\n if (node.isText) {\n list.push(node)\n\n return\n }\n\n // check for any other child nodes\n if (!types.includes(node.type.name)) {\n list.push(node.copy(removeId(node.content)))\n\n return\n }\n\n // remove id\n const nodeWithoutId = node.type.create(\n {\n ...node.attrs,\n [attributeName]: null,\n },\n removeId(node.content),\n node.marks,\n )\n\n list.push(nodeWithoutId)\n })\n\n return Fragment.from(list)\n }\n\n // reset check\n transformPasted = false\n\n return new Slice(removeId(slice.content), slice.openStart, slice.openEnd)\n },\n },\n }),\n ]\n },\n\n})\n"],"names":["uuidv4"],"mappings":";;;;;AAAA;;;AAGG;AACG,SAAU,gBAAgB,CAAI,KAAU,EAAE,EAAE,GAAG,IAAI,CAAC,SAAS,EAAA;IACjE,MAAM,IAAI,GAAqB,EAAE;AAEjC,IAAA,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,IAAG;AACzB,QAAA,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;QAEpB,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG;AACnD,cAAE;eACC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AACxB,KAAC,CAAC;AACJ;;ACZA;;AAEG;AACG,SAAU,cAAc,CAAC,KAAY,EAAA;IACzC,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,KAAK,KAAK,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,KAAK,C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Q,CAAC,OAAO,CAAC,IAAI,IAAG;;AAEtB,gCAAA,IAAI,IAAI,CAAC,MAAM,EAAE;AACf,oCAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;oCAEf;;;AAIF,gCAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;AACnC,oCAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;oCAE5C;;;AAIF,gCAAA,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CACpC;oCACE,GAAG,IAAI,CAAC,KAAK;oCACb,CAAC,aAAa,GAAG,IAAI;iCACtB,EACD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EACtB,IAAI,CAAC,KAAK,CACX;AAED,gCAAA,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;AAC1B,6BAAC,CAAC;AAEF,4BAAA,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;AAC5B,yBAAC;;wBAGD,eAAe,GAAG,KAAK;AAEvB,wBAAA,OAAO,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC;qBAC1E;AACF,iBAAA;aACF,CAAC;SACH;KACF;AAEF,CAAA;;;;"}
@@ -1,296 +1,268 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core'), require('prosemirror-state'), require('prosemirror-model'), require('uuid'), require('prosemirror-transform')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core', 'prosemirror-state', 'prosemirror-model', 'uuid', 'prosemirror-transform'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-unique-id"] = {}, global.core, global.prosemirrorState, global.prosemirrorModel, global.uuid, global.prosemirrorTransform));
5
- })(this, (function (exports, core, prosemirrorState, prosemirrorModel, uuid, prosemirrorTransform) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core'), require('@tiptap/pm/model'), require('@tiptap/pm/state'), require('uuid')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core', '@tiptap/pm/model', '@tiptap/pm/state', 'uuid'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-unique-id"] = {}, global.core, global.model, global.state, global.uuid));
5
+ })(this, (function (exports, core, model, state, uuid) { 'use strict';
6
6
 
7
- /**
8
- * Returns a new `Transform` based on all steps of the passed transactions.
9
- */
10
- function combineTransactionSteps(oldDoc, transactions) {
11
- const transform = new prosemirrorTransform.Transform(oldDoc);
12
- transactions.forEach(transaction => {
13
- transaction.steps.forEach(step => {
14
- transform.step(step);
15
- });
16
- });
17
- return transform;
7
+ /**
8
+ * Removes duplicated values within an array.
9
+ * Supports numbers, strings and objects.
10
+ */
11
+ function removeDuplicates(array, by = JSON.stringify) {
12
+ const seen = {};
13
+ return array.filter(item => {
14
+ const key = by(item);
15
+ return Object.prototype.hasOwnProperty.call(seen, key)
16
+ ? false
17
+ : (seen[key] = true);
18
+ });
18
19
  }
19
20
 
20
- /**
21
- * Removes duplicated values within an array.
22
- * Supports numbers, strings and objects.
23
- */
24
- function removeDuplicates(array, by = JSON.stringify) {
25
- const seen = {};
26
- return array.filter(item => {
27
- const key = by(item);
28
- return Object.prototype.hasOwnProperty.call(seen, key)
29
- ? false
30
- : (seen[key] = true);
31
- });
21
+ /**
22
+ * Returns a list of duplicated items within an array.
23
+ */
24
+ function findDuplicates(items) {
25
+ const filtered = items.filter((el, index) => items.indexOf(el) !== index);
26
+ const duplicates = removeDuplicates(filtered);
27
+ return duplicates;
32
28
  }
33
29
 
34
- /**
35
- * Removes duplicated ranges and ranges that are
36
- * fully captured by other ranges.
37
- */
38
- function simplifyChangedRanges(changes) {
39
- const uniqueChanges = removeDuplicates(changes);
40
- return uniqueChanges.length === 1
41
- ? uniqueChanges
42
- : uniqueChanges.filter((change, index) => {
43
- const rest = uniqueChanges.filter((_, i) => i !== index);
44
- return !rest.some(otherChange => {
45
- return change.oldStart >= otherChange.oldStart
46
- && change.oldEnd <= otherChange.oldEnd
47
- && change.newStart >= otherChange.newStart
48
- && change.newEnd <= otherChange.newEnd;
49
- });
50
- });
51
- }
52
- /**
53
- * Returns a list of changed ranges
54
- * based on the first and last state of all steps.
55
- */
56
- function getChangedRanges(transform) {
57
- const { mapping, steps } = transform;
58
- const changes = [];
59
- mapping.maps.forEach((stepMap, index) => {
60
- // This accounts for step changes where no range was actually altered
61
- // e.g. when setting a mark, node attribute, etc.
62
- // @ts-ignore
63
- if (!stepMap.ranges.length) {
64
- const step = steps[index];
65
- if (step.from === undefined || step.to === undefined) {
66
- return;
67
- }
68
- changes.push({
69
- oldStart: step.from,
70
- oldEnd: step.to,
71
- newStart: step.from,
72
- newEnd: step.to,
73
- });
74
- }
75
- else {
76
- stepMap.forEach((from, to) => {
77
- const newStart = mapping.slice(index).map(from, -1);
78
- const newEnd = mapping.slice(index).map(to);
79
- const oldStart = mapping.invert().map(newStart, -1);
80
- const oldEnd = mapping.invert().map(newEnd);
81
- changes.push({
82
- oldStart,
83
- oldEnd,
84
- newStart,
85
- newEnd,
86
- });
87
- });
88
- }
89
- });
90
- return simplifyChangedRanges(changes);
91
- }
92
-
93
- /**
94
- * Returns a list of duplicated items within an array.
95
- */
96
- function findDuplicates(items) {
97
- const filtered = items.filter((el, index) => items.indexOf(el) !== index);
98
- const duplicates = removeDuplicates(filtered);
99
- return duplicates;
100
- }
101
-
102
- const UniqueID = core.Extension.create({
103
- name: 'uniqueID',
104
- // we’ll set a very high priority to make sure this runs first
105
- // and is compatible with `appendTransaction` hooks of other extensions
106
- priority: 10000,
107
- addOptions() {
108
- return {
109
- attributeName: 'id',
110
- types: [],
111
- generateID: () => uuid.v4(),
112
- filterTransaction: null,
113
- };
114
- },
115
- addGlobalAttributes() {
116
- return [
117
- {
118
- types: this.options.types,
119
- attributes: {
120
- [this.options.attributeName]: {
121
- default: null,
122
- parseHTML: element => element.getAttribute(`data-${this.options.attributeName}`),
123
- renderHTML: attributes => {
124
- if (!attributes[this.options.attributeName]) {
125
- return {};
126
- }
127
- return {
128
- [`data-${this.options.attributeName}`]: attributes[this.options.attributeName],
129
- };
130
- },
131
- },
132
- },
133
- },
134
- ];
135
- },
136
- // check initial content for missing ids
137
- onCreate() {
138
- const { view, state } = this.editor;
139
- const { tr, doc } = state;
140
- const { types, attributeName, generateID } = this.options;
141
- const nodesWithoutId = core.findChildren(doc, node => {
142
- return types.includes(node.type.name)
143
- && node.attrs[attributeName] === null;
144
- });
145
- nodesWithoutId.forEach(({ node, pos }) => {
146
- tr.setNodeMarkup(pos, undefined, {
147
- ...node.attrs,
148
- [attributeName]: generateID(),
149
- });
150
- });
151
- view.dispatch(tr);
152
- },
153
- addProseMirrorPlugins() {
154
- let dragSourceElement = null;
155
- let transformPasted = false;
156
- return [
157
- new prosemirrorState.Plugin({
158
- key: new prosemirrorState.PluginKey('uniqueID'),
159
- appendTransaction: (transactions, oldState, newState) => {
160
- const docChanges = transactions.some(transaction => transaction.docChanged)
161
- && !oldState.doc.eq(newState.doc);
162
- const filterTransactions = this.options.filterTransaction
163
- && transactions.some(tr => { var _a, _b; return !((_b = (_a = this.options).filterTransaction) === null || _b === void 0 ? void 0 : _b.call(_a, tr)); });
164
- if (!docChanges || filterTransactions) {
165
- return;
166
- }
167
- const { tr } = newState;
168
- const { types, attributeName, generateID } = this.options;
169
- const transform = combineTransactionSteps(oldState.doc, transactions);
170
- const { mapping } = transform;
171
- // get changed ranges based on the old state
172
- const changes = getChangedRanges(transform);
173
- changes.forEach(change => {
174
- const newRange = {
175
- from: change.newStart,
176
- to: change.newEnd,
177
- };
178
- const newNodes = core.findChildrenInRange(newState.doc, newRange, node => {
179
- return types.includes(node.type.name);
180
- });
181
- const newIds = newNodes
182
- .map(({ node }) => node.attrs[attributeName])
183
- .filter(id => id !== null);
184
- const duplicatedNewIds = findDuplicates(newIds);
185
- newNodes.forEach(({ node, pos }) => {
186
- var _a;
187
- // instead of checking `node.attrs[attributeName]` directly
188
- // we look at the current state of the node within `tr.doc`.
189
- // this helps to prevent adding new ids to the same node
190
- // if the node changed multiple times within one transaction
191
- const id = (_a = tr.doc.nodeAt(pos)) === null || _a === void 0 ? void 0 : _a.attrs[attributeName];
192
- if (id === null) {
193
- tr.setNodeMarkup(pos, undefined, {
194
- ...node.attrs,
195
- [attributeName]: generateID(),
196
- });
197
- return;
198
- }
199
- // check if the node doesn’t exist in the old state
200
- const { deleted } = mapping.invert().mapResult(pos);
201
- const newNode = deleted && duplicatedNewIds.includes(id);
202
- if (newNode) {
203
- tr.setNodeMarkup(pos, undefined, {
204
- ...node.attrs,
205
- [attributeName]: generateID(),
206
- });
207
- }
208
- });
209
- });
210
- if (!tr.steps.length) {
211
- return;
212
- }
213
- return tr;
214
- },
215
- // we register a global drag handler to track the current drag source element
216
- view(view) {
217
- const handleDragstart = (event) => {
218
- var _a;
219
- dragSourceElement = ((_a = view.dom.parentElement) === null || _a === void 0 ? void 0 : _a.contains(event.target))
220
- ? view.dom.parentElement
221
- : null;
222
- };
223
- window.addEventListener('dragstart', handleDragstart);
224
- return {
225
- destroy() {
226
- window.removeEventListener('dragstart', handleDragstart);
227
- },
228
- };
229
- },
230
- props: {
231
- // `handleDOMEvents` is called before `transformPasted`
232
- // so we can do some checks before
233
- handleDOMEvents: {
234
- // only create new ids for dropped content while holding `alt`
235
- // or content is dragged from another editor
236
- drop: (view, event) => {
237
- var _a;
238
- if (dragSourceElement !== view.dom.parentElement
239
- || ((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.effectAllowed) === 'copy') {
240
- dragSourceElement = null;
241
- transformPasted = true;
242
- }
243
- return false;
244
- },
245
- // always create new ids on pasted content
246
- paste: () => {
247
- transformPasted = true;
248
- return false;
249
- },
250
- },
251
- // we’ll remove ids for every pasted node
252
- // so we can create a new one within `appendTransaction`
253
- transformPasted: slice => {
254
- if (!transformPasted) {
255
- return slice;
256
- }
257
- const { types, attributeName } = this.options;
258
- const removeId = (fragment) => {
259
- const list = [];
260
- fragment.forEach(node => {
261
- // don’t touch text nodes
262
- if (node.isText) {
263
- list.push(node);
264
- return;
265
- }
266
- // check for any other child nodes
267
- if (!types.includes(node.type.name)) {
268
- list.push(node.copy(removeId(node.content)));
269
- return;
270
- }
271
- // remove id
272
- const nodeWithoutId = node.type.create({
273
- ...node.attrs,
274
- [attributeName]: null,
275
- }, removeId(node.content), node.marks);
276
- list.push(nodeWithoutId);
277
- });
278
- return prosemirrorModel.Fragment.from(list);
279
- };
280
- // reset check
281
- transformPasted = false;
282
- return new prosemirrorModel.Slice(removeId(slice.content), slice.openStart, slice.openEnd);
283
- },
284
- },
285
- }),
286
- ];
287
- },
30
+ const UniqueID = core.Extension.create({
31
+ name: 'uniqueID',
32
+ // we’ll set a very high priority to make sure this runs first
33
+ // and is compatible with `appendTransaction` hooks of other extensions
34
+ priority: 10000,
35
+ addOptions() {
36
+ return {
37
+ attributeName: 'id',
38
+ types: [],
39
+ generateID: () => uuid.v4(),
40
+ filterTransaction: null,
41
+ };
42
+ },
43
+ addGlobalAttributes() {
44
+ return [
45
+ {
46
+ types: this.options.types,
47
+ attributes: {
48
+ [this.options.attributeName]: {
49
+ default: null,
50
+ parseHTML: element => element.getAttribute(`data-${this.options.attributeName}`),
51
+ renderHTML: attributes => {
52
+ if (!attributes[this.options.attributeName]) {
53
+ return {};
54
+ }
55
+ return {
56
+ [`data-${this.options.attributeName}`]: attributes[this.options.attributeName],
57
+ };
58
+ },
59
+ },
60
+ },
61
+ },
62
+ ];
63
+ },
64
+ // check initial content for missing ids
65
+ onCreate() {
66
+ const collab = this.editor.extensionManager.extensions.find(ext => ext.name === 'collaboration');
67
+ const provider = (collab === null || collab === void 0 ? void 0 : collab.options) ? collab.options.provider : undefined;
68
+ const createIds = () => {
69
+ const { view, state } = this.editor;
70
+ const { tr, doc } = state;
71
+ const { types, attributeName, generateID } = this.options;
72
+ const nodesWithoutId = core.findChildren(doc, node => {
73
+ return types.includes(node.type.name) && node.attrs[attributeName] === null;
74
+ });
75
+ nodesWithoutId.forEach(({ node, pos }) => {
76
+ tr.setNodeMarkup(pos, undefined, {
77
+ ...node.attrs,
78
+ [attributeName]: generateID(),
79
+ });
80
+ });
81
+ tr.setMeta('addToHistory', false);
82
+ view.dispatch(tr);
83
+ if (provider) {
84
+ provider.off('synced', createIds);
85
+ }
86
+ };
87
+ /**
88
+ * We need to handle collaboration a bit different here
89
+ * because we can't automatically add IDs when the provider is not yet synced
90
+ * otherwise we end up with empty paragraphs
91
+ */
92
+ if (collab) {
93
+ if (!provider) {
94
+ return createIds();
95
+ }
96
+ provider.on('synced', createIds);
97
+ }
98
+ else {
99
+ return createIds();
100
+ }
101
+ },
102
+ addProseMirrorPlugins() {
103
+ let dragSourceElement = null;
104
+ let transformPasted = false;
105
+ return [
106
+ new state.Plugin({
107
+ key: new state.PluginKey('uniqueID'),
108
+ appendTransaction: (transactions, oldState, newState) => {
109
+ const hasDocChanges = transactions.some(transaction => transaction.docChanged)
110
+ && !oldState.doc.eq(newState.doc);
111
+ const filterTransactions = this.options.filterTransaction
112
+ && transactions.some(tr => { var _a, _b; return !((_b = (_a = this.options).filterTransaction) === null || _b === void 0 ? void 0 : _b.call(_a, tr)); });
113
+ const isCollabTransaction = transactions.find(tr => tr.getMeta('y-sync$'));
114
+ if (isCollabTransaction) {
115
+ return;
116
+ }
117
+ if (!hasDocChanges || filterTransactions) {
118
+ return;
119
+ }
120
+ const { tr } = newState;
121
+ const { types, attributeName, generateID } = this.options;
122
+ const transform = core.combineTransactionSteps(oldState.doc, transactions);
123
+ const { mapping } = transform;
124
+ // get changed ranges based on the old state
125
+ const changes = core.getChangedRanges(transform);
126
+ changes.forEach(({ newRange }) => {
127
+ const newNodes = core.findChildrenInRange(newState.doc, newRange, node => {
128
+ return types.includes(node.type.name);
129
+ });
130
+ const newIds = newNodes
131
+ .map(({ node }) => node.attrs[attributeName])
132
+ .filter(id => id !== null);
133
+ newNodes.forEach(({ node, pos }, i) => {
134
+ var _a;
135
+ // instead of checking `node.attrs[attributeName]` directly
136
+ // we look at the current state of the node within `tr.doc`.
137
+ // this helps to prevent adding new ids to the same node
138
+ // if the node changed multiple times within one transaction
139
+ const id = (_a = tr.doc.nodeAt(pos)) === null || _a === void 0 ? void 0 : _a.attrs[attributeName];
140
+ if (id === null) {
141
+ tr.setNodeMarkup(pos, undefined, {
142
+ ...node.attrs,
143
+ [attributeName]: generateID(),
144
+ });
145
+ return;
146
+ }
147
+ const nextNode = newNodes[i + 1];
148
+ if (nextNode && node.content.size === 0) {
149
+ tr.setNodeMarkup(nextNode.pos, undefined, {
150
+ ...nextNode.node.attrs,
151
+ [attributeName]: id,
152
+ });
153
+ newIds[i + 1] = id;
154
+ if (nextNode.node.attrs[attributeName]) {
155
+ return;
156
+ }
157
+ const generatedId = generateID();
158
+ tr.setNodeMarkup(pos, undefined, {
159
+ ...node.attrs,
160
+ [attributeName]: generatedId,
161
+ });
162
+ newIds[i] = generatedId;
163
+ return tr;
164
+ }
165
+ const duplicatedNewIds = findDuplicates(newIds);
166
+ // check if the node doesn’t exist in the old state
167
+ const { deleted } = mapping.invert().mapResult(pos);
168
+ const newNode = deleted && duplicatedNewIds.includes(id);
169
+ if (newNode) {
170
+ tr.setNodeMarkup(pos, undefined, {
171
+ ...node.attrs,
172
+ [attributeName]: generateID(),
173
+ });
174
+ }
175
+ });
176
+ });
177
+ if (!tr.steps.length) {
178
+ return;
179
+ }
180
+ // `tr.setNodeMarkup` resets the stored marks
181
+ // so we’ll restore them if they exist
182
+ tr.setStoredMarks(newState.tr.storedMarks);
183
+ return tr;
184
+ },
185
+ // we register a global drag handler to track the current drag source element
186
+ view(view) {
187
+ const handleDragstart = (event) => {
188
+ var _a;
189
+ dragSourceElement = ((_a = view.dom.parentElement) === null || _a === void 0 ? void 0 : _a.contains(event.target))
190
+ ? view.dom.parentElement
191
+ : null;
192
+ };
193
+ window.addEventListener('dragstart', handleDragstart);
194
+ return {
195
+ destroy() {
196
+ window.removeEventListener('dragstart', handleDragstart);
197
+ },
198
+ };
199
+ },
200
+ props: {
201
+ // `handleDOMEvents` is called before `transformPasted`
202
+ // so we can do some checks before
203
+ handleDOMEvents: {
204
+ // only create new ids for dropped content
205
+ // or dropped content while holding `alt`
206
+ // or content is dragged from another editor
207
+ drop: (view, event) => {
208
+ var _a, _b;
209
+ if (dragSourceElement !== view.dom.parentElement
210
+ || ((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.effectAllowed) === 'copyMove'
211
+ || ((_b = event.dataTransfer) === null || _b === void 0 ? void 0 : _b.effectAllowed) === 'copy') {
212
+ dragSourceElement = null;
213
+ transformPasted = true;
214
+ }
215
+ return false;
216
+ },
217
+ // always create new ids on pasted content
218
+ paste: () => {
219
+ transformPasted = true;
220
+ return false;
221
+ },
222
+ },
223
+ // we’ll remove ids for every pasted node
224
+ // so we can create a new one within `appendTransaction`
225
+ transformPasted: slice => {
226
+ if (!transformPasted) {
227
+ return slice;
228
+ }
229
+ const { types, attributeName } = this.options;
230
+ const removeId = (fragment) => {
231
+ const list = [];
232
+ fragment.forEach(node => {
233
+ // don’t touch text nodes
234
+ if (node.isText) {
235
+ list.push(node);
236
+ return;
237
+ }
238
+ // check for any other child nodes
239
+ if (!types.includes(node.type.name)) {
240
+ list.push(node.copy(removeId(node.content)));
241
+ return;
242
+ }
243
+ // remove id
244
+ const nodeWithoutId = node.type.create({
245
+ ...node.attrs,
246
+ [attributeName]: null,
247
+ }, removeId(node.content), node.marks);
248
+ list.push(nodeWithoutId);
249
+ });
250
+ return model.Fragment.from(list);
251
+ };
252
+ // reset check
253
+ transformPasted = false;
254
+ return new model.Slice(removeId(slice.content), slice.openStart, slice.openEnd);
255
+ },
256
+ },
257
+ }),
258
+ ];
259
+ },
288
260
  });
289
261
 
290
262
  exports.UniqueID = UniqueID;
291
- exports["default"] = UniqueID;
263
+ exports.default = UniqueID;
292
264
 
293
265
  Object.defineProperty(exports, '__esModule', { value: true });
294
266
 
295
267
  }));
296
- //# sourceMappingURL=tiptap-extension-unique-id.umd.js.map
268
+ //# sourceMappingURL=index.umd.js.map