@harbour-enterprises/superdoc 0.22.0-next.3 → 0.22.0-next.5

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 (28) hide show
  1. package/dist/chunks/{PdfViewer-CvFw8S_D.cjs → PdfViewer-Badqoc1e.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-D95oFKMa.es.js → PdfViewer-dsL5uHg1.es.js} +1 -1
  3. package/dist/chunks/{index-DgH1cx2c.es.js → index-DBNzXf1D.es.js} +2 -2
  4. package/dist/chunks/{index-Ct4VrAay.cjs → index-DVrbZM76.cjs} +2 -2
  5. package/dist/chunks/{super-editor.es-WUoM0FI7.es.js → super-editor.es-DruRanWK.es.js} +170 -67
  6. package/dist/chunks/{super-editor.es-CIDcWgLs.cjs → super-editor.es-p3eqHXlj.cjs} +170 -67
  7. package/dist/core/types/index.d.ts.map +1 -1
  8. package/dist/super-editor/ai-writer.es.js +2 -2
  9. package/dist/super-editor/chunks/{converter-DBwwYo1I.js → converter-DujfV3Zn.js} +46 -34
  10. package/dist/super-editor/chunks/{docx-zipper-BCI-3XE9.js → docx-zipper-DccEqL60.js} +73 -12
  11. package/dist/super-editor/chunks/{editor-W3rw5KHF.js → editor-Dq3xPdti.js} +54 -24
  12. package/dist/super-editor/chunks/{toolbar-CFfRuTi3.js → toolbar-u5oyT_9K.js} +2 -2
  13. package/dist/super-editor/converter.es.js +1 -1
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/src/core/DocxZipper.d.ts +1 -1
  18. package/dist/super-editor/src/core/super-converter/exporter.d.ts +1 -0
  19. package/dist/super-editor/src/extensions/custom-selection/custom-selection.d.ts +5 -0
  20. package/dist/super-editor/super-editor.es.js +6 -6
  21. package/dist/super-editor/toolbar.es.js +2 -2
  22. package/dist/super-editor.cjs +1 -1
  23. package/dist/super-editor.es.js +1 -1
  24. package/dist/superdoc.cjs +2 -2
  25. package/dist/superdoc.es.js +2 -2
  26. package/dist/superdoc.umd.js +170 -67
  27. package/dist/superdoc.umd.js.map +1 -1
  28. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { p as process$1, au as commonjsGlobal, B as Buffer, av as getDefaultExportFromCjs, aw as getContentTypesFromXml, ax as xmljs } from "./converter-DBwwYo1I.js";
1
+ import { p as process$1, au as commonjsGlobal, B as Buffer, av as getDefaultExportFromCjs, aw as getContentTypesFromXml, ax as xmljs } from "./converter-DujfV3Zn.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
  }
@@ -2414,14 +2414,19 @@ class DocxZipper {
2414
2414
  /**
2415
2415
  * Update [Content_Types].xml with extensions of new Image annotations
2416
2416
  */
2417
- async updateContentTypes(docx, media, fromJson) {
2417
+ async updateContentTypes(docx, media, fromJson, updatedDocs = {}) {
2418
+ const additionalPartNames = Object.keys(updatedDocs || {});
2418
2419
  const newMediaTypes = Object.keys(media).map((name) => {
2419
2420
  return this.getFileExtension(name);
2420
2421
  }).filter(Boolean);
2421
2422
  const contentTypesPath = "[Content_Types].xml";
2422
2423
  let contentTypesXml;
2423
2424
  if (fromJson) {
2424
- contentTypesXml = docx.files.find((file) => file.name === contentTypesPath)?.content || "";
2425
+ if (Array.isArray(docx.files)) {
2426
+ contentTypesXml = docx.files.find((file) => file.name === contentTypesPath)?.content || "";
2427
+ } else {
2428
+ contentTypesXml = docx.files?.[contentTypesPath] || "";
2429
+ }
2425
2430
  } else contentTypesXml = await docx.file(contentTypesPath).async("string");
2426
2431
  let typesString = "";
2427
2432
  const defaultMediaTypes = getContentTypesFromXml(contentTypesXml);
@@ -2447,24 +2452,39 @@ class DocxZipper {
2447
2452
  const hasCommentsExtensible = types.elements?.some(
2448
2453
  (el) => el.name === "Override" && el.attributes.PartName === "/word/commentsExtensible.xml"
2449
2454
  );
2450
- if (docx.files["word/comments.xml"]) {
2455
+ const hasFile = (filename) => {
2456
+ if (!docx?.files) return false;
2457
+ if (!fromJson) return Boolean(docx.files[filename]);
2458
+ if (Array.isArray(docx.files)) return docx.files.some((file) => file.name === filename);
2459
+ return Boolean(docx.files[filename]);
2460
+ };
2461
+ if (hasFile("word/comments.xml")) {
2451
2462
  const commentsDef = `<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" />`;
2452
2463
  if (!hasComments) typesString += commentsDef;
2453
2464
  }
2454
- if (docx.files["word/commentsExtended.xml"]) {
2465
+ if (hasFile("word/commentsExtended.xml")) {
2455
2466
  const commentsExtendedDef = `<Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml" />`;
2456
2467
  if (!hasCommentsExtended) typesString += commentsExtendedDef;
2457
2468
  }
2458
- if (docx.files["word/commentsIds.xml"]) {
2469
+ if (hasFile("word/commentsIds.xml")) {
2459
2470
  const commentsIdsDef = `<Override PartName="/word/commentsIds.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml" />`;
2460
2471
  if (!hasCommentsIds) typesString += commentsIdsDef;
2461
2472
  }
2462
- if (docx.files["word/commentsExtensible.xml"]) {
2473
+ if (hasFile("word/commentsExtensible.xml")) {
2463
2474
  const commentsExtendedDef = `<Override PartName="/word/commentsExtensible.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml" />`;
2464
2475
  if (!hasCommentsExtensible) typesString += commentsExtendedDef;
2465
2476
  }
2466
- Object.keys(docx.files).forEach((name) => {
2467
- if (name.includes(".rels") || !name.includes("header") && !name.includes("footer")) return;
2477
+ const partNames = new Set(additionalPartNames);
2478
+ if (docx?.files) {
2479
+ if (fromJson && Array.isArray(docx.files)) {
2480
+ docx.files.forEach((file) => partNames.add(file.name));
2481
+ } else {
2482
+ Object.keys(docx.files).forEach((key) => partNames.add(key));
2483
+ }
2484
+ }
2485
+ partNames.forEach((name) => {
2486
+ if (name.includes(".rels")) return;
2487
+ if (!name.includes("header") && !name.includes("footer")) return;
2468
2488
  const hasExtensible = types.elements?.some(
2469
2489
  (el) => el.name === "Override" && el.attributes.PartName === `/${name}`
2470
2490
  );
@@ -2475,7 +2495,48 @@ class DocxZipper {
2475
2495
  }
2476
2496
  });
2477
2497
  const beginningString = '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">';
2478
- const updatedContentTypesXml = contentTypesXml.replace(beginningString, `${beginningString}${typesString}`);
2498
+ let updatedContentTypesXml = contentTypesXml.replace(beginningString, `${beginningString}${typesString}`);
2499
+ let relationshipsXml = updatedDocs["word/_rels/document.xml.rels"];
2500
+ if (!relationshipsXml) {
2501
+ if (fromJson) {
2502
+ if (Array.isArray(docx.files)) {
2503
+ relationshipsXml = docx.files.find((file) => file.name === "word/_rels/document.xml.rels")?.content;
2504
+ } else {
2505
+ relationshipsXml = docx.files?.["word/_rels/document.xml.rels"];
2506
+ }
2507
+ } else {
2508
+ relationshipsXml = await docx.file("word/_rels/document.xml.rels")?.async("string");
2509
+ }
2510
+ }
2511
+ if (relationshipsXml) {
2512
+ try {
2513
+ const relJson = xmljs.xml2js(relationshipsXml, { compact: false });
2514
+ const relationships = relJson.elements?.find((el) => el.name === "Relationships");
2515
+ relationships?.elements?.forEach((rel) => {
2516
+ const type = rel.attributes?.Type;
2517
+ const target = rel.attributes?.Target;
2518
+ if (!type || !target) return;
2519
+ const isHeader = type.includes("/header");
2520
+ const isFooter = type.includes("/footer");
2521
+ if (!isHeader && !isFooter) return;
2522
+ let sanitizedTarget = target.replace(/^\.\//, "");
2523
+ if (sanitizedTarget.startsWith("../")) sanitizedTarget = sanitizedTarget.slice(3);
2524
+ if (sanitizedTarget.startsWith("/")) sanitizedTarget = sanitizedTarget.slice(1);
2525
+ const partName = sanitizedTarget.startsWith("word/") ? sanitizedTarget : `word/${sanitizedTarget}`;
2526
+ partNames.add(partName);
2527
+ });
2528
+ } catch (error) {
2529
+ console.warn("Failed to parse document relationships while updating content types", error);
2530
+ }
2531
+ }
2532
+ partNames.forEach((name) => {
2533
+ if (name.includes(".rels")) return;
2534
+ if (!name.includes("header") && !name.includes("footer")) return;
2535
+ if (updatedContentTypesXml.includes(`PartName="/${name}"`)) return;
2536
+ const type = name.includes("header") ? "header" : "footer";
2537
+ const extendedDef = `<Override PartName="/${name}" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.${type}+xml"/>`;
2538
+ updatedContentTypesXml = updatedContentTypesXml.replace("</Types>", `${extendedDef}</Types>`);
2539
+ });
2479
2540
  if (fromJson) return updatedContentTypesXml;
2480
2541
  docx.file(contentTypesPath, updatedContentTypesXml);
2481
2542
  }
@@ -2516,7 +2577,7 @@ class DocxZipper {
2516
2577
  for (const [fontName, fontUintArray] of Object.entries(fonts)) {
2517
2578
  zip.file(fontName, fontUintArray);
2518
2579
  }
2519
- await this.updateContentTypes(zip, media);
2580
+ await this.updateContentTypes(zip, media, false, updatedDocs);
2520
2581
  return zip;
2521
2582
  }
2522
2583
  /**
@@ -2542,7 +2603,7 @@ class DocxZipper {
2542
2603
  Object.keys(media).forEach((path) => {
2543
2604
  unzippedOriginalDocx.file(path, media[path]);
2544
2605
  });
2545
- await this.updateContentTypes(unzippedOriginalDocx, media);
2606
+ await this.updateContentTypes(unzippedOriginalDocx, media, false, updatedDocs);
2546
2607
  return unzippedOriginalDocx;
2547
2608
  }
2548
2609
  }
@@ -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, 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, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_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 InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as SelectionRange, ao as Transform, ap as isInTable$1, aq as generateDocxRandomId, ar as insertNewRelationship, as as updateDOMAttributes, at as htmlHandler } from "./converter-DBwwYo1I.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 InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as SelectionRange, ao as Transform, ap as isInTable$1, aq as generateDocxRandomId, ar as insertNewRelationship, as as updateDOMAttributes, at as htmlHandler } from "./converter-DujfV3Zn.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-BCI-3XE9.js";
17
+ import { D as DocxZipper } from "./docx-zipper-DccEqL60.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -11675,9 +11675,11 @@ const toggleHeaderFooterEditMode = ({ editor, focusedSectionEditor, isEditMode,
11675
11675
  item.editor.view.dom.setAttribute("documentmode", documentMode);
11676
11676
  });
11677
11677
  if (isEditMode) {
11678
- const pm = document.querySelector(".ProseMirror");
11679
- pm.classList.add("header-footer-edit");
11680
- pm.setAttribute("aria-readonly", true);
11678
+ const pm = editor.view?.dom || editor.options.element?.querySelector?.(".ProseMirror");
11679
+ if (pm) {
11680
+ pm.classList.add("header-footer-edit");
11681
+ pm.setAttribute("aria-readonly", true);
11682
+ }
11681
11683
  }
11682
11684
  if (focusedSectionEditor) {
11683
11685
  focusedSectionEditor.view.focus();
@@ -14332,7 +14334,7 @@ const _Editor = class _Editor extends EventEmitter {
14332
14334
  setDocumentMode(documentMode) {
14333
14335
  let cleanedMode = documentMode?.toLowerCase() || "editing";
14334
14336
  if (!this.extensionService || !this.state) return;
14335
- const pm = document.querySelector(".ProseMirror");
14337
+ const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
14336
14338
  if (this.options.role === "viewer") cleanedMode = "viewing";
14337
14339
  if (this.options.role === "suggester" && cleanedMode === "editing") cleanedMode = "suggesting";
14338
14340
  if (cleanedMode === "viewing") {
@@ -14820,7 +14822,8 @@ const _Editor = class _Editor extends EventEmitter {
14820
14822
  files: this.options.content
14821
14823
  },
14822
14824
  media,
14823
- true
14825
+ true,
14826
+ updatedDocs
14824
14827
  );
14825
14828
  return updatedDocs;
14826
14829
  }
@@ -15380,9 +15383,11 @@ createView_fn = function(element) {
15380
15383
  isEditMode: false,
15381
15384
  documentMode: this.options.documentMode
15382
15385
  });
15383
- const pm = document.querySelector(".ProseMirror");
15384
- pm.classList.remove("header-footer-edit");
15385
- pm.setAttribute("aria-readonly", false);
15386
+ const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
15387
+ if (pm) {
15388
+ pm.classList.remove("header-footer-edit");
15389
+ pm.setAttribute("aria-readonly", false);
15390
+ }
15386
15391
  }
15387
15392
  setWordSelection(view, pos);
15388
15393
  }
@@ -17494,6 +17499,16 @@ const shouldAllowNativeContextMenu = (event) => {
17494
17499
  return prefersNativeMenu(event);
17495
17500
  };
17496
17501
  const shouldBypassContextMenu = shouldAllowNativeContextMenu;
17502
+ const DEFAULT_SELECTION_STATE = Object.freeze({
17503
+ focused: false,
17504
+ preservedSelection: null,
17505
+ showVisualSelection: false,
17506
+ skipFocusReset: false
17507
+ });
17508
+ const normalizeSelectionState = (state = {}) => ({
17509
+ ...DEFAULT_SELECTION_STATE,
17510
+ ...state
17511
+ });
17497
17512
  const CustomSelectionPluginKey = new PluginKey("CustomSelection");
17498
17513
  const handleClickOutside = (event, editor) => {
17499
17514
  const editorElem = editor?.options?.element;
@@ -17531,11 +17546,7 @@ const CustomSelection = Extension.create({
17531
17546
  const customSelectionPlugin = new Plugin({
17532
17547
  key: CustomSelectionPluginKey,
17533
17548
  state: {
17534
- init: () => ({
17535
- focused: false,
17536
- preservedSelection: null,
17537
- showVisualSelection: false
17538
- }),
17549
+ init: () => ({ ...DEFAULT_SELECTION_STATE }),
17539
17550
  apply: (tr, value) => {
17540
17551
  const meta = getFocusMeta(tr);
17541
17552
  if (meta !== void 0) {
@@ -17566,7 +17577,8 @@ const CustomSelection = Extension.create({
17566
17577
  setFocusMeta(view.state.tr, {
17567
17578
  focused: true,
17568
17579
  preservedSelection: selection,
17569
- showVisualSelection: true
17580
+ showVisualSelection: true,
17581
+ skipFocusReset: true
17570
17582
  })
17571
17583
  );
17572
17584
  }
@@ -17587,7 +17599,8 @@ const CustomSelection = Extension.create({
17587
17599
  setFocusMeta(view.state.tr, {
17588
17600
  focused: true,
17589
17601
  preservedSelection: selection2,
17590
- showVisualSelection: true
17602
+ showVisualSelection: true,
17603
+ skipFocusReset: true
17591
17604
  })
17592
17605
  );
17593
17606
  this.editor.setOptions({
@@ -17610,7 +17623,8 @@ const CustomSelection = Extension.create({
17610
17623
  setFocusMeta(view.state.tr, {
17611
17624
  focused: true,
17612
17625
  preservedSelection: selection,
17613
- showVisualSelection: true
17626
+ showVisualSelection: true,
17627
+ skipFocusReset: false
17614
17628
  })
17615
17629
  );
17616
17630
  this.editor.setOptions({
@@ -17628,7 +17642,8 @@ const CustomSelection = Extension.create({
17628
17642
  setFocusMeta(view.state.tr, {
17629
17643
  focused: true,
17630
17644
  preservedSelection: selection,
17631
- showVisualSelection: true
17645
+ showVisualSelection: true,
17646
+ skipFocusReset: false
17632
17647
  })
17633
17648
  );
17634
17649
  }
@@ -17639,7 +17654,8 @@ const CustomSelection = Extension.create({
17639
17654
  setFocusMeta(view.state.tr, {
17640
17655
  focused: false,
17641
17656
  preservedSelection: null,
17642
- showVisualSelection: false
17657
+ showVisualSelection: false,
17658
+ skipFocusReset: false
17643
17659
  })
17644
17660
  );
17645
17661
  if (!selection.empty && !this.editor.options.element?.contains(target)) {
@@ -17656,12 +17672,20 @@ const CustomSelection = Extension.create({
17656
17672
  const isElement2 = target instanceof Element;
17657
17673
  const isToolbarBtn = isElement2 && isToolbarButton(target);
17658
17674
  const isToolbarInp = isElement2 && isToolbarInput(target);
17675
+ const focusState = getFocusState(view.state);
17676
+ if (focusState?.skipFocusReset) {
17677
+ view.dispatch(
17678
+ setFocusMeta(view.state.tr, normalizeSelectionState({ ...focusState, skipFocusReset: false }))
17679
+ );
17680
+ return false;
17681
+ }
17659
17682
  if (!isToolbarBtn && !isToolbarInp) {
17660
17683
  view.dispatch(
17661
17684
  setFocusMeta(view.state.tr, {
17662
17685
  focused: false,
17663
17686
  preservedSelection: null,
17664
- showVisualSelection: false
17687
+ showVisualSelection: false,
17688
+ skipFocusReset: false
17665
17689
  })
17666
17690
  );
17667
17691
  }
@@ -17672,12 +17696,16 @@ const CustomSelection = Extension.create({
17672
17696
  const isToolbarBtn = isElement2 && isToolbarButton(target);
17673
17697
  const isToolbarInp = isElement2 && isToolbarInput(target);
17674
17698
  const state = getFocusState(view.state);
17699
+ if (state?.skipFocusReset) {
17700
+ return false;
17701
+ }
17675
17702
  if (isToolbarBtn || isToolbarInp) {
17676
17703
  view.dispatch(
17677
17704
  setFocusMeta(view.state.tr, {
17678
17705
  focused: true,
17679
17706
  preservedSelection: state.preservedSelection || view.state.selection,
17680
- showVisualSelection: true
17707
+ showVisualSelection: true,
17708
+ skipFocusReset: false
17681
17709
  })
17682
17710
  );
17683
17711
  } else {
@@ -17685,7 +17713,8 @@ const CustomSelection = Extension.create({
17685
17713
  setFocusMeta(view.state.tr, {
17686
17714
  focused: false,
17687
17715
  preservedSelection: null,
17688
- showVisualSelection: false
17716
+ showVisualSelection: false,
17717
+ skipFocusReset: false
17689
17718
  })
17690
17719
  );
17691
17720
  }
@@ -33460,7 +33489,8 @@ const nodeResizer = (nodeNames = ["image"], editor) => {
33460
33489
  const prevSelection = prevState.selection;
33461
33490
  if (selection.from !== prevSelection.from || selection.to !== prevSelection.to) {
33462
33491
  setTimeout(() => {
33463
- const selectedResizableWrapper = document.querySelector(".sd-editor-resizable-wrapper");
33492
+ const searchRoot = editorView?.dom;
33493
+ const selectedResizableWrapper = searchRoot?.querySelector(".sd-editor-resizable-wrapper");
33464
33494
  if (selectedResizableWrapper) {
33465
33495
  showResizeHandles(view2, selectedResizableWrapper);
33466
33496
  } else {
@@ -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-DBwwYo1I.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-W3rw5KHF.js";
2
+ import { p as process$1 } from "./converter-DujfV3Zn.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Dq3xPdti.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-DBwwYo1I.js";
1
+ import { a5 } from "./chunks/converter-DujfV3Zn.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-DBwwYo1I.js";
2
- import { D } from "./chunks/docx-zipper-BCI-3XE9.js";
1
+ import "./chunks/converter-DujfV3Zn.js";
2
+ import { D } from "./chunks/docx-zipper-DccEqL60.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-W3rw5KHF.js";
2
- import "./chunks/converter-DBwwYo1I.js";
3
- import "./chunks/docx-zipper-BCI-3XE9.js";
1
+ import { E } from "./chunks/editor-Dq3xPdti.js";
2
+ import "./chunks/converter-DujfV3Zn.js";
3
+ import "./chunks/docx-zipper-DccEqL60.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-BCI-3XE9.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-DccEqL60.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -33,7 +33,7 @@ declare class DocxZipper {
33
33
  /**
34
34
  * Update [Content_Types].xml with extensions of new Image annotations
35
35
  */
36
- updateContentTypes(docx: any, media: any, fromJson: any): Promise<any>;
36
+ updateContentTypes(docx: any, media: any, fromJson: any, updatedDocs?: {}): Promise<any>;
37
37
  unzip(file: any): Promise<any>;
38
38
  updateZip({ docx, updatedDocs, originalDocxFile, media, fonts, isHeadless }: {
39
39
  docx: any;
@@ -103,6 +103,7 @@ export function translateHardBreak(params: any): {
103
103
  };
104
104
  }[];
105
105
  };
106
+ export function ensureSectionLayoutDefaults(sectPr: any, converter: any): any;
106
107
  export function isLineBreakOnlyRun(node: any): any;
107
108
  export class DocxExporter {
108
109
  constructor(converter: any);
@@ -4,6 +4,7 @@
4
4
  * @property {boolean} focused - Whether editor is focused
5
5
  * @property {Object|null} preservedSelection - Stored selection
6
6
  * @property {boolean} showVisualSelection - Whether to show selection decoration
7
+ * @property {boolean} skipFocusReset - Whether to skip clearing selection on next focus
7
8
  */
8
9
  /**
9
10
  * Configuration options for CustomSelection
@@ -44,6 +45,10 @@ export type SelectionState = {
44
45
  * - Whether to show selection decoration
45
46
  */
46
47
  showVisualSelection: boolean;
48
+ /**
49
+ * - Whether to skip clearing selection on next focus
50
+ */
51
+ skipFocusReset: boolean;
47
52
  };
48
53
  /**
49
54
  * Configuration options for CustomSelection
@@ -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, runCommandWithArgumentOnly_fn;
12
- import { av as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, ay as vClickOutside, H as findParentNode, az as getActiveFormatting, ap as isInTable, aA as readFromClipboard, aB as handleClipboardPaste, aC as getFileObject, aD as runPropertyTranslators, aE as translator, aF as translator$1, aG as translator$2, aH as translator$3, aI as translator$4, aJ as translator$5, aK as translator$6, aL as translator$7, aM as translator$8, aN as translator$9, aO as translator$a, aP as translator$b, aQ as translator$c, aR as translator$d, aS as translator$e, aT as translator$f, aU as translator$g, aV as translator$h, aW as translator$i, aX as translator$j, aY as translator$k, aZ as translator$l, a_ as translator$m, a$ as translator$n, b0 as translator$o, b1 as translator$p, b2 as translator$q, b3 as translator$r, b4 as translator$s, b5 as translator$t, b6 as translator$u, b7 as translator$v, b8 as translator$w, b9 as translator$x, ba as translator$y, bb as translator$z, bc as translator$A, bd as translator$B, be as translator$C, bf as translator$D, bg as translator$E, bh as translator$F, bi as translator$G, bj as translator$H, bk as translator$I, bl as translator$J, bm as translator$K, bn as translator$L, bo as translator$M, bp as translator$N, bq as translator$O, br as translator$P, bs as translator$Q, bt as translator$R, bu as translator$S, bv as translator$T, bw as translator$U, bx as translator$V, by as translator$W, bz as translator$X, bA as translator$Y, bB as translator$Z, bC as translator$_, bD as translator$$, bE as translator$10, a as Plugin } from "./chunks/converter-DBwwYo1I.js";
13
- import { bF, a5, i, a2 } from "./chunks/converter-DBwwYo1I.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, y as yUndoPluginKey, f as undoDepth, h as redoDepth, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-W3rw5KHF.js";
15
- import { n, C, o, T, l, p, m } from "./chunks/editor-W3rw5KHF.js";
12
+ import { av as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, ay as vClickOutside, H as findParentNode, az as getActiveFormatting, ap as isInTable, aA as readFromClipboard, aB as handleClipboardPaste, aC as getFileObject, aD as runPropertyTranslators, aE as translator, aF as translator$1, aG as translator$2, aH as translator$3, aI as translator$4, aJ as translator$5, aK as translator$6, aL as translator$7, aM as translator$8, aN as translator$9, aO as translator$a, aP as translator$b, aQ as translator$c, aR as translator$d, aS as translator$e, aT as translator$f, aU as translator$g, aV as translator$h, aW as translator$i, aX as translator$j, aY as translator$k, aZ as translator$l, a_ as translator$m, a$ as translator$n, b0 as translator$o, b1 as translator$p, b2 as translator$q, b3 as translator$r, b4 as translator$s, b5 as translator$t, b6 as translator$u, b7 as translator$v, b8 as translator$w, b9 as translator$x, ba as translator$y, bb as translator$z, bc as translator$A, bd as translator$B, be as translator$C, bf as translator$D, bg as translator$E, bh as translator$F, bi as translator$G, bj as translator$H, bk as translator$I, bl as translator$J, bm as translator$K, bn as translator$L, bo as translator$M, bp as translator$N, bq as translator$O, br as translator$P, bs as translator$Q, bt as translator$R, bu as translator$S, bv as translator$T, bw as translator$U, bx as translator$V, by as translator$W, bz as translator$X, bA as translator$Y, bB as translator$Z, bC as translator$_, bD as translator$$, bE as translator$10, a as Plugin } from "./chunks/converter-DujfV3Zn.js";
13
+ import { bF, a5, i, a2 } from "./chunks/converter-DujfV3Zn.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, y as yUndoPluginKey, f as undoDepth, h as redoDepth, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-Dq3xPdti.js";
15
+ import { n, C, o, T, l, p, m } from "./chunks/editor-Dq3xPdti.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, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-CFfRuTi3.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-u5oyT_9K.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-BCI-3XE9.js";
19
+ import { D } from "./chunks/docx-zipper-DccEqL60.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-CFfRuTi3.js";
3
- import "./chunks/editor-W3rw5KHF.js";
2
+ import { T } from "./chunks/toolbar-u5oyT_9K.js";
3
+ import "./chunks/editor-Dq3xPdti.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-CIDcWgLs.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-p3eqHXlj.cjs");
4
4
  require("./chunks/vue-DWle4Cai.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-WUoM0FI7.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-DruRanWK.es.js";
2
2
  import "./chunks/vue-CXxsqYcP.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-CIDcWgLs.cjs");
4
- const superdoc = require("./chunks/index-Ct4VrAay.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-p3eqHXlj.cjs");
4
+ const superdoc = require("./chunks/index-DVrbZM76.cjs");
5
5
  require("./chunks/vue-DWle4Cai.cjs");
6
6
  require("./chunks/jszip-b7l8QkfH.cjs");
7
7
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-WUoM0FI7.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DgH1cx2c.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DruRanWK.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-DBNzXf1D.es.js";
3
3
  import "./chunks/vue-CXxsqYcP.es.js";
4
4
  import "./chunks/jszip-B8KIZSNe.es.js";
5
5
  import { B } from "./chunks/blank-docx-iwdyG9RH.es.js";