@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.
- package/dist/chunks/{PdfViewer-9z5hlRyt.es.js → PdfViewer-CLpN99Rl.es.js} +1 -1
- package/dist/chunks/{PdfViewer-Jb55JUCS.cjs → PdfViewer-CvsrAT4c.cjs} +1 -1
- package/dist/chunks/default-BS6z0SoE-BS6z0SoE.es.js +5 -0
- package/dist/chunks/default-BS6z0SoE-Gl4f7Y7J.cjs +4 -0
- package/dist/chunks/index-CHAKf7mX-C5aFF6Zl.es.js +2213 -0
- package/dist/chunks/index-CHAKf7mX-Dx-DOGGJ.cjs +2213 -0
- package/dist/chunks/{index-DqP-8_tO.es.js → index-CNPV5EVY.es.js} +2 -2
- package/dist/chunks/index-CSaZZzfe-BzemjgYL.cjs +264 -0
- package/dist/chunks/index-CSaZZzfe-CSaZZzfe.es.js +265 -0
- package/dist/chunks/index-C_x_N6Uh-DJn8hIEt.es.js +2200 -0
- package/dist/chunks/index-C_x_N6Uh-Db3CUJMX.cjs +2200 -0
- package/dist/chunks/index-Cd3D_8gF-CFhMnajQ.es.js +862 -0
- package/dist/chunks/index-Cd3D_8gF-DKJ_wTu_.cjs +861 -0
- package/dist/chunks/index-CvBqQJbG-CvBqQJbG.es.js +878 -0
- package/dist/chunks/index-CvBqQJbG-Dwm0THD7.cjs +877 -0
- package/dist/chunks/index-DL9bff78-8izww2lB.es.js +845 -0
- package/dist/chunks/index-DL9bff78-Cf4UBVvQ.cjs +845 -0
- package/dist/chunks/index-DRCvimau-Cw339678.es.js +9876 -0
- package/dist/chunks/index-DRCvimau-H4Ck3S9a.cjs +9876 -0
- package/dist/chunks/index-D_sWOSiG-BtDZzJ6I.cjs +588 -0
- package/dist/chunks/index-D_sWOSiG-DE96TaT5.es.js +588 -0
- package/dist/chunks/{index-D0UvyM8m.cjs → index-sLveeSfi.cjs} +2 -2
- package/dist/chunks/{super-editor.es-BBJIKdhr.es.js → super-editor.es-0SXIzzbj.es.js} +1846 -1655
- package/dist/chunks/{super-editor.es-Ca5D3ZTW.cjs → super-editor.es-Dy32MdYk.cjs} +1845 -1654
- package/dist/core/types/index.d.ts +2 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/images/altText_add.svg +3 -0
- package/dist/images/altText_disclaimer.svg +3 -0
- package/dist/images/altText_done.svg +3 -0
- package/dist/images/altText_spinner.svg +30 -0
- package/dist/images/altText_warning.svg +3 -0
- package/dist/images/annotation-check.svg +11 -0
- package/dist/images/annotation-comment.svg +16 -0
- package/dist/images/annotation-help.svg +26 -0
- package/dist/images/annotation-insert.svg +10 -0
- package/dist/images/annotation-key.svg +11 -0
- package/dist/images/annotation-newparagraph.svg +11 -0
- package/dist/images/annotation-noicon.svg +7 -0
- package/dist/images/annotation-note.svg +42 -0
- package/dist/images/annotation-paperclip.svg +6 -0
- package/dist/images/annotation-paragraph.svg +16 -0
- package/dist/images/annotation-pushpin.svg +7 -0
- package/dist/images/cursor-editorFreeHighlight.svg +6 -0
- package/dist/images/cursor-editorFreeText.svg +3 -0
- package/dist/images/cursor-editorInk.svg +4 -0
- package/dist/images/cursor-editorTextHighlight.svg +8 -0
- package/dist/images/editor-toolbar-delete.svg +5 -0
- package/dist/images/loading-icon.gif +0 -0
- package/dist/images/messageBar_closingButton.svg +3 -0
- package/dist/images/messageBar_warning.svg +3 -0
- package/dist/images/toolbarButton-editorHighlight.svg +6 -0
- package/dist/images/toolbarButton-menuArrow.svg +3 -0
- package/dist/stores/comments-store.d.ts +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-AR-76siZ.js → converter-DMwo26F4.js} +1299 -1211
- package/dist/super-editor/chunks/default-BS6z0SoE.js +5 -0
- package/dist/super-editor/chunks/{docx-zipper-DVb-VGgt.js → docx-zipper-CuoYR_fZ.js} +1 -1
- package/dist/super-editor/chunks/{editor-mK_uimq6.js → editor-BQ9mPcm5.js} +202 -104
- package/dist/super-editor/chunks/index-CHAKf7mX.js +2213 -0
- package/dist/super-editor/chunks/index-CSaZZzfe.js +265 -0
- package/dist/super-editor/chunks/index-C_x_N6Uh.js +2200 -0
- package/dist/super-editor/chunks/index-Cd3D_8gF.js +862 -0
- package/dist/super-editor/chunks/index-CvBqQJbG.js +878 -0
- package/dist/super-editor/chunks/index-DL9bff78.js +845 -0
- package/dist/super-editor/chunks/index-DRCvimau.js +9876 -0
- package/dist/super-editor/chunks/index-D_sWOSiG.js +588 -0
- package/dist/super-editor/chunks/{toolbar-ByoNwr7x.js → toolbar-D59d-aMm.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor/src/core/Editor.d.ts +7 -1
- package/dist/super-editor/super-editor/src/core/commands/decreaseListIndent.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/commands/increaseListIndent.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/commands/list-helpers/list-indent-helpers.d.ts +3 -0
- package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/types/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-structured-content.d.ts +2 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/t/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/t/t-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-block.d.ts +8 -6
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content.d.ts +8 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentBlockTags.d.ts +11 -4
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentInlineTags.d.ts +11 -4
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTablesById.d.ts +8 -4
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTags.d.ts +11 -4
- package/dist/super-editor/super-editor/src/extensions/structured-content/structuredContentHelpers/getStructuredContentTagsById.d.ts +12 -5
- package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts +2 -1
- package/dist/super-editor/super-editor.es.js +22 -22
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist/superdoc.umd.js +26057 -8172
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-
|
|
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,
|
|
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-
|
|
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-
|
|
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
|
|
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
|
-
|
|
9800
|
-
const
|
|
9801
|
-
const
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
const
|
|
9805
|
-
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9811
|
-
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
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
|
-
|
|
10073
|
-
const
|
|
10074
|
-
const
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
const
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
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
|
-
|
|
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
|
-
{
|
|
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
|
-
|
|
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
|
-
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
|
|
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
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
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
|
-
|
|
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;
|
|
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("
|
|
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("
|
|
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
|
-
|
|
37750
|
-
|
|
37751
|
-
|
|
37752
|
-
|
|
37846
|
+
collectTargetListItemPositions as c,
|
|
37847
|
+
getFileOpener as d,
|
|
37848
|
+
checkAndProcessImage as e,
|
|
37849
|
+
uploadAndInsertImage as f,
|
|
37753
37850
|
global as g,
|
|
37754
|
-
|
|
37851
|
+
collectTrackedChanges as h,
|
|
37755
37852
|
isTrackedChangeActionAllowed as i,
|
|
37756
|
-
|
|
37757
|
-
|
|
37758
|
-
|
|
37759
|
-
|
|
37760
|
-
|
|
37761
|
-
|
|
37762
|
-
|
|
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
|
-
|
|
37863
|
+
index as t,
|
|
37767
37864
|
useHighContrastMode as u,
|
|
37768
|
-
|
|
37769
|
-
|
|
37865
|
+
AnnotatorHelpers as v,
|
|
37866
|
+
SectionHelpers as w,
|
|
37867
|
+
getAllowedImageDimensions as x,
|
|
37770
37868
|
yUndoPluginKey as y
|
|
37771
37869
|
};
|