{"version":3,"file":"index.cjs","names":["DecorationSet","Decoration","NodeRange","SelectionRange","Selection","Extension","Plugin","PluginKey"],"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","../src/index.ts"],"sourcesContent":["import type { 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 { type ResolvedPos, NodeRange } from '@tiptap/pm/model'\nimport { SelectionRange } from '@tiptap/pm/state'\n\nexport interface GetSelectionRangesOptions {\n /**\n * Whether nodes should be included when the selection only overlaps their\n * start or end content boundary.\n * @default true\n */\n extendOnBoundaryOverlap?: boolean\n}\n\nfunction getNodeContentBounds(\n nodeStart: number,\n nodeSize: number,\n node: { isText: boolean; isAtom: boolean },\n) {\n const contentOffset = node.isText || node.isAtom ? 0 : 1\n\n return {\n start: nodeStart + contentOffset,\n end: nodeStart + nodeSize - contentOffset,\n }\n}\n\n/**\n * Calculates node-aligned selection ranges between two resolved positions.\n *\n * The helper derives a suitable depth when none is provided and returns a\n * `SelectionRange` for each matching child node in the computed `NodeRange`.\n * Each returned range exposes `$from` as the resolved start position of the\n * node selection and `$to` as the resolved end position.\n *\n * @param $from The resolved anchor position where the selection starts.\n * @param $to The resolved head position where the selection ends.\n * @param depth An optional depth to force when creating the ProseMirror `NodeRange`.\n * When omitted, the depth is inferred from the shared depth of `$from` and `$to`.\n * @param options Optional behavior flags for how boundary nodes are handled.\n * @param options.extendOnBoundaryOverlap Whether touching only a node's start\n * or end content boundary should still include that node in the returned ranges.\n * @returns An array of `SelectionRange` objects for the nodes covered at the\n * computed depth.\n * @example\n * ```ts\n * const { $from, $to } = editor.state.selection\n * const ranges = getSelectionRanges($from, $to, undefined, {\n * extendOnBoundaryOverlap: false,\n * })\n *\n * ranges.forEach(range => {\n * console.log(range.$from.pos, range.$to.pos)\n * })\n * ```\n */\nexport function getSelectionRanges(\n $from: ResolvedPos,\n $to: ResolvedPos,\n depth?: number,\n options: GetSelectionRangesOptions = {},\n): SelectionRange[] {\n const ranges: SelectionRange[] = []\n const doc = $from.node(0)\n const { extendOnBoundaryOverlap = true } = options\n\n // Determine the appropriate depth\n if (typeof depth === 'number' && depth >= 0) {\n // Use the provided depth\n } else if ($from.sameParent($to)) {\n depth = Math.max(0, $from.sharedDepth($to.pos) - 1)\n } else {\n depth = $from.sharedDepth($to.pos)\n }\n\n const nodeRange = new NodeRange($from, $to, depth)\n const offset = nodeRange.depth === 0 ? 0 : 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 const contentBounds = getNodeContentBounds(from, node.nodeSize, node)\n const overlapsNodeContent = extendOnBoundaryOverlap\n ? $to.pos >= contentBounds.start && $from.pos <= contentBounds.end\n : $to.pos > contentBounds.start && $from.pos < contentBounds.end\n\n if (from < nodeRange.start || from >= nodeRange.end) {\n return\n }\n\n if (!overlapsNodeContent) {\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 type { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport type { Mappable } from '@tiptap/pm/transform'\n\nimport { NodeRangeSelection } from './NodeRangeSelection.js'\n\nexport class NodeRangeBookmark {\n anchor!: number\n head!: number\n depth!: number\n\n constructor(anchor: number, head: number, depth: number | undefined) {\n this.anchor = anchor\n this.head = head\n this.depth = depth ?? 0\n }\n\n map(mapping: Mappable) {\n return new NodeRangeBookmark(mapping.map(this.anchor), mapping.map(this.head), this.depth)\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, this.depth)\n }\n}\n","import type { Node as ProseMirrorNode, ResolvedPos } from '@tiptap/pm/model'\nimport { Selection } from '@tiptap/pm/state'\nimport type { Mapping } from '@tiptap/pm/transform'\n\nimport { getSelectionRanges } from './getSelectionRanges.js'\nimport { NodeRangeBookmark } from './NodeRangeBookmark.js'\n\nexport class NodeRangeSelection extends Selection {\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 =\n isCursor && !isCursorAtEnd ? doc.resolve($head.pos + (bias > 0 ? 1 : -1)) : $head\n const $correctedAnchor =\n isCursor && isCursorAtEnd ? doc.resolve($anchor.pos - (bias > 0 ? 1 : -1)) : $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 =\n $correctedHead.pos >= $anchor.pos ? ranges[0].$from : ranges[ranges.length - 1].$to\n\n // get the biggest range end position\n // this will become the $head\n const $rangeTo =\n $correctedHead.pos >= $anchor.pos ? ranges[ranges.length - 1].$to : 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 (\n other instanceof NodeRangeSelection &&\n other.$from.pos === this.$from.pos &&\n other.$to.pos === this.$to.pos\n )\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, this.depth)\n }\n\n toJSON() {\n return {\n type: 'nodeRange',\n anchor: this.anchor,\n head: this.head,\n depth: this.depth,\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(\n doc: ProseMirrorNode,\n json: { anchor: number; head: number; depth?: number },\n ): NodeRangeSelection {\n return new NodeRangeSelection(doc.resolve(json.anchor), doc.resolve(json.head), json.depth)\n }\n\n static create(\n doc: ProseMirrorNode,\n anchor: number,\n head: number,\n depth?: number,\n bias = 1,\n ): 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, this.depth)\n }\n}\n\nNodeRangeSelection.prototype.visible = false\n\n// register the JSON id so collaboration can restore the selection on remote updates\n// guarded because Selection.jsonID throws if the id is already registered (dual ESM/CJS builds)\ntry {\n Selection.jsonID('nodeRange', NodeRangeSelection)\n} catch {\n // already registered — safe to ignore\n}\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 type { SelectionRange } from '@tiptap/pm/state'\nimport { Plugin, PluginKey } 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({\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 ? isMeta : 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(\n 'mouseup',\n () => {\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(\n doc,\n $anchor.pos,\n $head.pos,\n this.options.depth,\n )\n\n tr.setSelection(nodeRangeSelection)\n view.dispatch(tr)\n },\n { once: true },\n )\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","import { NodeRange } from './node-range.js'\n\nexport * from './helpers/getNodeRangeDecorations.js'\nexport * from './helpers/getSelectionRanges.js'\nexport * from './helpers/isNodeRangeSelection.js'\nexport * from './helpers/NodeRangeSelection.js'\nexport * from './node-range.js'\n\nexport default NodeRange\n"],"mappings":";;;;;;;;;AAGA,SAAgB,wBAAwB,QAAyC;CAC/E,IAAI,CAAC,OAAO,QACV,OAAOA,gBAAAA,cAAc;CAGvB,MAAM,cAA4B,CAAC;CACnC,MAAM,MAAM,OAAO,EAAE,CAAC,MAAM,KAAK,CAAC;CAElC,OAAO,SAAQ,UAAS;EACtB,MAAM,MAAM,MAAM,MAAM;EACxB,MAAM,OAAO,MAAM,MAAM;EAEzB,IAAI,CAAC,MACH;EAGF,YAAY,KACVC,gBAAAA,WAAW,KAAK,KAAK,MAAM,KAAK,UAAU,EACxC,OAAO,gCACT,CAAC,CACH;CACF,CAAC;CAED,OAAOD,gBAAAA,cAAc,OAAO,KAAK,WAAW;AAC9C;;;ACfA,SAAS,qBACP,WACA,UACA,MACA;CACA,MAAM,gBAAgB,KAAK,UAAU,KAAK,SAAS,IAAI;CAEvD,OAAO;EACL,OAAO,YAAY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