@harbour-enterprises/superdoc 0.27.0-next.1 → 0.27.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 (25) hide show
  1. package/dist/chunks/{PdfViewer-Caa3ZJY4.cjs → PdfViewer-C7U0afIq.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-CegNKOLN.es.js → PdfViewer-CymzL6pA.es.js} +1 -1
  3. package/dist/chunks/{index-DP1njdRr.es.js → index-CCotbgzR.es.js} +2 -2
  4. package/dist/chunks/{index-BXLDmCzi.cjs → index-FmOItkm6.cjs} +2 -2
  5. package/dist/chunks/{super-editor.es-ihBKB9j_.cjs → super-editor.es-C4b8Qz1U.cjs} +61 -27
  6. package/dist/chunks/{super-editor.es-DLyAUJ56.es.js → super-editor.es-DiNNVR7Q.es.js} +61 -27
  7. package/dist/super-editor/ai-writer.es.js +2 -2
  8. package/dist/super-editor/chunks/{converter-BupPKWvT.js → converter-Bnmt0bNT.js} +5 -5
  9. package/dist/super-editor/chunks/{docx-zipper-B_zB1qvo.js → docx-zipper-B1_YD3fF.js} +1 -1
  10. package/dist/super-editor/chunks/{editor-Chw_8G5O.js → editor-BHtGMc-u.js} +58 -24
  11. package/dist/super-editor/chunks/{toolbar-D8p5YzRz.js → toolbar-Cgj3meLH.js} +2 -2
  12. package/dist/super-editor/converter.es.js +1 -1
  13. package/dist/super-editor/docx-zipper.es.js +2 -2
  14. package/dist/super-editor/editor.es.js +3 -3
  15. package/dist/super-editor/file-zipper.es.js +1 -1
  16. package/dist/super-editor/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +4 -3
  17. package/dist/super-editor/super-editor.es.js +6 -6
  18. package/dist/super-editor/toolbar.es.js +2 -2
  19. package/dist/super-editor.cjs +1 -1
  20. package/dist/super-editor.es.js +1 -1
  21. package/dist/superdoc.cjs +2 -2
  22. package/dist/superdoc.es.js +2 -2
  23. package/dist/superdoc.umd.js +61 -27
  24. package/dist/superdoc.umd.js.map +1 -1
  25. package/package.json +1 -1
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, 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, 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 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-BupPKWvT.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-Bnmt0bNT.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-B_zB1qvo.js";
17
+ import { D as DocxZipper } from "./docx-zipper-B1_YD3fF.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -20808,6 +20808,8 @@ const defaultLineLength = 816;
20808
20808
  const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
20809
20809
  const decorations = [];
20810
20810
  const paragraphCache = /* @__PURE__ */ new Map();
20811
+ const coordCache = /* @__PURE__ */ new Map();
20812
+ const domPosCache = /* @__PURE__ */ new Map();
20811
20813
  const end2 = to ?? doc2.content.size;
20812
20814
  doc2.nodesBetween(from2, end2, (node, pos) => {
20813
20815
  if (node.type.name !== "tab") return;
@@ -20819,9 +20821,9 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
20819
20821
  const { tabStops, flattened, startPos } = paragraphContext;
20820
20822
  const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
20821
20823
  if (entryIndex === -1) return;
20822
- const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent);
20824
+ const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
20823
20825
  const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
20824
- const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos) + accumulatedTabWidth;
20826
+ const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
20825
20827
  let tabWidth;
20826
20828
  if (tabStops.length) {
20827
20829
  const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
@@ -20831,12 +20833,18 @@ const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
20831
20833
  const nextTabIndex = findNextTabIndex(flattened, entryIndex + 1);
20832
20834
  const segmentStartPos = pos + node.nodeSize;
20833
20835
  const segmentEndPos = nextTabIndex === -1 ? startPos + paragraphContext.paragraph.nodeSize - 1 : flattened[nextTabIndex].pos;
20834
- const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos);
20836
+ const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos, coordCache, domPosCache);
20835
20837
  tabWidth -= tabStop.val === "center" ? segmentWidth / 2 : segmentWidth;
20836
20838
  } else if (tabStop.val === "decimal" || tabStop.val === "num") {
20837
20839
  const breakChar = tabStop.decimalChar || ".";
20838
20840
  const decimalPos = findDecimalBreakPos(flattened, entryIndex + 1, breakChar);
20839
- const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos) : measureRangeWidth(view, pos + node.nodeSize, startPos + paragraphContext.paragraph.nodeSize - 1);
20841
+ const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos, coordCache, domPosCache) : measureRangeWidth(
20842
+ view,
20843
+ pos + node.nodeSize,
20844
+ startPos + paragraphContext.paragraph.nodeSize - 1,
20845
+ coordCache,
20846
+ domPosCache
20847
+ );
20840
20848
  tabWidth -= integralWidth;
20841
20849
  }
20842
20850
  if (tabStop.leader) {
@@ -20939,27 +20947,27 @@ function findDecimalBreakPos(flattened, startIndex, breakChar) {
20939
20947
  }
20940
20948
  return null;
20941
20949
  }
20942
- function measureRangeWidth(view, from2, to) {
20950
+ function measureRangeWidth(view, from2, to, coordCache = null, domPosCache = null) {
20943
20951
  if (!Number.isFinite(from2) || !Number.isFinite(to) || to <= from2) return 0;
20944
20952
  try {
20945
20953
  const range = document.createRange();
20946
- const fromRef = view.domAtPos(from2);
20947
- const toRef = view.domAtPos(to);
20954
+ const fromRef = getCachedDomAtPos(view, from2, domPosCache);
20955
+ const toRef = getCachedDomAtPos(view, to, domPosCache);
20948
20956
  range.setStart(fromRef.node, fromRef.offset);
20949
20957
  range.setEnd(toRef.node, toRef.offset);
20950
20958
  const rect = range.getBoundingClientRect();
20951
20959
  range.detach?.();
20952
20960
  return rect.width || 0;
20953
20961
  } catch {
20954
- const startLeft = getLeftCoord(view, from2);
20955
- const endLeft = getLeftCoord(view, to);
20962
+ const startLeft = getLeftCoord(view, from2, coordCache, domPosCache);
20963
+ const endLeft = getLeftCoord(view, to, coordCache, domPosCache);
20956
20964
  if (startLeft == null || endLeft == null) return 0;
20957
20965
  return Math.max(0, endLeft - startLeft);
20958
20966
  }
20959
20967
  }
20960
- function getIndentWidth(view, paragraphStartPos, indentAttrs = {}) {
20961
- const marginLeft = getLeftCoord(view, paragraphStartPos);
20962
- const lineLeft = getLeftCoord(view, paragraphStartPos + 1);
20968
+ function getIndentWidth(view, paragraphStartPos, indentAttrs = {}, coordCache = null, domPosCache = null) {
20969
+ const marginLeft = getLeftCoord(view, paragraphStartPos, coordCache, domPosCache);
20970
+ const lineLeft = getLeftCoord(view, paragraphStartPos + 1, coordCache, domPosCache);
20963
20971
  if (marginLeft != null && lineLeft != null) {
20964
20972
  const diff = lineLeft - marginLeft;
20965
20973
  if (!Number.isNaN(diff) && Math.abs(diff) > 0.5) {
@@ -20990,23 +20998,41 @@ function calculateIndentFallback(indentAttrs = {}) {
20990
20998
  if (left2) return left2;
20991
20999
  return 0;
20992
21000
  }
20993
- function getLeftCoord(view, pos) {
21001
+ function getLeftCoord(view, pos, coordCache = null, domPosCache = null) {
20994
21002
  if (!Number.isFinite(pos)) return null;
21003
+ if (coordCache && coordCache.has(pos)) {
21004
+ return coordCache.get(pos);
21005
+ }
21006
+ let result = null;
20995
21007
  try {
20996
- return view.coordsAtPos(pos).left;
21008
+ result = view.coordsAtPos(pos).left;
20997
21009
  } catch {
20998
21010
  try {
20999
- const ref2 = view.domAtPos(pos);
21011
+ const ref2 = getCachedDomAtPos(view, pos, domPosCache);
21000
21012
  const range = document.createRange();
21001
21013
  range.setStart(ref2.node, ref2.offset);
21002
21014
  range.setEnd(ref2.node, ref2.offset);
21003
21015
  const rect = range.getBoundingClientRect();
21004
21016
  range.detach?.();
21005
- return rect.left;
21017
+ result = rect.left;
21006
21018
  } catch {
21007
- return null;
21019
+ result = null;
21008
21020
  }
21009
21021
  }
21022
+ if (coordCache) {
21023
+ coordCache.set(pos, result);
21024
+ }
21025
+ return result;
21026
+ }
21027
+ function getCachedDomAtPos(view, pos, domPosCache = null) {
21028
+ if (domPosCache && domPosCache.has(pos)) {
21029
+ return domPosCache.get(pos);
21030
+ }
21031
+ const result = view.domAtPos(pos);
21032
+ if (domPosCache) {
21033
+ domPosCache.set(pos, result);
21034
+ }
21035
+ return result;
21010
21036
  }
21011
21037
  function calcTabHeight(pos) {
21012
21038
  const ptToPxRatio = 1.333;
@@ -21066,7 +21092,7 @@ const TabNode = Node$1.create({
21066
21092
  if (!decorations) {
21067
21093
  decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
21068
21094
  }
21069
- if (!tr.docChanged) {
21095
+ if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate") === true) {
21070
21096
  return { decorations };
21071
21097
  }
21072
21098
  decorations = decorations.map(tr.mapping, tr.doc);
@@ -28431,13 +28457,20 @@ const BlockNode = Extension.create({
28431
28457
  return [
28432
28458
  new Plugin({
28433
28459
  key: BlockNodePluginKey,
28434
- appendTransaction: (transactions, _oldState, newState) => {
28435
- if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
28436
- if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) return null;
28460
+ appendTransaction: (transactions, oldState, newState) => {
28461
+ let docChanges = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
28462
+ if (hasInitialized && !docChanges) {
28463
+ return;
28464
+ }
28465
+ if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) {
28466
+ return;
28467
+ }
28437
28468
  const { tr } = newState;
28438
28469
  let changed = false;
28439
28470
  newState.doc.descendants((node, pos) => {
28440
- if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node)) return null;
28471
+ if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node)) {
28472
+ return;
28473
+ }
28441
28474
  tr.setNodeMarkup(
28442
28475
  pos,
28443
28476
  void 0,
@@ -28451,6 +28484,7 @@ const BlockNode = Extension.create({
28451
28484
  });
28452
28485
  if (changed && !hasInitialized) {
28453
28486
  hasInitialized = true;
28487
+ tr.setMeta("blockNodeInitialUpdate", true);
28454
28488
  }
28455
28489
  tr.setStoredMarks(newState.tr.storedMarks);
28456
28490
  return changed ? tr : null;
@@ -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-BupPKWvT.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Chw_8G5O.js";
2
+ import { p as process$1 } from "./converter-Bnmt0bNT.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BHtGMc-u.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-BupPKWvT.js";
1
+ import { a5 } from "./chunks/converter-Bnmt0bNT.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-BupPKWvT.js";
2
- import { D } from "./chunks/docx-zipper-B_zB1qvo.js";
1
+ import "./chunks/converter-Bnmt0bNT.js";
2
+ import { D } from "./chunks/docx-zipper-B1_YD3fF.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-Chw_8G5O.js";
2
- import "./chunks/converter-BupPKWvT.js";
3
- import "./chunks/docx-zipper-B_zB1qvo.js";
1
+ import { E } from "./chunks/editor-BHtGMc-u.js";
2
+ import "./chunks/converter-Bnmt0bNT.js";
3
+ import "./chunks/docx-zipper-B1_YD3fF.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-B_zB1qvo.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-B1_YD3fF.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -2,10 +2,11 @@ export function getParagraphContext($pos: any, cache: any, helpers: any): any;
2
2
  export function flattenParagraph(paragraph: any, paragraphStartPos: any): any[];
3
3
  export function findNextTabIndex(flattened: any, fromIndex: any): any;
4
4
  export function findDecimalBreakPos(flattened: any, startIndex: any, breakChar: any): any;
5
- export function measureRangeWidth(view: any, from: any, to: any): number;
6
- export function getIndentWidth(view: any, paragraphStartPos: any, indentAttrs?: {}): number;
5
+ export function measureRangeWidth(view: any, from: any, to: any, coordCache?: any, domPosCache?: any): number;
6
+ export function getIndentWidth(view: any, paragraphStartPos: any, indentAttrs?: {}, coordCache?: any, domPosCache?: any): number;
7
7
  export function calculateIndentFallback(indentAttrs?: {}): number;
8
- export function getLeftCoord(view: any, pos: any): any;
8
+ export function getLeftCoord(view: any, pos: any, coordCache?: any, domPosCache?: any): any;
9
+ export function getCachedDomAtPos(view: any, pos: any, domPosCache?: any): any;
9
10
  export function calcTabHeight(pos: any): string;
10
11
  export const defaultTabDistance: 48;
11
12
  export const defaultLineLength: 816;
@@ -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-BupPKWvT.js";
13
- import { c1, a5, i, a2 } from "./chunks/converter-BupPKWvT.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-Chw_8G5O.js";
15
- import { t, C, v, T, p, w, q } from "./chunks/editor-Chw_8G5O.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-Bnmt0bNT.js";
13
+ import { c1, a5, i, a2 } from "./chunks/converter-Bnmt0bNT.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-BHtGMc-u.js";
15
+ import { t, C, v, T, p, w, q } from "./chunks/editor-BHtGMc-u.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-D8p5YzRz.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-Cgj3meLH.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-B_zB1qvo.js";
19
+ import { D } from "./chunks/docx-zipper-B1_YD3fF.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-D8p5YzRz.js";
3
- import "./chunks/editor-Chw_8G5O.js";
2
+ import { T } from "./chunks/toolbar-Cgj3meLH.js";
3
+ import "./chunks/editor-BHtGMc-u.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-ihBKB9j_.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-C4b8Qz1U.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-DLyAUJ56.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-DiNNVR7Q.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-ihBKB9j_.cjs");
4
- const superdoc = require("./chunks/index-BXLDmCzi.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-C4b8Qz1U.cjs");
4
+ const superdoc = require("./chunks/index-FmOItkm6.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-DLyAUJ56.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DP1njdRr.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DiNNVR7Q.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-CCotbgzR.es.js";
3
3
  import "./chunks/vue-ZWZLQtoU.es.js";
4
4
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
5
5
  export {
@@ -36611,9 +36611,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
36611
36611
  newG = g * percent2;
36612
36612
  newB = b2 * percent2;
36613
36613
  } else if (modifier === "tint") {
36614
- newR = r2 + (255 - r2) * (1 - percent2);
36615
- newG = g + (255 - g) * (1 - percent2);
36616
- newB = b2 + (255 - b2) * (1 - percent2);
36614
+ newR = r2 + (255 - r2) * percent2;
36615
+ newG = g + (255 - g) * percent2;
36616
+ newB = b2 + (255 - b2) * percent2;
36617
36617
  } else if (modifier === "lumOff") {
36618
36618
  const offset2 = 255 * percent2;
36619
36619
  newR = r2 + offset2;
@@ -37371,11 +37371,11 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37371
37371
  attributes: { Requires: "wps" },
37372
37372
  elements: [drawing]
37373
37373
  };
37374
- const result = {
37374
+ const alternateContent = {
37375
37375
  name: "mc:AlternateContent",
37376
37376
  elements: [choice]
37377
37377
  };
37378
- return result;
37378
+ return wrapTextInRun(alternateContent);
37379
37379
  }
37380
37380
  function translateAnchorNode(params2) {
37381
37381
  const { attrs } = params2.node;
@@ -66984,6 +66984,8 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66984
66984
  const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
66985
66985
  const decorations = [];
66986
66986
  const paragraphCache = /* @__PURE__ */ new Map();
66987
+ const coordCache = /* @__PURE__ */ new Map();
66988
+ const domPosCache = /* @__PURE__ */ new Map();
66987
66989
  const end2 = to ?? doc2.content.size;
66988
66990
  doc2.nodesBetween(from2, end2, (node, pos) => {
66989
66991
  if (node.type.name !== "tab") return;
@@ -66995,9 +66997,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
66995
66997
  const { tabStops, flattened, startPos } = paragraphContext;
66996
66998
  const entryIndex = flattened.findIndex((entry) => entry.pos === pos);
66997
66999
  if (entryIndex === -1) return;
66998
- const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent);
67000
+ const indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
66999
67001
  const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
67000
- const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos) + accumulatedTabWidth;
67002
+ const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
67001
67003
  let tabWidth;
67002
67004
  if (tabStops.length) {
67003
67005
  const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
@@ -67007,12 +67009,18 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67007
67009
  const nextTabIndex = findNextTabIndex(flattened, entryIndex + 1);
67008
67010
  const segmentStartPos = pos + node.nodeSize;
67009
67011
  const segmentEndPos = nextTabIndex === -1 ? startPos + paragraphContext.paragraph.nodeSize - 1 : flattened[nextTabIndex].pos;
67010
- const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos);
67012
+ const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos, coordCache, domPosCache);
67011
67013
  tabWidth -= tabStop.val === "center" ? segmentWidth / 2 : segmentWidth;
67012
67014
  } else if (tabStop.val === "decimal" || tabStop.val === "num") {
67013
67015
  const breakChar = tabStop.decimalChar || ".";
67014
67016
  const decimalPos = findDecimalBreakPos(flattened, entryIndex + 1, breakChar);
67015
- const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos) : measureRangeWidth(view, pos + node.nodeSize, startPos + paragraphContext.paragraph.nodeSize - 1);
67017
+ const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos, coordCache, domPosCache) : measureRangeWidth(
67018
+ view,
67019
+ pos + node.nodeSize,
67020
+ startPos + paragraphContext.paragraph.nodeSize - 1,
67021
+ coordCache,
67022
+ domPosCache
67023
+ );
67016
67024
  tabWidth -= integralWidth;
67017
67025
  }
67018
67026
  if (tabStop.leader) {
@@ -67115,27 +67123,27 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67115
67123
  }
67116
67124
  return null;
67117
67125
  }
67118
- function measureRangeWidth(view, from2, to) {
67126
+ function measureRangeWidth(view, from2, to, coordCache = null, domPosCache = null) {
67119
67127
  if (!Number.isFinite(from2) || !Number.isFinite(to) || to <= from2) return 0;
67120
67128
  try {
67121
67129
  const range2 = document.createRange();
67122
- const fromRef = view.domAtPos(from2);
67123
- const toRef2 = view.domAtPos(to);
67130
+ const fromRef = getCachedDomAtPos(view, from2, domPosCache);
67131
+ const toRef2 = getCachedDomAtPos(view, to, domPosCache);
67124
67132
  range2.setStart(fromRef.node, fromRef.offset);
67125
67133
  range2.setEnd(toRef2.node, toRef2.offset);
67126
67134
  const rect = range2.getBoundingClientRect();
67127
67135
  range2.detach?.();
67128
67136
  return rect.width || 0;
67129
67137
  } catch {
67130
- const startLeft = getLeftCoord(view, from2);
67131
- const endLeft = getLeftCoord(view, to);
67138
+ const startLeft = getLeftCoord(view, from2, coordCache, domPosCache);
67139
+ const endLeft = getLeftCoord(view, to, coordCache, domPosCache);
67132
67140
  if (startLeft == null || endLeft == null) return 0;
67133
67141
  return Math.max(0, endLeft - startLeft);
67134
67142
  }
67135
67143
  }
67136
- function getIndentWidth(view, paragraphStartPos, indentAttrs = {}) {
67137
- const marginLeft = getLeftCoord(view, paragraphStartPos);
67138
- const lineLeft = getLeftCoord(view, paragraphStartPos + 1);
67144
+ function getIndentWidth(view, paragraphStartPos, indentAttrs = {}, coordCache = null, domPosCache = null) {
67145
+ const marginLeft = getLeftCoord(view, paragraphStartPos, coordCache, domPosCache);
67146
+ const lineLeft = getLeftCoord(view, paragraphStartPos + 1, coordCache, domPosCache);
67139
67147
  if (marginLeft != null && lineLeft != null) {
67140
67148
  const diff = lineLeft - marginLeft;
67141
67149
  if (!Number.isNaN(diff) && Math.abs(diff) > 0.5) {
@@ -67166,23 +67174,41 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67166
67174
  if (left2) return left2;
67167
67175
  return 0;
67168
67176
  }
67169
- function getLeftCoord(view, pos) {
67177
+ function getLeftCoord(view, pos, coordCache = null, domPosCache = null) {
67170
67178
  if (!Number.isFinite(pos)) return null;
67179
+ if (coordCache && coordCache.has(pos)) {
67180
+ return coordCache.get(pos);
67181
+ }
67182
+ let result = null;
67171
67183
  try {
67172
- return view.coordsAtPos(pos).left;
67184
+ result = view.coordsAtPos(pos).left;
67173
67185
  } catch {
67174
67186
  try {
67175
- const ref2 = view.domAtPos(pos);
67187
+ const ref2 = getCachedDomAtPos(view, pos, domPosCache);
67176
67188
  const range2 = document.createRange();
67177
67189
  range2.setStart(ref2.node, ref2.offset);
67178
67190
  range2.setEnd(ref2.node, ref2.offset);
67179
67191
  const rect = range2.getBoundingClientRect();
67180
67192
  range2.detach?.();
67181
- return rect.left;
67193
+ result = rect.left;
67182
67194
  } catch {
67183
- return null;
67195
+ result = null;
67184
67196
  }
67185
67197
  }
67198
+ if (coordCache) {
67199
+ coordCache.set(pos, result);
67200
+ }
67201
+ return result;
67202
+ }
67203
+ function getCachedDomAtPos(view, pos, domPosCache = null) {
67204
+ if (domPosCache && domPosCache.has(pos)) {
67205
+ return domPosCache.get(pos);
67206
+ }
67207
+ const result = view.domAtPos(pos);
67208
+ if (domPosCache) {
67209
+ domPosCache.set(pos, result);
67210
+ }
67211
+ return result;
67186
67212
  }
67187
67213
  function calcTabHeight(pos) {
67188
67214
  const ptToPxRatio = 1.333;
@@ -67242,7 +67268,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
67242
67268
  if (!decorations) {
67243
67269
  decorations = DecorationSet.create(newState.doc, getTabDecorations(newState.doc, view, helpers2));
67244
67270
  }
67245
- if (!tr.docChanged) {
67271
+ if (!tr.docChanged || tr.getMeta("blockNodeInitialUpdate") === true) {
67246
67272
  return { decorations };
67247
67273
  }
67248
67274
  decorations = decorations.map(tr.mapping, tr.doc);
@@ -74607,13 +74633,20 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74607
74633
  return [
74608
74634
  new Plugin({
74609
74635
  key: BlockNodePluginKey,
74610
- appendTransaction: (transactions, _oldState, newState) => {
74611
- if (hasInitialized && !transactions.some((tr2) => tr2.docChanged)) return null;
74612
- if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) return null;
74636
+ appendTransaction: (transactions, oldState, newState) => {
74637
+ let docChanges = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
74638
+ if (hasInitialized && !docChanges) {
74639
+ return;
74640
+ }
74641
+ if (hasInitialized && !checkForNewBlockNodesInTrs([...transactions])) {
74642
+ return;
74643
+ }
74613
74644
  const { tr } = newState;
74614
74645
  let changed = false;
74615
74646
  newState.doc.descendants((node, pos) => {
74616
- if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node)) return null;
74647
+ if (!nodeAllowsSdBlockIdAttr(node) || !nodeNeedsSdBlockId(node)) {
74648
+ return;
74649
+ }
74617
74650
  tr.setNodeMarkup(
74618
74651
  pos,
74619
74652
  void 0,
@@ -74627,6 +74660,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
74627
74660
  });
74628
74661
  if (changed && !hasInitialized) {
74629
74662
  hasInitialized = true;
74663
+ tr.setMeta("blockNodeInitialUpdate", true);
74630
74664
  }
74631
74665
  tr.setStoredMarks(newState.tr.storedMarks);
74632
74666
  return changed ? tr : null;