@harbour-enterprises/superdoc 0.26.0-next.1 → 0.26.0-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.
Files changed (30) hide show
  1. package/dist/chunks/{PdfViewer-BdAhZa5N.cjs → PdfViewer-Ddo_DM5d.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BKHHNbny.es.js → PdfViewer-juhTQvgB.es.js} +1 -1
  3. package/dist/chunks/{index-ClUzozbw.es.js → index-CV1DF2JY.es.js} +18 -4
  4. package/dist/chunks/{index-CAVKoWDJ.cjs → index-CgZ_A5Ca.cjs} +18 -4
  5. package/dist/chunks/{super-editor.es-DZb1VLxX.cjs → super-editor.es-CGKyR4l8.cjs} +5057 -4930
  6. package/dist/chunks/{super-editor.es-BewiNPbf.es.js → super-editor.es-zFJj_1tC.es.js} +5057 -4930
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/core/collaboration/helpers.d.ts.map +1 -1
  9. package/dist/core/types/index.d.ts.map +1 -1
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-khE-H7hH.js → converter-CTSH6ApH.js} +5056 -4972
  12. package/dist/super-editor/chunks/{docx-zipper-KoUEtzIj.js → docx-zipper-B9s4CP-_.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-CeTu_f0L.js → editor-CwtMgXx9.js} +119 -52
  14. package/dist/super-editor/chunks/{toolbar-D1RxvV5u.js → toolbar-C66Pu-nq.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/listImporter.d.ts +2 -2
  20. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/numberingCache.d.ts +37 -0
  21. package/dist/super-editor/super-editor/src/extensions/list-item/ListItemNodeView.d.ts +8 -2
  22. package/dist/super-editor/super-editor.es.js +6 -6
  23. package/dist/super-editor/toolbar.es.js +2 -2
  24. package/dist/super-editor.cjs +1 -1
  25. package/dist/super-editor.es.js +1 -1
  26. package/dist/superdoc.cjs +2 -2
  27. package/dist/superdoc.es.js +2 -2
  28. package/dist/superdoc.umd.js +5073 -4932
  29. package/dist/superdoc.umd.js.map +1 -1
  30. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-khE-H7hH.js";
1
+ import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-CTSH6ApH.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -9,12 +9,12 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
12
+ var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initTrackChanges_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, applyIndentStyling_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberigHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-khE-H7hH.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-CTSH6ApH.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-KoUEtzIj.js";
17
+ import { D as DocxZipper } from "./docx-zipper-B9s4CP-_.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -14424,6 +14424,7 @@ const _Editor = class _Editor extends EventEmitter {
14424
14424
  * @param {string} documentMode - The document mode ('editing', 'viewing', 'suggesting')
14425
14425
  */
14426
14426
  setDocumentMode(documentMode) {
14427
+ if (this.options.isHeaderOrFooter || this.options.isChildEditor) return;
14427
14428
  let cleanedMode = documentMode?.toLowerCase() || "editing";
14428
14429
  if (!this.extensionService || !this.state) return;
14429
14430
  const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
@@ -14439,7 +14440,7 @@ const _Editor = class _Editor extends EventEmitter {
14439
14440
  isEditMode: false,
14440
14441
  documentMode: cleanedMode
14441
14442
  });
14442
- if (!this.options.isHeaderOrFooter && pm) pm.classList.add("view-mode");
14443
+ if (pm) pm.classList.add("view-mode");
14443
14444
  } else if (cleanedMode === "suggesting") {
14444
14445
  __privateMethod(this, _Editor_instances, registerPluginByNameIfNotExists_fn).call(this, "TrackChangesBase");
14445
14446
  this.commands.disableTrackChangesShowOriginal();
@@ -15654,6 +15655,30 @@ initComments_fn = function() {
15654
15655
  dispatch(tr);
15655
15656
  }, 50);
15656
15657
  };
15658
+ /**
15659
+ * Initialize track changes based on document mode
15660
+ * @returns {void}
15661
+ */
15662
+ initTrackChanges_fn = function() {
15663
+ if (!this.extensionService || this.options.isHeaderOrFooter) {
15664
+ return;
15665
+ }
15666
+ switch (this.options.documentMode) {
15667
+ case "editing":
15668
+ __privateMethod(this, _Editor_instances, registerPluginByNameIfNotExists_fn).call(this, "TrackChangesBase");
15669
+ this.commands.disableTrackChangesShowOriginal();
15670
+ this.commands.disableTrackChanges();
15671
+ break;
15672
+ case "suggesting":
15673
+ __privateMethod(this, _Editor_instances, registerPluginByNameIfNotExists_fn).call(this, "TrackChangesBase");
15674
+ this.commands.disableTrackChangesShowOriginal();
15675
+ this.commands.enableTrackChanges();
15676
+ break;
15677
+ case "viewing":
15678
+ this.commands.toggleTrackChangesShowOriginal();
15679
+ break;
15680
+ }
15681
+ };
15657
15682
  initPagination_fn = async function() {
15658
15683
  if (this.options.isHeadless || !this.extensionService || this.options.isHeaderOrFooter) {
15659
15684
  return;
@@ -19712,7 +19737,11 @@ function getAdjacentListItemNodeView({ nodeView, pos, direction, activeNodeViews
19712
19737
  if (view === nodeView) return;
19713
19738
  let viewPos;
19714
19739
  try {
19715
- viewPos = view.getPos();
19740
+ if (typeof view.getResolvedPos === "function") {
19741
+ viewPos = view.getResolvedPos();
19742
+ } else if (typeof view.getPos === "function") {
19743
+ viewPos = view.getPos();
19744
+ }
19716
19745
  } catch {
19717
19746
  return;
19718
19747
  }
@@ -19878,54 +19907,44 @@ class ListItemNodeView {
19878
19907
  this.editor = editor;
19879
19908
  this.decorations = decorations;
19880
19909
  this.view = editor.view;
19881
- this.getPos = getPos;
19910
+ this._rawGetPos = getPos;
19911
+ this._pendingIndentRefresh = null;
19912
+ this.getPos = () => this.getResolvedPos();
19882
19913
  __privateMethod(this, _ListItemNodeView_instances, init_fn3).call(this);
19883
19914
  activeListItemNodeViews.add(this);
19884
19915
  }
19885
- refreshIndentStyling() {
19886
- const { attrs } = this.node;
19887
- const { styleId, numId, level, indent: inlineIndent } = attrs;
19888
- const defs = getListItemStyleDefinitions({ styleId, node: this.node, numId, level, editor: this.editor });
19889
- const visibleIndent = getVisibleIndent(defs.stylePpr, defs.numDefPpr, inlineIndent);
19890
- const lvlJc = defs.numLvlJs?.attributes?.["w:val"] || "left";
19891
- const contentLeft = visibleIndent.left || 0;
19892
- const hanging = visibleIndent.hanging || 0;
19893
- const handlers2 = {
19894
- right: () => {
19895
- const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM, this.editor);
19896
- const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
19897
- const effectiveHanging = Math.max(hanging, minMarkerWidth);
19898
- const markerLeft = contentLeft - effectiveHanging - MARKER_OFFSET_RIGHT;
19899
- this.contentDOM.style.marginLeft = `${contentLeft}px`;
19900
- this.numberingDOM.style.left = `${markerLeft}px`;
19901
- this.numberingDOM.style.width = `${effectiveHanging}px`;
19902
- this.numberingDOM.style.textAlign = "right";
19903
- },
19904
- left: () => {
19905
- const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM, this.editor);
19906
- const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
19907
- let markerLeft = contentLeft - hanging;
19908
- if (markerLeft === contentLeft) {
19909
- markerLeft -= minMarkerWidth;
19910
- } else if (minMarkerWidth > hanging) {
19911
- const diff = minMarkerWidth - hanging;
19912
- markerLeft -= diff;
19913
- }
19914
- this.contentDOM.style.marginLeft = `${contentLeft}px`;
19915
- this.numberingDOM.style.left = `${markerLeft}px`;
19916
- this.numberingDOM.style.width = "";
19917
- this.numberingDOM.style.textAlign = "";
19918
- }
19919
- };
19920
- const handleStyles = handlers2[lvlJc] ?? handlers2.left;
19921
- handleStyles();
19916
+ getResolvedPos() {
19917
+ if (typeof this._rawGetPos !== "function") return null;
19918
+ try {
19919
+ const resolved = this._rawGetPos();
19920
+ return typeof resolved === "number" ? resolved : null;
19921
+ } catch {
19922
+ return null;
19923
+ }
19924
+ }
19925
+ invalidateResolvedPos() {
19926
+ }
19927
+ refreshIndentStyling({ immediate = false } = {}) {
19928
+ const raf = typeof globalThis !== "undefined" ? globalThis.requestAnimationFrame : void 0;
19929
+ const shouldSchedule = !immediate && typeof raf === "function";
19930
+ if (!shouldSchedule) {
19931
+ this._pendingIndentRefresh = null;
19932
+ __privateMethod(this, _ListItemNodeView_instances, applyIndentStyling_fn).call(this);
19933
+ return;
19934
+ }
19935
+ if (this._pendingIndentRefresh != null) return;
19936
+ this._pendingIndentRefresh = raf(() => {
19937
+ this._pendingIndentRefresh = null;
19938
+ __privateMethod(this, _ListItemNodeView_instances, applyIndentStyling_fn).call(this);
19939
+ });
19922
19940
  }
19923
19941
  update(node, decorations) {
19924
19942
  this.node = node;
19925
19943
  this.decorations = decorations;
19944
+ this.invalidateResolvedPos();
19926
19945
  const { fontSize, fontFamily, lineHeight } = resolveListItemTypography({
19927
19946
  node,
19928
- pos: this.getPos(),
19947
+ pos: this.getResolvedPos(),
19929
19948
  editor: this.editor,
19930
19949
  nodeView: this,
19931
19950
  activeNodeViews: activeListItemNodeViews
@@ -19933,10 +19952,16 @@ class ListItemNodeView {
19933
19952
  this.dom.style.fontSize = fontSize;
19934
19953
  this.dom.style.fontFamily = fontFamily || "inherit";
19935
19954
  this.dom.style.lineHeight = lineHeight || "";
19955
+ this.refreshIndentStyling();
19936
19956
  }
19937
19957
  destroy() {
19938
19958
  activeListItemNodeViews.delete(this);
19939
19959
  this.numberingDOM.removeEventListener("click", this.handleNumberingClick);
19960
+ const caf = typeof globalThis !== "undefined" ? globalThis.cancelAnimationFrame : void 0;
19961
+ if (this._pendingIndentRefresh != null && typeof caf === "function") {
19962
+ caf(this._pendingIndentRefresh);
19963
+ }
19964
+ this._pendingIndentRefresh = null;
19940
19965
  }
19941
19966
  }
19942
19967
  _ListItemNodeView_instances = new WeakSet();
@@ -19953,10 +19978,10 @@ init_fn3 = function() {
19953
19978
  customFormat
19954
19979
  });
19955
19980
  } else {
19956
- orderMarker = docxNumberigHelpers.normalizeLvlTextChar(lvlText);
19981
+ orderMarker = docxNumberingHelpers.normalizeLvlTextChar(lvlText);
19957
19982
  }
19958
19983
  }
19959
- const pos = this.getPos();
19984
+ const pos = this.getResolvedPos();
19960
19985
  const { fontSize, fontFamily, lineHeight } = resolveListItemTypography({
19961
19986
  node: this.node,
19962
19987
  pos,
@@ -19985,10 +20010,48 @@ init_fn3 = function() {
19985
20010
  this.dom.appendChild(this.contentDOM);
19986
20011
  this.refreshIndentStyling();
19987
20012
  };
20013
+ applyIndentStyling_fn = function() {
20014
+ const { attrs } = this.node;
20015
+ const { styleId, numId, level, indent: inlineIndent } = attrs;
20016
+ const defs = getListItemStyleDefinitions({ styleId, node: this.node, numId, level, editor: this.editor });
20017
+ const visibleIndent = getVisibleIndent(defs.stylePpr, defs.numDefPpr, inlineIndent);
20018
+ const lvlJc = defs.numLvlJs?.attributes?.["w:val"] || "left";
20019
+ const contentLeft = visibleIndent.left || 0;
20020
+ const hanging = visibleIndent.hanging || 0;
20021
+ const handlers2 = {
20022
+ right: () => {
20023
+ const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM, this.editor);
20024
+ const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
20025
+ const effectiveHanging = Math.max(hanging, minMarkerWidth);
20026
+ const markerLeft = contentLeft - effectiveHanging - MARKER_OFFSET_RIGHT;
20027
+ this.contentDOM.style.marginLeft = `${contentLeft}px`;
20028
+ this.numberingDOM.style.left = `${markerLeft}px`;
20029
+ this.numberingDOM.style.width = `${effectiveHanging}px`;
20030
+ this.numberingDOM.style.textAlign = "right";
20031
+ },
20032
+ left: () => {
20033
+ const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM, this.editor);
20034
+ const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
20035
+ let markerLeft = contentLeft - hanging;
20036
+ if (markerLeft === contentLeft) {
20037
+ markerLeft -= minMarkerWidth;
20038
+ } else if (minMarkerWidth > hanging) {
20039
+ const diff = minMarkerWidth - hanging;
20040
+ markerLeft -= diff;
20041
+ }
20042
+ this.contentDOM.style.marginLeft = `${contentLeft}px`;
20043
+ this.numberingDOM.style.left = `${markerLeft}px`;
20044
+ this.numberingDOM.style.width = "";
20045
+ this.numberingDOM.style.textAlign = "";
20046
+ }
20047
+ };
20048
+ const handleStyles = handlers2[lvlJc] ?? handlers2.left;
20049
+ handleStyles();
20050
+ };
19988
20051
  function refreshAllListItemNodeViews() {
19989
20052
  activeListItemNodeViews.forEach((nodeView) => {
19990
20053
  try {
19991
- nodeView.refreshIndentStyling();
20054
+ nodeView.refreshIndentStyling({ immediate: true });
19992
20055
  } catch (error) {
19993
20056
  console.error("Error refreshing list item node view:", error);
19994
20057
  activeListItemNodeViews.delete(nodeView);
@@ -20064,7 +20127,7 @@ function orderedListSync(editor) {
20064
20127
  const start2 = parseInt(numberingDefStart) || 1;
20065
20128
  if (!listMap.has(numId)) {
20066
20129
  const generatedLevels = {};
20067
- const initialPath = docxNumberigHelpers.generateListPath(level, numId, styleId, generatedLevels, docx);
20130
+ const initialPath = docxNumberingHelpers.generateListPath(level, numId, styleId, generatedLevels, docx);
20068
20131
  listMap.set(numId, initialPath || []);
20069
20132
  listInitialized.set(numId, false);
20070
20133
  }
@@ -27003,7 +27066,7 @@ const Image = Node$1.create({
27003
27066
  return {
27004
27067
  allowBase64: true,
27005
27068
  htmlAttributes: {
27006
- style: "display: inline-block;",
27069
+ style: "display: inline-block; content-visibility: auto; contain-intrinsic-size: auto 600px;",
27007
27070
  "aria-label": "Image node"
27008
27071
  }
27009
27072
  };
@@ -29416,6 +29479,10 @@ const derivePermissionKey = ({ action, isOwn }) => {
29416
29479
  if (!mapping) return null;
29417
29480
  return isOwn ? mapping.own : mapping.other;
29418
29481
  };
29482
+ const normalizeEmail = (value) => {
29483
+ if (typeof value !== "string") return "";
29484
+ return value.trim().toLowerCase();
29485
+ };
29419
29486
  const resolveChanges = (editor) => {
29420
29487
  if (!editor) return { role: "editor", isInternal: false, currentUser: null, resolver: null };
29421
29488
  const role = editor.options?.role ?? "editor";
@@ -29428,10 +29495,10 @@ const isTrackedChangeActionAllowed = ({ editor, action, trackedChanges }) => {
29428
29495
  if (!trackedChanges?.length) return true;
29429
29496
  const { role, isInternal, currentUser, resolver } = resolveChanges(editor);
29430
29497
  if (typeof resolver !== "function") return true;
29431
- const currentEmail = currentUser?.email ?? null;
29498
+ const currentEmail = normalizeEmail(currentUser?.email);
29432
29499
  return trackedChanges.every((change) => {
29433
- const authorEmail = change.attrs?.authorEmail ?? null;
29434
- const isOwn = Boolean(currentEmail && authorEmail && currentEmail === authorEmail);
29500
+ const authorEmail = normalizeEmail(change.attrs?.authorEmail);
29501
+ const isOwn = !currentEmail || !authorEmail || currentEmail === authorEmail;
29435
29502
  const permission = derivePermissionKey({ action, isOwn });
29436
29503
  if (!permission) return true;
29437
29504
  const payload = {
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-khE-H7hH.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CeTu_f0L.js";
2
+ import { p as process$1 } from "./converter-CTSH6ApH.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CwtMgXx9.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-khE-H7hH.js";
1
+ import { a5 } from "./chunks/converter-CTSH6ApH.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-khE-H7hH.js";
2
- import { D } from "./chunks/docx-zipper-KoUEtzIj.js";
1
+ import "./chunks/converter-CTSH6ApH.js";
2
+ import { D } from "./chunks/docx-zipper-B9s4CP-_.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-CeTu_f0L.js";
2
- import "./chunks/converter-khE-H7hH.js";
3
- import "./chunks/docx-zipper-KoUEtzIj.js";
1
+ import { E } from "./chunks/editor-CwtMgXx9.js";
2
+ import "./chunks/converter-CTSH6ApH.js";
3
+ import "./chunks/docx-zipper-B9s4CP-_.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-KoUEtzIj.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-B9s4CP-_.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -107,10 +107,10 @@ export const handleListNode: any;
107
107
  * @type {import("docxImporter").NodeHandlerEntry}
108
108
  */
109
109
  export const listHandlerEntity: any;
110
- export function getAbstractDefinition(numId: any, docx: any): any;
110
+ export function getAbstractDefinition(numId: any, docx: any): import("./numberingCache.js").DocxXmlElement;
111
111
  export function generateListPath(level: any, numId: any, styleId: any, levels: any, docx: any): any[];
112
112
  export function getListLevelDefinitionTag(numId: string, level: string, pStyleId: any, docx: any): any;
113
- export namespace docxNumberigHelpers {
113
+ export namespace docxNumberingHelpers {
114
114
  export { getListLevelDefinitionTag };
115
115
  export { combineIndents };
116
116
  export { parseIndentElement };
@@ -0,0 +1,37 @@
1
+ /** Key used to store the numbering cache on the docx container. */
2
+ export const NUMBERING_CACHE_KEY: "numbering-cache";
3
+ /** Symbol used to memoize level lookups on abstract numbering elements. */
4
+ export const LEVELS_MAP_KEY: unique symbol;
5
+ export function buildNumberingCache(docx: DocxPackage | null | undefined): NumberingCache;
6
+ export function ensureNumberingCache(docx: DocxPackage | null | undefined): NumberingCache;
7
+ export function getNumberingCache(docx: DocxPackage | null | undefined): NumberingCache;
8
+ export type DocxXmlElement = {
9
+ name?: string;
10
+ attributes?: Record<string, unknown>;
11
+ elements?: DocxXmlElement[];
12
+ };
13
+ export type DocxPackage = Record<string, {
14
+ elements?: DocxXmlElement[];
15
+ }>;
16
+ export type NumberingCache = {
17
+ /**
18
+ * Maps w:numId values to their abstract numbering ids.
19
+ */
20
+ numToAbstractId: Map<string, string>;
21
+ /**
22
+ * Stores abstract numbering definitions by id.
23
+ */
24
+ abstractById: Map<string, DocxXmlElement>;
25
+ /**
26
+ * Stores abstract numbering definitions keyed by the template value.
27
+ */
28
+ templateById: Map<string, DocxXmlElement>;
29
+ /**
30
+ * Maps w:numId to their resolved abstract numbering element.
31
+ */
32
+ numToDefinition: Map<string, DocxXmlElement>;
33
+ /**
34
+ * Stores the raw w:num nodes by id for quick lookup.
35
+ */
36
+ numNodesById: Map<string, DocxXmlElement>;
37
+ };
@@ -5,11 +5,17 @@ export class ListItemNodeView {
5
5
  editor: any;
6
6
  decorations: any;
7
7
  view: any;
8
- getPos: any;
8
+ _rawGetPos: any;
9
+ _pendingIndentRefresh: any;
10
+ getPos: () => number;
9
11
  dom: HTMLLIElement;
10
12
  numberingDOM: HTMLSpanElement;
11
13
  contentDOM: HTMLDivElement;
12
- refreshIndentStyling(): void;
14
+ getResolvedPos(): number;
15
+ invalidateResolvedPos(): void;
16
+ refreshIndentStyling({ immediate }?: {
17
+ immediate?: boolean;
18
+ }): void;
13
19
  handleNumberingClick: () => void;
14
20
  update(node: any, decorations: any): void;
15
21
  destroy(): void;
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, enrichTrackedChanges_fn, runCommandWithArgumentOnly_fn;
12
- import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, H as findParentNode, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, P as PluginKey, a as Plugin } from "./chunks/converter-khE-H7hH.js";
13
- import { c1, a5, i, a2 } from "./chunks/converter-khE-H7hH.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, l as getStarterExtensions, P as Placeholder, m as getRichTextExtensions, D as DecorationSet, n as Decoration, M as Mark, o as Extension, A as Attribute, N as Node } from "./chunks/editor-CeTu_f0L.js";
15
- import { t, C, v, T, p, w, q } from "./chunks/editor-CeTu_f0L.js";
12
+ import { aA as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aD as vClickOutside, H as findParentNode, aE as getActiveFormatting, av as isInTable, aF as readFromClipboard, aG as handleClipboardPaste, aH as getFileObject, aI as runPropertyTranslators, aJ as translator, aK as translator$1, aL as translator$2, aM as translator$3, aN as translator$4, aO as translator$5, aP as translator$6, aQ as translator$7, aR as translator$8, aS as translator$9, aT as translator$a, aU as translator$b, aV as translator$c, aW as translator$d, aX as translator$e, aY as commentRangeEndTranslator, aZ as commentRangeStartTranslator, a_ as translator$f, a$ as translator$g, b0 as translator$h, b1 as translator$i, b2 as translator$j, b3 as translator$k, b4 as translator$l, b5 as translator$m, b6 as translator$n, b7 as translator$o, b8 as translator$p, b9 as translator$q, ba as translator$r, bb as translator$s, bc as translator$t, bd as translator$u, be as translator$v, bf as translator$w, bg as translator$x, bh as translator$y, bi as translator$z, bj as translator$A, bk as translator$B, bl as translator$C, bm as translator$D, bn as translator$E, bo as translator$F, bp as translator$G, bq as translator$H, br as translator$I, bs as translator$J, bt as translator$K, bu as translator$L, bv as translator$M, bw as translator$N, bx as translator$O, by as translator$P, bz as translator$Q, bA as translator$R, bB as translator$S, bC as translator$T, bD as translator$U, bE as translator$V, bF as translator$W, bG as translator$X, bH as translator$Y, bI as translator$Z, bJ as translator$_, bK as translator$$, bL as translator$10, bM as translator$11, bN as translator$12, bO as translator$13, bP as translator$14, bQ as translator$15, bR as translator$16, bS as translator$17, bT as translator$18, bU as translator$19, bV as translator$1a, bW as translator$1b, bX as translator$1c, bY as translator$1d, bZ as translator$1e, b_ as translator$1f, b$ as translator$1g, c0 as translator$1h, P as PluginKey, a as Plugin } from "./chunks/converter-CTSH6ApH.js";
13
+ import { c1, a5, i, a2 } from "./chunks/converter-CTSH6ApH.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, f as collectTrackedChanges, i as isTrackedChangeActionAllowed, y as yUndoPluginKey, h as undoDepth, j as redoDepth, k as collectTrackedChangesForContext, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, l as getStarterExtensions, P as Placeholder, m as getRichTextExtensions, D as DecorationSet, n as Decoration, M as Mark, o as Extension, A as Attribute, N as Node } from "./chunks/editor-CwtMgXx9.js";
15
+ import { t, C, v, T, p, w, q } from "./chunks/editor-CwtMgXx9.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-D1RxvV5u.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, p as plusIconSvg, a as trashIconSvg, b as borderNoneIconSvg, c as arrowsToDotIconSvg, d as arrowsLeftRightIconSvg, w as wrenchIconSvg, m as magicWandIcon, e as checkIconSvg$1, x as xMarkIconSvg, l as linkIconSvg, f as tableIconSvg, g as scissorsIconSvg, h as copyIconSvg, i as pasteIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-C66Pu-nq.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-KoUEtzIj.js";
19
+ import { D } from "./chunks/docx-zipper-B9s4CP-_.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-D1RxvV5u.js";
3
- import "./chunks/editor-CeTu_f0L.js";
2
+ import { T } from "./chunks/toolbar-C66Pu-nq.js";
3
+ import "./chunks/editor-CwtMgXx9.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-DZb1VLxX.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-CGKyR4l8.cjs");
4
4
  require("./chunks/vue-DKMj1I9B.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-BewiNPbf.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-zFJj_1tC.es.js";
2
2
  import "./chunks/vue-ZWZLQtoU.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-DZb1VLxX.cjs");
4
- const superdoc = require("./chunks/index-CAVKoWDJ.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-CGKyR4l8.cjs");
4
+ const superdoc = require("./chunks/index-CgZ_A5Ca.cjs");
5
5
  require("./chunks/vue-DKMj1I9B.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
7
7
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-BewiNPbf.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-ClUzozbw.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-zFJj_1tC.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-CV1DF2JY.es.js";
3
3
  import "./chunks/vue-ZWZLQtoU.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  export {