@harbour-enterprises/superdoc 1.4.1-next.1 → 1.4.1-next.3

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,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-BGllXGwn.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-DwUAu2hL.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-krXG8rm6.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-pQPsdBlj.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -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-lAO6pLM-.cjs");
5
- const index = require("./index-Bpm2bUws.cjs");
4
+ const superdoc = require("./index-myKwrK5s.cjs");
5
+ const index = require("./index-CyuAmipW.cjs");
6
6
  function self(vars) {
7
7
  const {
8
8
  opacityDisabled,
@@ -31533,7 +31533,7 @@ class SuperConverter {
31533
31533
  static getStoredSuperdocVersion(docx) {
31534
31534
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
31535
31535
  }
31536
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.4.1-next.1") {
31536
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.4.1-next.3") {
31537
31537
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
31538
31538
  }
31539
31539
  /**
@@ -31534,7 +31534,7 @@ class SuperConverter {
31534
31534
  static getStoredSuperdocVersion(docx) {
31535
31535
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
31536
31536
  }
31537
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.4.1-next.1") {
31537
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.4.1-next.3") {
31538
31538
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
31539
31539
  }
31540
31540
  /**
@@ -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-nKpvrgP6.cjs");
4
+ const superEditor_converter = require("./SuperConverter-D8OyLf2e.cjs");
5
5
  const vue = require("./vue-De9wkgLl.cjs");
6
6
  require("./jszip.min-BPh2MMAa.cjs");
7
7
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
@@ -15516,7 +15516,7 @@ const canUseDOM = () => {
15516
15516
  return false;
15517
15517
  }
15518
15518
  };
15519
- const summaryVersion = "1.4.1-next.1";
15519
+ const summaryVersion = "1.4.1-next.3";
15520
15520
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15521
15521
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15522
15522
  function mapAttributes(attrs) {
@@ -18148,7 +18148,7 @@ class Editor extends EventEmitter {
18148
18148
  * Process collaboration migrations
18149
18149
  */
18150
18150
  processCollaborationMigrations() {
18151
- console.debug("[checkVersionMigrations] Current editor version", "1.4.1-next.1");
18151
+ console.debug("[checkVersionMigrations] Current editor version", "1.4.1-next.3");
18152
18152
  if (!this.options.ydoc) return;
18153
18153
  const metaMap = this.options.ydoc.getMap("meta");
18154
18154
  let docVersion = metaMap.get("version");
@@ -23331,7 +23331,6 @@ const SDT_CONTAINER_STYLES = `
23331
23331
  const FIELD_ANNOTATION_STYLES = `
23332
23332
  /* Field annotation draggable styles */
23333
23333
  .superdoc-layout .annotation[data-draggable="true"] {
23334
- cursor: grab;
23335
23334
  user-select: none;
23336
23335
  -webkit-user-select: none;
23337
23336
  }
@@ -33992,8 +33991,15 @@ function layoutDocument(blocks, measures, options = {}) {
33992
33991
  const paraBlock = block;
33993
33992
  const isEmpty2 = !paraBlock.runs || paraBlock.runs.length === 0 || paraBlock.runs.length === 1 && (!paraBlock.runs[0].kind || paraBlock.runs[0].kind === "text") && (!paraBlock.runs[0].text || paraBlock.runs[0].text === "");
33994
33993
  if (isEmpty2) {
33994
+ const isSectPrMarker = paraBlock.attrs?.sectPrMarker === true;
33995
33995
  const prevBlock = index2 > 0 ? blocks[index2 - 1] : null;
33996
33996
  const nextBlock = index2 < blocks.length - 1 ? blocks[index2 + 1] : null;
33997
+ const nextSectionBreak = nextBlock?.kind === "sectionBreak" ? nextBlock : null;
33998
+ const nextBreakType = nextSectionBreak?.type ?? (nextSectionBreak?.attrs?.source === "sectPr" ? "nextPage" : void 0);
33999
+ const nextBreakForcesPage = nextSectionBreak && (nextBreakType === "nextPage" || nextBreakType === "evenPage" || nextBreakType === "oddPage" || nextSectionBreak.attrs?.requirePageBoundary === true);
34000
+ if (isSectPrMarker && nextBreakForcesPage) {
34001
+ continue;
34002
+ }
33997
34003
  if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak") {
33998
34004
  continue;
33999
34005
  }
@@ -45355,6 +45361,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45355
45361
  }
45356
45362
  const linkedStyleResolver = createLinkedStyleResolver(converterContext?.linkedStyles);
45357
45363
  const blocks = [];
45364
+ const paraAttrs = para.attrs ?? {};
45365
+ const rawParagraphProps = typeof paraAttrs.paragraphProperties === "object" && paraAttrs.paragraphProperties !== null ? paraAttrs.paragraphProperties : void 0;
45366
+ const hasSectPr2 = Boolean(rawParagraphProps?.sectPr);
45367
+ const isSectPrMarker = hasSectPr2 || paraAttrs.pageBreakSource === "sectPr";
45358
45368
  if (hasPageBreakBefore(para)) {
45359
45369
  blocks.push({
45360
45370
  kind: "pageBreak",
@@ -45376,11 +45386,19 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45376
45386
  emptyRun.pmStart = paraPos.start + 1;
45377
45387
  emptyRun.pmEnd = paraPos.start + 1;
45378
45388
  }
45389
+ let emptyParagraphAttrs = cloneParagraphAttrs(paragraphAttrs);
45390
+ if (isSectPrMarker) {
45391
+ if (emptyParagraphAttrs) {
45392
+ emptyParagraphAttrs.sectPrMarker = true;
45393
+ } else {
45394
+ emptyParagraphAttrs = { sectPrMarker: true };
45395
+ }
45396
+ }
45379
45397
  blocks.push({
45380
45398
  kind: "paragraph",
45381
45399
  id: baseBlockId,
45382
45400
  runs: [emptyRun],
45383
- attrs: cloneParagraphAttrs(paragraphAttrs)
45401
+ attrs: emptyParagraphAttrs
45384
45402
  });
45385
45403
  return blocks;
45386
45404
  }
@@ -52533,6 +52551,40 @@ class PresentationEditor extends EventEmitter {
52533
52551
  this.#editor.view?.focus();
52534
52552
  }
52535
52553
  }
52554
+ #resolveFieldAnnotationSelectionFromElement(annotationEl) {
52555
+ const pmStartRaw = annotationEl.dataset?.pmStart;
52556
+ if (pmStartRaw == null) {
52557
+ return null;
52558
+ }
52559
+ const pmStart = Number(pmStartRaw);
52560
+ if (!Number.isFinite(pmStart)) {
52561
+ return null;
52562
+ }
52563
+ const doc2 = this.#editor.state?.doc;
52564
+ if (!doc2) {
52565
+ return null;
52566
+ }
52567
+ const layoutEpochRaw = annotationEl.dataset?.layoutEpoch;
52568
+ const layoutEpoch = layoutEpochRaw != null ? Number(layoutEpochRaw) : NaN;
52569
+ const effectiveEpoch = Number.isFinite(layoutEpoch) ? layoutEpoch : this.#epochMapper.getCurrentEpoch();
52570
+ const mapped = this.#epochMapper.mapPosFromLayoutToCurrentDetailed(pmStart, effectiveEpoch, 1);
52571
+ if (!mapped.ok) {
52572
+ const fallbackPos = Math.max(0, Math.min(pmStart, doc2.content.size));
52573
+ const fallbackNode = doc2.nodeAt(fallbackPos);
52574
+ if (fallbackNode?.type?.name === "fieldAnnotation") {
52575
+ return { node: fallbackNode, pos: fallbackPos };
52576
+ }
52577
+ this.#pendingDocChange = true;
52578
+ this.#scheduleRerender();
52579
+ return null;
52580
+ }
52581
+ const clampedPos = Math.max(0, Math.min(mapped.pos, doc2.content.size));
52582
+ const node = doc2.nodeAt(clampedPos);
52583
+ if (!node || node.type.name !== "fieldAnnotation") {
52584
+ return null;
52585
+ }
52586
+ return { node, pos: clampedPos };
52587
+ }
52536
52588
  #setupInputBridge() {
52537
52589
  this.#inputBridge?.destroy();
52538
52590
  const win = this.#visibleHost.ownerDocument?.defaultView ?? window;
@@ -52623,8 +52675,30 @@ class PresentationEditor extends EventEmitter {
52623
52675
  linkEl.dispatchEvent(linkClickEvent);
52624
52676
  return;
52625
52677
  }
52678
+ const annotationEl = target?.closest?.(".annotation[data-pm-start]");
52626
52679
  const isDraggableAnnotation = target?.closest?.('[data-draggable="true"]') != null;
52627
52680
  this.#suppressFocusInFromDraggable = isDraggableAnnotation;
52681
+ if (annotationEl) {
52682
+ if (!this.#editor.isEditable) {
52683
+ return;
52684
+ }
52685
+ const resolved = this.#resolveFieldAnnotationSelectionFromElement(annotationEl);
52686
+ if (resolved) {
52687
+ try {
52688
+ const tr = this.#editor.state.tr.setSelection(superEditor_converter.NodeSelection.create(this.#editor.state.doc, resolved.pos));
52689
+ this.#editor.view?.dispatch(tr);
52690
+ } catch {
52691
+ }
52692
+ this.#editor.emit("fieldAnnotationClicked", {
52693
+ editor: this.#editor,
52694
+ node: resolved.node,
52695
+ nodePos: resolved.pos,
52696
+ event,
52697
+ currentTarget: annotationEl
52698
+ });
52699
+ }
52700
+ return;
52701
+ }
52628
52702
  if (!this.#layoutState.layout) {
52629
52703
  if (!isDraggableAnnotation) {
52630
52704
  event.preventDefault();
@@ -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-DwUAu2hL.es.js";
2
- import "./SuperConverter-BuK6B5Kx.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-pQPsdBlj.es.js";
2
+ import "./SuperConverter-Cc0b8QgF.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-D_1Yi2Kj.es.js"));
7516
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-B8mbSF_z.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.4.1-next.1";
8470
+ this.version = "1.4.1-next.3";
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,6 +1,6 @@
1
1
  "use strict";
2
- const index = require("./index-Bpm2bUws.cjs");
3
- require("./SuperConverter-nKpvrgP6.cjs");
2
+ const index = require("./index-CyuAmipW.cjs");
3
+ require("./SuperConverter-D8OyLf2e.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-BaDWswEX.cjs")));
7533
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CCmdZiiL.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.4.1-next.1";
8487
+ this.version = "1.4.1-next.3";
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-BuK6B5Kx.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-Cc0b8QgF.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 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";
@@ -15499,7 +15499,7 @@ const canUseDOM = () => {
15499
15499
  return false;
15500
15500
  }
15501
15501
  };
15502
- const summaryVersion = "1.4.1-next.1";
15502
+ const summaryVersion = "1.4.1-next.3";
15503
15503
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15504
15504
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15505
15505
  function mapAttributes(attrs) {
@@ -18131,7 +18131,7 @@ class Editor extends EventEmitter {
18131
18131
  * Process collaboration migrations
18132
18132
  */
18133
18133
  processCollaborationMigrations() {
18134
- console.debug("[checkVersionMigrations] Current editor version", "1.4.1-next.1");
18134
+ console.debug("[checkVersionMigrations] Current editor version", "1.4.1-next.3");
18135
18135
  if (!this.options.ydoc) return;
18136
18136
  const metaMap = this.options.ydoc.getMap("meta");
18137
18137
  let docVersion = metaMap.get("version");
@@ -23314,7 +23314,6 @@ const SDT_CONTAINER_STYLES = `
23314
23314
  const FIELD_ANNOTATION_STYLES = `
23315
23315
  /* Field annotation draggable styles */
23316
23316
  .superdoc-layout .annotation[data-draggable="true"] {
23317
- cursor: grab;
23318
23317
  user-select: none;
23319
23318
  -webkit-user-select: none;
23320
23319
  }
@@ -33975,8 +33974,15 @@ function layoutDocument(blocks, measures, options = {}) {
33975
33974
  const paraBlock = block;
33976
33975
  const isEmpty2 = !paraBlock.runs || paraBlock.runs.length === 0 || paraBlock.runs.length === 1 && (!paraBlock.runs[0].kind || paraBlock.runs[0].kind === "text") && (!paraBlock.runs[0].text || paraBlock.runs[0].text === "");
33977
33976
  if (isEmpty2) {
33977
+ const isSectPrMarker = paraBlock.attrs?.sectPrMarker === true;
33978
33978
  const prevBlock = index2 > 0 ? blocks[index2 - 1] : null;
33979
33979
  const nextBlock = index2 < blocks.length - 1 ? blocks[index2 + 1] : null;
33980
+ const nextSectionBreak = nextBlock?.kind === "sectionBreak" ? nextBlock : null;
33981
+ const nextBreakType = nextSectionBreak?.type ?? (nextSectionBreak?.attrs?.source === "sectPr" ? "nextPage" : void 0);
33982
+ const nextBreakForcesPage = nextSectionBreak && (nextBreakType === "nextPage" || nextBreakType === "evenPage" || nextBreakType === "oddPage" || nextSectionBreak.attrs?.requirePageBoundary === true);
33983
+ if (isSectPrMarker && nextBreakForcesPage) {
33984
+ continue;
33985
+ }
33980
33986
  if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak") {
33981
33987
  continue;
33982
33988
  }
@@ -45338,6 +45344,10 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45338
45344
  }
45339
45345
  const linkedStyleResolver = createLinkedStyleResolver(converterContext?.linkedStyles);
45340
45346
  const blocks = [];
45347
+ const paraAttrs = para.attrs ?? {};
45348
+ const rawParagraphProps = typeof paraAttrs.paragraphProperties === "object" && paraAttrs.paragraphProperties !== null ? paraAttrs.paragraphProperties : void 0;
45349
+ const hasSectPr2 = Boolean(rawParagraphProps?.sectPr);
45350
+ const isSectPrMarker = hasSectPr2 || paraAttrs.pageBreakSource === "sectPr";
45341
45351
  if (hasPageBreakBefore(para)) {
45342
45352
  blocks.push({
45343
45353
  kind: "pageBreak",
@@ -45359,11 +45369,19 @@ function paragraphToFlowBlocks$1(para, nextBlockId, positions, defaultFont, defa
45359
45369
  emptyRun.pmStart = paraPos.start + 1;
45360
45370
  emptyRun.pmEnd = paraPos.start + 1;
45361
45371
  }
45372
+ let emptyParagraphAttrs = cloneParagraphAttrs(paragraphAttrs);
45373
+ if (isSectPrMarker) {
45374
+ if (emptyParagraphAttrs) {
45375
+ emptyParagraphAttrs.sectPrMarker = true;
45376
+ } else {
45377
+ emptyParagraphAttrs = { sectPrMarker: true };
45378
+ }
45379
+ }
45362
45380
  blocks.push({
45363
45381
  kind: "paragraph",
45364
45382
  id: baseBlockId,
45365
45383
  runs: [emptyRun],
45366
- attrs: cloneParagraphAttrs(paragraphAttrs)
45384
+ attrs: emptyParagraphAttrs
45367
45385
  });
45368
45386
  return blocks;
45369
45387
  }
@@ -52516,6 +52534,40 @@ class PresentationEditor extends EventEmitter {
52516
52534
  this.#editor.view?.focus();
52517
52535
  }
52518
52536
  }
52537
+ #resolveFieldAnnotationSelectionFromElement(annotationEl) {
52538
+ const pmStartRaw = annotationEl.dataset?.pmStart;
52539
+ if (pmStartRaw == null) {
52540
+ return null;
52541
+ }
52542
+ const pmStart = Number(pmStartRaw);
52543
+ if (!Number.isFinite(pmStart)) {
52544
+ return null;
52545
+ }
52546
+ const doc2 = this.#editor.state?.doc;
52547
+ if (!doc2) {
52548
+ return null;
52549
+ }
52550
+ const layoutEpochRaw = annotationEl.dataset?.layoutEpoch;
52551
+ const layoutEpoch = layoutEpochRaw != null ? Number(layoutEpochRaw) : NaN;
52552
+ const effectiveEpoch = Number.isFinite(layoutEpoch) ? layoutEpoch : this.#epochMapper.getCurrentEpoch();
52553
+ const mapped = this.#epochMapper.mapPosFromLayoutToCurrentDetailed(pmStart, effectiveEpoch, 1);
52554
+ if (!mapped.ok) {
52555
+ const fallbackPos = Math.max(0, Math.min(pmStart, doc2.content.size));
52556
+ const fallbackNode = doc2.nodeAt(fallbackPos);
52557
+ if (fallbackNode?.type?.name === "fieldAnnotation") {
52558
+ return { node: fallbackNode, pos: fallbackPos };
52559
+ }
52560
+ this.#pendingDocChange = true;
52561
+ this.#scheduleRerender();
52562
+ return null;
52563
+ }
52564
+ const clampedPos = Math.max(0, Math.min(mapped.pos, doc2.content.size));
52565
+ const node = doc2.nodeAt(clampedPos);
52566
+ if (!node || node.type.name !== "fieldAnnotation") {
52567
+ return null;
52568
+ }
52569
+ return { node, pos: clampedPos };
52570
+ }
52519
52571
  #setupInputBridge() {
52520
52572
  this.#inputBridge?.destroy();
52521
52573
  const win = this.#visibleHost.ownerDocument?.defaultView ?? window;
@@ -52606,8 +52658,30 @@ class PresentationEditor extends EventEmitter {
52606
52658
  linkEl.dispatchEvent(linkClickEvent);
52607
52659
  return;
52608
52660
  }
52661
+ const annotationEl = target?.closest?.(".annotation[data-pm-start]");
52609
52662
  const isDraggableAnnotation = target?.closest?.('[data-draggable="true"]') != null;
52610
52663
  this.#suppressFocusInFromDraggable = isDraggableAnnotation;
52664
+ if (annotationEl) {
52665
+ if (!this.#editor.isEditable) {
52666
+ return;
52667
+ }
52668
+ const resolved = this.#resolveFieldAnnotationSelectionFromElement(annotationEl);
52669
+ if (resolved) {
52670
+ try {
52671
+ const tr = this.#editor.state.tr.setSelection(NodeSelection.create(this.#editor.state.doc, resolved.pos));
52672
+ this.#editor.view?.dispatch(tr);
52673
+ } catch {
52674
+ }
52675
+ this.#editor.emit("fieldAnnotationClicked", {
52676
+ editor: this.#editor,
52677
+ node: resolved.node,
52678
+ nodePos: resolved.pos,
52679
+ event,
52680
+ currentTarget: annotationEl
52681
+ });
52682
+ }
52683
+ return;
52684
+ }
52611
52685
  if (!this.#layoutState.layout) {
52612
52686
  if (!isDraggableAnnotation) {
52613
52687
  event.preventDefault();
@@ -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-nKpvrgP6.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-D8OyLf2e.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-BuK6B5Kx.es.js";
3
+ import { S } from "../chunks/SuperConverter-Cc0b8QgF.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-Bpm2bUws.cjs");
3
+ const index = require("./chunks/index-CyuAmipW.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-nKpvrgP6.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-D8OyLf2e.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-DwUAu2hL.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-DwUAu2hL.es.js";
1
+ import { ax as Node, ay as Mark } from "./chunks/index-pQPsdBlj.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-pQPsdBlj.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-BuK6B5Kx.es.js";
6
+ import { S, r } from "./chunks/SuperConverter-Cc0b8QgF.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-Bpm2bUws.cjs");
4
- const superdoc = require("./chunks/index-lAO6pLM-.cjs");
5
- const superEditor_converter = require("./chunks/SuperConverter-nKpvrgP6.cjs");
3
+ const index = require("./chunks/index-CyuAmipW.cjs");
4
+ const superdoc = require("./chunks/index-myKwrK5s.cjs");
5
+ const superEditor_converter = require("./chunks/SuperConverter-D8OyLf2e.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-DwUAu2hL.es.js";
2
- import { D, H, P, S, c } from "./chunks/index-BGllXGwn.es.js";
3
- import { S as S2, r } from "./chunks/SuperConverter-BuK6B5Kx.es.js";
1
+ import { au, ab, aw, av, as, a7, ac, ar, at } from "./chunks/index-pQPsdBlj.es.js";
2
+ import { D, H, P, S, c } from "./chunks/index-krXG8rm6.es.js";
3
+ import { S as S2, r } from "./chunks/SuperConverter-Cc0b8QgF.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";
@@ -36961,7 +36961,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36961
36961
  static getStoredSuperdocVersion(docx) {
36962
36962
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
36963
36963
  }
36964
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.4.1-next.1") {
36964
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.4.1-next.3") {
36965
36965
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
36966
36966
  }
36967
36967
  /**
@@ -62836,7 +62836,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
62836
62836
  return false;
62837
62837
  }
62838
62838
  };
62839
- const summaryVersion = "1.4.1-next.1";
62839
+ const summaryVersion = "1.4.1-next.3";
62840
62840
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
62841
62841
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
62842
62842
  function mapAttributes(attrs) {
@@ -65469,7 +65469,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65469
65469
  * Process collaboration migrations
65470
65470
  */
65471
65471
  processCollaborationMigrations() {
65472
- console.debug("[checkVersionMigrations] Current editor version", "1.4.1-next.1");
65472
+ console.debug("[checkVersionMigrations] Current editor version", "1.4.1-next.3");
65473
65473
  if (!this.options.ydoc) return;
65474
65474
  const metaMap = this.options.ydoc.getMap("meta");
65475
65475
  let docVersion = metaMap.get("version");
@@ -70652,7 +70652,6 @@ ${l}
70652
70652
  const FIELD_ANNOTATION_STYLES = `
70653
70653
  /* Field annotation draggable styles */
70654
70654
  .superdoc-layout .annotation[data-draggable="true"] {
70655
- cursor: grab;
70656
70655
  user-select: none;
70657
70656
  -webkit-user-select: none;
70658
70657
  }
@@ -81314,8 +81313,15 @@ ${l}
81314
81313
  const paraBlock = block;
81315
81314
  const isEmpty2 = !paraBlock.runs || paraBlock.runs.length === 0 || paraBlock.runs.length === 1 && (!paraBlock.runs[0].kind || paraBlock.runs[0].kind === "text") && (!paraBlock.runs[0].text || paraBlock.runs[0].text === "");
81316
81315
  if (isEmpty2) {
81316
+ const isSectPrMarker = paraBlock.attrs?.sectPrMarker === true;
81317
81317
  const prevBlock = index2 > 0 ? blocks2[index2 - 1] : null;
81318
81318
  const nextBlock = index2 < blocks2.length - 1 ? blocks2[index2 + 1] : null;
81319
+ const nextSectionBreak = nextBlock?.kind === "sectionBreak" ? nextBlock : null;
81320
+ const nextBreakType = nextSectionBreak?.type ?? (nextSectionBreak?.attrs?.source === "sectPr" ? "nextPage" : void 0);
81321
+ const nextBreakForcesPage = nextSectionBreak && (nextBreakType === "nextPage" || nextBreakType === "evenPage" || nextBreakType === "oddPage" || nextSectionBreak.attrs?.requirePageBoundary === true);
81322
+ if (isSectPrMarker && nextBreakForcesPage) {
81323
+ continue;
81324
+ }
81319
81325
  if (prevBlock?.kind === "pageBreak" && nextBlock?.kind === "sectionBreak") {
81320
81326
  continue;
81321
81327
  }
@@ -92624,6 +92630,10 @@ ${l}
92624
92630
  }
92625
92631
  const linkedStyleResolver = createLinkedStyleResolver(converterContext?.linkedStyles);
92626
92632
  const blocks2 = [];
92633
+ const paraAttrs = para.attrs ?? {};
92634
+ const rawParagraphProps = typeof paraAttrs.paragraphProperties === "object" && paraAttrs.paragraphProperties !== null ? paraAttrs.paragraphProperties : void 0;
92635
+ const hasSectPr2 = Boolean(rawParagraphProps?.sectPr);
92636
+ const isSectPrMarker = hasSectPr2 || paraAttrs.pageBreakSource === "sectPr";
92627
92637
  if (hasPageBreakBefore(para)) {
92628
92638
  blocks2.push({
92629
92639
  kind: "pageBreak",
@@ -92645,11 +92655,19 @@ ${l}
92645
92655
  emptyRun.pmStart = paraPos.start + 1;
92646
92656
  emptyRun.pmEnd = paraPos.start + 1;
92647
92657
  }
92658
+ let emptyParagraphAttrs = cloneParagraphAttrs(paragraphAttrs);
92659
+ if (isSectPrMarker) {
92660
+ if (emptyParagraphAttrs) {
92661
+ emptyParagraphAttrs.sectPrMarker = true;
92662
+ } else {
92663
+ emptyParagraphAttrs = { sectPrMarker: true };
92664
+ }
92665
+ }
92648
92666
  blocks2.push({
92649
92667
  kind: "paragraph",
92650
92668
  id: baseBlockId,
92651
92669
  runs: [emptyRun],
92652
- attrs: cloneParagraphAttrs(paragraphAttrs)
92670
+ attrs: emptyParagraphAttrs
92653
92671
  });
92654
92672
  return blocks2;
92655
92673
  }
@@ -99799,6 +99817,40 @@ ${l}
99799
99817
  this.#editor.view?.focus();
99800
99818
  }
99801
99819
  }
99820
+ #resolveFieldAnnotationSelectionFromElement(annotationEl) {
99821
+ const pmStartRaw = annotationEl.dataset?.pmStart;
99822
+ if (pmStartRaw == null) {
99823
+ return null;
99824
+ }
99825
+ const pmStart = Number(pmStartRaw);
99826
+ if (!Number.isFinite(pmStart)) {
99827
+ return null;
99828
+ }
99829
+ const doc2 = this.#editor.state?.doc;
99830
+ if (!doc2) {
99831
+ return null;
99832
+ }
99833
+ const layoutEpochRaw = annotationEl.dataset?.layoutEpoch;
99834
+ const layoutEpoch = layoutEpochRaw != null ? Number(layoutEpochRaw) : NaN;
99835
+ const effectiveEpoch = Number.isFinite(layoutEpoch) ? layoutEpoch : this.#epochMapper.getCurrentEpoch();
99836
+ const mapped = this.#epochMapper.mapPosFromLayoutToCurrentDetailed(pmStart, effectiveEpoch, 1);
99837
+ if (!mapped.ok) {
99838
+ const fallbackPos = Math.max(0, Math.min(pmStart, doc2.content.size));
99839
+ const fallbackNode = doc2.nodeAt(fallbackPos);
99840
+ if (fallbackNode?.type?.name === "fieldAnnotation") {
99841
+ return { node: fallbackNode, pos: fallbackPos };
99842
+ }
99843
+ this.#pendingDocChange = true;
99844
+ this.#scheduleRerender();
99845
+ return null;
99846
+ }
99847
+ const clampedPos = Math.max(0, Math.min(mapped.pos, doc2.content.size));
99848
+ const node2 = doc2.nodeAt(clampedPos);
99849
+ if (!node2 || node2.type.name !== "fieldAnnotation") {
99850
+ return null;
99851
+ }
99852
+ return { node: node2, pos: clampedPos };
99853
+ }
99802
99854
  #setupInputBridge() {
99803
99855
  this.#inputBridge?.destroy();
99804
99856
  const win = this.#visibleHost.ownerDocument?.defaultView ?? window;
@@ -99889,8 +99941,30 @@ ${l}
99889
99941
  linkEl.dispatchEvent(linkClickEvent);
99890
99942
  return;
99891
99943
  }
99944
+ const annotationEl = target?.closest?.(".annotation[data-pm-start]");
99892
99945
  const isDraggableAnnotation = target?.closest?.('[data-draggable="true"]') != null;
99893
99946
  this.#suppressFocusInFromDraggable = isDraggableAnnotation;
99947
+ if (annotationEl) {
99948
+ if (!this.#editor.isEditable) {
99949
+ return;
99950
+ }
99951
+ const resolved = this.#resolveFieldAnnotationSelectionFromElement(annotationEl);
99952
+ if (resolved) {
99953
+ try {
99954
+ const tr = this.#editor.state.tr.setSelection(NodeSelection.create(this.#editor.state.doc, resolved.pos));
99955
+ this.#editor.view?.dispatch(tr);
99956
+ } catch {
99957
+ }
99958
+ this.#editor.emit("fieldAnnotationClicked", {
99959
+ editor: this.#editor,
99960
+ node: resolved.node,
99961
+ nodePos: resolved.pos,
99962
+ event,
99963
+ currentTarget: annotationEl
99964
+ });
99965
+ }
99966
+ return;
99967
+ }
99894
99968
  if (!this.#layoutState.layout) {
99895
99969
  if (!isDraggableAnnotation) {
99896
99970
  event.preventDefault();
@@ -145530,7 +145604,7 @@ ${reason}`);
145530
145604
  this.config.colors = shuffleArray(this.config.colors);
145531
145605
  this.userColorMap = /* @__PURE__ */ new Map();
145532
145606
  this.colorIndex = 0;
145533
- this.version = "1.4.1-next.1";
145607
+ this.version = "1.4.1-next.3";
145534
145608
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
145535
145609
  this.superdocId = config2.superdocId || v4();
145536
145610
  this.colors = this.config.colors;