@tiptap/extension-node-range 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.
package/dist/index.js ADDED
@@ -0,0 +1,310 @@
1
+ import { Extension } from '@tiptap/core';
2
+ import { SelectionRange, Selection, Plugin, PluginKey } from '@tiptap/pm/state';
3
+ import { DecorationSet, Decoration } from '@tiptap/pm/view';
4
+ import { NodeRange as NodeRange$1 } from '@tiptap/pm/model';
5
+
6
+ function getNodeRangeDecorations(ranges) {
7
+ if (!ranges.length) {
8
+ return DecorationSet.empty;
9
+ }
10
+ const decorations = [];
11
+ const doc = ranges[0].$from.node(0);
12
+ ranges.forEach(range => {
13
+ const pos = range.$from.pos;
14
+ const node = range.$from.nodeAfter;
15
+ if (!node) {
16
+ return;
17
+ }
18
+ decorations.push(Decoration.node(pos, pos + node.nodeSize, {
19
+ class: 'ProseMirror-selectednoderange',
20
+ }));
21
+ });
22
+ return DecorationSet.create(doc, decorations);
23
+ }
24
+
25
+ function getSelectionRanges($from, $to, depth) {
26
+ const ranges = [];
27
+ const doc = $from.node(0);
28
+ // eslint-disable-next-line
29
+ depth = (typeof depth === 'number' && depth >= 0)
30
+ ? depth
31
+ : $from.sameParent($to)
32
+ ? Math.max(0, $from.sharedDepth($to.pos) - 1)
33
+ : $from.sharedDepth($to.pos);
34
+ const nodeRange = new NodeRange$1($from, $to, depth);
35
+ const offset = nodeRange.depth === 0
36
+ ? 0
37
+ : doc.resolve(nodeRange.start).posAtIndex(0);
38
+ nodeRange.parent.forEach((node, pos) => {
39
+ const from = offset + pos;
40
+ const to = from + node.nodeSize;
41
+ if (from < nodeRange.start || from >= nodeRange.end) {
42
+ return;
43
+ }
44
+ const selectionRange = new SelectionRange(doc.resolve(from), doc.resolve(to));
45
+ ranges.push(selectionRange);
46
+ });
47
+ return ranges;
48
+ }
49
+
50
+ class NodeRangeBookmark {
51
+ constructor(anchor, head) {
52
+ this.anchor = anchor;
53
+ this.head = head;
54
+ }
55
+ map(mapping) {
56
+ return new NodeRangeBookmark(mapping.map(this.anchor), mapping.map(this.head));
57
+ }
58
+ resolve(doc) {
59
+ const $anchor = doc.resolve(this.anchor);
60
+ const $head = doc.resolve(this.head);
61
+ return new NodeRangeSelection($anchor, $head);
62
+ }
63
+ }
64
+
65
+ class NodeRangeSelection extends Selection {
66
+ constructor($anchor, $head, depth, bias = 1) {
67
+ // if there is only a cursor we can’t calculate a direction of the selection
68
+ // that’s why we adjust the head position by 1 in the desired direction
69
+ const { doc } = $anchor;
70
+ const isCursor = $anchor === $head;
71
+ const isCursorAtEnd = $anchor.pos === doc.content.size && $head.pos === doc.content.size;
72
+ const $correctedHead = isCursor && !isCursorAtEnd
73
+ ? doc.resolve($head.pos + (bias > 0 ? 1 : -1))
74
+ : $head;
75
+ const $correctedAnchor = isCursor && isCursorAtEnd
76
+ ? doc.resolve($anchor.pos - (bias > 0 ? 1 : -1))
77
+ : $anchor;
78
+ const ranges = getSelectionRanges($correctedAnchor.min($correctedHead), $correctedAnchor.max($correctedHead), depth);
79
+ // get the smallest range start position
80
+ // this will become the $anchor
81
+ const $rangeFrom = ($correctedHead.pos >= $anchor.pos)
82
+ ? ranges[0].$from
83
+ : ranges[ranges.length - 1].$to;
84
+ // get the biggest range end position
85
+ // this will become the $head
86
+ const $rangeTo = ($correctedHead.pos >= $anchor.pos)
87
+ ? ranges[ranges.length - 1].$to
88
+ : ranges[0].$from;
89
+ super($rangeFrom, $rangeTo, ranges);
90
+ this.depth = depth;
91
+ }
92
+ // we can safely ignore this TypeScript error: https://github.com/Microsoft/TypeScript/issues/338
93
+ // @ts-ignore
94
+ get $to() {
95
+ return this.ranges[this.ranges.length - 1].$to;
96
+ }
97
+ eq(other) {
98
+ return other instanceof NodeRangeSelection
99
+ && other.$from.pos === this.$from.pos
100
+ && other.$to.pos === this.$to.pos;
101
+ }
102
+ map(doc, mapping) {
103
+ const $anchor = doc.resolve(mapping.map(this.anchor));
104
+ const $head = doc.resolve(mapping.map(this.head));
105
+ return new NodeRangeSelection($anchor, $head);
106
+ }
107
+ toJSON() {
108
+ return {
109
+ type: 'nodeRange',
110
+ anchor: this.anchor,
111
+ head: this.head,
112
+ };
113
+ }
114
+ get isForwards() {
115
+ return this.head >= this.anchor;
116
+ }
117
+ get isBackwards() {
118
+ return !this.isForwards;
119
+ }
120
+ extendBackwards() {
121
+ const { doc } = this.$from;
122
+ if (this.isForwards && this.ranges.length > 1) {
123
+ const ranges = this.ranges.slice(0, -1);
124
+ const $from = ranges[0].$from;
125
+ const $to = ranges[ranges.length - 1].$to;
126
+ return new NodeRangeSelection($from, $to, this.depth);
127
+ }
128
+ const firstRange = this.ranges[0];
129
+ const $from = doc.resolve(Math.max(0, firstRange.$from.pos - 1));
130
+ return new NodeRangeSelection(this.$anchor, $from, this.depth);
131
+ }
132
+ extendForwards() {
133
+ const { doc } = this.$from;
134
+ if (this.isBackwards && this.ranges.length > 1) {
135
+ const ranges = this.ranges.slice(1);
136
+ const $from = ranges[0].$from;
137
+ const $to = ranges[ranges.length - 1].$to;
138
+ return new NodeRangeSelection($to, $from, this.depth);
139
+ }
140
+ const lastRange = this.ranges[this.ranges.length - 1];
141
+ const $to = doc.resolve(Math.min(doc.content.size, lastRange.$to.pos + 1));
142
+ return new NodeRangeSelection(this.$anchor, $to, this.depth);
143
+ }
144
+ static fromJSON(doc, json) {
145
+ return new NodeRangeSelection(doc.resolve(json.anchor), doc.resolve(json.head));
146
+ }
147
+ static create(doc, anchor, head, depth, bias = 1) {
148
+ return new this(doc.resolve(anchor), doc.resolve(head), depth, bias);
149
+ }
150
+ getBookmark() {
151
+ return new NodeRangeBookmark(this.anchor, this.head);
152
+ }
153
+ }
154
+ NodeRangeSelection.prototype.visible = false;
155
+
156
+ function isNodeRangeSelection(value) {
157
+ return value instanceof NodeRangeSelection;
158
+ }
159
+
160
+ const NodeRange = Extension.create({
161
+ name: 'nodeRange',
162
+ addOptions() {
163
+ return {
164
+ depth: undefined,
165
+ key: 'Mod',
166
+ };
167
+ },
168
+ addKeyboardShortcuts() {
169
+ return {
170
+ // extend NodeRangeSelection upwards
171
+ 'Shift-ArrowUp': ({ editor }) => {
172
+ const { depth } = this.options;
173
+ const { view, state } = editor;
174
+ const { doc, selection, tr } = state;
175
+ const { anchor, head } = selection;
176
+ if (!isNodeRangeSelection(selection)) {
177
+ const nodeRangeSelection = NodeRangeSelection.create(doc, anchor, head, depth, -1);
178
+ tr.setSelection(nodeRangeSelection);
179
+ view.dispatch(tr);
180
+ return true;
181
+ }
182
+ const nodeRangeSelection = selection.extendBackwards();
183
+ tr.setSelection(nodeRangeSelection);
184
+ view.dispatch(tr);
185
+ return true;
186
+ },
187
+ // extend NodeRangeSelection downwards
188
+ 'Shift-ArrowDown': ({ editor }) => {
189
+ const { depth } = this.options;
190
+ const { view, state } = editor;
191
+ const { doc, selection, tr } = state;
192
+ const { anchor, head } = selection;
193
+ if (!isNodeRangeSelection(selection)) {
194
+ const nodeRangeSelection = NodeRangeSelection.create(doc, anchor, head, depth);
195
+ tr.setSelection(nodeRangeSelection);
196
+ view.dispatch(tr);
197
+ return true;
198
+ }
199
+ const nodeRangeSelection = selection.extendForwards();
200
+ tr.setSelection(nodeRangeSelection);
201
+ view.dispatch(tr);
202
+ return true;
203
+ },
204
+ // add `NodeRangeSelection` to all nodes
205
+ 'Mod-a': ({ editor }) => {
206
+ const { depth } = this.options;
207
+ const { view, state } = editor;
208
+ const { doc, tr } = state;
209
+ const nodeRangeSelection = NodeRangeSelection.create(doc, 0, doc.content.size, depth);
210
+ tr.setSelection(nodeRangeSelection);
211
+ view.dispatch(tr);
212
+ return true;
213
+ },
214
+ };
215
+ },
216
+ onSelectionUpdate() {
217
+ const { selection } = this.editor.state;
218
+ if (isNodeRangeSelection(selection)) {
219
+ this.editor.view.dom.classList.add('ProseMirror-noderangeselection');
220
+ }
221
+ },
222
+ addProseMirrorPlugins() {
223
+ let hideTextSelection = false;
224
+ let activeMouseSelection = false;
225
+ return [
226
+ new Plugin({
227
+ key: new PluginKey('nodeRange'),
228
+ props: {
229
+ attributes: () => {
230
+ if (hideTextSelection) {
231
+ return {
232
+ class: 'ProseMirror-noderangeselection',
233
+ };
234
+ }
235
+ return { class: '' };
236
+ },
237
+ handleDOMEvents: {
238
+ mousedown: (view, event) => {
239
+ const { key } = this.options;
240
+ const isMac = /Mac/.test(navigator.platform);
241
+ const isShift = !!event.shiftKey;
242
+ const isControl = !!event.ctrlKey;
243
+ const isAlt = !!event.altKey;
244
+ const isMeta = !!event.metaKey;
245
+ const isMod = isMac
246
+ ? isMeta
247
+ : isControl;
248
+ if (key === null
249
+ || key === undefined
250
+ || (key === 'Shift' && isShift)
251
+ || (key === 'Control' && isControl)
252
+ || (key === 'Alt' && isAlt)
253
+ || (key === 'Meta' && isMeta)
254
+ || (key === 'Mod' && isMod)) {
255
+ activeMouseSelection = true;
256
+ }
257
+ if (!activeMouseSelection) {
258
+ return false;
259
+ }
260
+ document.addEventListener('mouseup', () => {
261
+ activeMouseSelection = false;
262
+ const { state } = view;
263
+ const { doc, selection, tr } = state;
264
+ const { $anchor, $head } = selection;
265
+ if ($anchor.sameParent($head)) {
266
+ return;
267
+ }
268
+ const nodeRangeSelection = NodeRangeSelection.create(doc, $anchor.pos, $head.pos, this.options.depth);
269
+ tr.setSelection(nodeRangeSelection);
270
+ view.dispatch(tr);
271
+ }, { once: true });
272
+ return false;
273
+ },
274
+ },
275
+ // when selecting some text we want to render some decorations
276
+ // to preview a `NodeRangeSelection`
277
+ decorations: state => {
278
+ const { selection } = state;
279
+ const isNodeRange = isNodeRangeSelection(selection);
280
+ hideTextSelection = false;
281
+ if (!activeMouseSelection) {
282
+ if (!isNodeRange) {
283
+ return null;
284
+ }
285
+ hideTextSelection = true;
286
+ return getNodeRangeDecorations(selection.ranges);
287
+ }
288
+ const { $from, $to } = selection;
289
+ // selection is probably in the same node like a paragraph
290
+ // so we don’t render decorations and show
291
+ // a simple text selection instead
292
+ if (!isNodeRange && $from.sameParent($to)) {
293
+ return null;
294
+ }
295
+ // try to calculate some node ranges
296
+ const nodeRanges = getSelectionRanges($from, $to, this.options.depth);
297
+ if (!nodeRanges.length) {
298
+ return null;
299
+ }
300
+ hideTextSelection = true;
301
+ return getNodeRangeDecorations(nodeRanges);
302
+ },
303
+ },
304
+ }),
305
+ ];
306
+ },
307
+ });
308
+
309
+ export { NodeRange, NodeRangeSelection, NodeRange as default, getNodeRangeDecorations, getSelectionRanges, isNodeRangeSelection };
310
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/helpers/getNodeRangeDecorations.ts","../src/helpers/getSelectionRanges.ts","../src/helpers/NodeRangeBookmark.ts","../src/helpers/NodeRangeSelection.ts","../src/helpers/isNodeRangeSelection.ts","../src/node-range.ts"],"sourcesContent":["import { SelectionRange } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\n\nexport function getNodeRangeDecorations(ranges: SelectionRange[]): DecorationSet {\n if (!ranges.length) {\n return DecorationSet.empty\n }\n\n const decorations: Decoration[] = []\n const doc = ranges[0].$from.node(0)\n\n ranges.forEach(range => {\n const pos = range.$from.pos\n const node = range.$from.nodeAfter\n\n if (!node) {\n return\n }\n\n decorations.push(\n Decoration.node(pos, pos + node.nodeSize, {\n class: 'ProseMirror-selectednoderange',\n }),\n )\n })\n\n return DecorationSet.create(doc, decorations)\n}\n","import { NodeRange, ResolvedPos } from '@tiptap/pm/model'\nimport { SelectionRange } from '@tiptap/pm/state'\n\nexport function getSelectionRanges(\n $from: ResolvedPos,\n $to: ResolvedPos,\n depth?: number,\n): SelectionRange[] {\n const ranges: SelectionRange[] = []\n const doc = $from.node(0)\n\n // eslint-disable-next-line\n depth = (typeof depth === 'number' && depth >= 0)\n ? depth\n : $from.sameParent($to)\n ? Math.max(0, $from.sharedDepth($to.pos) - 1)\n : $from.sharedDepth($to.pos)\n\n const nodeRange = new NodeRange($from, $to, depth)\n const offset = nodeRange.depth === 0\n ? 0\n : doc.resolve(nodeRange.start).posAtIndex(0)\n\n nodeRange.parent.forEach((node, pos) => {\n const from = offset + pos\n const to = from + node.nodeSize\n\n if (from < nodeRange.start || from >= nodeRange.end) {\n return\n }\n\n const selectionRange = new SelectionRange(doc.resolve(from), doc.resolve(to))\n\n ranges.push(selectionRange)\n })\n\n return ranges\n}\n","import { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Mappable } from '@tiptap/pm/transform'\n\nimport { NodeRangeSelection } from './NodeRangeSelection.js'\n\nexport class NodeRangeBookmark {\n\n anchor!: number\n\n head!: number\n\n constructor(anchor: number, head: number) {\n this.anchor = anchor\n this.head = head\n }\n\n map(mapping: Mappable) {\n return new NodeRangeBookmark(mapping.map(this.anchor), mapping.map(this.head))\n }\n\n resolve(doc: ProseMirrorNode) {\n const $anchor = doc.resolve(this.anchor)\n const $head = doc.resolve(this.head)\n\n return new NodeRangeSelection($anchor, $head)\n }\n\n}\n","import { Node as ProseMirrorNode, ResolvedPos } from '@tiptap/pm/model'\nimport { Selection } from '@tiptap/pm/state'\nimport { Mapping } from '@tiptap/pm/transform'\n\nimport { getSelectionRanges } from './getSelectionRanges.js'\nimport { NodeRangeBookmark } from './NodeRangeBookmark.js'\n\nexport class NodeRangeSelection extends Selection {\n\n depth: number | undefined\n\n constructor($anchor: ResolvedPos, $head: ResolvedPos, depth?: number, bias = 1) {\n // if there is only a cursor we can’t calculate a direction of the selection\n // that’s why we adjust the head position by 1 in the desired direction\n const { doc } = $anchor\n const isCursor = $anchor === $head\n const isCursorAtEnd = $anchor.pos === doc.content.size && $head.pos === doc.content.size\n const $correctedHead = isCursor && !isCursorAtEnd\n ? doc.resolve($head.pos + (bias > 0 ? 1 : -1))\n : $head\n const $correctedAnchor = isCursor && isCursorAtEnd\n ? doc.resolve($anchor.pos - (bias > 0 ? 1 : -1))\n : $anchor\n\n const ranges = getSelectionRanges(\n $correctedAnchor.min($correctedHead),\n $correctedAnchor.max($correctedHead),\n depth,\n )\n\n // get the smallest range start position\n // this will become the $anchor\n const $rangeFrom = ($correctedHead.pos >= $anchor.pos)\n ? ranges[0].$from\n : ranges[ranges.length - 1].$to\n\n // get the biggest range end position\n // this will become the $head\n const $rangeTo = ($correctedHead.pos >= $anchor.pos)\n ? ranges[ranges.length - 1].$to\n : ranges[0].$from\n\n super($rangeFrom, $rangeTo, ranges)\n\n this.depth = depth\n }\n\n // we can safely ignore this TypeScript error: https://github.com/Microsoft/TypeScript/issues/338\n // @ts-ignore\n get $to() {\n return this.ranges[this.ranges.length - 1].$to\n }\n\n eq(other: Selection): boolean {\n return other instanceof NodeRangeSelection\n && other.$from.pos === this.$from.pos\n && other.$to.pos === this.$to.pos\n }\n\n map(doc: ProseMirrorNode, mapping: Mapping): NodeRangeSelection {\n const $anchor = doc.resolve(mapping.map(this.anchor))\n const $head = doc.resolve(mapping.map(this.head))\n\n return new NodeRangeSelection($anchor, $head)\n }\n\n toJSON() {\n return {\n type: 'nodeRange',\n anchor: this.anchor,\n head: this.head,\n }\n }\n\n get isForwards(): boolean {\n return this.head >= this.anchor\n }\n\n get isBackwards(): boolean {\n return !this.isForwards\n }\n\n extendBackwards(): NodeRangeSelection {\n const { doc } = this.$from\n\n if (this.isForwards && this.ranges.length > 1) {\n const ranges = this.ranges.slice(0, -1)\n const $from = ranges[0].$from\n const $to = ranges[ranges.length - 1].$to\n\n return new NodeRangeSelection($from, $to, this.depth)\n }\n\n const firstRange = this.ranges[0]\n const $from = doc.resolve(Math.max(0, firstRange.$from.pos - 1))\n\n return new NodeRangeSelection(this.$anchor, $from, this.depth)\n }\n\n extendForwards(): NodeRangeSelection {\n const { doc } = this.$from\n\n if (this.isBackwards && this.ranges.length > 1) {\n const ranges = this.ranges.slice(1)\n const $from = ranges[0].$from\n const $to = ranges[ranges.length - 1].$to\n\n return new NodeRangeSelection($to, $from, this.depth)\n }\n\n const lastRange = this.ranges[this.ranges.length - 1]\n const $to = doc.resolve(Math.min(doc.content.size, lastRange.$to.pos + 1))\n\n return new NodeRangeSelection(this.$anchor, $to, this.depth)\n }\n\n static fromJSON(doc: ProseMirrorNode, json: any): NodeRangeSelection {\n return new NodeRangeSelection(doc.resolve(json.anchor), doc.resolve(json.head))\n }\n\n static create(doc: ProseMirrorNode, anchor: number, head: number, depth?: number, bias = 1): NodeRangeSelection {\n return new this(doc.resolve(anchor), doc.resolve(head), depth, bias)\n }\n\n getBookmark(): NodeRangeBookmark {\n return new NodeRangeBookmark(this.anchor, this.head)\n }\n\n}\n\nNodeRangeSelection.prototype.visible = false\n","import { NodeRangeSelection } from './NodeRangeSelection.js'\n\nexport function isNodeRangeSelection(value: unknown): value is NodeRangeSelection {\n return value instanceof NodeRangeSelection\n}\n","import { Extension } from '@tiptap/core'\nimport { Plugin, PluginKey, SelectionRange } from '@tiptap/pm/state'\n\nimport { getNodeRangeDecorations } from './helpers/getNodeRangeDecorations.js'\nimport { getSelectionRanges } from './helpers/getSelectionRanges.js'\nimport { isNodeRangeSelection } from './helpers/isNodeRangeSelection.js'\nimport { NodeRangeSelection } from './helpers/NodeRangeSelection.js'\n\nexport interface NodeRangeOptions {\n depth: number | undefined,\n key: 'Shift' | 'Control' | 'Alt' | 'Meta' | 'Mod' | null | undefined,\n}\n\nexport const NodeRange = Extension.create<NodeRangeOptions>({\n name: 'nodeRange',\n\n addOptions() {\n return {\n depth: undefined,\n key: 'Mod',\n }\n },\n\n addKeyboardShortcuts() {\n return {\n // extend NodeRangeSelection upwards\n 'Shift-ArrowUp': ({ editor }) => {\n const { depth } = this.options\n const { view, state } = editor\n const { doc, selection, tr } = state\n const { anchor, head } = selection\n\n if (!isNodeRangeSelection(selection)) {\n const nodeRangeSelection = NodeRangeSelection.create(doc, anchor, head, depth, -1)\n\n tr.setSelection(nodeRangeSelection)\n view.dispatch(tr)\n\n return true\n }\n\n const nodeRangeSelection = selection.extendBackwards()\n\n tr.setSelection(nodeRangeSelection)\n view.dispatch(tr)\n\n return true\n },\n\n // extend NodeRangeSelection downwards\n 'Shift-ArrowDown': ({ editor }) => {\n const { depth } = this.options\n const { view, state } = editor\n const { doc, selection, tr } = state\n const { anchor, head } = selection\n\n if (!isNodeRangeSelection(selection)) {\n const nodeRangeSelection = NodeRangeSelection.create(doc, anchor, head, depth)\n\n tr.setSelection(nodeRangeSelection)\n view.dispatch(tr)\n\n return true\n }\n\n const nodeRangeSelection = selection.extendForwards()\n\n tr.setSelection(nodeRangeSelection)\n view.dispatch(tr)\n\n return true\n },\n\n // add `NodeRangeSelection` to all nodes\n 'Mod-a': ({ editor }) => {\n const { depth } = this.options\n const { view, state } = editor\n const { doc, tr } = state\n const nodeRangeSelection = NodeRangeSelection.create(doc, 0, doc.content.size, depth)\n\n tr.setSelection(nodeRangeSelection)\n view.dispatch(tr)\n\n return true\n },\n }\n },\n\n onSelectionUpdate() {\n const { selection } = this.editor.state\n\n if (isNodeRangeSelection(selection)) {\n this.editor.view.dom.classList.add('ProseMirror-noderangeselection')\n }\n },\n\n addProseMirrorPlugins() {\n let hideTextSelection = false\n let activeMouseSelection = false\n\n return [\n new Plugin({\n key: new PluginKey('nodeRange'),\n\n props: {\n attributes: () => {\n if (hideTextSelection) {\n return {\n class: 'ProseMirror-noderangeselection',\n }\n }\n\n return { class: '' }\n },\n\n handleDOMEvents: {\n mousedown: (view, event) => {\n const { key } = this.options\n const isMac = /Mac/.test(navigator.platform)\n const isShift = !!event.shiftKey\n const isControl = !!event.ctrlKey\n const isAlt = !!event.altKey\n const isMeta = !!event.metaKey\n const isMod = isMac\n ? isMeta\n : isControl\n\n if (\n key === null\n || key === undefined\n || (key === 'Shift' && isShift)\n || (key === 'Control' && isControl)\n || (key === 'Alt' && isAlt)\n || (key === 'Meta' && isMeta)\n || (key === 'Mod' && isMod)\n ) {\n activeMouseSelection = true\n }\n\n if (!activeMouseSelection) {\n return false\n }\n\n document.addEventListener('mouseup', () => {\n activeMouseSelection = false\n\n const { state } = view\n const { doc, selection, tr } = state\n const { $anchor, $head } = selection\n\n if ($anchor.sameParent($head)) {\n return\n }\n\n const nodeRangeSelection = NodeRangeSelection.create(doc, $anchor.pos, $head.pos, this.options.depth)\n\n tr.setSelection(nodeRangeSelection)\n view.dispatch(tr)\n }, { once: true })\n\n return false\n },\n },\n\n // when selecting some text we want to render some decorations\n // to preview a `NodeRangeSelection`\n decorations: state => {\n const { selection } = state\n const isNodeRange = isNodeRangeSelection(selection)\n\n hideTextSelection = false\n\n if (!activeMouseSelection) {\n if (!isNodeRange) {\n return null\n }\n\n hideTextSelection = true\n\n return getNodeRangeDecorations(selection.ranges as SelectionRange[])\n }\n\n const { $from, $to } = selection\n\n // selection is probably in the same node like a paragraph\n // so we don’t render decorations and show\n // a simple text selection instead\n if (!isNodeRange && $from.sameParent($to)) {\n return null\n }\n\n // try to calculate some node ranges\n const nodeRanges = getSelectionRanges($from, $to, this.options.depth)\n\n if (!nodeRanges.length) {\n return null\n }\n\n hideTextSelection = true\n\n return getNodeRangeDecorations(nodeRanges)\n },\n },\n }),\n ]\n },\n})\n"],"names":["NodeRange"],"mappings":";;;;;AAGM,SAAU,uBAAuB,CAAC,MAAwB,EAAA;AAC9D,IAAA,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;QAClB,OAAO,aAAa,CAAC,KAAK;;IAG5B,MAAM,WAAW,GAAiB,EAAE;AACpC,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAEnC,IAAA,MAAM,CAAC,OAAO,CAAC,KAAK,IAAG;AACrB,QAAA,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG;AAC3B,QAAA,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS;QAElC,IAAI,CAAC,IAAI,EAAE;YACT;;AAGF,QAAA,WAAW,CAAC,IAAI,CACd,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE;AACxC,YAAA,KAAK,EAAE,+BA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