@harbour-enterprises/superdoc 0.28.0-next.1 → 0.28.0-next.11

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 (99) hide show
  1. package/dist/chunks/{PdfViewer-9z5hlRyt.es.js → PdfViewer-CLpN99Rl.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-Jb55JUCS.cjs → PdfViewer-CvsrAT4c.cjs} +1 -1
  3. package/dist/chunks/default-BS6z0SoE-BS6z0SoE.es.js +5 -0
  4. package/dist/chunks/default-BS6z0SoE-Gl4f7Y7J.cjs +4 -0
  5. package/dist/chunks/index-CHAKf7mX-C5aFF6Zl.es.js +2213 -0
  6. package/dist/chunks/index-CHAKf7mX-Dx-DOGGJ.cjs +2213 -0
  7. package/dist/chunks/{index-DqP-8_tO.es.js → index-CNPV5EVY.es.js} +2 -2
  8. package/dist/chunks/index-CSaZZzfe-BzemjgYL.cjs +264 -0
  9. package/dist/chunks/index-CSaZZzfe-CSaZZzfe.es.js +265 -0
  10. package/dist/chunks/index-C_x_N6Uh-DJn8hIEt.es.js +2200 -0
  11. package/dist/chunks/index-C_x_N6Uh-Db3CUJMX.cjs +2200 -0
  12. package/dist/chunks/index-Cd3D_8gF-CFhMnajQ.es.js +862 -0
  13. package/dist/chunks/index-Cd3D_8gF-DKJ_wTu_.cjs +861 -0
  14. package/dist/chunks/index-CvBqQJbG-CvBqQJbG.es.js +878 -0
  15. package/dist/chunks/index-CvBqQJbG-Dwm0THD7.cjs +877 -0
  16. package/dist/chunks/index-DL9bff78-8izww2lB.es.js +845 -0
  17. package/dist/chunks/index-DL9bff78-Cf4UBVvQ.cjs +845 -0
  18. package/dist/chunks/index-DRCvimau-Cw339678.es.js +9876 -0
  19. package/dist/chunks/index-DRCvimau-H4Ck3S9a.cjs +9876 -0
  20. package/dist/chunks/index-D_sWOSiG-BtDZzJ6I.cjs +588 -0
  21. package/dist/chunks/index-D_sWOSiG-DE96TaT5.es.js +588 -0
  22. package/dist/chunks/{index-D0UvyM8m.cjs → index-sLveeSfi.cjs} +2 -2
  23. package/dist/chunks/{super-editor.es-BBJIKdhr.es.js → super-editor.es-0SXIzzbj.es.js} +1846 -1655
  24. package/dist/chunks/{super-editor.es-Ca5D3ZTW.cjs → super-editor.es-Dy32MdYk.cjs} +1845 -1654
  25. package/dist/core/types/index.d.ts +2 -1
  26. package/dist/core/types/index.d.ts.map +1 -1
  27. package/dist/images/altText_add.svg +3 -0
  28. package/dist/images/altText_disclaimer.svg +3 -0
  29. package/dist/images/altText_done.svg +3 -0
  30. package/dist/images/altText_spinner.svg +30 -0
  31. package/dist/images/altText_warning.svg +3 -0
  32. package/dist/images/annotation-check.svg +11 -0
  33. package/dist/images/annotation-comment.svg +16 -0
  34. package/dist/images/annotation-help.svg +26 -0
  35. package/dist/images/annotation-insert.svg +10 -0
  36. package/dist/images/annotation-key.svg +11 -0
  37. package/dist/images/annotation-newparagraph.svg +11 -0
  38. package/dist/images/annotation-noicon.svg +7 -0
  39. package/dist/images/annotation-note.svg +42 -0
  40. package/dist/images/annotation-paperclip.svg +6 -0
  41. package/dist/images/annotation-paragraph.svg +16 -0
  42. package/dist/images/annotation-pushpin.svg +7 -0
  43. package/dist/images/cursor-editorFreeHighlight.svg +6 -0
  44. package/dist/images/cursor-editorFreeText.svg +3 -0
  45. package/dist/images/cursor-editorInk.svg +4 -0
  46. package/dist/images/cursor-editorTextHighlight.svg +8 -0
  47. package/dist/images/editor-toolbar-delete.svg +5 -0
  48. package/dist/images/loading-icon.gif +0 -0
  49. package/dist/images/messageBar_closingButton.svg +3 -0
  50. package/dist/images/messageBar_warning.svg +3 -0
  51. package/dist/images/toolbarButton-editorHighlight.svg +6 -0
  52. package/dist/images/toolbarButton-menuArrow.svg +3 -0
  53. package/dist/stores/comments-store.d.ts +1 -1
  54. package/dist/super-editor/ai-writer.es.js +2 -2
  55. package/dist/super-editor/chunks/{converter-AR-76siZ.js → converter-DMwo26F4.js} +1299 -1211
  56. package/dist/super-editor/chunks/default-BS6z0SoE.js +5 -0
  57. package/dist/super-editor/chunks/{docx-zipper-DVb-VGgt.js → docx-zipper-CuoYR_fZ.js} +1 -1
  58. package/dist/super-editor/chunks/{editor-mK_uimq6.js → editor-BQ9mPcm5.js} +202 -104
  59. package/dist/super-editor/chunks/index-CHAKf7mX.js +2213 -0
  60. package/dist/super-editor/chunks/index-CSaZZzfe.js +265 -0
  61. package/dist/super-editor/chunks/index-C_x_N6Uh.js +2200 -0
  62. package/dist/super-editor/chunks/index-Cd3D_8gF.js +862 -0
  63. package/dist/super-editor/chunks/index-CvBqQJbG.js +878 -0
  64. package/dist/super-editor/chunks/index-DL9bff78.js +845 -0
  65. package/dist/super-editor/chunks/index-DRCvimau.js +9876 -0
  66. package/dist/super-editor/chunks/index-D_sWOSiG.js +588 -0
  67. package/dist/super-editor/chunks/{toolbar-ByoNwr7x.js → toolbar-D59d-aMm.js} +2 -2
  68. package/dist/super-editor/converter.es.js +1 -1
  69. package/dist/super-editor/docx-zipper.es.js +2 -2
  70. package/dist/super-editor/editor.es.js +3 -3
  71. package/dist/super-editor/file-zipper.es.js +1 -1
  72. package/dist/super-editor/super-editor/src/core/Editor.d.ts +7 -1
  73. package/dist/super-editor/super-editor/src/core/commands/decreaseListIndent.d.ts +1 -1
  74. package/dist/super-editor/super-editor/src/core/commands/increaseListIndent.d.ts +1 -1
  75. package/dist/super-editor/super-editor/src/core/commands/list-helpers/list-indent-helpers.d.ts +3 -0
  76. package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts +6 -0
  77. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts +1 -0
  78. package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/types/index.d.ts +1 -0
  79. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-structured-content.d.ts +2 -2
  80. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/t/index.d.ts +1 -0
  81. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/t/t-translator.d.ts +7 -0
  82. package/dist/super-editor/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -1
  83. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-block.d.ts +8 -6
  84. package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content.d.ts +8 -1
  85. package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentBlockTags.d.ts +11 -4
  86. package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentInlineTags.d.ts +11 -4
  87. package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTablesById.d.ts +8 -4
  88. package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTags.d.ts +11 -4
  89. package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsById.d.ts +12 -5
  90. package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts +2 -1
  91. package/dist/super-editor/super-editor.es.js +22 -22
  92. package/dist/super-editor/toolbar.es.js +2 -2
  93. package/dist/super-editor.cjs +1 -1
  94. package/dist/super-editor.es.js +1 -1
  95. package/dist/superdoc.cjs +2 -2
  96. package/dist/superdoc.es.js +2 -2
  97. package/dist/superdoc.umd.js +26057 -8172
  98. package/dist/superdoc.umd.js.map +1 -1
  99. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ function ok() {
2
+ }
3
+ export {
4
+ ok as o
5
+ };
@@ -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-AR-76siZ.js";
1
+ import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-DMwo26F4.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, applyIndentStyling_fn, _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, 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-AR-76siZ.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-DMwo26F4.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-DVb-VGgt.js";
17
+ import { D as DocxZipper } from "./docx-zipper-CuoYR_fZ.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -9793,38 +9793,93 @@ const toggleList = (listType) => ({ editor, state, tr, dispatch }) => {
9793
9793
  if (dispatch) dispatch(tr);
9794
9794
  return true;
9795
9795
  };
9796
- const decreaseListIndent = () => ({ editor, tr }) => {
9796
+ const LIST_NODE_NAMES = /* @__PURE__ */ new Set(["orderedList", "bulletList"]);
9797
+ const parseLevel = (value) => {
9798
+ if (typeof value === "number") return value;
9799
+ const parsed = parseInt(value, 10);
9800
+ return Number.isNaN(parsed) ? 0 : parsed;
9801
+ };
9802
+ const resolveParentList = ($pos) => {
9803
+ if (!$pos) return null;
9804
+ for (let depth = $pos.depth; depth >= 0; depth--) {
9805
+ const node = $pos.node(depth);
9806
+ if (node?.type && LIST_NODE_NAMES.has(node.type.name)) {
9807
+ return node;
9808
+ }
9809
+ }
9810
+ return null;
9811
+ };
9812
+ const collectTargetListItemPositions = (state, fallbackPos) => {
9813
+ const doc2 = state?.doc;
9814
+ const listItemType = state?.schema?.nodes?.listItem;
9815
+ if (!doc2 || !listItemType) {
9816
+ return typeof fallbackPos === "number" ? [fallbackPos] : [];
9817
+ }
9818
+ const candidates = [];
9819
+ const { from: from2, to } = state.selection;
9820
+ doc2.nodesBetween(from2, to, (node, pos) => {
9821
+ if (node.type === listItemType) {
9822
+ const size = typeof node.nodeSize === "number" ? node.nodeSize : 0;
9823
+ candidates.push({ node, pos, end: pos + size });
9824
+ }
9825
+ });
9826
+ if (!candidates.length && typeof fallbackPos === "number") {
9827
+ return [fallbackPos];
9828
+ }
9829
+ const filtered = candidates.filter(({ pos, end: end2 }) => {
9830
+ return !candidates.some((other) => other.pos > pos && other.pos < end2);
9831
+ });
9832
+ const sorted = filtered.map(({ pos }) => pos).sort((a, b) => a - b);
9833
+ return sorted.filter((pos, index2) => index2 === 0 || pos !== sorted[index2 - 1]);
9834
+ };
9835
+ const decreaseListIndent = (_targetPositions) => ({ editor, tr }) => {
9797
9836
  const { state } = editor;
9798
9837
  const currentItem = ListHelpers.getCurrentListItem && ListHelpers.getCurrentListItem(state) || findParentNode((n) => n.type && n.type.name === "listItem")(state.selection);
9799
- if (!currentItem) return false;
9800
- const parentOrdered = ListHelpers.getParentOrderedList && ListHelpers.getParentOrderedList(state);
9801
- const parentBullet = ListHelpers.getParentBulletList && ListHelpers.getParentBulletList(state);
9802
- const parentList = parentOrdered || parentBullet || findParentNode((n) => n.type && (n.type.name === "orderedList" || n.type.name === "bulletList"))(state.selection);
9803
- if (!parentList) return false;
9804
- const attrs = currentItem.node.attrs || {};
9805
- const currLevel = typeof attrs.level === "number" ? attrs.level : 0;
9806
- if (currLevel <= 0) return true;
9807
- const newLevel = currLevel - 1;
9808
- const parentNumId = parentList.node?.attrs?.listId ?? null;
9809
- let numId = parentNumId ?? attrs.numId ?? null;
9810
- let createdNewId = false;
9811
- if (numId == null && ListHelpers.getNewListId) {
9812
- numId = ListHelpers.getNewListId(editor);
9813
- createdNewId = true;
9814
- }
9815
- if (createdNewId && numId != null && ListHelpers.generateNewListDefinition) {
9816
- ListHelpers.generateNewListDefinition({
9817
- numId,
9818
- listType: parentList.node.type,
9819
- editor
9838
+ const parentOrderedHelper = ListHelpers.getParentOrderedList && ListHelpers.getParentOrderedList(state);
9839
+ const parentBulletHelper = ListHelpers.getParentBulletList && ListHelpers.getParentBulletList(state);
9840
+ const targetPositions = _targetPositions || collectTargetListItemPositions(state, currentItem?.pos);
9841
+ if (!targetPositions.length) return false;
9842
+ let parentListsMap = {};
9843
+ const mappedNodes = targetPositions.map((originalPos) => {
9844
+ const mappedPos = tr.mapping ? tr.mapping.map(originalPos) : originalPos;
9845
+ const node = tr.doc && tr.doc.nodeAt(mappedPos) || (currentItem && originalPos === currentItem.pos ? currentItem.node : null);
9846
+ return { originalPos, mappedPos, node };
9847
+ });
9848
+ const validNodes = mappedNodes.filter(({ node }) => node && node.type.name === "listItem");
9849
+ validNodes.forEach(({ mappedPos, node }) => {
9850
+ const attrs = node.attrs || {};
9851
+ const currLevel = parseLevel(attrs.level);
9852
+ if (currLevel <= 0) {
9853
+ return;
9854
+ }
9855
+ const newLevel = currLevel - 1;
9856
+ const $pos = tr.doc ? tr.doc.resolve(mappedPos) : null;
9857
+ const parentListNode = resolveParentList($pos) || parentOrderedHelper?.node || parentBulletHelper?.node || parentOrderedHelper || parentBulletHelper;
9858
+ parentListsMap[mappedPos] = parentListNode;
9859
+ if (!parentListNode) {
9860
+ return;
9861
+ }
9862
+ const fallbackListId = parentListNode.attrs?.listId ?? null;
9863
+ let numId = fallbackListId ?? attrs.numId ?? null;
9864
+ let createdNewId = false;
9865
+ if (numId == null && ListHelpers.getNewListId) {
9866
+ numId = ListHelpers.getNewListId(editor);
9867
+ createdNewId = numId != null;
9868
+ }
9869
+ if (createdNewId && numId != null && ListHelpers.generateNewListDefinition) {
9870
+ ListHelpers.generateNewListDefinition({
9871
+ numId,
9872
+ listType: parentListNode.type,
9873
+ editor
9874
+ });
9875
+ }
9876
+ tr.setNodeMarkup(mappedPos, null, {
9877
+ ...attrs,
9878
+ level: newLevel,
9879
+ numId
9820
9880
  });
9821
- }
9822
- tr.setNodeMarkup(currentItem.pos, null, {
9823
- ...attrs,
9824
- level: newLevel,
9825
- numId
9826
9881
  });
9827
- return true;
9882
+ return Object.values(parentListsMap).length ? !Object.values(parentListsMap).every((pos) => !pos) : true;
9828
9883
  };
9829
9884
  function isVisuallyEmptyParagraph(node) {
9830
9885
  if (!node || node.type.name !== "paragraph") return false;
@@ -10066,30 +10121,49 @@ const deleteListItem = () => (props) => {
10066
10121
  tr.setSelection(TextSelection.near($pos));
10067
10122
  return true;
10068
10123
  };
10069
- const increaseListIndent = () => ({ editor, tr }) => {
10124
+ const increaseListIndent = (_targetPositions) => ({ editor, tr }) => {
10070
10125
  const { state } = editor;
10071
10126
  const currentItem = ListHelpers.getCurrentListItem && ListHelpers.getCurrentListItem(state) || findParentNode((n) => n.type && n.type.name === "listItem")(state.selection);
10072
- if (!currentItem) return false;
10073
- const parentOrdered = ListHelpers.getParentOrderedList && ListHelpers.getParentOrderedList(state);
10074
- const parentBullet = ListHelpers.getParentBulletList && ListHelpers.getParentBulletList(state);
10075
- const parentList = parentOrdered || parentBullet || findParentNode((n) => n.type && (n.type.name === "orderedList" || n.type.name === "bulletList"))(state.selection);
10076
- if (!parentList) return false;
10077
- const currAttrs = currentItem.node.attrs || {};
10078
- const newLevel = (typeof currAttrs.level === "number" ? currAttrs.level : 0) + 1;
10079
- let numId = currAttrs.numId;
10080
- if (numId == null) {
10081
- numId = parentList.node?.attrs?.listId ?? ListHelpers.getNewListId(editor);
10082
- if (ListHelpers.generateNewListDefinition) {
10083
- const listType = parentList.node.type === editor.schema.nodes.orderedList ? editor.schema.nodes.orderedList : editor.schema.nodes.bulletList;
10084
- ListHelpers.generateNewListDefinition({ numId, listType, editor });
10085
- }
10086
- }
10087
- tr.setNodeMarkup(currentItem.pos, null, {
10088
- ...currAttrs,
10089
- level: newLevel,
10090
- numId
10127
+ const parentOrderedHelper = ListHelpers.getParentOrderedList && ListHelpers.getParentOrderedList(state);
10128
+ const parentBulletHelper = ListHelpers.getParentBulletList && ListHelpers.getParentBulletList(state);
10129
+ const targetPositions = _targetPositions || collectTargetListItemPositions(state, currentItem?.pos);
10130
+ if (!targetPositions.length) return false;
10131
+ let parentListsMap = {};
10132
+ const mappedNodes = targetPositions.map((originalPos) => {
10133
+ const mappedPos = tr.mapping ? tr.mapping.map(originalPos) : originalPos;
10134
+ const node = tr.doc && tr.doc.nodeAt(mappedPos) || (currentItem && originalPos === currentItem.pos ? currentItem.node : null);
10135
+ return { originalPos, mappedPos, node };
10091
10136
  });
10092
- return true;
10137
+ const validNodes = mappedNodes.filter(({ node }) => node && node.type.name === "listItem");
10138
+ validNodes.forEach(({ mappedPos, node }) => {
10139
+ const attrs = node.attrs || {};
10140
+ const currentLevel = parseLevel(attrs.level);
10141
+ const newLevel = currentLevel + 1;
10142
+ const $pos = tr.doc ? tr.doc.resolve(mappedPos) : null;
10143
+ const parentListNode = resolveParentList($pos) || parentOrderedHelper?.node || parentBulletHelper?.node || parentOrderedHelper || parentBulletHelper;
10144
+ parentListsMap[mappedPos] = parentListNode;
10145
+ if (!parentListNode) {
10146
+ return;
10147
+ }
10148
+ let numId = attrs.numId;
10149
+ if (numId == null) {
10150
+ const fallbackListId = parentListNode.attrs?.listId ?? null;
10151
+ numId = fallbackListId ?? (ListHelpers.getNewListId ? ListHelpers.getNewListId(editor) : null);
10152
+ if (numId != null && ListHelpers.generateNewListDefinition) {
10153
+ ListHelpers.generateNewListDefinition({
10154
+ numId,
10155
+ listType: parentListNode.type,
10156
+ editor
10157
+ });
10158
+ }
10159
+ }
10160
+ tr.setNodeMarkup(mappedPos, null, {
10161
+ ...attrs,
10162
+ level: newLevel,
10163
+ numId
10164
+ });
10165
+ });
10166
+ return Object.values(parentListsMap).length ? !Object.values(parentListsMap).every((pos) => !pos) : true;
10093
10167
  };
10094
10168
  const isList = (n) => !!n && (n.type?.name === "orderedList" || n.type?.name === "bulletList");
10095
10169
  const findNodePosition = (doc2, targetNode) => {
@@ -11332,10 +11406,12 @@ const getTrackChangesDecorations = (state, onlyOriginalShown, onlyModifiedShown)
11332
11406
  () => {
11333
11407
  const span = document.createElement("span");
11334
11408
  span.classList.add("track-delete-widget");
11335
- span.contentEditable = false;
11336
11409
  return span;
11337
11410
  },
11338
- { ignoreSelection: true }
11411
+ {
11412
+ ignoreSelection: true,
11413
+ key: "stable-key"
11414
+ }
11339
11415
  );
11340
11416
  decorations.push(decorationWidget);
11341
11417
  }
@@ -12521,7 +12597,8 @@ const removeMarkStep = ({ state, step, newTr, doc: doc2, user, date }) => {
12521
12597
  const trackedTransaction = ({ tr, state, user }) => {
12522
12598
  const onlyInputTypeMeta = ["inputType", "uiEvent", "paste", "pointer"];
12523
12599
  const notAllowedMeta = ["historyUndo", "historyRedo", "acceptReject"];
12524
- if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => onlyInputTypeMeta.includes(meta)) || notAllowedMeta.includes(tr.getMeta("inputType")) || tr.getMeta(CommentsPluginKey)) {
12600
+ const isProgrammaticInput = tr.getMeta("inputType") === "programmatic";
12601
+ if (!tr.steps.length || tr.meta && !Object.keys(tr.meta).every((meta) => onlyInputTypeMeta.includes(meta)) && !isProgrammaticInput || notAllowedMeta.includes(tr.getMeta("inputType")) || tr.getMeta(CommentsPluginKey)) {
12525
12602
  return tr;
12526
12603
  }
12527
12604
  const newTr = state.tr;
@@ -12569,10 +12646,13 @@ const trackedTransaction = ({ tr, state, user }) => {
12569
12646
  }
12570
12647
  });
12571
12648
  if (tr.getMeta("inputType")) {
12572
- newTr.setMeta(tr.getMeta("inputType"));
12649
+ newTr.setMeta("inputType", tr.getMeta("inputType"));
12573
12650
  }
12574
12651
  if (tr.getMeta("uiEvent")) {
12575
- newTr.setMeta(tr.getMeta("uiEvent"));
12652
+ newTr.setMeta("uiEvent", tr.getMeta("uiEvent"));
12653
+ }
12654
+ if (tr.getMeta("addToHistory") !== void 0) {
12655
+ newTr.setMeta("addToHistory", tr.getMeta("addToHistory"));
12576
12656
  }
12577
12657
  if (tr.selectionSet) {
12578
12658
  const deletionMarkSchema = state.schema.marks[TrackDeleteMarkName];
@@ -14477,8 +14557,9 @@ const _Editor = class _Editor extends EventEmitter {
14477
14557
  /**
14478
14558
  * Set the document mode
14479
14559
  * @param {string} documentMode - The document mode ('editing', 'viewing', 'suggesting')
14560
+ * @param {string} caller - Calling context
14480
14561
  */
14481
- setDocumentMode(documentMode) {
14562
+ setDocumentMode(documentMode, caller) {
14482
14563
  if (this.options.isHeaderOrFooter || this.options.isChildEditor) return;
14483
14564
  let cleanedMode = documentMode?.toLowerCase() || "editing";
14484
14565
  if (!this.extensionService || !this.state) return;
@@ -14489,32 +14570,32 @@ const _Editor = class _Editor extends EventEmitter {
14489
14570
  this.commands.toggleTrackChangesShowOriginal();
14490
14571
  this.setEditable(false, false);
14491
14572
  this.setOptions({ documentMode: "viewing" });
14492
- toggleHeaderFooterEditMode({
14493
- editor: this,
14494
- focusedSectionEditor: null,
14495
- isEditMode: false,
14496
- documentMode: cleanedMode
14497
- });
14573
+ if (caller !== "init")
14574
+ toggleHeaderFooterEditMode({
14575
+ editor: this,
14576
+ focusedSectionEditor: null,
14577
+ isEditMode: false,
14578
+ documentMode: cleanedMode
14579
+ });
14498
14580
  if (pm) pm.classList.add("view-mode");
14499
14581
  } else if (cleanedMode === "suggesting") {
14500
- __privateMethod(this, _Editor_instances, registerPluginByNameIfNotExists_fn).call(this, "TrackChangesBase");
14501
14582
  this.commands.disableTrackChangesShowOriginal();
14502
14583
  this.commands.enableTrackChanges();
14503
14584
  this.setOptions({ documentMode: "suggesting" });
14504
14585
  this.setEditable(true, false);
14505
14586
  if (pm) pm.classList.remove("view-mode");
14506
14587
  } else if (cleanedMode === "editing") {
14507
- __privateMethod(this, _Editor_instances, registerPluginByNameIfNotExists_fn).call(this, "TrackChangesBase");
14508
14588
  this.commands.disableTrackChangesShowOriginal();
14509
14589
  this.commands.disableTrackChanges();
14510
14590
  this.setEditable(true, false);
14511
14591
  this.setOptions({ documentMode: "editing" });
14512
- toggleHeaderFooterEditMode({
14513
- editor: this,
14514
- focusedSectionEditor: null,
14515
- isEditMode: false,
14516
- documentMode: cleanedMode
14517
- });
14592
+ if (caller !== "init")
14593
+ toggleHeaderFooterEditMode({
14594
+ editor: this,
14595
+ focusedSectionEditor: null,
14596
+ isEditMode: false,
14597
+ documentMode: cleanedMode
14598
+ });
14518
14599
  if (pm) pm.classList.remove("view-mode");
14519
14600
  }
14520
14601
  }
@@ -14909,6 +14990,31 @@ const _Editor = class _Editor extends EventEmitter {
14909
14990
  }
14910
14991
  return html;
14911
14992
  }
14993
+ /**
14994
+ * Get the editor content as Markdown
14995
+ * @returns {Promise<string>} Editor content as Markdown
14996
+ */
14997
+ async getMarkdown() {
14998
+ const [
14999
+ { unified },
15000
+ { default: rehypeParse },
15001
+ { default: rehypeRemark },
15002
+ { default: remarkStringify },
15003
+ { default: remarkGfm }
15004
+ ] = await Promise.all([
15005
+ import("./index-DL9bff78.js"),
15006
+ import("./index-DRCvimau.js"),
15007
+ import("./index-C_x_N6Uh.js"),
15008
+ import("./index-D_sWOSiG.js"),
15009
+ import("./index-CHAKf7mX.js")
15010
+ ]);
15011
+ const html = this.getHTML();
15012
+ const file = unified().use(rehypeParse, { fragment: true }).use(rehypeRemark).use(remarkGfm).use(remarkStringify, {
15013
+ bullet: "-",
15014
+ fences: true
15015
+ }).processSync(html);
15016
+ return String(file);
15017
+ }
14912
15018
  /**
14913
15019
  * Get the document version from the converter
14914
15020
  * @returns {string|null} The SuperDoc version stored in the document
@@ -15358,7 +15464,7 @@ init_fn = function() {
15358
15464
  if (shouldMigrateListsOnInit) {
15359
15465
  this.migrateListsToV2();
15360
15466
  }
15361
- this.setDocumentMode(this.options.documentMode);
15467
+ this.setDocumentMode(this.options.documentMode, "init");
15362
15468
  if (!this.options.ydoc) {
15363
15469
  if (!this.options.isChildEditor) {
15364
15470
  __privateMethod(this, _Editor_instances, initPagination_fn).call(this);
@@ -15457,17 +15563,6 @@ insertNewFileData_fn = function() {
15457
15563
  __privateMethod(this, _Editor_instances, initComments_fn).call(this);
15458
15564
  }, 50);
15459
15565
  };
15460
- /**
15461
- * Register a plugin by name if it doesn't already exist
15462
- * @param {string} name - Plugin name
15463
- * @returns {string|void}
15464
- */
15465
- registerPluginByNameIfNotExists_fn = function(name) {
15466
- const plugin = this.extensionService?.plugins.find((p) => p.key.startsWith(name));
15467
- const hasPlugin = this.state?.plugins?.find((p) => p.key.startsWith(name));
15468
- if (plugin && !hasPlugin) this.registerPlugin(plugin);
15469
- return plugin?.key;
15470
- };
15471
15566
  /**
15472
15567
  * Creates extension service.
15473
15568
  * @returns {void}
@@ -20167,7 +20262,8 @@ function orderedListSync(editor) {
20167
20262
  const updateNodeViews = transactions.some((tr2) => tr2.getMeta("updatedListItemNodeViews"));
20168
20263
  if (updateNodeViews || !hasInitialized) refreshAllListItemNodeViews();
20169
20264
  const isFromPlugin = transactions.some((tr2) => tr2.getMeta("orderedListSync"));
20170
- if (isFromPlugin || !transactions.some((tr2) => tr2.docChanged)) {
20265
+ const docChanged = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
20266
+ if (isFromPlugin || !docChanged) {
20171
20267
  return null;
20172
20268
  }
20173
20269
  hasInitialized = true;
@@ -26819,6 +26915,7 @@ const ImageRegistrationPlugin = ({ editor }) => {
26819
26915
  },
26820
26916
  appendTransaction: (trs, _oldState, state) => {
26821
26917
  let foundImages = [];
26918
+ if (!trs.some((tr) => tr.docChanged)) return null;
26822
26919
  trs.forEach((tr) => {
26823
26920
  if (tr.docChanged) {
26824
26921
  tr.steps.forEach((step, index2) => {
@@ -27162,7 +27259,7 @@ const Image = Node$1.create({
27162
27259
  return {
27163
27260
  allowBase64: true,
27164
27261
  htmlAttributes: {
27165
- style: "display: inline-block; content-visibility: auto; contain-intrinsic-size: auto 600px;",
27262
+ style: "display: inline-block;",
27166
27263
  "aria-label": "Image node"
27167
27264
  }
27168
27265
  };
@@ -31944,7 +32041,7 @@ const TrackChanges = Extension.create({
31944
32041
  const trackedChanges = collectTrackedChanges({ state, from: from2, to });
31945
32042
  if (!isTrackedChangeActionAllowed({ editor, action: "accept", trackedChanges })) return false;
31946
32043
  let { tr, doc: doc2 } = state;
31947
- tr.setMeta("acceptReject", true);
32044
+ tr.setMeta("inputType", "acceptReject");
31948
32045
  const map2 = new Mapping();
31949
32046
  doc2.nodesBetween(from2, to, (node, pos) => {
31950
32047
  if (node.marks && node.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
@@ -31984,7 +32081,7 @@ const TrackChanges = Extension.create({
31984
32081
  const trackedChanges = collectTrackedChanges({ state, from: from2, to });
31985
32082
  if (!isTrackedChangeActionAllowed({ editor, action: "reject", trackedChanges })) return false;
31986
32083
  const { tr, doc: doc2 } = state;
31987
- tr.setMeta("acceptReject", true);
32084
+ tr.setMeta("inputType", "acceptReject");
31988
32085
  const map2 = new Mapping();
31989
32086
  doc2.nodesBetween(from2, to, (node, pos) => {
31990
32087
  if (node.marks && node.marks.find((mark) => mark.type.name === TrackDeleteMarkName)) {
@@ -37746,26 +37843,27 @@ export {
37746
37843
  _export_sfc as _,
37747
37844
  getQuickFormatList as a,
37748
37845
  generateLinkedStyleString as b,
37749
- getFileOpener as c,
37750
- checkAndProcessImage as d,
37751
- uploadAndInsertImage as e,
37752
- collectTrackedChanges as f,
37846
+ collectTargetListItemPositions as c,
37847
+ getFileOpener as d,
37848
+ checkAndProcessImage as e,
37849
+ uploadAndInsertImage as f,
37753
37850
  global as g,
37754
- undoDepth as h,
37851
+ collectTrackedChanges as h,
37755
37852
  isTrackedChangeActionAllowed as i,
37756
- redoDepth as j,
37757
- collectTrackedChangesForContext as k,
37758
- getStarterExtensions as l,
37759
- getRichTextExtensions as m,
37760
- Decoration as n,
37761
- Extension as o,
37762
- index$1 as p,
37763
- index as q,
37853
+ undoDepth as j,
37854
+ redoDepth as k,
37855
+ collectTrackedChangesForContext as l,
37856
+ getStarterExtensions as m,
37857
+ getRichTextExtensions as n,
37858
+ Decoration as o,
37859
+ Extension as p,
37860
+ index$1 as q,
37764
37861
  replaceSelectionWithImagePlaceholder as r,
37765
37862
  shouldBypassContextMenu as s,
37766
- AnnotatorHelpers as t,
37863
+ index as t,
37767
37864
  useHighContrastMode as u,
37768
- SectionHelpers as v,
37769
- getAllowedImageDimensions as w,
37865
+ AnnotatorHelpers as v,
37866
+ SectionHelpers as w,
37867
+ getAllowedImageDimensions as x,
37770
37868
  yUndoPluginKey as y
37771
37869
  };