@harbour-enterprises/superdoc 1.9.0 → 1.10.0-next.1

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 (25) hide show
  1. package/dist/chunks/{PdfViewer-WdyXSIvk.cjs → PdfViewer-B6cdXTuo.cjs} +2 -2
  2. package/dist/chunks/{PdfViewer-D1Am0D4N.es.js → PdfViewer-DWeh_pDp.es.js} +2 -2
  3. package/dist/chunks/{SuperConverter-VeJEcjsk.cjs → SuperConverter-BO9kMm-h.cjs} +33 -8
  4. package/dist/chunks/{SuperConverter-CQG__OC1.es.js → SuperConverter-qcdYJrXV.es.js} +33 -8
  5. package/dist/chunks/{index-DCmsKDv1.cjs → index-BYMKRslm.cjs} +42 -5
  6. package/dist/chunks/{index-CWI4NbKU.es.js → index-D3eg-_78.es.js} +42 -5
  7. package/dist/chunks/{index-VYosokDK.es.js → index-DjSMQmwC.es.js} +9 -9
  8. package/dist/chunks/{index-s4_zQhVC.cjs → index-DlMzhWAN.cjs} +9 -9
  9. package/dist/style.css +17 -17
  10. package/dist/super-editor/converter.cjs +1 -1
  11. package/dist/super-editor/converter.es.js +1 -1
  12. package/dist/super-editor/core/presentation-editor/PresentationEditor.d.ts.map +1 -1
  13. package/dist/super-editor/core/presentation-editor/pointer-events/EditorInputManager.d.ts.map +1 -1
  14. package/dist/super-editor/core/super-converter/v2/importer/documentCommentsImporter.d.ts.map +1 -1
  15. package/dist/super-editor/core/super-converter/v3/handlers/w/tbl/tbl-translator.d.ts.map +1 -1
  16. package/dist/super-editor/core/super-converter/v3/handlers/w/tc/helpers/legacy-handle-table-cell-node.d.ts.map +1 -1
  17. package/dist/super-editor.cjs +2 -2
  18. package/dist/super-editor.es.js +3 -3
  19. package/dist/superdoc/src/stores/comments-store.d.ts +1 -1
  20. package/dist/superdoc/src/stores/superdoc-store.d.ts +3 -3
  21. package/dist/superdoc.cjs +3 -3
  22. package/dist/superdoc.es.js +3 -3
  23. package/dist/superdoc.umd.js +80 -18
  24. package/dist/superdoc.umd.js.map +1 -1
  25. package/package.json +1 -1
@@ -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-s4_zQhVC.cjs");
5
- const index = require("./index-DCmsKDv1.cjs");
4
+ const superdoc = require("./index-DlMzhWAN.cjs");
5
+ const index = require("./index-BYMKRslm.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, b as computed, r as ref, e as onMounted, f as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, g as createCommentVNode, i as createVNode, u as unref } from "./vue-DI6_Tcq0.es.js";
2
- import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-VYosokDK.es.js";
3
- import { o as derived, p as c, q as cB, r as fadeInTransition, s as cM, w as warnOnce, u as useConfig, t as useTheme, v as pxfy, x as createKey, y as useThemeClass, z as useCompitable, B as _export_sfc } from "./index-CWI4NbKU.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-DjSMQmwC.es.js";
3
+ import { o as derived, p as c, q as cB, r as fadeInTransition, s as cM, w as warnOnce, u as useConfig, t as useTheme, v as pxfy, x as createKey, y as useThemeClass, z as useCompitable, B as _export_sfc } from "./index-D3eg-_78.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -9761,10 +9761,12 @@ function handleTableCellNode({
9761
9761
  });
9762
9762
  if (colspan > 1) attributes["colspan"] = colspan;
9763
9763
  let width = null;
9764
+ const widthType = tableCellProperties.cellWidth?.type;
9764
9765
  if (!preferTableGridWidths) {
9765
- width = tableCellProperties.cellWidth?.value ? helpers.twipsToPixels(tableCellProperties.cellWidth?.value) : null;
9766
+ if (widthType !== "pct") {
9767
+ width = tableCellProperties.cellWidth?.value ? helpers.twipsToPixels(tableCellProperties.cellWidth?.value) : null;
9768
+ }
9766
9769
  }
9767
- const widthType = tableCellProperties.cellWidth?.type;
9768
9770
  if (widthType) attributes["widthType"] = widthType;
9769
9771
  if (!width && columnWidth) width = columnWidth;
9770
9772
  if (width) {
@@ -27490,13 +27492,21 @@ const encode$u = (params, encodedAttrs) => {
27490
27492
  }
27491
27493
  if (encodedAttrs.tableProperties.tableWidth) {
27492
27494
  const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
27493
- const widthPx = helpers.twipsToPixels(tableWidthMeasurement.value);
27494
- if (widthPx != null) {
27495
+ if (tableWidthMeasurement.type === "pct" && typeof tableWidthMeasurement.value === "number") {
27495
27496
  encodedAttrs.tableWidth = {
27496
- width: widthPx,
27497
+ value: tableWidthMeasurement.value,
27497
27498
  type: tableWidthMeasurement.type
27498
27499
  };
27499
- } else if (tableWidthMeasurement.type === "auto") {
27500
+ } else {
27501
+ const widthPx = helpers.twipsToPixels(tableWidthMeasurement.value);
27502
+ if (widthPx != null) {
27503
+ encodedAttrs.tableWidth = {
27504
+ width: widthPx,
27505
+ type: tableWidthMeasurement.type
27506
+ };
27507
+ }
27508
+ }
27509
+ if (!encodedAttrs.tableWidth && tableWidthMeasurement.type === "auto") {
27500
27510
  encodedAttrs.tableWidth = {
27501
27511
  width: 0,
27502
27512
  type: tableWidthMeasurement.type
@@ -29960,8 +29970,9 @@ function importCommentData({ docx, editor, converter }) {
29960
29970
  const lastElement = parsedElements[parsedElements.length - 1];
29961
29971
  const paraId = lastElement?.attrs?.["w14:paraId"];
29962
29972
  const threadingMethod = commentThreadingProfile.defaultStyle;
29973
+ const commentId = getCommentId(internalId, importedId, unixTimestampMs);
29963
29974
  return {
29964
- commentId: internalId || uuid.v4(),
29975
+ commentId,
29965
29976
  importedId,
29966
29977
  creatorName: authorName,
29967
29978
  creatorEmail: authorEmail,
@@ -30340,6 +30351,20 @@ const applyParentRelationships = (comments, parentMap, trackedChangeParentMap =
30340
30351
  return updatedComment;
30341
30352
  });
30342
30353
  };
30354
+ const simpleHash = (input) => {
30355
+ let hash = 2166136261;
30356
+ for (let i = 0; i < input.length; i++) {
30357
+ hash ^= input.charCodeAt(i);
30358
+ hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);
30359
+ }
30360
+ return (hash >>> 0).toString(16).padStart(8, "0");
30361
+ };
30362
+ const getCommentId = (internalId, importedId, createdTime) => {
30363
+ if (internalId != null) return internalId;
30364
+ if (importedId == null || !Number.isFinite(createdTime)) return uuid.v4();
30365
+ const hash = simpleHash(`${importedId}-${createdTime}`);
30366
+ return `imported-${hash}`;
30367
+ };
30343
30368
  const stripFootnoteMarkerNodes = (nodes) => {
30344
30369
  if (!Array.isArray(nodes) || nodes.length === 0) return nodes;
30345
30370
  const walk = (list) => {
@@ -33705,7 +33730,7 @@ class SuperConverter {
33705
33730
  static getStoredSuperdocVersion(docx) {
33706
33731
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33707
33732
  }
33708
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.9.0") {
33733
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.10.0-next.1") {
33709
33734
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33710
33735
  }
33711
33736
  /**
@@ -9760,10 +9760,12 @@ function handleTableCellNode({
9760
9760
  });
9761
9761
  if (colspan > 1) attributes["colspan"] = colspan;
9762
9762
  let width = null;
9763
+ const widthType = tableCellProperties.cellWidth?.type;
9763
9764
  if (!preferTableGridWidths) {
9764
- width = tableCellProperties.cellWidth?.value ? twipsToPixels(tableCellProperties.cellWidth?.value) : null;
9765
+ if (widthType !== "pct") {
9766
+ width = tableCellProperties.cellWidth?.value ? twipsToPixels(tableCellProperties.cellWidth?.value) : null;
9767
+ }
9765
9768
  }
9766
- const widthType = tableCellProperties.cellWidth?.type;
9767
9769
  if (widthType) attributes["widthType"] = widthType;
9768
9770
  if (!width && columnWidth) width = columnWidth;
9769
9771
  if (width) {
@@ -27489,13 +27491,21 @@ const encode$u = (params, encodedAttrs) => {
27489
27491
  }
27490
27492
  if (encodedAttrs.tableProperties.tableWidth) {
27491
27493
  const tableWidthMeasurement = encodedAttrs.tableProperties.tableWidth;
27492
- const widthPx = twipsToPixels(tableWidthMeasurement.value);
27493
- if (widthPx != null) {
27494
+ if (tableWidthMeasurement.type === "pct" && typeof tableWidthMeasurement.value === "number") {
27494
27495
  encodedAttrs.tableWidth = {
27495
- width: widthPx,
27496
+ value: tableWidthMeasurement.value,
27496
27497
  type: tableWidthMeasurement.type
27497
27498
  };
27498
- } else if (tableWidthMeasurement.type === "auto") {
27499
+ } else {
27500
+ const widthPx = twipsToPixels(tableWidthMeasurement.value);
27501
+ if (widthPx != null) {
27502
+ encodedAttrs.tableWidth = {
27503
+ width: widthPx,
27504
+ type: tableWidthMeasurement.type
27505
+ };
27506
+ }
27507
+ }
27508
+ if (!encodedAttrs.tableWidth && tableWidthMeasurement.type === "auto") {
27499
27509
  encodedAttrs.tableWidth = {
27500
27510
  width: 0,
27501
27511
  type: tableWidthMeasurement.type
@@ -29959,8 +29969,9 @@ function importCommentData({ docx, editor, converter }) {
29959
29969
  const lastElement = parsedElements[parsedElements.length - 1];
29960
29970
  const paraId = lastElement?.attrs?.["w14:paraId"];
29961
29971
  const threadingMethod = commentThreadingProfile.defaultStyle;
29972
+ const commentId = getCommentId(internalId, importedId, unixTimestampMs);
29962
29973
  return {
29963
- commentId: internalId || v4(),
29974
+ commentId,
29964
29975
  importedId,
29965
29976
  creatorName: authorName,
29966
29977
  creatorEmail: authorEmail,
@@ -30339,6 +30350,20 @@ const applyParentRelationships = (comments, parentMap, trackedChangeParentMap =
30339
30350
  return updatedComment;
30340
30351
  });
30341
30352
  };
30353
+ const simpleHash = (input) => {
30354
+ let hash = 2166136261;
30355
+ for (let i = 0; i < input.length; i++) {
30356
+ hash ^= input.charCodeAt(i);
30357
+ hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);
30358
+ }
30359
+ return (hash >>> 0).toString(16).padStart(8, "0");
30360
+ };
30361
+ const getCommentId = (internalId, importedId, createdTime) => {
30362
+ if (internalId != null) return internalId;
30363
+ if (importedId == null || !Number.isFinite(createdTime)) return v4();
30364
+ const hash = simpleHash(`${importedId}-${createdTime}`);
30365
+ return `imported-${hash}`;
30366
+ };
30342
30367
  const stripFootnoteMarkerNodes = (nodes) => {
30343
30368
  if (!Array.isArray(nodes) || nodes.length === 0) return nodes;
30344
30369
  const walk = (list) => {
@@ -33704,7 +33729,7 @@ class SuperConverter {
33704
33729
  static getStoredSuperdocVersion(docx) {
33705
33730
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33706
33731
  }
33707
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.9.0") {
33732
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.10.0-next.1") {
33708
33733
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33709
33734
  }
33710
33735
  /**
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_converter = require("./SuperConverter-VeJEcjsk.cjs");
2
+ const superEditor_converter = require("./SuperConverter-BO9kMm-h.cjs");
3
3
  const jszip = require("./jszip-C8_CqJxM.cjs");
4
4
  const helpers$1 = require("./helpers-C7_u3NNJ.cjs");
5
5
  const vue = require("./vue-De9wkgLl.cjs");
@@ -15815,7 +15815,7 @@ const canUseDOM = () => {
15815
15815
  return false;
15816
15816
  }
15817
15817
  };
15818
- const summaryVersion = "1.9.0";
15818
+ const summaryVersion = "1.10.0-next.1";
15819
15819
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15820
15820
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15821
15821
  function mapAttributes(attrs) {
@@ -18563,7 +18563,7 @@ class Editor extends EventEmitter {
18563
18563
  * Process collaboration migrations
18564
18564
  */
18565
18565
  processCollaborationMigrations() {
18566
- console.debug("[checkVersionMigrations] Current editor version", "1.9.0");
18566
+ console.debug("[checkVersionMigrations] Current editor version", "1.10.0-next.1");
18567
18567
  if (!this.options.ydoc) return;
18568
18568
  const metaMap = this.options.ydoc.getMap("meta");
18569
18569
  let docVersion = metaMap.get("version");
@@ -47137,6 +47137,8 @@ class EditorInputManager {
47137
47137
  #boundHandleClick = null;
47138
47138
  #boundHandleKeyDown = null;
47139
47139
  #boundHandleFocusIn = null;
47140
+ #boundHandleEditorFocus = null;
47141
+ #boundHandleEditorBlur = null;
47140
47142
  // ==========================================================================
47141
47143
  // Constructor
47142
47144
  // ==========================================================================
@@ -47173,6 +47175,8 @@ class EditorInputManager {
47173
47175
  this.#boundHandleClick = this.#handleClick.bind(this);
47174
47176
  this.#boundHandleKeyDown = this.#handleKeyDown.bind(this);
47175
47177
  this.#boundHandleFocusIn = this.#handleFocusIn.bind(this);
47178
+ this.#boundHandleEditorFocus = this.#handleEditorFocus.bind(this);
47179
+ this.#boundHandleEditorBlur = this.#handleEditorBlur.bind(this);
47176
47180
  viewportHost.addEventListener("pointerdown", this.#boundHandlePointerDown);
47177
47181
  viewportHost.addEventListener("pointermove", this.#boundHandlePointerMove);
47178
47182
  viewportHost.addEventListener("pointerup", this.#boundHandlePointerUp);
@@ -47184,6 +47188,9 @@ class EditorInputManager {
47184
47188
  container.addEventListener("keydown", this.#boundHandleKeyDown);
47185
47189
  }
47186
47190
  visibleHost.addEventListener("focusin", this.#boundHandleFocusIn);
47191
+ const editor = this.#deps.getEditor();
47192
+ editor.on?.("focus", this.#boundHandleEditorFocus);
47193
+ editor.on?.("blur", this.#boundHandleEditorBlur);
47187
47194
  }
47188
47195
  /**
47189
47196
  * Unbind event listeners.
@@ -47219,6 +47226,12 @@ class EditorInputManager {
47219
47226
  if (this.#boundHandleFocusIn) {
47220
47227
  visibleHost.removeEventListener("focusin", this.#boundHandleFocusIn);
47221
47228
  }
47229
+ if (this.#boundHandleEditorFocus) {
47230
+ this.#deps.getEditor().off?.("focus", this.#boundHandleEditorFocus);
47231
+ }
47232
+ if (this.#boundHandleEditorBlur) {
47233
+ this.#deps.getEditor().off?.("blur", this.#boundHandleEditorBlur);
47234
+ }
47222
47235
  this.#boundHandlePointerDown = null;
47223
47236
  this.#boundHandlePointerMove = null;
47224
47237
  this.#boundHandlePointerUp = null;
@@ -47227,6 +47240,8 @@ class EditorInputManager {
47227
47240
  this.#boundHandleClick = null;
47228
47241
  this.#boundHandleKeyDown = null;
47229
47242
  this.#boundHandleFocusIn = null;
47243
+ this.#boundHandleEditorFocus = null;
47244
+ this.#boundHandleEditorBlur = null;
47230
47245
  }
47231
47246
  /**
47232
47247
  * Destroy the manager and clean up.
@@ -47506,6 +47521,10 @@ class EditorInputManager {
47506
47521
  handledByDepth = this.#callbacks.selectWordAt?.(selectionPos) ?? false;
47507
47522
  }
47508
47523
  }
47524
+ const hasFocus = editor.view?.hasFocus?.() ?? false;
47525
+ if (!hasFocus) {
47526
+ this.#focusEditor();
47527
+ }
47509
47528
  if (!handledByDepth) {
47510
47529
  try {
47511
47530
  let nextSelection = superEditor_converter.TextSelection.create(doc2, hit.pos);
@@ -47521,7 +47540,6 @@ class EditorInputManager {
47521
47540
  }
47522
47541
  }
47523
47542
  this.#callbacks.scheduleSelectionUpdate?.();
47524
- this.#focusEditor();
47525
47543
  }
47526
47544
  #handlePointerMove(event) {
47527
47545
  if (!this.#deps) return;
@@ -47653,6 +47671,15 @@ class EditorInputManager {
47653
47671
  this.#deps.getActiveEditor().view?.focus();
47654
47672
  } catch {
47655
47673
  }
47674
+ this.#callbacks.scheduleSelectionUpdate?.();
47675
+ }
47676
+ #handleEditorFocus() {
47677
+ if (!this.#deps) return;
47678
+ this.#callbacks.scheduleSelectionUpdate?.();
47679
+ }
47680
+ #handleEditorBlur() {
47681
+ if (!this.#deps) return;
47682
+ this.#callbacks.scheduleSelectionUpdate?.();
47656
47683
  }
47657
47684
  // ==========================================================================
47658
47685
  // Handler Helpers
@@ -56958,8 +56985,18 @@ class PresentationEditor extends EventEmitter {
56958
56985
  }
56959
56986
  return;
56960
56987
  }
56988
+ const activeEditor = this.getActiveEditor();
56989
+ const hasFocus = activeEditor?.view?.hasFocus?.() ?? false;
56990
+ if (!hasFocus) {
56991
+ try {
56992
+ this.#clearSelectedFieldAnnotationClass();
56993
+ this.#localSelectionLayer.innerHTML = "";
56994
+ } catch {
56995
+ }
56996
+ return;
56997
+ }
56961
56998
  const layout = this.#layoutState.layout;
56962
- const editorState = this.getActiveEditor().state;
56999
+ const editorState = activeEditor.state;
56963
57000
  const selection = editorState?.selection;
56964
57001
  if (!selection) {
56965
57002
  try {
@@ -1,4 +1,4 @@
1
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, 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, 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, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as carbonCopy, a4 as calculateResolvedParagraphProperties, a5 as encodeCSSFromPPr, a6 as encodeCSSFromRPr, a7 as generateOrderedListIndex, a8 as docxNumberingHelpers, a9 as InputRule, aa as insertNewRelationship, ab as kebabCase$1, ac as getUnderlineCssString } from "./SuperConverter-CQG__OC1.es.js";
1
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, 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, 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, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as carbonCopy, a4 as calculateResolvedParagraphProperties, a5 as encodeCSSFromPPr, a6 as encodeCSSFromRPr, a7 as generateOrderedListIndex, a8 as docxNumberingHelpers, a9 as InputRule, aa as insertNewRelationship, ab as kebabCase$1, ac as getUnderlineCssString } from "./SuperConverter-qcdYJrXV.es.js";
2
2
  import { B as Buffer$2 } from "./jszip-BjHgpFjf.es.js";
3
3
  import { j as twipsToInches, m as inchesToTwips, p as ptToTwips, d as linesToTwips, f as twipsToLines, k as pixelsToTwips, z as resolveOpcTargetPath, C as getArrayBufferFromUrl, h as halfPointToPoints, c as twipsToPixels$2, D as convertSizeToCSS, E as inchesToPixels } from "./helpers-BsvIMOxu.es.js";
4
4
  import { p as process$1, r as ref, J as global$1, b as computed, c as createElementBlock, F as Fragment$1, U as renderList, P as withModifiers, o as openBlock, Q as normalizeClass, g as createCommentVNode, L as toDisplayString, a as createBaseVNode, V as createApp, e as onMounted, f as onUnmounted, S as withDirectives, u as unref, Y as vModelText, E as nextTick, N as normalizeStyle, C as watch, Z as withKeys, _ as createTextVNode, i as createVNode, h as h$1, $ as readonly, B as getCurrentInstance, l as onBeforeUnmount, s as reactive, m as onBeforeMount, j as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, k as provide, q as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, K as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, x as markRaw, O as createBlock, M as withCtx, a9 as useCssVars, W as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-DI6_Tcq0.es.js";
@@ -15798,7 +15798,7 @@ const canUseDOM = () => {
15798
15798
  return false;
15799
15799
  }
15800
15800
  };
15801
- const summaryVersion = "1.9.0";
15801
+ const summaryVersion = "1.10.0-next.1";
15802
15802
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15803
15803
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15804
15804
  function mapAttributes(attrs) {
@@ -18546,7 +18546,7 @@ class Editor extends EventEmitter {
18546
18546
  * Process collaboration migrations
18547
18547
  */
18548
18548
  processCollaborationMigrations() {
18549
- console.debug("[checkVersionMigrations] Current editor version", "1.9.0");
18549
+ console.debug("[checkVersionMigrations] Current editor version", "1.10.0-next.1");
18550
18550
  if (!this.options.ydoc) return;
18551
18551
  const metaMap = this.options.ydoc.getMap("meta");
18552
18552
  let docVersion = metaMap.get("version");
@@ -47120,6 +47120,8 @@ class EditorInputManager {
47120
47120
  #boundHandleClick = null;
47121
47121
  #boundHandleKeyDown = null;
47122
47122
  #boundHandleFocusIn = null;
47123
+ #boundHandleEditorFocus = null;
47124
+ #boundHandleEditorBlur = null;
47123
47125
  // ==========================================================================
47124
47126
  // Constructor
47125
47127
  // ==========================================================================
@@ -47156,6 +47158,8 @@ class EditorInputManager {
47156
47158
  this.#boundHandleClick = this.#handleClick.bind(this);
47157
47159
  this.#boundHandleKeyDown = this.#handleKeyDown.bind(this);
47158
47160
  this.#boundHandleFocusIn = this.#handleFocusIn.bind(this);
47161
+ this.#boundHandleEditorFocus = this.#handleEditorFocus.bind(this);
47162
+ this.#boundHandleEditorBlur = this.#handleEditorBlur.bind(this);
47159
47163
  viewportHost.addEventListener("pointerdown", this.#boundHandlePointerDown);
47160
47164
  viewportHost.addEventListener("pointermove", this.#boundHandlePointerMove);
47161
47165
  viewportHost.addEventListener("pointerup", this.#boundHandlePointerUp);
@@ -47167,6 +47171,9 @@ class EditorInputManager {
47167
47171
  container.addEventListener("keydown", this.#boundHandleKeyDown);
47168
47172
  }
47169
47173
  visibleHost.addEventListener("focusin", this.#boundHandleFocusIn);
47174
+ const editor = this.#deps.getEditor();
47175
+ editor.on?.("focus", this.#boundHandleEditorFocus);
47176
+ editor.on?.("blur", this.#boundHandleEditorBlur);
47170
47177
  }
47171
47178
  /**
47172
47179
  * Unbind event listeners.
@@ -47202,6 +47209,12 @@ class EditorInputManager {
47202
47209
  if (this.#boundHandleFocusIn) {
47203
47210
  visibleHost.removeEventListener("focusin", this.#boundHandleFocusIn);
47204
47211
  }
47212
+ if (this.#boundHandleEditorFocus) {
47213
+ this.#deps.getEditor().off?.("focus", this.#boundHandleEditorFocus);
47214
+ }
47215
+ if (this.#boundHandleEditorBlur) {
47216
+ this.#deps.getEditor().off?.("blur", this.#boundHandleEditorBlur);
47217
+ }
47205
47218
  this.#boundHandlePointerDown = null;
47206
47219
  this.#boundHandlePointerMove = null;
47207
47220
  this.#boundHandlePointerUp = null;
@@ -47210,6 +47223,8 @@ class EditorInputManager {
47210
47223
  this.#boundHandleClick = null;
47211
47224
  this.#boundHandleKeyDown = null;
47212
47225
  this.#boundHandleFocusIn = null;
47226
+ this.#boundHandleEditorFocus = null;
47227
+ this.#boundHandleEditorBlur = null;
47213
47228
  }
47214
47229
  /**
47215
47230
  * Destroy the manager and clean up.
@@ -47489,6 +47504,10 @@ class EditorInputManager {
47489
47504
  handledByDepth = this.#callbacks.selectWordAt?.(selectionPos) ?? false;
47490
47505
  }
47491
47506
  }
47507
+ const hasFocus = editor.view?.hasFocus?.() ?? false;
47508
+ if (!hasFocus) {
47509
+ this.#focusEditor();
47510
+ }
47492
47511
  if (!handledByDepth) {
47493
47512
  try {
47494
47513
  let nextSelection = TextSelection$1.create(doc2, hit.pos);
@@ -47504,7 +47523,6 @@ class EditorInputManager {
47504
47523
  }
47505
47524
  }
47506
47525
  this.#callbacks.scheduleSelectionUpdate?.();
47507
- this.#focusEditor();
47508
47526
  }
47509
47527
  #handlePointerMove(event) {
47510
47528
  if (!this.#deps) return;
@@ -47636,6 +47654,15 @@ class EditorInputManager {
47636
47654
  this.#deps.getActiveEditor().view?.focus();
47637
47655
  } catch {
47638
47656
  }
47657
+ this.#callbacks.scheduleSelectionUpdate?.();
47658
+ }
47659
+ #handleEditorFocus() {
47660
+ if (!this.#deps) return;
47661
+ this.#callbacks.scheduleSelectionUpdate?.();
47662
+ }
47663
+ #handleEditorBlur() {
47664
+ if (!this.#deps) return;
47665
+ this.#callbacks.scheduleSelectionUpdate?.();
47639
47666
  }
47640
47667
  // ==========================================================================
47641
47668
  // Handler Helpers
@@ -56941,8 +56968,18 @@ class PresentationEditor extends EventEmitter {
56941
56968
  }
56942
56969
  return;
56943
56970
  }
56971
+ const activeEditor = this.getActiveEditor();
56972
+ const hasFocus = activeEditor?.view?.hasFocus?.() ?? false;
56973
+ if (!hasFocus) {
56974
+ try {
56975
+ this.#clearSelectedFieldAnnotationClass();
56976
+ this.#localSelectionLayer.innerHTML = "";
56977
+ } catch {
56978
+ }
56979
+ return;
56980
+ }
56944
56981
  const layout = this.#layoutState.layout;
56945
- const editorState = this.getActiveEditor().state;
56982
+ const editorState = activeEditor.state;
56946
56983
  const selection = editorState?.selection;
56947
56984
  if (!selection) {
56948
56985
  try {
@@ -1,8 +1,8 @@
1
- import { D as BIT8, F as MAX_SAFE_INTEGER, G as create, H as BITS7, I as utf8TextDecoder, J as create$1, K as setIfUndefined, L as create$2, O as from, Q as floor$1, R as equalityDeep, U as writeVarUint, V as writeVarString, W as toUint8Array, X as createEncoder, Y as createInjectionKey, Z as toString, $ as throwError, a0 as useSsrAdapter, a1 as configProviderInjectionKey, a2 as cssrAnchorMetaName, a3 as globalStyle, q as cB, p as c, a4 as isMounted, a5 as commonVariables$2, s as cM, a6 as cNotM, a7 as cE, o as derived, a8 as changeColor, a9 as insideModal, aa as insidePopover, ab as resolveWrappedSlot, ac as on, w as warnOnce, u as useConfig, ad as useMergedState, ae as useMemo, t as useTheme, af as useRtl, x as createKey, y as useThemeClass, ag as createId, ah as call, ai as render, aj as messageProviderInjectionKey, ak as messageApiInjectionKey, j as getStarterExtensions, k as getRichTextExtensions, E as Editor, al as fromBase64, am as onChange, an as varStorage, ao as toBase64, ap as createUint8ArrayFromArrayBuffer, aq as offChange, ar as writeVarUint8Array, as as map, at as length, au as isNode, av as min, aw as pow, ax as comments_module_events, ay as getFileObject, az as getTrackChanges, C as CommentsPluginKey, n as TrackChangesBasePluginKey, aA as ellipsisVerticalSvg, aB as xmarkIconSvg, aC as checkIconSvg, aD as caretDownIconSvg, aE as commentIconSvg, B as _export_sfc, aF as NDropdown, b as SuperInput, aG as vClickOutside, P as PresentationEditor, a as SuperEditor, A as AIWriter, aH as NConfigProvider, S as SuperToolbar } from "./index-CWI4NbKU.es.js";
1
+ import { D as BIT8, F as MAX_SAFE_INTEGER, G as create, H as BITS7, I as utf8TextDecoder, J as create$1, K as setIfUndefined, L as create$2, O as from, Q as floor$1, R as equalityDeep, U as writeVarUint, V as writeVarString, W as toUint8Array, X as createEncoder, Y as createInjectionKey, Z as toString, $ as throwError, a0 as useSsrAdapter, a1 as configProviderInjectionKey, a2 as cssrAnchorMetaName, a3 as globalStyle, q as cB, p as c, a4 as isMounted, a5 as commonVariables$2, s as cM, a6 as cNotM, a7 as cE, o as derived, a8 as changeColor, a9 as insideModal, aa as insidePopover, ab as resolveWrappedSlot, ac as on, w as warnOnce, u as useConfig, ad as useMergedState, ae as useMemo, t as useTheme, af as useRtl, x as createKey, y as useThemeClass, ag as createId, ah as call, ai as render, aj as messageProviderInjectionKey, ak as messageApiInjectionKey, j as getStarterExtensions, k as getRichTextExtensions, E as Editor, al as fromBase64, am as onChange, an as varStorage, ao as toBase64, ap as createUint8ArrayFromArrayBuffer, aq as offChange, ar as writeVarUint8Array, as as map, at as length, au as isNode, av as min, aw as pow, ax as comments_module_events, ay as getFileObject, az as getTrackChanges, C as CommentsPluginKey, n as TrackChangesBasePluginKey, aA as ellipsisVerticalSvg, aB as xmarkIconSvg, aC as checkIconSvg, aD as caretDownIconSvg, aE as commentIconSvg, B as _export_sfc, aF as NDropdown, b as SuperInput, aG as vClickOutside, P as PresentationEditor, a as SuperEditor, A as AIWriter, aH as NConfigProvider, S as SuperToolbar } from "./index-D3eg-_78.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import "./jszip-BjHgpFjf.es.js";
4
4
  import "./helpers-BsvIMOxu.es.js";
5
- import "./SuperConverter-CQG__OC1.es.js";
5
+ import "./SuperConverter-qcdYJrXV.es.js";
6
6
  import { E as EventEmitter } from "./eventemitter3-B9iqx_uA.es.js";
7
7
  import { j as inject, k as provide, b as computed, l as onBeforeUnmount, p as process$1, m as onBeforeMount, d as defineComponent, h, t as toRef, T as Transition, n as TransitionGroup, w as watchEffect, r as ref, e as onMounted, q as Teleport, F as Fragment, s as reactive, v as effectScope, x as markRaw, y as toRaw, z as isRef, A as isReactive, B as getCurrentInstance, C as watch, u as unref, D as hasInjectionContext, E as nextTick, G as getCurrentScope, H as onScopeDispose, I as toRefs, J as global, K as shallowRef, c as createElementBlock, o as openBlock, L as toDisplayString, i as createVNode, M as withCtx, a as createBaseVNode, N as normalizeStyle, g as createCommentVNode, O as createBlock, P as withModifiers, Q as normalizeClass, R as resolveDirective, S as withDirectives, U as renderList, V as createApp, W as resolveDynamicComponent, X as defineAsyncComponent } from "./vue-DI6_Tcq0.es.js";
8
8
  import "./jszip.min-BWx74pG_.es.js";
@@ -6618,15 +6618,15 @@ const _sfc_main$c = {
6618
6618
  createBaseVNode("div", _hoisted_3$4, [
6619
6619
  createBaseVNode("div", _hoisted_4$2, [
6620
6620
  comment.trackedChangeType === "trackFormat" ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
6621
- _cache[2] || (_cache[2] = createBaseVNode("span", { class: "change-type" }, "Format: ", -1)),
6621
+ _cache[1] || (_cache[1] = createBaseVNode("span", { class: "change-type" }, "Format: ", -1)),
6622
6622
  createBaseVNode("span", _hoisted_6, toDisplayString(comment.trackedChangeText), 1)
6623
6623
  ])) : createCommentVNode("", true),
6624
6624
  comment.trackedChangeText && comment.trackedChangeType !== "trackFormat" ? (openBlock(), createElementBlock("div", _hoisted_7, [
6625
- _cache[3] || (_cache[3] = createBaseVNode("span", { class: "change-type" }, "Added: ", -1)),
6625
+ _cache[2] || (_cache[2] = createBaseVNode("span", { class: "change-type" }, "Added: ", -1)),
6626
6626
  createBaseVNode("span", _hoisted_8, toDisplayString(comment.trackedChangeText), 1)
6627
6627
  ])) : createCommentVNode("", true),
6628
6628
  comment.deletedText && comment.trackedChangeType !== "trackFormat" ? (openBlock(), createElementBlock("div", _hoisted_9, [
6629
- _cache[4] || (_cache[4] = createBaseVNode("span", { class: "change-type" }, "Deleted: ", -1)),
6629
+ _cache[3] || (_cache[3] = createBaseVNode("span", { class: "change-type" }, "Deleted: ", -1)),
6630
6630
  createBaseVNode("span", _hoisted_10, toDisplayString(comment.deletedText), 1)
6631
6631
  ])) : createCommentVNode("", true)
6632
6632
  ])
@@ -6670,7 +6670,7 @@ const _sfc_main$c = {
6670
6670
  showButtons.value && !unref(getConfig).readOnly ? (openBlock(), createElementBlock("div", _hoisted_20, [
6671
6671
  createBaseVNode("button", {
6672
6672
  class: "sd-button",
6673
- onClick: _cache[1] || (_cache[1] = withModifiers((...args) => unref(cancelComment) && unref(cancelComment)(...args), ["stop", "prevent"]))
6673
+ onClick: withModifiers(handleCancel, ["stop", "prevent"])
6674
6674
  }, "Cancel"),
6675
6675
  createBaseVNode("button", {
6676
6676
  class: normalizeClass(["sd-button primary", { disabled: !hasTextContent.value }]),
@@ -6685,7 +6685,7 @@ const _sfc_main$c = {
6685
6685
  };
6686
6686
  }
6687
6687
  };
6688
- const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-664ab253"]]);
6688
+ const CommentDialog = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-0bdd1e37"]]);
6689
6689
  const _hoisted_1$a = { class: "comments-list" };
6690
6690
  const _hoisted_2$5 = { key: 0 };
6691
6691
  const _hoisted_3$3 = { class: "comment-item" };
@@ -7692,7 +7692,7 @@ const _sfc_main = {
7692
7692
  __name: "SuperDoc",
7693
7693
  emits: ["selection-update"],
7694
7694
  setup(__props, { emit: __emit }) {
7695
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-D1Am0D4N.es.js"));
7695
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DWeh_pDp.es.js"));
7696
7696
  const superdocStore = useSuperdocStore();
7697
7697
  const commentsStore = useCommentsStore();
7698
7698
  const {
@@ -8677,7 +8677,7 @@ class SuperDoc extends EventEmitter {
8677
8677
  this.config.colors = shuffleArray(this.config.colors);
8678
8678
  this.userColorMap = /* @__PURE__ */ new Map();
8679
8679
  this.colorIndex = 0;
8680
- this.version = "1.9.0";
8680
+ this.version = "1.10.0-next.1";
8681
8681
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8682
8682
  this.superdocId = config.superdocId || v4();
8683
8683
  this.colors = this.config.colors;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- const index = require("./index-DCmsKDv1.cjs");
2
+ const index = require("./index-BYMKRslm.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  require("./jszip-C8_CqJxM.cjs");
5
5
  require("./helpers-C7_u3NNJ.cjs");
6
- require("./SuperConverter-VeJEcjsk.cjs");
6
+ require("./SuperConverter-BO9kMm-h.cjs");
7
7
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
8
8
  const vue = require("./vue-De9wkgLl.cjs");
9
9
  require("./jszip.min-BPh2MMAa.cjs");
@@ -6635,15 +6635,15 @@ const _sfc_main$c = {
6635
6635
  vue.createBaseVNode("div", _hoisted_3$4, [
6636
6636
  vue.createBaseVNode("div", _hoisted_4$2, [
6637
6637
  comment.trackedChangeType === "trackFormat" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$1, [
6638
- _cache[2] || (_cache[2] = vue.createBaseVNode("span", { class: "change-type" }, "Format: ", -1)),
6638
+ _cache[1] || (_cache[1] = vue.createBaseVNode("span", { class: "change-type" }, "Format: ", -1)),
6639
6639
  vue.createBaseVNode("span", _hoisted_6, vue.toDisplayString(comment.trackedChangeText), 1)
6640
6640
  ])) : vue.createCommentVNode("", true),
6641
6641
  comment.trackedChangeText && comment.trackedChangeType !== "trackFormat" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
6642
- _cache[3] || (_cache[3] = vue.createBaseVNode("span", { class: "change-type" }, "Added: ", -1)),
6642
+ _cache[2] || (_cache[2] = vue.createBaseVNode("span", { class: "change-type" }, "Added: ", -1)),
6643
6643
  vue.createBaseVNode("span", _hoisted_8, vue.toDisplayString(comment.trackedChangeText), 1)
6644
6644
  ])) : vue.createCommentVNode("", true),
6645
6645
  comment.deletedText && comment.trackedChangeType !== "trackFormat" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9, [
6646
- _cache[4] || (_cache[4] = vue.createBaseVNode("span", { class: "change-type" }, "Deleted: ", -1)),
6646
+ _cache[3] || (_cache[3] = vue.createBaseVNode("span", { class: "change-type" }, "Deleted: ", -1)),
6647
6647
  vue.createBaseVNode("span", _hoisted_10, vue.toDisplayString(comment.deletedText), 1)
6648
6648
  ])) : vue.createCommentVNode("", true)
6649
6649
  ])
@@ -6687,7 +6687,7 @@ const _sfc_main$c = {
6687
6687
  showButtons.value && !vue.unref(getConfig).readOnly ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_20, [
6688
6688
  vue.createBaseVNode("button", {
6689
6689
  class: "sd-button",
6690
- onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => vue.unref(cancelComment) && vue.unref(cancelComment)(...args), ["stop", "prevent"]))
6690
+ onClick: vue.withModifiers(handleCancel, ["stop", "prevent"])
6691
6691
  }, "Cancel"),
6692
6692
  vue.createBaseVNode("button", {
6693
6693
  class: vue.normalizeClass(["sd-button primary", { disabled: !hasTextContent.value }]),
@@ -6702,7 +6702,7 @@ const _sfc_main$c = {
6702
6702
  };
6703
6703
  }
6704
6704
  };
6705
- const CommentDialog = /* @__PURE__ */ index._export_sfc(_sfc_main$c, [["__scopeId", "data-v-664ab253"]]);
6705
+ const CommentDialog = /* @__PURE__ */ index._export_sfc(_sfc_main$c, [["__scopeId", "data-v-0bdd1e37"]]);
6706
6706
  const _hoisted_1$a = { class: "comments-list" };
6707
6707
  const _hoisted_2$5 = { key: 0 };
6708
6708
  const _hoisted_3$3 = { class: "comment-item" };
@@ -7709,7 +7709,7 @@ const _sfc_main = {
7709
7709
  __name: "SuperDoc",
7710
7710
  emits: ["selection-update"],
7711
7711
  setup(__props, { emit: __emit }) {
7712
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-WdyXSIvk.cjs")));
7712
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-B6cdXTuo.cjs")));
7713
7713
  const superdocStore = useSuperdocStore();
7714
7714
  const commentsStore = useCommentsStore();
7715
7715
  const {
@@ -8694,7 +8694,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8694
8694
  this.config.colors = shuffleArray(this.config.colors);
8695
8695
  this.userColorMap = /* @__PURE__ */ new Map();
8696
8696
  this.colorIndex = 0;
8697
- this.version = "1.9.0";
8697
+ this.version = "1.10.0-next.1";
8698
8698
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8699
8699
  this.superdocId = config.superdocId || uuid.v4();
8700
8700
  this.colors = this.config.colors;