@harbour-enterprises/superdoc 1.7.0-next.6 → 1.7.0-next.7

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.
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-De9wkgLl.cjs");
4
- const superdoc = require("./index-DfBvgXLe.cjs");
5
- const index = require("./index-ChXg2ff-.cjs");
4
+ const superdoc = require("./index-Brw_Mb9u.cjs");
5
+ const index = require("./index-menqq4VC.cjs");
6
6
  function self(vars) {
7
7
  const {
8
8
  opacityDisabled,
@@ -1,6 +1,6 @@
1
1
  import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, c as computed, r as ref, f as onMounted, X as onUnmounted, E as createElementBlock, G as openBlock, K as createBaseVNode, M as createCommentVNode, I as createVNode, v as unref } from "./vue-BnBKJwCW.es.js";
2
- import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-HKM0YiEI.es.js";
3
- import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-DnpYZRby.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-CWf082Tz.es.js";
3
+ import { C as derived, r as c, q as cB, aF as fadeInTransition, y as cM, I as warnOnce, J as useConfig, N as useTheme, aG as pxfy, P as createKey, Q as useThemeClass, aH as useCompitable, ai as _export_sfc } from "./index-C16jjGce.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -19458,6 +19458,26 @@ const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
19458
19458
  }
19459
19459
  const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
19460
19460
  const fldType = fldCharEl?.attributes?.["w:fldCharType"];
19461
+ if (node.name === "w:fldSimple") {
19462
+ const instrAttr = node.attributes?.["w:instr"] || "";
19463
+ const fieldType = instrAttr.trim().split(/\s+/)[0];
19464
+ if (fieldType === "PAGE" || fieldType === "NUMPAGES") {
19465
+ const preprocessor = fieldType === "PAGE" ? preProcessPageInstruction : preProcessNumPagesInstruction;
19466
+ const contentNodes = node.elements || [];
19467
+ let fieldRunRPr = null;
19468
+ for (const child of contentNodes) {
19469
+ const rPr = child.elements?.find((el) => el.name === "w:rPr");
19470
+ if (rPr) {
19471
+ fieldRunRPr = rPr;
19472
+ break;
19473
+ }
19474
+ }
19475
+ const processedField = preprocessor(contentNodes, instrAttr.trim(), fieldRunRPr);
19476
+ processedNodes.push(...processedField);
19477
+ i++;
19478
+ continue;
19479
+ }
19480
+ }
19461
19481
  if (fldType === "begin") {
19462
19482
  const fieldInfo = scanFieldSequence(nodes, i);
19463
19483
  if (fieldInfo && (fieldInfo.fieldType === "PAGE" || fieldInfo.fieldType === "NUMPAGES")) {
@@ -32769,7 +32789,7 @@ class SuperConverter {
32769
32789
  static getStoredSuperdocVersion(docx) {
32770
32790
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
32771
32791
  }
32772
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.7.0-next.6") {
32792
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.7.0-next.7") {
32773
32793
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
32774
32794
  }
32775
32795
  /**
@@ -19459,6 +19459,26 @@ const preProcessPageFieldsOnly = (nodes = [], depth = 0) => {
19459
19459
  }
19460
19460
  const fldCharEl = node.elements?.find((el) => el.name === "w:fldChar");
19461
19461
  const fldType = fldCharEl?.attributes?.["w:fldCharType"];
19462
+ if (node.name === "w:fldSimple") {
19463
+ const instrAttr = node.attributes?.["w:instr"] || "";
19464
+ const fieldType = instrAttr.trim().split(/\s+/)[0];
19465
+ if (fieldType === "PAGE" || fieldType === "NUMPAGES") {
19466
+ const preprocessor = fieldType === "PAGE" ? preProcessPageInstruction : preProcessNumPagesInstruction;
19467
+ const contentNodes = node.elements || [];
19468
+ let fieldRunRPr = null;
19469
+ for (const child of contentNodes) {
19470
+ const rPr = child.elements?.find((el) => el.name === "w:rPr");
19471
+ if (rPr) {
19472
+ fieldRunRPr = rPr;
19473
+ break;
19474
+ }
19475
+ }
19476
+ const processedField = preprocessor(contentNodes, instrAttr.trim(), fieldRunRPr);
19477
+ processedNodes.push(...processedField);
19478
+ i++;
19479
+ continue;
19480
+ }
19481
+ }
19462
19482
  if (fldType === "begin") {
19463
19483
  const fieldInfo = scanFieldSequence(nodes, i);
19464
19484
  if (fieldInfo && (fieldInfo.fieldType === "PAGE" || fieldInfo.fieldType === "NUMPAGES")) {
@@ -32770,7 +32790,7 @@ class SuperConverter {
32770
32790
  static getStoredSuperdocVersion(docx) {
32771
32791
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
32772
32792
  }
32773
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.7.0-next.6") {
32793
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.7.0-next.7") {
32774
32794
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
32775
32795
  }
32776
32796
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const index = require("./index-ChXg2ff-.cjs");
3
- require("./SuperConverter-iUnNfL5l.cjs");
2
+ const index = require("./index-menqq4VC.cjs");
3
+ require("./SuperConverter-ChOaRc8I.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
6
6
  const provider = require("@hocuspocus/provider");
@@ -7530,7 +7530,7 @@ const _sfc_main = {
7530
7530
  __name: "SuperDoc",
7531
7531
  emits: ["selection-update"],
7532
7532
  setup(__props, { emit: __emit }) {
7533
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CWbiDeiU.cjs")));
7533
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CPavU1ww.cjs")));
7534
7534
  const superdocStore = useSuperdocStore();
7535
7535
  const commentsStore = useCommentsStore();
7536
7536
  const {
@@ -8484,7 +8484,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8484
8484
  this.config.colors = shuffleArray(this.config.colors);
8485
8485
  this.userColorMap = /* @__PURE__ */ new Map();
8486
8486
  this.colorIndex = 0;
8487
- this.version = "1.7.0-next.6";
8487
+ this.version = "1.7.0-next.7";
8488
8488
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8489
8489
  this.superdocId = config.superdocId || uuid.v4();
8490
8490
  this.colors = this.config.colors;
@@ -1,6 +1,6 @@
1
1
  import { B as Buffer$2 } from "./jszip-B1fkPkPJ.es.js";
2
2
  import { t as twipsToInches, i as inchesToTwips, p as ptToTwips, l as linesToTwips, a as twipsToLines, b as pixelsToTwips, h as halfPointToPoints, c as twipsToPixels$2, d as convertSizeToCSS, e as inchesToPixels } from "./helpers-C8e9wR5l.es.js";
3
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-DpNWJAJU.es.js";
3
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, F as Fragment, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName$1, O as TrackInsertMarkName$1, Q as TrackFormatMarkName$1, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as createOoxmlResolver, a0 as translator, a1 as translator$1, a2 as resolveDocxFontFamily, a3 as combineIndentProperties, a4 as _getReferencedTableStyles, a5 as decodeRPrFromMarks, a6 as calculateResolvedParagraphProperties, a7 as encodeCSSFromPPr, a8 as encodeCSSFromRPr, a9 as generateOrderedListIndex, aa as docxNumberingHelpers, ab as InputRule, ac as insertNewRelationship, ad as kebabCase$1, ae as getUnderlineCssString } from "./SuperConverter-CQtzIJhu.es.js";
4
4
  import { p as process$1, r as ref, C as global$1, c as computed, E as createElementBlock, F as Fragment$1, S as renderList, O as withModifiers, G as openBlock, P as normalizeClass, M as createCommentVNode, H as toDisplayString, K as createBaseVNode, U as createApp, f as onMounted, X as onUnmounted, R as withDirectives, v as unref, Y as vModelText, y as nextTick, L as normalizeStyle, u as watch, Z as withKeys, _ as createTextVNode, I as createVNode, h as h$1, $ as readonly, s as getCurrentInstance, o as onBeforeUnmount, j as reactive, b as onBeforeMount, i as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, a as provide, g as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, D as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, m as markRaw, N as createBlock, J as withCtx, a9 as useCssVars, V as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-BnBKJwCW.es.js";
5
5
  import "./jszip.min-DCl8qkFO.es.js";
6
6
  import { E as EventEmitter$1 } from "./eventemitter3-CwrdEv8r.es.js";
@@ -15771,7 +15771,7 @@ const canUseDOM = () => {
15771
15771
  return false;
15772
15772
  }
15773
15773
  };
15774
- const summaryVersion = "1.7.0-next.6";
15774
+ const summaryVersion = "1.7.0-next.7";
15775
15775
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15776
15776
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15777
15777
  function mapAttributes(attrs) {
@@ -18438,7 +18438,7 @@ class Editor extends EventEmitter {
18438
18438
  * Process collaboration migrations
18439
18439
  */
18440
18440
  processCollaborationMigrations() {
18441
- console.debug("[checkVersionMigrations] Current editor version", "1.7.0-next.6");
18441
+ console.debug("[checkVersionMigrations] Current editor version", "1.7.0-next.7");
18442
18442
  if (!this.options.ydoc) return;
18443
18443
  const metaMap = this.options.ydoc.getMap("meta");
18444
18444
  let docVersion = metaMap.get("version");
@@ -42349,18 +42349,29 @@ function setupInternalFieldAnnotationDragHandlers({
42349
42349
  const fieldId = event.data.fieldId;
42350
42350
  if (fieldId) {
42351
42351
  const targetPos = event.pmPosition;
42352
+ const pmStart = event.data.pmStart;
42352
42353
  let sourceStart = null;
42353
42354
  let sourceEnd = null;
42354
42355
  let sourceNode = null;
42355
- state.doc.descendants((node, pos) => {
42356
- if (node.type.name === "fieldAnnotation" && node.attrs.fieldId === fieldId) {
42357
- sourceStart = pos;
42358
- sourceEnd = pos + node.nodeSize;
42359
- sourceNode = node;
42360
- return false;
42356
+ if (pmStart != null) {
42357
+ const nodeAt = state.doc.nodeAt(pmStart);
42358
+ if (nodeAt?.type?.name === "fieldAnnotation") {
42359
+ sourceStart = pmStart;
42360
+ sourceEnd = pmStart + nodeAt.nodeSize;
42361
+ sourceNode = nodeAt;
42361
42362
  }
42362
- return true;
42363
- });
42363
+ }
42364
+ if (sourceStart == null || sourceEnd == null || !sourceNode) {
42365
+ state.doc.descendants((node, pos) => {
42366
+ if (node.type.name === "fieldAnnotation" && node.attrs.fieldId === fieldId) {
42367
+ sourceStart = pos;
42368
+ sourceEnd = pos + node.nodeSize;
42369
+ sourceNode = node;
42370
+ return false;
42371
+ }
42372
+ return true;
42373
+ });
42374
+ }
42364
42375
  if (sourceStart === null || sourceEnd === null || !sourceNode) {
42365
42376
  return;
42366
42377
  }
@@ -47683,7 +47694,10 @@ function fieldAnnotationNodeToRun(node, positions, fieldMetadata) {
47683
47694
  }
47684
47695
  return run;
47685
47696
  }
47686
- const isTextRun = (run) => run.kind !== "tab";
47697
+ const isTextRun = (run) => {
47698
+ const kind = run.kind;
47699
+ return (kind === void 0 || kind === "text") && "text" in run;
47700
+ };
47687
47701
  const dataAttrsCompatible = (a, b2) => {
47688
47702
  const aAttrs = a.dataAttrs;
47689
47703
  const bAttrs = b2.dataAttrs;
@@ -1,5 +1,5 @@
1
- import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-DnpYZRby.es.js";
2
- import "./SuperConverter-DpNWJAJU.es.js";
1
+ import { B as BIT8, M as MAX_SAFE_INTEGER, c as create, a as BITS7, u as utf8TextDecoder, b as create$1, s as setIfUndefined, d as create$2, f as from, e as floor$1, g as equalityDeep, w as writeVarUint, h as writeVarString, t as toUint8Array, i as createEncoder, j as createInjectionKey, k as toString, l as throwError, m as useSsrAdapter, n as configProviderInjectionKey, o as cssrAnchorMetaName, p as globalStyle, q as cB, r as c, v as isMounted, x as commonVariables$2, y as cM, z as cNotM, A as cE, C as derived, D as changeColor, E as insideModal, F as insidePopover, G as resolveWrappedSlot, H as on, I as warnOnce, J as useConfig, K as useMergedState, L as useMemo, N as useTheme, O as useRtl, P as createKey, Q as useThemeClass, R as createId, S as call, T as render, U as messageProviderInjectionKey, V as messageApiInjectionKey, W as fromBase64, X as onChange, Y as varStorage, Z as toBase64, _ as createUint8ArrayFromArrayBuffer, $ as offChange, a0 as writeVarUint8Array, a1 as map, a2 as length, a3 as isNode, a4 as min, a5 as pow, a6 as comments_module_events, a7 as getFileObject, a8 as getTrackChanges, a9 as CommentsPluginKey, aa as TrackChangesBasePluginKey, ab as Editor, ac as getRichTextExtensions, ad as ellipsisVerticalSvg, ae as xmarkIconSvg, af as checkIconSvg, ag as caretDownIconSvg, ah as commentIconSvg, ai as _export_sfc, aj as NDropdown, ak as SuperInput, al as vClickOutside, am as PresentationEditor, an as SuperEditor, ao as AIWriter, ap as NConfigProvider, aq as SuperToolbar } from "./index-C16jjGce.es.js";
2
+ import "./SuperConverter-CQtzIJhu.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-CwrdEv8r.es.js";
5
5
  import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
@@ -7513,7 +7513,7 @@ const _sfc_main = {
7513
7513
  __name: "SuperDoc",
7514
7514
  emits: ["selection-update"],
7515
7515
  setup(__props, { emit: __emit }) {
7516
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CVwE4WYW.es.js"));
7516
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DXTnaF8I.es.js"));
7517
7517
  const superdocStore = useSuperdocStore();
7518
7518
  const commentsStore = useCommentsStore();
7519
7519
  const {
@@ -8467,7 +8467,7 @@ class SuperDoc extends EventEmitter {
8467
8467
  this.config.colors = shuffleArray(this.config.colors);
8468
8468
  this.userColorMap = /* @__PURE__ */ new Map();
8469
8469
  this.colorIndex = 0;
8470
- this.version = "1.7.0-next.6";
8470
+ this.version = "1.7.0-next.7";
8471
8471
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8472
8472
  this.superdocId = config.superdocId || v4();
8473
8473
  this.colors = this.config.colors;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const jszip = require("./jszip-C8_CqJxM.cjs");
3
3
  const helpers$1 = require("./helpers-nOdwpmwb.cjs");
4
- const superEditor_converter = require("./SuperConverter-iUnNfL5l.cjs");
4
+ const superEditor_converter = require("./SuperConverter-ChOaRc8I.cjs");
5
5
  const vue = require("./vue-De9wkgLl.cjs");
6
6
  require("./jszip.min-BPh2MMAa.cjs");
7
7
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
@@ -15788,7 +15788,7 @@ const canUseDOM = () => {
15788
15788
  return false;
15789
15789
  }
15790
15790
  };
15791
- const summaryVersion = "1.7.0-next.6";
15791
+ const summaryVersion = "1.7.0-next.7";
15792
15792
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15793
15793
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15794
15794
  function mapAttributes(attrs) {
@@ -18455,7 +18455,7 @@ class Editor extends EventEmitter {
18455
18455
  * Process collaboration migrations
18456
18456
  */
18457
18457
  processCollaborationMigrations() {
18458
- console.debug("[checkVersionMigrations] Current editor version", "1.7.0-next.6");
18458
+ console.debug("[checkVersionMigrations] Current editor version", "1.7.0-next.7");
18459
18459
  if (!this.options.ydoc) return;
18460
18460
  const metaMap = this.options.ydoc.getMap("meta");
18461
18461
  let docVersion = metaMap.get("version");
@@ -42366,18 +42366,29 @@ function setupInternalFieldAnnotationDragHandlers({
42366
42366
  const fieldId = event.data.fieldId;
42367
42367
  if (fieldId) {
42368
42368
  const targetPos = event.pmPosition;
42369
+ const pmStart = event.data.pmStart;
42369
42370
  let sourceStart = null;
42370
42371
  let sourceEnd = null;
42371
42372
  let sourceNode = null;
42372
- state.doc.descendants((node, pos) => {
42373
- if (node.type.name === "fieldAnnotation" && node.attrs.fieldId === fieldId) {
42374
- sourceStart = pos;
42375
- sourceEnd = pos + node.nodeSize;
42376
- sourceNode = node;
42377
- return false;
42373
+ if (pmStart != null) {
42374
+ const nodeAt = state.doc.nodeAt(pmStart);
42375
+ if (nodeAt?.type?.name === "fieldAnnotation") {
42376
+ sourceStart = pmStart;
42377
+ sourceEnd = pmStart + nodeAt.nodeSize;
42378
+ sourceNode = nodeAt;
42378
42379
  }
42379
- return true;
42380
- });
42380
+ }
42381
+ if (sourceStart == null || sourceEnd == null || !sourceNode) {
42382
+ state.doc.descendants((node, pos) => {
42383
+ if (node.type.name === "fieldAnnotation" && node.attrs.fieldId === fieldId) {
42384
+ sourceStart = pos;
42385
+ sourceEnd = pos + node.nodeSize;
42386
+ sourceNode = node;
42387
+ return false;
42388
+ }
42389
+ return true;
42390
+ });
42391
+ }
42381
42392
  if (sourceStart === null || sourceEnd === null || !sourceNode) {
42382
42393
  return;
42383
42394
  }
@@ -47700,7 +47711,10 @@ function fieldAnnotationNodeToRun(node, positions, fieldMetadata) {
47700
47711
  }
47701
47712
  return run;
47702
47713
  }
47703
- const isTextRun = (run) => run.kind !== "tab";
47714
+ const isTextRun = (run) => {
47715
+ const kind = run.kind;
47716
+ return (kind === void 0 || kind === "text") && "text" in run;
47717
+ };
47704
47718
  const dataAttrsCompatible = (a, b2) => {
47705
47719
  const aAttrs = a.dataAttrs;
47706
47720
  const bAttrs = b2.dataAttrs;
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../chunks/jszip-C8_CqJxM.cjs");
4
4
  require("../chunks/helpers-nOdwpmwb.cjs");
5
- const superEditor_converter = require("../chunks/SuperConverter-iUnNfL5l.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-ChOaRc8I.cjs");
6
6
  require("../chunks/uuid-R7L08bOx.cjs");
7
7
  exports.SuperConverter = superEditor_converter.SuperConverter;
@@ -1,6 +1,6 @@
1
1
  import "../chunks/jszip-B1fkPkPJ.es.js";
2
2
  import "../chunks/helpers-C8e9wR5l.es.js";
3
- import { S } from "../chunks/SuperConverter-DpNWJAJU.es.js";
3
+ import { S } from "../chunks/SuperConverter-CQtzIJhu.es.js";
4
4
  import "../chunks/uuid-CjlX8hrF.es.js";
5
5
  export {
6
6
  S as SuperConverter
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-ChXg2ff-.cjs");
3
+ const index = require("./chunks/index-menqq4VC.cjs");
4
4
  const superEditor_docxZipper = require("./super-editor/docx-zipper.cjs");
5
5
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
6
6
  const vue = require("./chunks/vue-De9wkgLl.cjs");
7
- const superEditor_converter = require("./chunks/SuperConverter-iUnNfL5l.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-ChOaRc8I.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { ax as Node, ay as Mark } from "./chunks/index-DnpYZRby.es.js";
2
- import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-DnpYZRby.es.js";
1
+ import { ax as Node, ay as Mark } from "./chunks/index-C16jjGce.es.js";
2
+ import { ao, au, a9, ab, aw, am, av, aA, an, ak, aq, az, aa, as, aC, aE, aB, ac, aD, ar, at } from "./chunks/index-C16jjGce.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, E as createElementBlock, G as openBlock, K as createBaseVNode } from "./chunks/vue-BnBKJwCW.es.js";
6
- import { S, r } from "./chunks/SuperConverter-DpNWJAJU.es.js";
6
+ import { S, r } from "./chunks/SuperConverter-CQtzIJhu.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-ChXg2ff-.cjs");
4
- const superdoc = require("./chunks/index-DfBvgXLe.cjs");
5
- const superEditor_converter = require("./chunks/SuperConverter-iUnNfL5l.cjs");
3
+ const index = require("./chunks/index-menqq4VC.cjs");
4
+ const superdoc = require("./chunks/index-Brw_Mb9u.cjs");
5
+ const superEditor_converter = require("./chunks/SuperConverter-ChOaRc8I.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  require("./chunks/jszip-C8_CqJxM.cjs");
8
8
  require("./chunks/helpers-nOdwpmwb.cjs");
@@ -1,6 +1,6 @@
1
- import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-DnpYZRby.es.js";
2
- import { D, H, P, S, c } from "./chunks/index-HKM0YiEI.es.js";
3
- import { S as S2, r } from "./chunks/SuperConverter-DpNWJAJU.es.js";
1
+ import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-C16jjGce.es.js";
2
+ import { D, H, P, S, c } from "./chunks/index-CWf082Tz.es.js";
3
+ import { S as S2, r } from "./chunks/SuperConverter-CQtzIJhu.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  import "./chunks/jszip-B1fkPkPJ.es.js";
6
6
  import "./chunks/helpers-C8e9wR5l.es.js";
@@ -24496,6 +24496,26 @@
24496
24496
  }
24497
24497
  const fldCharEl = node2.elements?.find((el) => el.name === "w:fldChar");
24498
24498
  const fldType = fldCharEl?.attributes?.["w:fldCharType"];
24499
+ if (node2.name === "w:fldSimple") {
24500
+ const instrAttr = node2.attributes?.["w:instr"] || "";
24501
+ const fieldType = instrAttr.trim().split(/\s+/)[0];
24502
+ if (fieldType === "PAGE" || fieldType === "NUMPAGES") {
24503
+ const preprocessor = fieldType === "PAGE" ? preProcessPageInstruction : preProcessNumPagesInstruction;
24504
+ const contentNodes = node2.elements || [];
24505
+ let fieldRunRPr = null;
24506
+ for (const child of contentNodes) {
24507
+ const rPr = child.elements?.find((el) => el.name === "w:rPr");
24508
+ if (rPr) {
24509
+ fieldRunRPr = rPr;
24510
+ break;
24511
+ }
24512
+ }
24513
+ const processedField = preprocessor(contentNodes, instrAttr.trim(), fieldRunRPr);
24514
+ processedNodes.push(...processedField);
24515
+ i2++;
24516
+ continue;
24517
+ }
24518
+ }
24499
24519
  if (fldType === "begin") {
24500
24520
  const fieldInfo = scanFieldSequence(nodes, i2);
24501
24521
  if (fieldInfo && (fieldInfo.fieldType === "PAGE" || fieldInfo.fieldType === "NUMPAGES")) {
@@ -38197,7 +38217,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38197
38217
  static getStoredSuperdocVersion(docx) {
38198
38218
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
38199
38219
  }
38200
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.7.0-next.6") {
38220
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.7.0-next.7") {
38201
38221
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
38202
38222
  }
38203
38223
  /**
@@ -64367,7 +64387,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
64367
64387
  return false;
64368
64388
  }
64369
64389
  };
64370
- const summaryVersion = "1.7.0-next.6";
64390
+ const summaryVersion = "1.7.0-next.7";
64371
64391
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
64372
64392
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
64373
64393
  function mapAttributes(attrs) {
@@ -67035,7 +67055,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67035
67055
  * Process collaboration migrations
67036
67056
  */
67037
67057
  processCollaborationMigrations() {
67038
- console.debug("[checkVersionMigrations] Current editor version", "1.7.0-next.6");
67058
+ console.debug("[checkVersionMigrations] Current editor version", "1.7.0-next.7");
67039
67059
  if (!this.options.ydoc) return;
67040
67060
  const metaMap = this.options.ydoc.getMap("meta");
67041
67061
  let docVersion = metaMap.get("version");
@@ -90943,18 +90963,29 @@ ${o}
90943
90963
  const fieldId = event.data.fieldId;
90944
90964
  if (fieldId) {
90945
90965
  const targetPos = event.pmPosition;
90966
+ const pmStart = event.data.pmStart;
90946
90967
  let sourceStart = null;
90947
90968
  let sourceEnd = null;
90948
90969
  let sourceNode = null;
90949
- state.doc.descendants((node2, pos) => {
90950
- if (node2.type.name === "fieldAnnotation" && node2.attrs.fieldId === fieldId) {
90951
- sourceStart = pos;
90952
- sourceEnd = pos + node2.nodeSize;
90953
- sourceNode = node2;
90954
- return false;
90955
- }
90956
- return true;
90957
- });
90970
+ if (pmStart != null) {
90971
+ const nodeAt = state.doc.nodeAt(pmStart);
90972
+ if (nodeAt?.type?.name === "fieldAnnotation") {
90973
+ sourceStart = pmStart;
90974
+ sourceEnd = pmStart + nodeAt.nodeSize;
90975
+ sourceNode = nodeAt;
90976
+ }
90977
+ }
90978
+ if (sourceStart == null || sourceEnd == null || !sourceNode) {
90979
+ state.doc.descendants((node2, pos) => {
90980
+ if (node2.type.name === "fieldAnnotation" && node2.attrs.fieldId === fieldId) {
90981
+ sourceStart = pos;
90982
+ sourceEnd = pos + node2.nodeSize;
90983
+ sourceNode = node2;
90984
+ return false;
90985
+ }
90986
+ return true;
90987
+ });
90988
+ }
90958
90989
  if (sourceStart === null || sourceEnd === null || !sourceNode) {
90959
90990
  return;
90960
90991
  }
@@ -96228,7 +96259,10 @@ ${o}
96228
96259
  }
96229
96260
  return run2;
96230
96261
  }
96231
- const isTextRun = (run2) => run2.kind !== "tab";
96262
+ const isTextRun = (run2) => {
96263
+ const kind = run2.kind;
96264
+ return (kind === void 0 || kind === "text") && "text" in run2;
96265
+ };
96232
96266
  const dataAttrsCompatible = (a2, b2) => {
96233
96267
  const aAttrs = a2.dataAttrs;
96234
96268
  const bAttrs = b2.dataAttrs;
@@ -151161,7 +151195,7 @@ ${reason}`);
151161
151195
  this.config.colors = shuffleArray(this.config.colors);
151162
151196
  this.userColorMap = /* @__PURE__ */ new Map();
151163
151197
  this.colorIndex = 0;
151164
- this.version = "1.7.0-next.6";
151198
+ this.version = "1.7.0-next.7";
151165
151199
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
151166
151200
  this.superdocId = config2.superdocId || v4();
151167
151201
  this.colors = this.config.colors;