@harbour-enterprises/superdoc 0.21.0-next.1 → 0.21.0-next.2

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 (27) hide show
  1. package/dist/chunks/{PdfViewer-Bn3Lvd0m.cjs → PdfViewer-1mNuyy3m.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-0jdn-cVx.es.js → PdfViewer-BkXBRXPs.es.js} +1 -1
  3. package/dist/chunks/{index-C0XOj4vH.cjs → index-BB3Qn69u.cjs} +2 -2
  4. package/dist/chunks/{index-BiZcP3bK.es.js → index-C-44kxYe.es.js} +2 -2
  5. package/dist/chunks/{super-editor.es-DQx0kzCl.es.js → super-editor.es-CKw7iZcz.es.js} +151 -89
  6. package/dist/chunks/{super-editor.es-BWdUsCXq.cjs → super-editor.es-Dd0joLAR.cjs} +151 -89
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/super-editor/ai-writer.es.js +2 -2
  9. package/dist/super-editor/chunks/{converter-DMpIH4c0.js → converter-FESR2WO7.js} +1 -1
  10. package/dist/super-editor/chunks/{docx-zipper-CDrFfcVc.js → docx-zipper-BWZ2o1H5.js} +1 -1
  11. package/dist/super-editor/chunks/{editor-DrzPfOIy.js → editor-XsrBXzy-.js} +149 -87
  12. package/dist/super-editor/chunks/{toolbar-NxB-WhNb.js → toolbar-tBWlOBPh.js} +2 -2
  13. package/dist/super-editor/converter.es.js +1 -1
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/src/extensions/comment/comment-import-helpers.d.ts +15 -0
  18. package/dist/super-editor/src/extensions/search/prosemirror-search-patched.d.ts +110 -0
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +151 -89
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as SelectionRange, ao as Transform, ap as isInTable$1, aq as generateDocxRandomId, ar as insertNewRelationship, as as updateDOMAttributes, at as htmlHandler } from "./converter-DMpIH4c0.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as SelectionRange, ao as Transform, ap as isInTable$1, aq as generateDocxRandomId, ar as insertNewRelationship, as as updateDOMAttributes, at as htmlHandler } from "./converter-FESR2WO7.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-CDrFfcVc.js";
17
+ import { D as DocxZipper } from "./docx-zipper-BWZ2o1H5.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -11288,6 +11288,33 @@ const getTrackChangesDecorations = (state, onlyOriginalShown, onlyModifiedShown)
11288
11288
  return DecorationSet.create(state.doc, decorations);
11289
11289
  };
11290
11290
  const CommentMarkName = "commentMark";
11291
+ const resolveCommentMeta = ({ converter, importedId }) => {
11292
+ const comments = converter?.comments || [];
11293
+ const matchingImportedComment = comments.find((c) => c.importedId == importedId);
11294
+ const resolvedCommentId = matchingImportedComment?.commentId ?? (importedId ? String(importedId) : v4());
11295
+ const internal = matchingImportedComment?.internal ?? matchingImportedComment?.isInternal ?? false;
11296
+ return {
11297
+ resolvedCommentId,
11298
+ importedId,
11299
+ internal,
11300
+ matchingImportedComment
11301
+ };
11302
+ };
11303
+ const ensureFallbackComment = ({ converter, matchingImportedComment, commentId, importedId }) => {
11304
+ if (matchingImportedComment || !converter) return;
11305
+ converter.comments = converter.comments || [];
11306
+ const alreadyExists = converter.comments.some((comment) => comment.commentId === commentId);
11307
+ if (alreadyExists) return;
11308
+ converter.comments.push({
11309
+ commentId,
11310
+ importedId,
11311
+ textJson: null,
11312
+ creatorName: null,
11313
+ creatorEmail: null,
11314
+ createdTime: null,
11315
+ isDone: false
11316
+ });
11317
+ };
11291
11318
  const removeCommentsById = ({ commentId, state, tr, dispatch }) => {
11292
11319
  const positions = getCommentPositionsById(commentId, state.doc);
11293
11320
  positions.forEach(({ from: from2, to }) => {
@@ -11381,24 +11408,31 @@ const prepareCommentsForImport = (doc2, tr, schema, converter) => {
11381
11408
  const { type } = node;
11382
11409
  const commentNodes = ["commentRangeStart", "commentRangeEnd", "commentReference"];
11383
11410
  if (!commentNodes.includes(type.name)) return;
11384
- const matchingImportedComment = converter.comments?.find((c) => c.importedId == node.attrs["w:id"]) || {};
11385
- const { commentId } = matchingImportedComment;
11386
- if (!commentId) return;
11411
+ const { resolvedCommentId, importedId, internal, matchingImportedComment } = resolveCommentMeta({
11412
+ converter,
11413
+ importedId: node.attrs["w:id"]
11414
+ });
11387
11415
  if (type.name === "commentRangeStart") {
11388
11416
  toMark.push({
11389
- "w:id": commentId,
11390
- importedId: node.attrs["w:id"],
11391
- internal: false,
11417
+ commentId: resolvedCommentId,
11418
+ importedId,
11419
+ internal,
11392
11420
  start: pos
11393
11421
  });
11422
+ ensureFallbackComment({
11423
+ converter,
11424
+ matchingImportedComment,
11425
+ commentId: resolvedCommentId,
11426
+ importedId
11427
+ });
11394
11428
  toDelete.push({ start: pos, end: pos + 1 });
11395
11429
  } else if (type.name === "commentRangeEnd") {
11396
- const itemToMark = toMark.find((p) => p.importedId === node.attrs["w:id"]);
11430
+ const itemToMark = toMark.find((p) => p.importedId === importedId);
11397
11431
  if (!itemToMark) return;
11398
11432
  const { start: start2 } = itemToMark;
11399
11433
  const markAttrs = {
11400
- commentId,
11401
- importedId: node.attrs["w:id"],
11434
+ commentId: itemToMark.commentId,
11435
+ importedId,
11402
11436
  internal: itemToMark.internal
11403
11437
  };
11404
11438
  tr.addMark(start2, pos + 1, schema.marks[CommentMarkName].create(markAttrs));
@@ -32845,8 +32879,8 @@ function getScaleFactor(element) {
32845
32879
  }
32846
32880
  class SearchQuery {
32847
32881
  /**
32848
- Create a query object.
32849
- */
32882
+ Create a query object.
32883
+ */
32850
32884
  constructor(config) {
32851
32885
  this.search = config.search;
32852
32886
  this.caseSensitive = !!config.caseSensitive;
@@ -32859,72 +32893,70 @@ class SearchQuery {
32859
32893
  this.impl = !this.valid ? nullQuery : this.regexp ? new RegExpQuery(this) : new StringQuery(this);
32860
32894
  }
32861
32895
  /**
32862
- Compare this query to another query.
32863
- */
32896
+ Compare this query to another query.
32897
+ */
32864
32898
  eq(other) {
32865
32899
  return this.search == other.search && this.replace == other.replace && this.caseSensitive == other.caseSensitive && this.regexp == other.regexp && this.wholeWord == other.wholeWord;
32866
32900
  }
32867
32901
  /**
32868
- Find the next occurrence of this query in the given range.
32869
- */
32902
+ Find the next occurrence of this query in the given range.
32903
+ */
32870
32904
  findNext(state, from2 = 0, to = state.doc.content.size) {
32871
32905
  for (; ; ) {
32872
- if (from2 >= to)
32873
- return null;
32906
+ if (from2 >= to) return null;
32874
32907
  let result = this.impl.findNext(state, from2, to);
32875
- if (!result || this.checkResult(state, result))
32876
- return result;
32908
+ if (!result || this.checkResult(state, result)) return result;
32877
32909
  from2 = result.from + 1;
32878
32910
  }
32879
32911
  }
32880
32912
  /**
32881
- Find the previous occurrence of this query in the given range.
32882
- Note that, if `to` is given, it should be _less_ than `from`.
32883
- */
32913
+ Find the previous occurrence of this query in the given range.
32914
+ Note that, if `to` is given, it should be _less_ than `from`.
32915
+ */
32884
32916
  findPrev(state, from2 = state.doc.content.size, to = 0) {
32885
32917
  for (; ; ) {
32886
- if (from2 <= to)
32887
- return null;
32918
+ if (from2 <= to) return null;
32888
32919
  let result = this.impl.findPrev(state, from2, to);
32889
- if (!result || this.checkResult(state, result))
32890
- return result;
32920
+ if (!result || this.checkResult(state, result)) return result;
32891
32921
  from2 = result.to - 1;
32892
32922
  }
32893
32923
  }
32894
32924
  /**
32895
- @internal
32896
- */
32925
+ @internal
32926
+ */
32897
32927
  checkResult(state, result) {
32898
32928
  return (!this.wholeWord || checkWordBoundary(state, result.from) && checkWordBoundary(state, result.to)) && (!this.filter || this.filter(state, result));
32899
32929
  }
32900
32930
  /**
32901
- @internal
32902
- */
32931
+ @internal
32932
+ */
32903
32933
  unquote(string) {
32904
32934
  return this.literal ? string : string.replace(/\\([nrt\\])/g, (_, ch) => ch == "n" ? "\n" : ch == "r" ? "\r" : ch == "t" ? " " : "\\");
32905
32935
  }
32906
32936
  /**
32907
- Get the ranges that should be replaced for this result. This can
32908
- return multiple ranges when `this.replace` contains
32909
- `$1`/`$&`-style placeholders, in which case the preserved
32910
- content is skipped by the replacements.
32911
-
32912
- Ranges are sorted by position, and `from`/`to` positions all
32913
- refer to positions in `state.doc`. When applying these, you'll
32914
- want to either apply them from back to front, or map these
32915
- positions through your transaction's current mapping.
32916
- */
32937
+ Get the ranges that should be replaced for this result. This can
32938
+ return multiple ranges when `this.replace` contains
32939
+ `$1`/`$&`-style placeholders, in which case the preserved
32940
+ content is skipped by the replacements.
32941
+
32942
+ Ranges are sorted by position, and `from`/`to` positions all
32943
+ refer to positions in `state.doc`. When applying these, you'll
32944
+ want to either apply them from back to front, or map these
32945
+ positions through your transaction's current mapping.
32946
+ */
32917
32947
  getReplacements(state, result) {
32918
32948
  let $from = state.doc.resolve(result.from);
32919
32949
  let marks = $from.marksAcross(state.doc.resolve(result.to));
32920
32950
  let ranges = [];
32921
32951
  let frag = Fragment.empty, pos = result.from, { match } = result;
32922
32952
  let groups = match ? getGroupIndices(match) : [[0, result.to - result.from]];
32923
- let replParts = parseReplacement(this.unquote(this.replace)), groupSpan;
32953
+ let replParts = parseReplacement(this.unquote(this.replace));
32924
32954
  for (let part of replParts) {
32925
32955
  if (typeof part == "string") {
32926
32956
  frag = frag.addToEnd(state.schema.text(part, marks));
32927
- } else if (groupSpan = groups[part.group]) {
32957
+ } else {
32958
+ const groupSpan = groups[part.group];
32959
+ if (!groupSpan) continue;
32928
32960
  let from2 = result.matchStart + groupSpan[0], to = result.matchStart + groupSpan[1];
32929
32961
  if (part.copy) {
32930
32962
  frag = frag.append(state.doc.slice(from2, to).content);
@@ -32954,8 +32986,7 @@ class StringQuery {
32954
32986
  constructor(query) {
32955
32987
  this.query = query;
32956
32988
  let string = query.unquote(query.search);
32957
- if (!query.caseSensitive)
32958
- string = string.toLowerCase();
32989
+ if (!query.caseSensitive) string = string.toLowerCase();
32959
32990
  this.string = string;
32960
32991
  }
32961
32992
  findNext(state, from2, to) {
@@ -32963,17 +32994,26 @@ class StringQuery {
32963
32994
  let off = Math.max(from2, start2);
32964
32995
  let content = textContent(node).slice(off - start2, Math.min(node.content.size, to - start2));
32965
32996
  let index2 = (this.query.caseSensitive ? content : content.toLowerCase()).indexOf(this.string);
32966
- return index2 < 0 ? null : { from: off + index2, to: off + index2 + this.string.length, match: null, matchStart: start2 };
32997
+ if (index2 < 0) return null;
32998
+ const startOffset = off - start2;
32999
+ const absoluteIndex = startOffset + index2;
33000
+ const fromPos = mapIndexToDocPos(node, start2, absoluteIndex);
33001
+ const toPos = mapIndexToDocPos(node, start2, absoluteIndex + this.string.length);
33002
+ return { from: fromPos, to: toPos, match: null, matchStart: start2 };
32967
33003
  });
32968
33004
  }
32969
33005
  findPrev(state, from2, to) {
32970
33006
  return scanTextblocks(state.doc, from2, to, (node, start2) => {
32971
33007
  let off = Math.max(start2, to);
32972
33008
  let content = textContent(node).slice(off - start2, Math.min(node.content.size, from2 - start2));
32973
- if (!this.query.caseSensitive)
32974
- content = content.toLowerCase();
33009
+ if (!this.query.caseSensitive) content = content.toLowerCase();
32975
33010
  let index2 = content.lastIndexOf(this.string);
32976
- return index2 < 0 ? null : { from: off + index2, to: off + index2 + this.string.length, match: null, matchStart: start2 };
33011
+ if (index2 < 0) return null;
33012
+ const startOffset = off - start2;
33013
+ const absoluteIndex = startOffset + index2;
33014
+ const fromPos = mapIndexToDocPos(node, start2, absoluteIndex);
33015
+ const toPos = mapIndexToDocPos(node, start2, absoluteIndex + this.string.length);
33016
+ return { from: fromPos, to: toPos, match: null, matchStart: start2 };
32977
33017
  });
32978
33018
  }
32979
33019
  }
@@ -32988,7 +33028,11 @@ class RegExpQuery {
32988
33028
  let content = textContent(node).slice(0, Math.min(node.content.size, to - start2));
32989
33029
  this.regexp.lastIndex = from2 - start2;
32990
33030
  let match = this.regexp.exec(content);
32991
- return match ? { from: start2 + match.index, to: start2 + match.index + match[0].length, match, matchStart: start2 } : null;
33031
+ if (!match) return null;
33032
+ const absoluteIndex = match.index;
33033
+ const fromPos = mapIndexToDocPos(node, start2, absoluteIndex);
33034
+ const toPos = mapIndexToDocPos(node, start2, absoluteIndex + match[0].length);
33035
+ return { from: fromPos, to: toPos, match, matchStart: start2 };
32992
33036
  });
32993
33037
  }
32994
33038
  findPrev(state, from2, to) {
@@ -32998,18 +33042,20 @@ class RegExpQuery {
32998
33042
  for (let off = 0; ; ) {
32999
33043
  this.regexp.lastIndex = off;
33000
33044
  let next = this.regexp.exec(content);
33001
- if (!next)
33002
- break;
33045
+ if (!next) break;
33003
33046
  match = next;
33004
33047
  off = next.index + 1;
33005
33048
  }
33006
- return match ? { from: start2 + match.index, to: start2 + match.index + match[0].length, match, matchStart: start2 } : null;
33049
+ if (!match) return null;
33050
+ const absoluteIndex = match.index;
33051
+ const fromPos = mapIndexToDocPos(node, start2, absoluteIndex);
33052
+ const toPos = mapIndexToDocPos(node, start2, absoluteIndex + match[0].length);
33053
+ return { from: fromPos, to: toPos, match, matchStart: start2 };
33007
33054
  });
33008
33055
  }
33009
33056
  }
33010
33057
  function getGroupIndices(match) {
33011
- if (match.indices)
33012
- return match.indices;
33058
+ if (match.indices) return match.indices;
33013
33059
  let result = [[0, match[0].length]];
33014
33060
  for (let i = 1, pos = 0; i < match.length; i++) {
33015
33061
  let found = match[i] ? match[0].indexOf(match[i], pos) : -1;
@@ -33021,10 +33067,8 @@ function parseReplacement(text) {
33021
33067
  let result = [], highestSeen = -1;
33022
33068
  function add(text2) {
33023
33069
  let last = result.length - 1;
33024
- if (last > -1 && typeof result[last] == "string")
33025
- result[last] += text2;
33026
- else
33027
- result.push(text2);
33070
+ if (last > -1 && typeof result[last] == "string") result[last] += text2;
33071
+ else result.push(text2);
33028
33072
  }
33029
33073
  while (text.length) {
33030
33074
  let m = /\$([$&\d+])/.exec(text);
@@ -33032,8 +33076,7 @@ function parseReplacement(text) {
33032
33076
  add(text);
33033
33077
  return result;
33034
33078
  }
33035
- if (m.index > 0)
33036
- add(text.slice(0, m.index + (m[1] == "$" ? 1 : 0)));
33079
+ if (m.index > 0) add(text.slice(0, m.index + (m[1] == "$" ? 1 : 0)));
33037
33080
  if (m[1] != "$") {
33038
33081
  let n = m[1] == "&" ? 0 : +m[1];
33039
33082
  if (highestSeen >= n) {
@@ -33051,30 +33094,50 @@ function validRegExp(source) {
33051
33094
  try {
33052
33095
  new RegExp(source, baseFlags);
33053
33096
  return true;
33054
- } catch (_a) {
33097
+ } catch {
33055
33098
  return false;
33056
33099
  }
33057
33100
  }
33058
33101
  const TextContentCache = /* @__PURE__ */ new WeakMap();
33059
33102
  function textContent(node) {
33060
33103
  let cached = TextContentCache.get(node);
33061
- if (cached)
33062
- return cached;
33104
+ if (cached) return cached;
33063
33105
  let content = "";
33064
33106
  for (let i = 0; i < node.childCount; i++) {
33065
33107
  let child = node.child(i);
33066
- if (child.isText)
33067
- content += child.text;
33068
- else if (child.isLeaf)
33069
- content += "";
33070
- else
33071
- content += " " + textContent(child) + " ";
33108
+ if (child.isText) content += child.text;
33109
+ else if (child.isLeaf) content += "";
33110
+ else if (child.type && child.type.name === "run") content += textContent(child);
33111
+ else content += " " + textContent(child) + " ";
33072
33112
  }
33073
33113
  TextContentCache.set(node, content);
33074
33114
  return content;
33075
33115
  }
33116
+ function mapIndexToDocPos(node, start2, index2) {
33117
+ if (index2 <= 0) return start2;
33118
+ const fullText = textContent(node);
33119
+ if (index2 >= fullText.length) return start2 + node.content.size;
33120
+ let target = start2;
33121
+ let remaining = index2;
33122
+ let found = false;
33123
+ node.descendants((child, pos) => {
33124
+ if (found) return false;
33125
+ if (!child.isText) return true;
33126
+ const len = child.text.length;
33127
+ if (remaining <= len) {
33128
+ target = start2 + pos + remaining;
33129
+ found = true;
33130
+ return false;
33131
+ }
33132
+ remaining -= len;
33133
+ return true;
33134
+ });
33135
+ return found ? target : start2 + node.content.size;
33136
+ }
33137
+ const transparentInlineNodes = /* @__PURE__ */ new Set(["run"]);
33076
33138
  function scanTextblocks(node, from2, to, f, nodeStart = 0) {
33077
- if (node.inlineContent) {
33139
+ const isTransparentInline = node.inlineContent && node.type && transparentInlineNodes.has(node.type.name);
33140
+ if (node.inlineContent && !isTransparentInline) {
33078
33141
  return f(node, nodeStart);
33079
33142
  } else if (!node.isLeaf) {
33080
33143
  if (from2 > to) {
@@ -33083,8 +33146,7 @@ function scanTextblocks(node, from2, to, f, nodeStart = 0) {
33083
33146
  pos -= child.nodeSize;
33084
33147
  if (pos < from2) {
33085
33148
  let result = scanTextblocks(child, from2, to, f, pos + 1);
33086
- if (result != null)
33087
- return result;
33149
+ if (result != null) return result;
33088
33150
  }
33089
33151
  }
33090
33152
  } else {
@@ -33093,8 +33155,7 @@ function scanTextblocks(node, from2, to, f, nodeStart = 0) {
33093
33155
  pos += child.nodeSize;
33094
33156
  if (pos > from2) {
33095
33157
  let result = scanTextblocks(child, from2, to, f, start2 + 1);
33096
- if (result != null)
33097
- return result;
33158
+ if (result != null) return result;
33098
33159
  }
33099
33160
  }
33100
33161
  }
@@ -33104,8 +33165,7 @@ function scanTextblocks(node, from2, to, f, nodeStart = 0) {
33104
33165
  function checkWordBoundary(state, pos) {
33105
33166
  let $pos = state.doc.resolve(pos);
33106
33167
  let before = $pos.nodeBefore, after = $pos.nodeAfter;
33107
- if (!before || !after || !before.isText || !after.isText)
33108
- return true;
33168
+ if (!before || !after || !before.isText || !after.isText) return true;
33109
33169
  return !/\p{L}$/u.test(before.text) || !/^\p{L}/u.test(after.text);
33110
33170
  }
33111
33171
  class SearchState {
@@ -33116,14 +33176,12 @@ class SearchState {
33116
33176
  }
33117
33177
  }
33118
33178
  function buildMatchDeco(state, query, range) {
33119
- if (!query.valid)
33120
- return DecorationSet.empty;
33179
+ if (!query.valid) return DecorationSet.empty;
33121
33180
  let deco = [];
33122
33181
  let sel = state.selection;
33123
33182
  for (let pos = range ? range.from : 0, end2 = range ? range.to : state.doc.content.size; ; ) {
33124
33183
  let next = query.findNext(state, pos, end2);
33125
- if (!next)
33126
- break;
33184
+ if (!next) break;
33127
33185
  let cls = next.from == sel.from && next.to == sel.to ? "ProseMirror-active-search-match" : "ProseMirror-search-match";
33128
33186
  deco.push(Decoration.inline(next.from, next.to, { class: cls }));
33129
33187
  pos = next.to;
@@ -33142,8 +33200,7 @@ function search(options = {}) {
33142
33200
  },
33143
33201
  apply(tr, search2, _oldState, state) {
33144
33202
  let set = tr.getMeta(searchKey);
33145
- if (set)
33146
- return new SearchState(set.query, set.range, buildMatchDeco(state, set.query, set.range));
33203
+ if (set) return new SearchState(set.query, set.range, buildMatchDeco(state, set.query, set.range));
33147
33204
  if (tr.docChanged || tr.selectionSet) {
33148
33205
  let range = search2.range;
33149
33206
  if (range) {
@@ -33168,6 +33225,7 @@ function getMatchHighlights(state) {
33168
33225
  function setSearchState(tr, query, range = null) {
33169
33226
  return tr.setMeta(searchKey, { query, range });
33170
33227
  }
33228
+ const isRegExp = (value) => Object.prototype.toString.call(value) === "[object RegExp]";
33171
33229
  const Search = Extension.create({
33172
33230
  addStorage() {
33173
33231
  return {
@@ -33237,10 +33295,14 @@ const Search = Extension.create({
33237
33295
  let caseSensitive = false;
33238
33296
  let regexp = false;
33239
33297
  const wholeWord = false;
33240
- if (patternInput instanceof RegExp) {
33298
+ if (isRegExp(patternInput)) {
33299
+ const regexPattern = (
33300
+ /** @type {RegExp} */
33301
+ patternInput
33302
+ );
33241
33303
  regexp = true;
33242
- pattern = patternInput.source;
33243
- caseSensitive = !patternInput.flags.includes("i");
33304
+ pattern = regexPattern.source;
33305
+ caseSensitive = !regexPattern.flags.includes("i");
33244
33306
  } else if (typeof patternInput === "string" && /^\/(.+)\/([gimsuy]*)$/.test(patternInput)) {
33245
33307
  const [, body, flags] = patternInput.match(/^\/(.+)\/([gimsuy]*)$/);
33246
33308
  regexp = true;
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-DMpIH4c0.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DrzPfOIy.js";
2
+ import { p as process$1 } from "./converter-FESR2WO7.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-XsrBXzy-.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-DMpIH4c0.js";
1
+ import { a5 } from "./chunks/converter-FESR2WO7.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-DMpIH4c0.js";
2
- import { D } from "./chunks/docx-zipper-CDrFfcVc.js";
1
+ import "./chunks/converter-FESR2WO7.js";
2
+ import { D } from "./chunks/docx-zipper-BWZ2o1H5.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-DrzPfOIy.js";
2
- import "./chunks/converter-DMpIH4c0.js";
3
- import "./chunks/docx-zipper-CDrFfcVc.js";
1
+ import { E } from "./chunks/editor-XsrBXzy-.js";
2
+ import "./chunks/converter-FESR2WO7.js";
3
+ import "./chunks/docx-zipper-BWZ2o1H5.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-CDrFfcVc.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-BWZ2o1H5.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -0,0 +1,15 @@
1
+ export function resolveCommentMeta({ converter, importedId }: {
2
+ converter: any;
3
+ importedId: any;
4
+ }): {
5
+ resolvedCommentId: any;
6
+ importedId: any;
7
+ internal: any;
8
+ matchingImportedComment: any;
9
+ };
10
+ export function ensureFallbackComment({ converter, matchingImportedComment, commentId, importedId }: {
11
+ converter: any;
12
+ matchingImportedComment: any;
13
+ commentId: any;
14
+ importedId: any;
15
+ }): void;
@@ -0,0 +1,110 @@
1
+ export function __searchTextContent(node: any): any;
2
+ export class SearchQuery {
3
+ /**
4
+ Create a query object.
5
+ */
6
+ constructor(config: any);
7
+ search: any;
8
+ caseSensitive: boolean;
9
+ literal: boolean;
10
+ regexp: boolean;
11
+ replace: any;
12
+ valid: boolean;
13
+ wholeWord: boolean;
14
+ filter: any;
15
+ impl: {
16
+ findNext(): any;
17
+ findPrev(): any;
18
+ } | RegExpQuery | StringQuery;
19
+ /**
20
+ Compare this query to another query.
21
+ */
22
+ eq(other: any): boolean;
23
+ /**
24
+ Find the next occurrence of this query in the given range.
25
+ */
26
+ findNext(state: any, from?: number, to?: any): any;
27
+ /**
28
+ Find the previous occurrence of this query in the given range.
29
+ Note that, if `to` is given, it should be _less_ than `from`.
30
+ */
31
+ findPrev(state: any, from?: any, to?: number): any;
32
+ /**
33
+ @internal
34
+ */
35
+ checkResult(state: any, result: any): any;
36
+ /**
37
+ @internal
38
+ */
39
+ unquote(string: any): any;
40
+ /**
41
+ Get the ranges that should be replaced for this result. This can
42
+ return multiple ranges when `this.replace` contains
43
+ `$1`/`$&`-style placeholders, in which case the preserved
44
+ content is skipped by the replacements.
45
+
46
+ Ranges are sorted by position, and `from`/`to` positions all
47
+ refer to positions in `state.doc`. When applying these, you'll
48
+ want to either apply them from back to front, or map these
49
+ positions through your transaction's current mapping.
50
+ */
51
+ getReplacements(state: any, result: any): {
52
+ from: any;
53
+ to: any;
54
+ insert: Slice;
55
+ }[];
56
+ }
57
+ export function findNext(state: any, dispatch: any): boolean;
58
+ export function findNextNoWrap(state: any, dispatch: any): boolean;
59
+ export function findPrev(state: any, dispatch: any): boolean;
60
+ export function findPrevNoWrap(state: any, dispatch: any): boolean;
61
+ /**
62
+ Access the decoration set holding the currently highlighted search
63
+ matches in the document.
64
+ */
65
+ export function getMatchHighlights(state: any): any;
66
+ /**
67
+ Get the current active search query and searched range. Will
68
+ return `undefined` is the search plugin isn't active.
69
+ */
70
+ export function getSearchState(state: any): any;
71
+ /**
72
+ Replace all instances of the search query.
73
+ */
74
+ export function replaceAll(state: any, dispatch: any): boolean;
75
+ export function replaceCurrent(state: any, dispatch: any): boolean;
76
+ export function replaceNext(state: any, dispatch: any): boolean;
77
+ export function replaceNextNoWrap(state: any, dispatch: any): boolean;
78
+ /**
79
+ Returns a plugin that stores a current search query and searched
80
+ range, and highlights matches of the query.
81
+ */
82
+ export function search(options?: {}): Plugin<SearchState>;
83
+ /**
84
+ Add metadata to a transaction that updates the active search query
85
+ and searched range, when dispatched.
86
+ */
87
+ export function setSearchState(tr: any, query: any, range?: any): any;
88
+ declare class RegExpQuery {
89
+ constructor(query: any);
90
+ query: any;
91
+ regexp: RegExp;
92
+ findNext(state: any, from: any, to: any): any;
93
+ findPrev(state: any, from: any, to: any): any;
94
+ }
95
+ declare class StringQuery {
96
+ constructor(query: any);
97
+ query: any;
98
+ string: any;
99
+ findNext(state: any, from: any, to: any): any;
100
+ findPrev(state: any, from: any, to: any): any;
101
+ }
102
+ import { Slice } from 'prosemirror-model';
103
+ declare class SearchState {
104
+ constructor(query: any, range: any, deco: any);
105
+ query: any;
106
+ range: any;
107
+ deco: any;
108
+ }
109
+ import { Plugin } from 'prosemirror-state';
110
+ export {};
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
- import { av as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, ay as vClickOutside, H as findParentNode, az as getActiveFormatting, ap as isInTable, aA as readFromClipboard, aB as handleClipboardPaste, aC as getFileObject, aD as runPropertyTranslators, aE as translator, aF as translator$1, aG as translator$2, aH as translator$3, aI as translator$4, aJ as translator$5, aK as translator$6, aL as translator$7, aM as translator$8, aN as translator$9, aO as translator$a, aP as translator$b, aQ as translator$c, aR as translator$d, aS as translator$e, aT as translator$f, aU as translator$g, aV as translator$h, aW as translator$i, aX as translator$j, aY as translator$k, aZ as translator$l, a_ as translator$m, a$ as translator$n, b0 as translator$o, b1 as translator$p, a as Plugin } from "./chunks/converter-DMpIH4c0.js";
13
- import { b2, a5, i, a2 } from "./chunks/converter-DMpIH4c0.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, y as yUndoPluginKey, f as undoDepth, h as redoDepth, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-DrzPfOIy.js";
15
- import { n, C, o, T, l, p, m } from "./chunks/editor-DrzPfOIy.js";
12
+ import { av as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, ay as vClickOutside, H as findParentNode, az as getActiveFormatting, ap as isInTable, aA as readFromClipboard, aB as handleClipboardPaste, aC as getFileObject, aD as runPropertyTranslators, aE as translator, aF as translator$1, aG as translator$2, aH as translator$3, aI as translator$4, aJ as translator$5, aK as translator$6, aL as translator$7, aM as translator$8, aN as translator$9, aO as translator$a, aP as translator$b, aQ as translator$c, aR as translator$d, aS as translator$e, aT as translator$f, aU as translator$g, aV as translator$h, aW as translator$i, aX as translator$j, aY as translator$k, aZ as translator$l, a_ as translator$m, a$ as translator$n, b0 as translator$o, b1 as translator$p, a as Plugin } from "./chunks/converter-FESR2WO7.js";
13
+ import { b2, a5, i, a2 } from "./chunks/converter-FESR2WO7.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, y as yUndoPluginKey, f as undoDepth, h as redoDepth, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-XsrBXzy-.js";
15
+ import { n, C, o, T, l, p, m } from "./chunks/editor-XsrBXzy-.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-NxB-WhNb.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-tBWlOBPh.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-CDrFfcVc.js";
19
+ import { D } from "./chunks/docx-zipper-BWZ2o1H5.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-NxB-WhNb.js";
3
- import "./chunks/editor-DrzPfOIy.js";
2
+ import { T } from "./chunks/toolbar-tBWlOBPh.js";
3
+ import "./chunks/editor-XsrBXzy-.js";
4
4
  export {
5
5
  T as default
6
6
  };