superdoc 0.31.0-next.1 → 0.31.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{PdfViewer-CSZtzevK.cjs → PdfViewer-DoOKSkNf.cjs} +1 -1
- package/dist/chunks/{PdfViewer-DYfpBL2P.es.js → PdfViewer-UMfEMyPR.es.js} +1 -1
- package/dist/chunks/{index-0zP7LFOd-CQ5IRTwG.es.js → index-B74saKaW-CeHVjvs8.es.js} +1 -1
- package/dist/chunks/{index-0zP7LFOd-PDPveafF.cjs → index-B74saKaW-nw0M-3t9.cjs} +1 -1
- package/dist/chunks/{index-9j37gBmK.cjs → index-CjrYy0l4.cjs} +3 -3
- package/dist/chunks/{index-BiYSI2c3.es.js → index-D78pvKjo.es.js} +3 -3
- package/dist/chunks/{super-editor.es-BzhuUuJx.es.js → super-editor.es-CQFVPho1.es.js} +199 -255
- package/dist/chunks/{super-editor.es-D8j9E-4h.cjs → super-editor.es-DTqtLZgT.cjs} +199 -255
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts +132 -52
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/types/index.d.ts +132 -52
- package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-B3mE6WPB.js → converter-BdxQSBuI.js} +10 -7
- package/dist/super-editor/chunks/{docx-zipper-FgUekv4g.js → docx-zipper-CeENQy4K.js} +1 -1
- package/dist/super-editor/chunks/{editor-B0PiO07g.js → editor-fHPBoGEW.js} +203 -326
- package/dist/super-editor/chunks/{index-0zP7LFOd.js → index-B74saKaW.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-Bj9E8rmT.js → toolbar-DVn2P_6q.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/Attribute.d.ts +75 -29
- package/dist/super-editor/super-editor/src/core/Attribute.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/CommandService.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/CommandService.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/Editor.d.ts +136 -673
- package/dist/super-editor/super-editor/src/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/EventEmitter.d.ts +23 -14
- package/dist/super-editor/super-editor/src/core/EventEmitter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/Extension.d.ts +25 -11
- package/dist/super-editor/super-editor/src/core/Extension.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/ExtensionService.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/ExtensionService.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/Mark.d.ts +28 -12
- package/dist/super-editor/super-editor/src/core/Mark.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/Node.d.ts +87 -25
- package/dist/super-editor/super-editor/src/core/Node.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/OxmlNode.d.ts +20 -13
- package/dist/super-editor/super-editor/src/core/OxmlNode.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/commands/types/index.d.ts +11 -89
- package/dist/super-editor/super-editor/src/core/commands/types/index.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/extensions/commands.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/extensions/commands.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/extensions/editable.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/extensions/editable.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/extensions/editorFocus.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/extensions/editorFocus.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/extensions/keymap.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/extensions/keymap.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/helpers/annotator.d.ts +3 -2
- package/dist/super-editor/super-editor/src/core/helpers/annotator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/helpers/getExtensionConfigField.d.ts +12 -5
- package/dist/super-editor/super-editor/src/core/helpers/getExtensionConfigField.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/helpers/isList.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/helpers/isList.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/helpers/list-numbering-helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/index.d.ts +18 -13
- package/dist/super-editor/super-editor/src/core/index.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/types/ChainedCommands.d.ts +118 -0
- package/dist/super-editor/super-editor/src/core/types/ChainedCommands.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/types/EditorConfig.d.ts +265 -0
- package/dist/super-editor/super-editor/src/core/types/EditorConfig.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/types/EditorEvents.d.ts +144 -0
- package/dist/super-editor/super-editor/src/core/types/EditorEvents.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/types/EditorTypes.d.ts +73 -0
- package/dist/super-editor/super-editor/src/core/types/EditorTypes.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/types/__tests__/command-types.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/types/__tests__/command-types.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/utilities/callOrGet.d.ts +6 -2
- package/dist/super-editor/super-editor/src/core/utilities/callOrGet.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/utilities/isIOS.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/ai/ai-marks.d.ts +8 -2
- package/dist/super-editor/super-editor/src/extensions/ai/ai-marks.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/ai/ai-nodes.d.ts +7 -1
- package/dist/super-editor/super-editor/src/extensions/ai/ai-nodes.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/ai/ai-plugin.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/ai/ai-plugin.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/block-node/block-node.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/block-node/block-node.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/bold/bold.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/bold/bold.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-end.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-end.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-start.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/bookmarks/bookmark-start.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/collaboration/collaboration.d.ts +6 -1
- package/dist/super-editor/super-editor/src/extensions/collaboration/collaboration.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/collaboration-cursor/collaboration-cursor.d.ts +9 -1
- package/dist/super-editor/super-editor/src/extensions/collaboration-cursor/collaboration-cursor.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/color/color.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/color/color.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/comment/comment.d.ts +18 -3
- package/dist/super-editor/super-editor/src/extensions/comment/comment.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/comment/comments-marks.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/comment/comments-marks.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/comment/comments-plugin.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/comment/comments-plugin.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/content-block/content-block.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/content-block/content-block.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/custom-selection/custom-selection.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/custom-selection/custom-selection.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/document/document.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/document/document.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/dropcursor/dropcursor.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/dropcursor/dropcursor.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/field-annotation/field-annotation.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/field-annotation/field-annotation.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/font-family/font-family.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/font-family/font-family.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/font-size/font-size.d.ts +9 -1
- package/dist/super-editor/super-editor/src/extensions/font-size/font-size.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/format-commands/format-commands.d.ts +7 -1
- package/dist/super-editor/super-editor/src/extensions/format-commands/format-commands.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/gapcursor/gapcursor.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/gapcursor/gapcursor.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/heading/heading.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/heading/heading.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/highlight/highlight.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/highlight/highlight.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/history/history.d.ts +4 -1
- package/dist/super-editor/super-editor/src/extensions/history/history.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/image/image.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/image/image.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/index.d.ts +22 -2
- package/dist/super-editor/super-editor/src/extensions/index.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/italic/italic.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/italic/italic.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/line-break/line-break.d.ts +2 -2
- package/dist/super-editor/super-editor/src/extensions/line-break/line-break.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/line-height/line-height.d.ts +6 -1
- package/dist/super-editor/super-editor/src/extensions/line-height/line-height.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/link/link.d.ts +9 -1
- package/dist/super-editor/super-editor/src/extensions/link/link.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/linked-styles/linked-styles.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/linked-styles/linked-styles.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/mention/mention.d.ts +6 -1
- package/dist/super-editor/super-editor/src/extensions/mention/mention.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/noderesizer/noderesizer.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/noderesizer/noderesizer.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/page-number/page-number.d.ts +2 -2
- package/dist/super-editor/super-editor/src/extensions/page-number/page-number.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/page-reference/page-reference.d.ts +8 -1
- package/dist/super-editor/super-editor/src/extensions/page-reference/page-reference.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/pagination/pagination.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/pagination/pagination.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/placeholder/placeholder.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/placeholder/placeholder.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/popover-plugin/popover-plugin.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/popover-plugin/popover-plugin.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/run/run.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/run/run.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/search/search.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/search/search.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/shape-container/shape-container.d.ts +6 -1
- package/dist/super-editor/super-editor/src/extensions/shape-container/shape-container.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/shape-group/shape-group.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/shape-textbox/shape-textbox.d.ts +6 -1
- package/dist/super-editor/super-editor/src/extensions/shape-textbox/shape-textbox.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/slash-menu/slash-menu.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/slash-menu/slash-menu.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/strike/strike.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/strike/strike.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/document-part-object.d.ts +6 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/document-part-object.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/document-section.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/document-section.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-block.d.ts +6 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-block.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content-commands.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content.d.ts +6 -1
- package/dist/super-editor/super-editor/src/extensions/structured-content/structured-content.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/tab/tab.d.ts +6 -1
- package/dist/super-editor/super-editor/src/extensions/tab/tab.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/table/table.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/table/table.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/table-cell/table-cell.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/table-header/table-header.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/table-header/table-header.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts +6 -1
- package/dist/super-editor/super-editor/src/extensions/table-of-contents/table-of-contents.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/table-row/table-row.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/table-row/table-row.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/text/text.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/text/text.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/text-align/text-align.d.ts +4 -1
- package/dist/super-editor/super-editor/src/extensions/text-align/text-align.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/text-indent/text-indent.d.ts +7 -1
- package/dist/super-editor/super-editor/src/extensions/text-indent/text-indent.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/text-style/text-style.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/text-style/text-style.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/text-transform/text-transform.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/text-transform/text-transform.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts +132 -52
- package/dist/super-editor/super-editor/src/extensions/track-changes/permission-helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/track-changes.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/track-changes.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/track-delete.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/track-delete.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/track-format.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/track-format.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/track-insert.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/track-insert.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/trackChangesHelpers/trackedTransaction.d.ts +5 -1
- package/dist/super-editor/super-editor/src/extensions/track-changes/trackChangesHelpers/trackedTransaction.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/types/formatting-commands.d.ts +40 -0
- package/dist/super-editor/super-editor/src/extensions/types/formatting-commands.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/types/history-link-table-commands.d.ts +57 -0
- package/dist/super-editor/super-editor/src/extensions/types/history-link-table-commands.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/types/specialized-commands.d.ts +83 -0
- package/dist/super-editor/super-editor/src/extensions/types/specialized-commands.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/underline/underline.d.ts +3 -1
- package/dist/super-editor/super-editor/src/extensions/underline/underline.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/vector-shape/vector-shape.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/vector-shape/vector-shape.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/tests/export/export-helpers/export-helpers.d.ts +1 -1
- package/dist/super-editor/super-editor/src/tests/export/export-helpers/export-helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- 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 +201 -257
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -11703,8 +11703,9 @@ var bufferCrc32 = crc32;
|
|
|
11703
11703
|
const index$2 = /* @__PURE__ */ getDefaultExportFromCjs(bufferCrc32);
|
|
11704
11704
|
function callOrGet(value, context = null, ...props) {
|
|
11705
11705
|
if (typeof value === "function") {
|
|
11706
|
-
|
|
11707
|
-
return
|
|
11706
|
+
const fn2 = value;
|
|
11707
|
+
if (context) return fn2.bind(context)(...props);
|
|
11708
|
+
return fn2(...props);
|
|
11708
11709
|
}
|
|
11709
11710
|
return value;
|
|
11710
11711
|
}
|
|
@@ -11715,6 +11716,7 @@ const isMacOS = () => {
|
|
|
11715
11716
|
return typeof navigator !== "undefined" ? /Mac/.test(navigator.platform) : false;
|
|
11716
11717
|
};
|
|
11717
11718
|
const isIOS = () => {
|
|
11719
|
+
if (typeof navigator === "undefined") return false;
|
|
11718
11720
|
return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(
|
|
11719
11721
|
navigator.platform
|
|
11720
11722
|
);
|
|
@@ -25135,11 +25137,12 @@ function createDocument(converter, schema, editor, { check = false } = {}) {
|
|
|
25135
25137
|
return schema.topNodeType.createAndFill();
|
|
25136
25138
|
}
|
|
25137
25139
|
function getExtensionConfigField(extension, field, context = {}) {
|
|
25138
|
-
|
|
25139
|
-
|
|
25140
|
-
|
|
25140
|
+
const fieldValue = extension.config[field];
|
|
25141
|
+
if (typeof fieldValue === "function") {
|
|
25142
|
+
const boundValue = fieldValue.bind({ ...context });
|
|
25143
|
+
return boundValue;
|
|
25141
25144
|
}
|
|
25142
|
-
return
|
|
25145
|
+
return fieldValue;
|
|
25143
25146
|
}
|
|
25144
25147
|
function getSchemaTypeByName(name, schema) {
|
|
25145
25148
|
return schema.nodes[name] || schema.marks[name] || null;
|
|
@@ -35264,7 +35267,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
35264
35267
|
static getStoredSuperdocVersion(docx) {
|
|
35265
35268
|
return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
35266
35269
|
}
|
|
35267
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.
|
|
35270
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.31.0-next.3") {
|
|
35268
35271
|
return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
|
|
35269
35272
|
}
|
|
35270
35273
|
/**
|
|
@@ -38463,7 +38466,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
38463
38466
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
38464
38467
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
38465
38468
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
38466
|
-
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, _ParagraphNodeView_instances, updateHTMLAttributes_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
38469
|
+
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, getPluginKeyName_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, _ParagraphNodeView_instances, updateHTMLAttributes_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
38467
38470
|
var GOOD_LEAF_SIZE = 200;
|
|
38468
38471
|
var RopeSequence = function RopeSequence2() {
|
|
38469
38472
|
};
|
|
@@ -46095,15 +46098,10 @@ const yUndoPlugin = ({ protectedNodes = defaultProtectedNodes, trackedOrigins =
|
|
|
46095
46098
|
});
|
|
46096
46099
|
class Extension {
|
|
46097
46100
|
constructor(config2) {
|
|
46098
|
-
|
|
46099
|
-
|
|
46100
|
-
__publicField$1(this, "options");
|
|
46101
|
-
__publicField$1(this, "storage");
|
|
46102
|
-
__publicField$1(this, "config", {
|
|
46103
|
-
name: this.name
|
|
46104
|
-
});
|
|
46101
|
+
this.type = "extension";
|
|
46102
|
+
this.name = "extension";
|
|
46105
46103
|
this.config = {
|
|
46106
|
-
|
|
46104
|
+
name: this.name,
|
|
46107
46105
|
...config2
|
|
46108
46106
|
};
|
|
46109
46107
|
this.name = this.config.name;
|
|
@@ -46112,7 +46110,9 @@ class Extension {
|
|
|
46112
46110
|
getExtensionConfigField(this, "addOptions", {
|
|
46113
46111
|
name: this.name
|
|
46114
46112
|
})
|
|
46115
|
-
);
|
|
46113
|
+
) || {};
|
|
46114
|
+
} else {
|
|
46115
|
+
this.options = {};
|
|
46116
46116
|
}
|
|
46117
46117
|
this.storage = callOrGet(
|
|
46118
46118
|
getExtensionConfigField(this, "addStorage", {
|
|
@@ -46123,10 +46123,10 @@ class Extension {
|
|
|
46123
46123
|
}
|
|
46124
46124
|
/**
|
|
46125
46125
|
* Static method for creating an extension.
|
|
46126
|
-
* @param
|
|
46126
|
+
* @param config Configuration for the extension.
|
|
46127
46127
|
*/
|
|
46128
|
-
static create(
|
|
46129
|
-
return new Extension(
|
|
46128
|
+
static create(config2) {
|
|
46129
|
+
return new Extension(config2);
|
|
46130
46130
|
}
|
|
46131
46131
|
}
|
|
46132
46132
|
const History = Extension.create({
|
|
@@ -46193,22 +46193,11 @@ const createUndoPlugin = () => {
|
|
|
46193
46193
|
return yUndoPluginInstance;
|
|
46194
46194
|
};
|
|
46195
46195
|
let Node$1 = class Node22 {
|
|
46196
|
-
/**
|
|
46197
|
-
* @param {import('./types/index.js').EditorNodeConfig} config
|
|
46198
|
-
*/
|
|
46199
46196
|
constructor(config2) {
|
|
46200
|
-
|
|
46201
|
-
|
|
46202
|
-
__publicField$1(this, "options");
|
|
46203
|
-
__publicField$1(this, "group");
|
|
46204
|
-
__publicField$1(this, "atom");
|
|
46205
|
-
__publicField$1(this, "editor");
|
|
46206
|
-
__publicField$1(this, "storage");
|
|
46207
|
-
__publicField$1(this, "config", {
|
|
46208
|
-
name: this.name
|
|
46209
|
-
});
|
|
46197
|
+
this.type = "node";
|
|
46198
|
+
this.name = "node";
|
|
46210
46199
|
this.config = {
|
|
46211
|
-
|
|
46200
|
+
name: this.name,
|
|
46212
46201
|
...config2
|
|
46213
46202
|
};
|
|
46214
46203
|
this.name = this.config.name;
|
|
@@ -46218,7 +46207,9 @@ let Node$1 = class Node22 {
|
|
|
46218
46207
|
getExtensionConfigField(this, "addOptions", {
|
|
46219
46208
|
name: this.name
|
|
46220
46209
|
})
|
|
46221
|
-
);
|
|
46210
|
+
) || {};
|
|
46211
|
+
} else {
|
|
46212
|
+
this.options = {};
|
|
46222
46213
|
}
|
|
46223
46214
|
this.storage = callOrGet(
|
|
46224
46215
|
getExtensionConfigField(this, "addStorage", {
|
|
@@ -46229,9 +46220,8 @@ let Node$1 = class Node22 {
|
|
|
46229
46220
|
}
|
|
46230
46221
|
/**
|
|
46231
46222
|
* Factory method to construct a new Node extension.
|
|
46232
|
-
*
|
|
46233
|
-
* @
|
|
46234
|
-
* @returns {Node} A new Node instance.
|
|
46223
|
+
* @param config - The node configuration.
|
|
46224
|
+
* @returns A new Node instance.
|
|
46235
46225
|
*/
|
|
46236
46226
|
static create(config2) {
|
|
46237
46227
|
return new Node22(config2);
|
|
@@ -46239,16 +46229,10 @@ let Node$1 = class Node22 {
|
|
|
46239
46229
|
};
|
|
46240
46230
|
class Mark2 {
|
|
46241
46231
|
constructor(config2) {
|
|
46242
|
-
|
|
46243
|
-
|
|
46244
|
-
__publicField$1(this, "options");
|
|
46245
|
-
__publicField$1(this, "storage");
|
|
46246
|
-
__publicField$1(this, "isExternal");
|
|
46247
|
-
__publicField$1(this, "config", {
|
|
46248
|
-
name: this.name
|
|
46249
|
-
});
|
|
46232
|
+
this.type = "mark";
|
|
46233
|
+
this.name = "mark";
|
|
46250
46234
|
this.config = {
|
|
46251
|
-
|
|
46235
|
+
name: this.name,
|
|
46252
46236
|
...config2
|
|
46253
46237
|
};
|
|
46254
46238
|
this.name = this.config.name;
|
|
@@ -46258,7 +46242,9 @@ class Mark2 {
|
|
|
46258
46242
|
getExtensionConfigField(this, "addOptions", {
|
|
46259
46243
|
name: this.name
|
|
46260
46244
|
})
|
|
46261
|
-
);
|
|
46245
|
+
) || {};
|
|
46246
|
+
} else {
|
|
46247
|
+
this.options = {};
|
|
46262
46248
|
}
|
|
46263
46249
|
this.storage = callOrGet(
|
|
46264
46250
|
getExtensionConfigField(this, "addStorage", {
|
|
@@ -46269,10 +46255,10 @@ class Mark2 {
|
|
|
46269
46255
|
}
|
|
46270
46256
|
/**
|
|
46271
46257
|
* Static method for creating Mark extension.
|
|
46272
|
-
* @param
|
|
46258
|
+
* @param config Configuration for the mark.
|
|
46273
46259
|
*/
|
|
46274
|
-
static create(
|
|
46275
|
-
return new Mark2(
|
|
46260
|
+
static create(config2) {
|
|
46261
|
+
return new Mark2(config2);
|
|
46276
46262
|
}
|
|
46277
46263
|
}
|
|
46278
46264
|
class Attribute2 {
|
|
@@ -46364,8 +46350,10 @@ class Attribute2 {
|
|
|
46364
46350
|
continue;
|
|
46365
46351
|
}
|
|
46366
46352
|
if (key2 === "class") {
|
|
46367
|
-
const
|
|
46368
|
-
const
|
|
46353
|
+
const valueStr = typeof value === "string" ? value : String(value);
|
|
46354
|
+
const existingStr = typeof mergedAttributes[key2] === "string" ? mergedAttributes[key2] : String(mergedAttributes[key2] || "");
|
|
46355
|
+
const valueClasses = valueStr ? valueStr.split(" ") : [];
|
|
46356
|
+
const existingClasses = existingStr ? existingStr.split(" ") : [];
|
|
46369
46357
|
const insertClasses = valueClasses.filter((value2) => !existingClasses.includes(value2));
|
|
46370
46358
|
mergedAttributes[key2] = [...existingClasses, ...insertClasses].join(" ");
|
|
46371
46359
|
} else if (key2 === "style") {
|
|
@@ -46469,7 +46457,11 @@ getGlobalAttributes_fn = function(extensions, defaultAttribute) {
|
|
|
46469
46457
|
options: extension.options,
|
|
46470
46458
|
storage: extension.storage
|
|
46471
46459
|
};
|
|
46472
|
-
const addGlobalAttributes = getExtensionConfigField(
|
|
46460
|
+
const addGlobalAttributes = getExtensionConfigField(
|
|
46461
|
+
extension,
|
|
46462
|
+
"addGlobalAttributes",
|
|
46463
|
+
context
|
|
46464
|
+
);
|
|
46473
46465
|
if (!addGlobalAttributes) continue;
|
|
46474
46466
|
const globalAttributes = addGlobalAttributes();
|
|
46475
46467
|
for (const globalAttr of globalAttributes) {
|
|
@@ -46489,7 +46481,11 @@ getNodeAndMarksAttributes_fn = function(extensions, defaultAttribute) {
|
|
|
46489
46481
|
options: extension.options,
|
|
46490
46482
|
storage: extension.storage
|
|
46491
46483
|
};
|
|
46492
|
-
const addAttributes = getExtensionConfigField(
|
|
46484
|
+
const addAttributes = getExtensionConfigField(
|
|
46485
|
+
extension,
|
|
46486
|
+
"addAttributes",
|
|
46487
|
+
context
|
|
46488
|
+
);
|
|
46493
46489
|
if (!addAttributes) continue;
|
|
46494
46490
|
const attributes = addAttributes();
|
|
46495
46491
|
for (const [name, attribute] of Object.entries(attributes)) {
|
|
@@ -46634,19 +46630,14 @@ createMarksSchema_fn = function(markExtensions, attributes, editor) {
|
|
|
46634
46630
|
__privateAdd$1(_Schema, _Schema_static);
|
|
46635
46631
|
let Schema2 = _Schema;
|
|
46636
46632
|
class OxmlNode extends Node$1 {
|
|
46637
|
-
/**
|
|
46638
|
-
* @param {import('./types/index.js').OxmlNodeConfig} config
|
|
46639
|
-
*/
|
|
46640
46633
|
constructor(config2) {
|
|
46641
46634
|
super(config2);
|
|
46642
|
-
__publicField$1(this, "oXmlName");
|
|
46643
46635
|
this.oXmlName = config2.oXmlName;
|
|
46644
46636
|
}
|
|
46645
46637
|
/**
|
|
46646
46638
|
* Factory method to construct a new OxmlNode instance.
|
|
46647
|
-
*
|
|
46648
|
-
* @
|
|
46649
|
-
* @returns {OxmlNode} A new OxmlNode instance.
|
|
46639
|
+
* @param config - The OXML node configuration.
|
|
46640
|
+
* @returns A new OxmlNode instance.
|
|
46650
46641
|
*/
|
|
46651
46642
|
static create(config2) {
|
|
46652
46643
|
return new OxmlNode(config2);
|
|
@@ -48159,8 +48150,8 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
48159
48150
|
}
|
|
48160
48151
|
/**
|
|
48161
48152
|
* Subscribe to the event.
|
|
48162
|
-
* @param
|
|
48163
|
-
* @param
|
|
48153
|
+
* @param name Event name.
|
|
48154
|
+
* @param fn Callback.
|
|
48164
48155
|
* @returns {void}
|
|
48165
48156
|
*/
|
|
48166
48157
|
on(name, fn2) {
|
|
@@ -48170,8 +48161,8 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
48170
48161
|
}
|
|
48171
48162
|
/**
|
|
48172
48163
|
* Emit event.
|
|
48173
|
-
* @param
|
|
48174
|
-
* @param
|
|
48164
|
+
* @param name Event name.
|
|
48165
|
+
* @param args Arguments to pass to each listener.
|
|
48175
48166
|
* @returns {void}
|
|
48176
48167
|
*/
|
|
48177
48168
|
emit(name, ...args) {
|
|
@@ -48184,8 +48175,8 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
48184
48175
|
/**
|
|
48185
48176
|
* Remove a specific callback from event
|
|
48186
48177
|
* or all event subscriptions.
|
|
48187
|
-
* @param
|
|
48188
|
-
* @param
|
|
48178
|
+
* @param name Event name.
|
|
48179
|
+
* @param fn Callback.
|
|
48189
48180
|
* @returns {void}
|
|
48190
48181
|
*/
|
|
48191
48182
|
off(name, fn2) {
|
|
@@ -48202,8 +48193,8 @@ let EventEmitter$1 = class EventEmitter {
|
|
|
48202
48193
|
}
|
|
48203
48194
|
/**
|
|
48204
48195
|
* Subscribe to an event that will be called only once.
|
|
48205
|
-
* @param
|
|
48206
|
-
* @param
|
|
48196
|
+
* @param name Event name.
|
|
48197
|
+
* @param fn Callback.
|
|
48207
48198
|
* @returns {void}
|
|
48208
48199
|
*/
|
|
48209
48200
|
once(name, fn2) {
|
|
@@ -51929,19 +51920,16 @@ const getLevel = (node) => {
|
|
|
51929
51920
|
const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
51930
51921
|
/**
|
|
51931
51922
|
* Create a new Editor instance
|
|
51932
|
-
* @param
|
|
51923
|
+
* @param options - Editor configuration options
|
|
51933
51924
|
*/
|
|
51934
51925
|
constructor(options) {
|
|
51935
51926
|
super();
|
|
51936
51927
|
__privateAdd$1(this, _Editor_instances);
|
|
51937
51928
|
__privateAdd$1(this, _commandService);
|
|
51938
|
-
|
|
51939
|
-
|
|
51940
|
-
|
|
51941
|
-
|
|
51942
|
-
__publicField$1(this, "isFocused", false);
|
|
51943
|
-
__publicField$1(this, "fontsImported", []);
|
|
51944
|
-
__publicField$1(this, "options", {
|
|
51929
|
+
this.extensionStorage = {};
|
|
51930
|
+
this.isFocused = false;
|
|
51931
|
+
this.fontsImported = [];
|
|
51932
|
+
this.options = {
|
|
51945
51933
|
element: null,
|
|
51946
51934
|
selector: null,
|
|
51947
51935
|
isHeadless: false,
|
|
@@ -51974,11 +51962,15 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
51974
51962
|
annotations: false,
|
|
51975
51963
|
isInternal: false,
|
|
51976
51964
|
externalExtensions: [],
|
|
51965
|
+
isChildEditor: false,
|
|
51977
51966
|
numbering: {},
|
|
51978
51967
|
isHeaderOrFooter: false,
|
|
51968
|
+
pagination: null,
|
|
51979
51969
|
lastSelection: null,
|
|
51980
51970
|
suppressDefaultDocxStyles: false,
|
|
51981
51971
|
jsonOverride: null,
|
|
51972
|
+
loadFromSchema: false,
|
|
51973
|
+
fragment: null,
|
|
51982
51974
|
onBeforeCreate: () => null,
|
|
51983
51975
|
onCreate: () => null,
|
|
51984
51976
|
onUpdate: () => null,
|
|
@@ -52010,15 +52002,20 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52010
52002
|
customUpdatedFiles: {},
|
|
52011
52003
|
isHeaderFooterChanged: false,
|
|
52012
52004
|
isCustomXmlChanged: false,
|
|
52005
|
+
ydoc: null,
|
|
52006
|
+
collaborationProvider: null,
|
|
52007
|
+
collaborationIsReady: false,
|
|
52008
|
+
shouldLoadComments: false,
|
|
52009
|
+
replacedFile: false,
|
|
52013
52010
|
focusTarget: null,
|
|
52014
52011
|
permissionResolver: null,
|
|
52015
52012
|
// header/footer editors may have parent(main) editor set
|
|
52016
52013
|
parentEditor: null
|
|
52017
|
-
}
|
|
52014
|
+
};
|
|
52018
52015
|
__privateMethod$1(this, _Editor_instances, initContainerElement_fn).call(this, options);
|
|
52019
52016
|
__privateMethod$1(this, _Editor_instances, checkHeadless_fn).call(this, options);
|
|
52020
52017
|
this.setOptions(options);
|
|
52021
|
-
|
|
52018
|
+
const modes = {
|
|
52022
52019
|
docx: () => __privateMethod$1(this, _Editor_instances, init_fn).call(this),
|
|
52023
52020
|
text: () => __privateMethod$1(this, _Editor_instances, initRichText_fn).call(this),
|
|
52024
52021
|
html: () => __privateMethod$1(this, _Editor_instances, initRichText_fn).call(this),
|
|
@@ -52026,14 +52023,13 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52026
52023
|
console.log("Not implemented.");
|
|
52027
52024
|
}
|
|
52028
52025
|
};
|
|
52029
|
-
|
|
52026
|
+
const initMode = modes[this.options.mode] ?? modes.default;
|
|
52030
52027
|
const { setHighContrastMode } = useHighContrastMode();
|
|
52031
52028
|
this.setHighContrastMode = setHighContrastMode;
|
|
52032
52029
|
initMode();
|
|
52033
52030
|
}
|
|
52034
52031
|
/**
|
|
52035
52032
|
* Getter which indicates if any changes happen in Editor
|
|
52036
|
-
* @returns {boolean}
|
|
52037
52033
|
*/
|
|
52038
52034
|
get docChanged() {
|
|
52039
52035
|
return this.options.isHeaderFooterChanged || this.options.isCustomXmlChanged || !this.options.initialState.doc.eq(this.state.doc);
|
|
@@ -52049,97 +52045,84 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52049
52045
|
if (this.view) {
|
|
52050
52046
|
this.view.destroy();
|
|
52051
52047
|
}
|
|
52052
|
-
this.view =
|
|
52048
|
+
this.view = void 0;
|
|
52053
52049
|
}
|
|
52054
52050
|
/**
|
|
52055
52051
|
* Set the toolbar for this editor
|
|
52056
|
-
* @param {Object} toolbar - The toolbar instance
|
|
52057
|
-
* @returns {void}
|
|
52058
52052
|
*/
|
|
52059
52053
|
setToolbar(toolbar) {
|
|
52060
52054
|
this.toolbar = toolbar;
|
|
52061
52055
|
}
|
|
52062
52056
|
/**
|
|
52063
52057
|
* Focus the editor.
|
|
52064
|
-
* @returns {void}
|
|
52065
52058
|
*/
|
|
52066
52059
|
focus() {
|
|
52067
52060
|
this.view?.focus();
|
|
52068
52061
|
}
|
|
52069
52062
|
/**
|
|
52070
52063
|
* Get the editor state
|
|
52071
|
-
* @returns {Object} ProseMirror state
|
|
52072
52064
|
*/
|
|
52073
52065
|
get state() {
|
|
52074
52066
|
return this.view?.state;
|
|
52075
52067
|
}
|
|
52076
52068
|
/**
|
|
52077
52069
|
* Get the editor storage.
|
|
52078
|
-
* @returns {Object} Editor storage object
|
|
52079
52070
|
*/
|
|
52080
52071
|
get storage() {
|
|
52081
52072
|
return this.extensionStorage;
|
|
52082
52073
|
}
|
|
52083
52074
|
/**
|
|
52084
52075
|
* Get object of registered commands.
|
|
52085
|
-
* @returns {import('./commands/types/index.js').EditorCommands} Commands object
|
|
52086
52076
|
*/
|
|
52087
52077
|
get commands() {
|
|
52088
52078
|
return __privateGet$1(this, _commandService)?.commands;
|
|
52089
52079
|
}
|
|
52090
52080
|
/**
|
|
52091
52081
|
* Get extension helpers.
|
|
52092
|
-
* @returns {EditorHelpers} Object with helper methods for extensions
|
|
52093
52082
|
*/
|
|
52094
52083
|
get helpers() {
|
|
52095
52084
|
return this.extensionService.helpers;
|
|
52096
52085
|
}
|
|
52097
52086
|
/**
|
|
52098
52087
|
* Check if the editor is editable.
|
|
52099
|
-
* @returns {boolean}
|
|
52100
52088
|
*/
|
|
52101
52089
|
get isEditable() {
|
|
52102
52090
|
return Boolean(this.options.editable && this.view && this.view.editable);
|
|
52103
52091
|
}
|
|
52104
52092
|
/**
|
|
52105
52093
|
* Check if editor is destroyed.
|
|
52106
|
-
* @returns {boolean}
|
|
52107
52094
|
*/
|
|
52108
52095
|
get isDestroyed() {
|
|
52109
52096
|
return this.view?.isDestroyed ?? true;
|
|
52110
52097
|
}
|
|
52111
52098
|
/**
|
|
52112
52099
|
* Get the editor element
|
|
52113
|
-
* @returns {HTMLElement} The editor element
|
|
52114
52100
|
*/
|
|
52115
52101
|
get element() {
|
|
52116
52102
|
return this.options.element;
|
|
52117
52103
|
}
|
|
52118
52104
|
/**
|
|
52119
52105
|
* Get possible users of the editor.
|
|
52120
|
-
* @returns {Array.<User>} List of users
|
|
52121
52106
|
*/
|
|
52122
52107
|
get users() {
|
|
52123
52108
|
return this.options.users;
|
|
52124
52109
|
}
|
|
52125
52110
|
/**
|
|
52126
52111
|
* Create a chain of commands to call multiple commands at once.
|
|
52127
|
-
* @returns {Object} Command chain
|
|
52128
52112
|
*/
|
|
52129
52113
|
chain() {
|
|
52130
52114
|
return __privateGet$1(this, _commandService).chain();
|
|
52131
52115
|
}
|
|
52132
52116
|
/**
|
|
52133
52117
|
* Check if a command or a chain of commands can be executed. Without executing it.
|
|
52134
|
-
* @returns {Object} Object with methods to check command availability
|
|
52135
52118
|
*/
|
|
52136
52119
|
can() {
|
|
52137
52120
|
return __privateGet$1(this, _commandService).can();
|
|
52138
52121
|
}
|
|
52139
52122
|
/**
|
|
52140
52123
|
* Set the document mode
|
|
52141
|
-
* @param
|
|
52142
|
-
* @param
|
|
52124
|
+
* @param documentMode - The document mode ('editing', 'viewing', 'suggesting')
|
|
52125
|
+
* @param caller - Calling context
|
|
52143
52126
|
*/
|
|
52144
52127
|
setDocumentMode(documentMode, caller) {
|
|
52145
52128
|
if (this.options.isHeaderOrFooter || this.options.isChildEditor) return;
|
|
@@ -52183,7 +52166,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52183
52166
|
}
|
|
52184
52167
|
/**
|
|
52185
52168
|
* Export the yjs binary from the current state.
|
|
52186
|
-
* @returns {Promise<Uint8Array>} The exported yjs binary
|
|
52187
52169
|
*/
|
|
52188
52170
|
async generateCollaborationUpdate() {
|
|
52189
52171
|
return await generateCollaborationData(this);
|
|
@@ -52192,11 +52174,10 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52192
52174
|
* Initialize data for collaborative editing
|
|
52193
52175
|
* If we are replacing data and have a valid provider, listen for synced event
|
|
52194
52176
|
* so that we can initialize the data
|
|
52195
|
-
* @returns {void}
|
|
52196
52177
|
*/
|
|
52197
52178
|
initializeCollaborationData() {
|
|
52198
52179
|
if (!this.options.isNewFile || !this.options.collaborationProvider) return;
|
|
52199
|
-
const
|
|
52180
|
+
const provider = this.options.collaborationProvider;
|
|
52200
52181
|
const postSyncInit = () => {
|
|
52201
52182
|
provider.off("synced", postSyncInit);
|
|
52202
52183
|
__privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
|
|
@@ -52208,8 +52189,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52208
52189
|
* Replace content of editor that was created with loadFromSchema option
|
|
52209
52190
|
* Used to replace content of other header/footer when one of it was edited
|
|
52210
52191
|
*
|
|
52211
|
-
* @param
|
|
52212
|
-
* @returns {void}
|
|
52192
|
+
* @param content - new editor content json (retrieved from editor.getUpdatedJson)
|
|
52213
52193
|
*/
|
|
52214
52194
|
replaceContent(content) {
|
|
52215
52195
|
this.setOptions({
|
|
@@ -52226,8 +52206,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52226
52206
|
}
|
|
52227
52207
|
/**
|
|
52228
52208
|
* Set editor options and update state.
|
|
52229
|
-
* @param {EditorOptions} options - Editor options
|
|
52230
|
-
* @returns {void}
|
|
52231
52209
|
*/
|
|
52232
52210
|
setOptions(options = {}) {
|
|
52233
52211
|
this.options = {
|
|
@@ -52247,9 +52225,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52247
52225
|
}
|
|
52248
52226
|
/**
|
|
52249
52227
|
* Set whether the editor is editable
|
|
52250
|
-
* @param {boolean} [editable=true] - Whether the editor is editable
|
|
52251
|
-
* @param {boolean} [emitUpdate=true] - Whether to emit an update event
|
|
52252
|
-
* @returns {void}
|
|
52253
52228
|
*/
|
|
52254
52229
|
setEditable(editable = true, emitUpdate = true) {
|
|
52255
52230
|
this.setOptions({ editable });
|
|
@@ -52261,7 +52236,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52261
52236
|
* Register PM plugin.
|
|
52262
52237
|
* @param plugin PM plugin.
|
|
52263
52238
|
* @param handlePlugins Optional function for handling plugin merge.
|
|
52264
|
-
* @returns {void}
|
|
52265
52239
|
*/
|
|
52266
52240
|
registerPlugin(plugin2, handlePlugins) {
|
|
52267
52241
|
if (!this.state?.plugins) return;
|
|
@@ -52271,25 +52245,21 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52271
52245
|
}
|
|
52272
52246
|
/**
|
|
52273
52247
|
* Unregister a PM plugin
|
|
52274
|
-
* @param {string|Object} nameOrPluginKey - Plugin name or plugin instance
|
|
52275
|
-
* @returns {void}
|
|
52276
52248
|
*/
|
|
52277
52249
|
unregisterPlugin(nameOrPluginKey) {
|
|
52278
52250
|
if (this.isDestroyed) return;
|
|
52279
|
-
const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey
|
|
52251
|
+
const name = typeof nameOrPluginKey === "string" ? `${nameOrPluginKey}$` : nameOrPluginKey?.key ?? "";
|
|
52280
52252
|
const state2 = this.state.reconfigure({
|
|
52281
|
-
plugins: this.state.plugins.filter((plugin2) => !plugin2.
|
|
52253
|
+
plugins: this.state.plugins.filter((plugin2) => !__privateMethod$1(this, _Editor_instances, getPluginKeyName_fn).call(this, plugin2).startsWith(name))
|
|
52282
52254
|
});
|
|
52283
52255
|
this.view.updateState(state2);
|
|
52284
52256
|
}
|
|
52285
52257
|
/**
|
|
52286
52258
|
* Load the data from DOCX to be used in the schema.
|
|
52287
52259
|
* Expects a DOCX file.
|
|
52288
|
-
* @
|
|
52289
|
-
* @
|
|
52290
|
-
* @
|
|
52291
|
-
* @param {boolean} [isNode=false] - Whether the method is being called in a Node.js environment
|
|
52292
|
-
* @returns {Promise<Array>} - A promise that resolves to an array containing:
|
|
52260
|
+
* @param fileSource - The DOCX file to load (File/Blob in browser, Buffer in Node.js)
|
|
52261
|
+
* @param isNode - Whether the method is being called in a Node.js environment
|
|
52262
|
+
* @returns A promise that resolves to an array containing:
|
|
52293
52263
|
* - [0] xmlFiles - Array of XML files extracted from the DOCX
|
|
52294
52264
|
* - [1] mediaFiles - Object containing media files with URLs (browser only)
|
|
52295
52265
|
* - [2] mediaFiles - Object containing media files with base64 data
|
|
@@ -52304,33 +52274,22 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52304
52274
|
}
|
|
52305
52275
|
/**
|
|
52306
52276
|
* Get the document version
|
|
52307
|
-
* @static
|
|
52308
|
-
* @param {Object} doc - Document object
|
|
52309
|
-
* @returns {string} Document version
|
|
52310
52277
|
*/
|
|
52311
52278
|
static getDocumentVersion(doc2) {
|
|
52312
52279
|
return SuperConverter.getStoredSuperdocVersion(doc2);
|
|
52313
52280
|
}
|
|
52314
52281
|
/**
|
|
52315
52282
|
* Set the document version
|
|
52316
|
-
* @static
|
|
52317
|
-
* @param {Object} doc - Document object
|
|
52318
|
-
* @param {string} version - New version
|
|
52319
|
-
* @returns {string} The set version
|
|
52320
52283
|
*/
|
|
52321
52284
|
static setDocumentVersion(doc2, version2) {
|
|
52322
52285
|
return SuperConverter.setStoredSuperdocVersion(doc2, version2);
|
|
52323
52286
|
}
|
|
52324
52287
|
/**
|
|
52325
52288
|
* Get the document GUID
|
|
52326
|
-
* @static
|
|
52327
|
-
* @param {Object} doc - Document object
|
|
52328
|
-
* @returns {string|null} Document GUID
|
|
52329
52289
|
*/
|
|
52330
52290
|
static getDocumentGuid(doc2) {
|
|
52331
52291
|
return SuperConverter.extractDocumentGuid(doc2);
|
|
52332
52292
|
}
|
|
52333
|
-
// Deprecated
|
|
52334
52293
|
/**
|
|
52335
52294
|
* @deprecated use setDocumentVersion instead
|
|
52336
52295
|
*/
|
|
@@ -52340,7 +52299,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52340
52299
|
}
|
|
52341
52300
|
/**
|
|
52342
52301
|
* Creates all node views.
|
|
52343
|
-
* @returns {void}
|
|
52344
52302
|
*/
|
|
52345
52303
|
createNodeViews() {
|
|
52346
52304
|
this.view.setProps({
|
|
@@ -52349,7 +52307,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52349
52307
|
}
|
|
52350
52308
|
/**
|
|
52351
52309
|
* Get the maximum content size
|
|
52352
|
-
* @returns {Object} Size object with width and height
|
|
52353
52310
|
*/
|
|
52354
52311
|
getMaxContentSize() {
|
|
52355
52312
|
if (!this.converter) return {};
|
|
@@ -52373,7 +52330,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52373
52330
|
return;
|
|
52374
52331
|
}
|
|
52375
52332
|
proseMirror.setAttribute("role", "document");
|
|
52376
|
-
proseMirror.setAttribute("aria-multiline", true);
|
|
52333
|
+
proseMirror.setAttribute("aria-multiline", "true");
|
|
52377
52334
|
proseMirror.setAttribute("aria-label", "Main content area, start typing to enter text.");
|
|
52378
52335
|
proseMirror.setAttribute("aria-description", "");
|
|
52379
52336
|
proseMirror.classList.remove("view-mode");
|
|
@@ -52404,7 +52361,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52404
52361
|
element.style.touchAction = "auto";
|
|
52405
52362
|
element.style.webkitOverflowScrolling = "touch";
|
|
52406
52363
|
const defaultLineHeight = 1.2;
|
|
52407
|
-
proseMirror.style.lineHeight = defaultLineHeight;
|
|
52364
|
+
proseMirror.style.lineHeight = String(defaultLineHeight);
|
|
52408
52365
|
if (!hasPaginationEnabled) {
|
|
52409
52366
|
proseMirror.style.paddingTop = "1in";
|
|
52410
52367
|
proseMirror.style.paddingBottom = "1in";
|
|
@@ -52418,8 +52375,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52418
52375
|
* Get page size and margins from the converter.
|
|
52419
52376
|
* Set document default font and font size.
|
|
52420
52377
|
*
|
|
52421
|
-
* @param
|
|
52422
|
-
* @returns {void}
|
|
52378
|
+
* @param element - The DOM element to apply styles to
|
|
52423
52379
|
*/
|
|
52424
52380
|
initDefaultStyles(element = this.element, isPaginationEnabled = true) {
|
|
52425
52381
|
if (this.options.isHeadless || this.options.suppressDefaultDocxStyles) return;
|
|
@@ -52430,9 +52386,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52430
52386
|
/**
|
|
52431
52387
|
* Initializes responsive styles for mobile devices.
|
|
52432
52388
|
* Sets up scaling based on viewport width and handles orientation changes.
|
|
52433
|
-
*
|
|
52434
|
-
* @param {HTMLElement|void} element - The DOM element to apply mobile styles to
|
|
52435
|
-
* @returns {void}
|
|
52436
52389
|
*/
|
|
52437
52390
|
initMobileStyles(element) {
|
|
52438
52391
|
if (!element) {
|
|
@@ -52467,30 +52420,28 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52467
52420
|
};
|
|
52468
52421
|
if ("orientation" in screen && "addEventListener" in screen.orientation) {
|
|
52469
52422
|
screen.orientation.addEventListener("change", handleResize);
|
|
52470
|
-
} else
|
|
52471
|
-
window.matchMedia("(orientation: portrait)")
|
|
52472
|
-
|
|
52473
|
-
|
|
52474
|
-
|
|
52423
|
+
} else {
|
|
52424
|
+
const mediaQueryList = typeof window.matchMedia === "function" ? window.matchMedia("(orientation: portrait)") : null;
|
|
52425
|
+
if (mediaQueryList?.addEventListener) {
|
|
52426
|
+
mediaQueryList.addEventListener("change", handleResize);
|
|
52427
|
+
}
|
|
52475
52428
|
}
|
|
52429
|
+
window.addEventListener("resize", () => handleResize);
|
|
52476
52430
|
}
|
|
52477
52431
|
/**
|
|
52478
52432
|
* Get document identifier for telemetry (async - may generate hash)
|
|
52479
|
-
* @returns {Promise<string>} GUID for modified docs, hash for unmodified
|
|
52480
52433
|
*/
|
|
52481
52434
|
async getDocumentIdentifier() {
|
|
52482
52435
|
return await this.converter?.getDocumentIdentifier() || null;
|
|
52483
52436
|
}
|
|
52484
52437
|
/**
|
|
52485
52438
|
* Get permanent document GUID (sync - only for modified documents)
|
|
52486
|
-
* @returns {string|null} GUID or null if document hasn't been modified
|
|
52487
52439
|
*/
|
|
52488
52440
|
getDocumentGuid() {
|
|
52489
52441
|
return this.converter?.documentGuid || null;
|
|
52490
52442
|
}
|
|
52491
52443
|
/**
|
|
52492
52444
|
* Check if document has been modified
|
|
52493
|
-
* @returns {boolean}
|
|
52494
52445
|
*/
|
|
52495
52446
|
isDocumentModified() {
|
|
52496
52447
|
return this.converter?.documentModified || false;
|
|
@@ -52506,14 +52457,15 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52506
52457
|
version: this.converter?.getSuperdocVersion()
|
|
52507
52458
|
};
|
|
52508
52459
|
}
|
|
52509
|
-
|
|
52460
|
+
/**
|
|
52461
|
+
* @deprecated use getDocumentGuid instead
|
|
52462
|
+
*/
|
|
52510
52463
|
getDocumentId() {
|
|
52511
52464
|
console.warn("getDocumentId is deprecated, use getDocumentGuid instead");
|
|
52512
52465
|
return this.getDocumentGuid();
|
|
52513
52466
|
}
|
|
52514
52467
|
/**
|
|
52515
52468
|
* Get attrs of the currently selected node or mark.
|
|
52516
|
-
* @param {String} nameOrType
|
|
52517
52469
|
* @example
|
|
52518
52470
|
* editor.getAttributes('textStyle').color
|
|
52519
52471
|
*/
|
|
@@ -52522,9 +52474,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52522
52474
|
}
|
|
52523
52475
|
/**
|
|
52524
52476
|
* Returns if the currently selected node or mark is active.
|
|
52525
|
-
* @param
|
|
52526
|
-
* @param
|
|
52527
|
-
* @returns {Boolean} Whether the node or mark is active with the specified attributes
|
|
52477
|
+
* @param nameOrAttributes - The name of the node/mark or an attributes object
|
|
52478
|
+
* @param attributesOrUndefined - Optional attributes to check when first parameter is a name
|
|
52528
52479
|
* @example
|
|
52529
52480
|
* editor.isActive('bold')
|
|
52530
52481
|
* editor.isActive('textStyle', { color: 'purple' })
|
|
@@ -52537,18 +52488,12 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52537
52488
|
}
|
|
52538
52489
|
/**
|
|
52539
52490
|
* Get the editor content as JSON
|
|
52540
|
-
* @returns {Object} Editor content as JSON
|
|
52541
52491
|
*/
|
|
52542
52492
|
getJSON() {
|
|
52543
52493
|
return this.state.doc.toJSON();
|
|
52544
52494
|
}
|
|
52545
52495
|
/**
|
|
52546
52496
|
* Get document metadata including GUID, modification status, and version
|
|
52547
|
-
* @returns {{
|
|
52548
|
-
* documentGuid: string | null,
|
|
52549
|
-
* isModified: boolean,
|
|
52550
|
-
* version: string | null
|
|
52551
|
-
* }} Document metadata
|
|
52552
52497
|
*/
|
|
52553
52498
|
getMetadata() {
|
|
52554
52499
|
return {
|
|
@@ -52559,9 +52504,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52559
52504
|
}
|
|
52560
52505
|
/**
|
|
52561
52506
|
* Get the editor content as HTML
|
|
52562
|
-
* @param {Object} options - Options for the HTML serializer
|
|
52563
|
-
* @param {boolean} [options.unflattenLists] - Whether to unflatten lists in the HTML
|
|
52564
|
-
* @returns {string} Editor content as HTML
|
|
52565
52507
|
*/
|
|
52566
52508
|
getHTML({ unflattenLists = false } = {}) {
|
|
52567
52509
|
const tempDocument = document.implementation.createHTMLDocument();
|
|
@@ -52576,7 +52518,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52576
52518
|
}
|
|
52577
52519
|
/**
|
|
52578
52520
|
* Get the editor content as Markdown
|
|
52579
|
-
* @returns {Promise<string>} Editor content as Markdown
|
|
52580
52521
|
*/
|
|
52581
52522
|
async getMarkdown() {
|
|
52582
52523
|
const [
|
|
@@ -52586,7 +52527,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52586
52527
|
{ default: remarkStringify },
|
|
52587
52528
|
{ default: remarkGfm }
|
|
52588
52529
|
] = await Promise.all([
|
|
52589
|
-
Promise.resolve().then(() => require("./index-
|
|
52530
|
+
Promise.resolve().then(() => require("./index-B74saKaW-nw0M-3t9.cjs")),
|
|
52590
52531
|
Promise.resolve().then(() => require("./index-DRCvimau-H4Ck3S9a.cjs")),
|
|
52591
52532
|
Promise.resolve().then(() => require("./index-C_x_N6Uh-Db3CUJMX.cjs")),
|
|
52592
52533
|
Promise.resolve().then(() => require("./index-D_sWOSiG-BtDZzJ6I.cjs")),
|
|
@@ -52601,7 +52542,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52601
52542
|
}
|
|
52602
52543
|
/**
|
|
52603
52544
|
* Get the document version from the converter
|
|
52604
|
-
* @returns {string|null} The SuperDoc version stored in the document
|
|
52605
52545
|
*/
|
|
52606
52546
|
getDocumentVersion() {
|
|
52607
52547
|
return this.converter?.getSuperdocVersion() || null;
|
|
@@ -52610,25 +52550,18 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52610
52550
|
* Create a child editor linked to this editor.
|
|
52611
52551
|
* This is useful for creating header/footer editors that are linked to the main editor.
|
|
52612
52552
|
* Or paragraph fields that rely on the same underlying document and list defintions
|
|
52613
|
-
* @param {EditorOptions} options - Options for the child editor
|
|
52614
|
-
* @returns {Editor} A new child editor instance linked to this editor
|
|
52615
52553
|
*/
|
|
52616
52554
|
createChildEditor(options) {
|
|
52617
52555
|
return createLinkedChildEditor(this, options);
|
|
52618
52556
|
}
|
|
52619
52557
|
/**
|
|
52620
52558
|
* Get page styles
|
|
52621
|
-
* @returns {Object} Page styles
|
|
52622
52559
|
*/
|
|
52623
52560
|
getPageStyles() {
|
|
52624
52561
|
return this.converter?.pageStyles || {};
|
|
52625
52562
|
}
|
|
52626
52563
|
/**
|
|
52627
52564
|
* Update page styles
|
|
52628
|
-
*
|
|
52629
|
-
* @param {Object} param0
|
|
52630
|
-
* @param {Object} param0.pageMargins The new page margins
|
|
52631
|
-
* @returns {void}
|
|
52632
52565
|
*/
|
|
52633
52566
|
updatePageStyle({ pageMargins }) {
|
|
52634
52567
|
if (!this.converter) return;
|
|
@@ -52654,13 +52587,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52654
52587
|
}
|
|
52655
52588
|
/**
|
|
52656
52589
|
* Export the editor document to DOCX.
|
|
52657
|
-
* @async
|
|
52658
|
-
* @param {Object} options - The export options
|
|
52659
|
-
* @param {boolean} [options.isFinalDoc=false] - Whether this is the final document version
|
|
52660
|
-
* @param {string} [options.commentsType] - The type of comments to include
|
|
52661
|
-
* @param {Array} [options.comments=[]] - Array of comments to include in the document
|
|
52662
|
-
* @param {boolean} [options.getUpdatedDocs=false] - When set to true return only updated docx files
|
|
52663
|
-
* @returns {Promise<Blob|ArrayBuffer|Object>} The exported DOCX file or updated docx files
|
|
52664
52590
|
*/
|
|
52665
52591
|
async exportDocx({
|
|
52666
52592
|
isFinalDoc = false,
|
|
@@ -52695,7 +52621,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52695
52621
|
const updatedHeadersFooters = {};
|
|
52696
52622
|
Object.entries(this.converter.convertedXml).forEach(([name, json2]) => {
|
|
52697
52623
|
if (name.includes("header") || name.includes("footer")) {
|
|
52698
|
-
const
|
|
52624
|
+
const jsonObj = json2;
|
|
52625
|
+
const resultXml = this.converter.schemaToXml(jsonObj.elements?.[0]);
|
|
52699
52626
|
updatedHeadersFooters[name] = String(resultXml);
|
|
52700
52627
|
}
|
|
52701
52628
|
});
|
|
@@ -52750,19 +52677,19 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52750
52677
|
fonts: this.options.fonts,
|
|
52751
52678
|
isHeadless: this.options.isHeadless
|
|
52752
52679
|
});
|
|
52753
|
-
this.options.telemetry?.trackUsage("document_export", {
|
|
52680
|
+
this.options.telemetry?.trackUsage?.("document_export", {
|
|
52754
52681
|
documentType: "docx",
|
|
52755
52682
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
52756
52683
|
});
|
|
52757
52684
|
return result;
|
|
52758
52685
|
} catch (error) {
|
|
52759
|
-
|
|
52760
|
-
|
|
52686
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
52687
|
+
this.emit("exception", { error: err, editor: this });
|
|
52688
|
+
console.error(err);
|
|
52761
52689
|
}
|
|
52762
52690
|
}
|
|
52763
52691
|
/**
|
|
52764
52692
|
* Destroy the editor and clean up resources
|
|
52765
|
-
* @returns {void}
|
|
52766
52693
|
*/
|
|
52767
52694
|
destroy() {
|
|
52768
52695
|
this.emit("destroy");
|
|
@@ -52777,34 +52704,31 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52777
52704
|
const footerEditors = this.converter?.footerEditors ?? [];
|
|
52778
52705
|
if (!headerEditors.length && !footerEditors.length) return;
|
|
52779
52706
|
const editors = [...headerEditors, ...footerEditors].filter(Boolean);
|
|
52780
|
-
for (
|
|
52707
|
+
for (const editorData of editors) {
|
|
52781
52708
|
editorData?.editor?.destroy?.();
|
|
52782
52709
|
}
|
|
52783
52710
|
if (headerEditors.length) headerEditors.length = 0;
|
|
52784
52711
|
if (footerEditors.length) footerEditors.length = 0;
|
|
52785
52712
|
} catch (error) {
|
|
52786
|
-
|
|
52787
|
-
|
|
52713
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
52714
|
+
this.emit("exception", { error: err, editor: this });
|
|
52715
|
+
console.error(err);
|
|
52788
52716
|
}
|
|
52789
52717
|
}
|
|
52790
52718
|
/**
|
|
52791
52719
|
* Check if migrations are needed for the data
|
|
52792
|
-
* @static
|
|
52793
|
-
* @param {Object} data - Document data
|
|
52794
|
-
* @returns {boolean} Whether migrations are needed
|
|
52795
52720
|
*/
|
|
52796
52721
|
static checkIfMigrationsNeeded() {
|
|
52797
|
-
const dataVersion = version
|
|
52722
|
+
const dataVersion = version ?? "initial";
|
|
52798
52723
|
const migrations = getNecessaryMigrations(dataVersion) || [];
|
|
52799
52724
|
console.debug("[checkVersionMigrations] Migrations needed:", dataVersion, migrations.length);
|
|
52800
52725
|
return migrations.length > 0;
|
|
52801
52726
|
}
|
|
52802
52727
|
/**
|
|
52803
52728
|
* Process collaboration migrations
|
|
52804
|
-
* @returns {Object | void} Migration results
|
|
52805
52729
|
*/
|
|
52806
52730
|
processCollaborationMigrations() {
|
|
52807
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.
|
|
52731
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.3");
|
|
52808
52732
|
if (!this.options.ydoc) return;
|
|
52809
52733
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
52810
52734
|
let docVersion = metaMap.get("version");
|
|
@@ -52812,10 +52736,10 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52812
52736
|
console.debug("[checkVersionMigrations] Document version", docVersion);
|
|
52813
52737
|
const migrations = getNecessaryMigrations(docVersion) || [];
|
|
52814
52738
|
const plugins = this.state.plugins;
|
|
52815
|
-
const syncPlugin = plugins.find((
|
|
52739
|
+
const syncPlugin = plugins.find((plugin2) => __privateMethod$1(this, _Editor_instances, getPluginKeyName_fn).call(this, plugin2).startsWith("y-sync"));
|
|
52816
52740
|
if (!syncPlugin) return this.options.ydoc;
|
|
52817
52741
|
let hasRunMigrations = false;
|
|
52818
|
-
for (
|
|
52742
|
+
for (const migration of migrations) {
|
|
52819
52743
|
console.debug("🏃♂️ Running migration", migration.name);
|
|
52820
52744
|
const result = migration(this);
|
|
52821
52745
|
if (!result) throw new Error("Migration failed at " + migration.name);
|
|
@@ -52827,9 +52751,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52827
52751
|
}
|
|
52828
52752
|
/**
|
|
52829
52753
|
* Replace the current file
|
|
52830
|
-
* @async
|
|
52831
|
-
* @param {Object} newFile - New file data
|
|
52832
|
-
* @returns {Promise<void>}
|
|
52833
52754
|
*/
|
|
52834
52755
|
async replaceFile(newFile) {
|
|
52835
52756
|
this.setOptions({ annotations: true });
|
|
@@ -52840,15 +52761,15 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52840
52761
|
media,
|
|
52841
52762
|
mediaFiles,
|
|
52842
52763
|
fonts,
|
|
52843
|
-
isNewFile: true
|
|
52844
|
-
shouldLoadComments: true,
|
|
52845
|
-
replacedFile: true
|
|
52764
|
+
isNewFile: true
|
|
52846
52765
|
});
|
|
52766
|
+
this.options.shouldLoadComments = true;
|
|
52767
|
+
this.options.replacedFile = true;
|
|
52847
52768
|
__privateMethod$1(this, _Editor_instances, createConverter_fn).call(this);
|
|
52848
52769
|
__privateMethod$1(this, _Editor_instances, initMedia_fn).call(this);
|
|
52849
52770
|
this.initDefaultStyles();
|
|
52850
52771
|
if (this.options.ydoc && this.options.collaborationProvider) {
|
|
52851
|
-
updateYdocDocxData(this);
|
|
52772
|
+
updateYdocDocxData(this, this.options.ydoc);
|
|
52852
52773
|
this.initializeCollaborationData();
|
|
52853
52774
|
} else {
|
|
52854
52775
|
__privateMethod$1(this, _Editor_instances, insertNewFileData_fn).call(this);
|
|
@@ -52860,9 +52781,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52860
52781
|
}
|
|
52861
52782
|
/**
|
|
52862
52783
|
* Get internal docx file content
|
|
52863
|
-
* @param
|
|
52864
|
-
* @param
|
|
52865
|
-
* @returns {Object|String} - file content
|
|
52784
|
+
* @param name - File name
|
|
52785
|
+
* @param type - type of result (json, string)
|
|
52866
52786
|
*/
|
|
52867
52787
|
getInternalXmlFile(name, type2 = "json") {
|
|
52868
52788
|
if (!this.converter.convertedXml[name]) {
|
|
@@ -52876,8 +52796,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52876
52796
|
}
|
|
52877
52797
|
/**
|
|
52878
52798
|
* Update internal docx file content
|
|
52879
|
-
* @param
|
|
52880
|
-
* @param
|
|
52799
|
+
* @param name - File name
|
|
52800
|
+
* @param updatedContent - new file content
|
|
52881
52801
|
*/
|
|
52882
52802
|
updateInternalXmlFile(name, updatedContent) {
|
|
52883
52803
|
if (typeof updatedContent === "string") {
|
|
@@ -52890,8 +52810,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52890
52810
|
}
|
|
52891
52811
|
/**
|
|
52892
52812
|
* Get all nodes of a specific type
|
|
52893
|
-
* @param {string} type - Node type
|
|
52894
|
-
* @returns {Array} Array of nodes
|
|
52895
52813
|
*/
|
|
52896
52814
|
getNodesOfType(type2) {
|
|
52897
52815
|
const { findChildren: findChildren2 } = helpers;
|
|
@@ -52899,9 +52817,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52899
52817
|
}
|
|
52900
52818
|
/**
|
|
52901
52819
|
* Replace a node with HTML content
|
|
52902
|
-
* @param {Object} targetNode - The node to replace
|
|
52903
|
-
* @param {string} html - HTML content to replace with
|
|
52904
|
-
* @returns {void}
|
|
52905
52820
|
*/
|
|
52906
52821
|
replaceNodeWithHTML(targetNode, html) {
|
|
52907
52822
|
const { tr } = this.state;
|
|
@@ -52918,9 +52833,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52918
52833
|
* pre-process the document as needed prior to running in the annotator.
|
|
52919
52834
|
*
|
|
52920
52835
|
* Currently this is only used for table generation but additional pre-processing can be done here.
|
|
52921
|
-
*
|
|
52922
|
-
* @param {FieldValue[]} annotationValues
|
|
52923
|
-
* @returns {void}
|
|
52924
52836
|
*/
|
|
52925
52837
|
prepareForAnnotations(annotationValues = []) {
|
|
52926
52838
|
const { tr } = this.state;
|
|
@@ -52929,8 +52841,8 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52929
52841
|
}
|
|
52930
52842
|
/**
|
|
52931
52843
|
* Migrate paragraph fields to lists V2 structure if necessary.
|
|
52932
|
-
* @param
|
|
52933
|
-
* @returns
|
|
52844
|
+
* @param annotationValues - List of field values to migrate.
|
|
52845
|
+
* @returns Returns a promise that resolves to the migrated values
|
|
52934
52846
|
*/
|
|
52935
52847
|
async migrateParagraphFields(annotationValues = []) {
|
|
52936
52848
|
if (!Array.isArray(annotationValues) || !annotationValues.length) return annotationValues;
|
|
@@ -52939,10 +52851,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52939
52851
|
}
|
|
52940
52852
|
/**
|
|
52941
52853
|
* Annotate the document with the given annotation values.
|
|
52942
|
-
*
|
|
52943
|
-
* @param {FieldValue[]} annotationValues List of field values to apply.
|
|
52944
|
-
* @param {String[]} hiddenIds List of field ids to remove from the document.
|
|
52945
|
-
* @returns {void}
|
|
52946
52854
|
*/
|
|
52947
52855
|
annotate(annotationValues = [], hiddenIds = [], removeEmptyFields = false) {
|
|
52948
52856
|
const { state: state2, view, schema } = this;
|
|
@@ -52961,10 +52869,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52961
52869
|
/**
|
|
52962
52870
|
* Preview annotations in the editor. It stores a copy of the original state.
|
|
52963
52871
|
* This can be reverted via closePreview()
|
|
52964
|
-
*
|
|
52965
|
-
* @param {Object[]} annotationValues
|
|
52966
|
-
* @param {string[]} hiddenIds
|
|
52967
|
-
* @returns {void}
|
|
52968
52872
|
*/
|
|
52969
52873
|
previewAnnotations(annotationValues = [], hiddenIds = []) {
|
|
52970
52874
|
this.originalState = this.view.state;
|
|
@@ -52972,8 +52876,6 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
52972
52876
|
}
|
|
52973
52877
|
/**
|
|
52974
52878
|
* If there is a preview active, this will revert the editor to the original state.
|
|
52975
|
-
*
|
|
52976
|
-
* @returns {void}
|
|
52977
52879
|
*/
|
|
52978
52880
|
closePreview() {
|
|
52979
52881
|
if (!this.originalState) return;
|
|
@@ -53019,7 +52921,7 @@ init_fn = function() {
|
|
|
53019
52921
|
this.on("update", this.options.onUpdate);
|
|
53020
52922
|
this.on("selectionUpdate", this.options.onSelectionUpdate);
|
|
53021
52923
|
this.on("transaction", this.options.onTransaction);
|
|
53022
|
-
this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn));
|
|
52924
|
+
this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn).bind(this));
|
|
53023
52925
|
this.on("blur", this.options.onBlur);
|
|
53024
52926
|
this.on("destroy", this.options.onDestroy);
|
|
53025
52927
|
this.on("trackedChangesUpdate", this.options.onTrackedChangesUpdate);
|
|
@@ -53027,7 +52929,7 @@ init_fn = function() {
|
|
|
53027
52929
|
this.on("commentClick", this.options.onCommentClicked);
|
|
53028
52930
|
this.on("commentsUpdate", this.options.onCommentsUpdate);
|
|
53029
52931
|
this.on("locked", this.options.onDocumentLocked);
|
|
53030
|
-
this.on("collaborationReady", __privateMethod$1(this, _Editor_instances, onCollaborationReady_fn));
|
|
52932
|
+
this.on("collaborationReady", __privateMethod$1(this, _Editor_instances, onCollaborationReady_fn).bind(this));
|
|
53031
52933
|
this.on("paginationUpdate", this.options.onPaginationUpdate);
|
|
53032
52934
|
this.on("comment-positions", this.options.onCommentLocationsUpdate);
|
|
53033
52935
|
this.on("list-definitions-change", this.options.onListDefinitionsChange);
|
|
@@ -53070,7 +52972,7 @@ initRichText_fn = function() {
|
|
|
53070
52972
|
this.on("update", this.options.onUpdate);
|
|
53071
52973
|
this.on("selectionUpdate", this.options.onSelectionUpdate);
|
|
53072
52974
|
this.on("transaction", this.options.onTransaction);
|
|
53073
|
-
this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn));
|
|
52975
|
+
this.on("focus", __privateMethod$1(this, _Editor_instances, onFocus_fn).bind(this));
|
|
53074
52976
|
this.on("blur", this.options.onBlur);
|
|
53075
52977
|
this.on("destroy", this.options.onDestroy);
|
|
53076
52978
|
this.on("commentsLoaded", this.options.onCommentsLoaded);
|
|
@@ -53085,7 +52987,11 @@ onFocus_fn = function({ editor, event }) {
|
|
|
53085
52987
|
checkHeadless_fn = function(options) {
|
|
53086
52988
|
if (!options.isHeadless) return;
|
|
53087
52989
|
if (typeof navigator === "undefined") {
|
|
53088
|
-
|
|
52990
|
+
const minimalNavigator = {
|
|
52991
|
+
platform: "node",
|
|
52992
|
+
userAgent: "Node.js"
|
|
52993
|
+
};
|
|
52994
|
+
global$1.navigator = minimalNavigator;
|
|
53089
52995
|
}
|
|
53090
52996
|
if (options.mockDocument) {
|
|
53091
52997
|
global$1.document = options.mockDocument;
|
|
@@ -53118,13 +53024,18 @@ insertNewFileData_fn = function() {
|
|
|
53118
53024
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
53119
53025
|
}, 50);
|
|
53120
53026
|
};
|
|
53027
|
+
getPluginKeyName_fn = function(plugin2) {
|
|
53028
|
+
const pluginKey = plugin2.key;
|
|
53029
|
+
return typeof pluginKey?.key === "string" ? pluginKey.key : "";
|
|
53030
|
+
};
|
|
53121
53031
|
createExtensionService_fn = function() {
|
|
53122
53032
|
const allowedExtensions = ["extension", "node", "mark"];
|
|
53123
53033
|
const coreExtensions = [Editable, Commands, EditorFocus, Keymap];
|
|
53124
53034
|
const externalExtensions = this.options.externalExtensions || [];
|
|
53125
|
-
const allExtensions = [...coreExtensions, ...this.options.extensions].filter(
|
|
53126
|
-
|
|
53127
|
-
|
|
53035
|
+
const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension) => {
|
|
53036
|
+
const extensionType = typeof extension?.type === "string" ? extension.type : void 0;
|
|
53037
|
+
return extensionType ? allowedExtensions.includes(extensionType) : false;
|
|
53038
|
+
});
|
|
53128
53039
|
this.extensionService = ExtensionService.create(allExtensions, externalExtensions, this);
|
|
53129
53040
|
};
|
|
53130
53041
|
createCommandService_fn = function() {
|
|
@@ -53149,7 +53060,10 @@ createConverter_fn = function() {
|
|
|
53149
53060
|
};
|
|
53150
53061
|
initMedia_fn = function() {
|
|
53151
53062
|
if (this.options.isChildEditor) return;
|
|
53152
|
-
if (!this.options.ydoc)
|
|
53063
|
+
if (!this.options.ydoc) {
|
|
53064
|
+
this.storage.image.media = this.options.mediaFiles;
|
|
53065
|
+
return;
|
|
53066
|
+
}
|
|
53153
53067
|
const mediaMap = this.options.ydoc.getMap("media");
|
|
53154
53068
|
if (this.options.isNewFile) {
|
|
53155
53069
|
Object.entries(this.options.mediaFiles).forEach(([key2, value]) => {
|
|
@@ -53179,10 +53093,11 @@ checkFonts_fn = async function() {
|
|
|
53179
53093
|
try {
|
|
53180
53094
|
const fontsUsedInDocument = this.converter.getDocumentFonts();
|
|
53181
53095
|
const unsupportedFonts = __privateMethod$1(this, _Editor_instances, determineUnsupportedFonts_fn).call(this, fontsUsedInDocument);
|
|
53182
|
-
|
|
53096
|
+
const payload = {
|
|
53183
53097
|
documentFonts: fontsUsedInDocument,
|
|
53184
53098
|
unsupportedFonts
|
|
53185
|
-
}
|
|
53099
|
+
};
|
|
53100
|
+
this.emit("fonts-resolved", payload);
|
|
53186
53101
|
} catch {
|
|
53187
53102
|
console.warn("[SuperDoc] Could not determine document fonts and unsupported fonts");
|
|
53188
53103
|
}
|
|
@@ -53201,9 +53116,10 @@ createSchema_fn = function() {
|
|
|
53201
53116
|
generatePmData_fn = function() {
|
|
53202
53117
|
let doc2;
|
|
53203
53118
|
try {
|
|
53204
|
-
const { mode,
|
|
53119
|
+
const { mode, content, fragment, loadFromSchema } = this.options;
|
|
53120
|
+
const hasJsonContent = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
53205
53121
|
if (mode === "docx") {
|
|
53206
|
-
if (loadFromSchema) {
|
|
53122
|
+
if (loadFromSchema && hasJsonContent(content)) {
|
|
53207
53123
|
doc2 = this.schema.nodeFromJSON(content);
|
|
53208
53124
|
doc2 = __privateMethod$1(this, _Editor_instances, prepareDocumentForImport_fn).call(this, doc2);
|
|
53209
53125
|
} else {
|
|
@@ -53216,18 +53132,19 @@ generatePmData_fn = function() {
|
|
|
53216
53132
|
if (fragment) doc2 = yXmlFragmentToProseMirrorRootNode(fragment, this.schema);
|
|
53217
53133
|
}
|
|
53218
53134
|
} else if (mode === "text" || mode === "html") {
|
|
53219
|
-
if (loadFromSchema) doc2 = this.schema.nodeFromJSON(content);
|
|
53220
|
-
else if (content) doc2 = createDocFromHTML(content, this);
|
|
53135
|
+
if (loadFromSchema && hasJsonContent(content)) doc2 = this.schema.nodeFromJSON(content);
|
|
53136
|
+
else if (typeof content === "string") doc2 = createDocFromHTML(content, this);
|
|
53221
53137
|
else doc2 = this.schema.topNodeType.createAndFill();
|
|
53222
53138
|
}
|
|
53223
53139
|
} catch (err) {
|
|
53224
53140
|
console.error(err);
|
|
53225
|
-
|
|
53141
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
53142
|
+
this.emit("contentError", { editor: this, error });
|
|
53226
53143
|
}
|
|
53227
53144
|
return doc2;
|
|
53228
53145
|
};
|
|
53229
53146
|
createView_fn = function(element) {
|
|
53230
|
-
|
|
53147
|
+
const doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
|
|
53231
53148
|
const state2 = { schema: this.schema };
|
|
53232
53149
|
if (!this.options.ydoc) state2.doc = doc2;
|
|
53233
53150
|
this.options.initialState = EditorState.create(state2);
|
|
@@ -53236,13 +53153,14 @@ createView_fn = function(element) {
|
|
|
53236
53153
|
dispatchTransaction: __privateMethod$1(this, _Editor_instances, dispatchTransaction_fn).bind(this),
|
|
53237
53154
|
state: this.options.initialState,
|
|
53238
53155
|
handleClick: __privateMethod$1(this, _Editor_instances, handleNodeSelection_fn).bind(this),
|
|
53239
|
-
handleDoubleClick:
|
|
53156
|
+
handleDoubleClick: (view, pos, event) => {
|
|
53240
53157
|
if (this.options.documentMode !== "editing") return;
|
|
53241
53158
|
if (!isHeadless(this)) {
|
|
53242
53159
|
const isHeader = hasSomeParentWithClass(event.target, "pagination-section-header");
|
|
53243
53160
|
const isFooter = hasSomeParentWithClass(event.target, "pagination-section-footer");
|
|
53244
53161
|
if (isHeader || isFooter) {
|
|
53245
|
-
const
|
|
53162
|
+
const EventConstructor = event.constructor;
|
|
53163
|
+
const eventClone = new EventConstructor(event.type);
|
|
53246
53164
|
event.target.dispatchEvent(eventClone);
|
|
53247
53165
|
if (this.options.isHeaderOrFooter && this.options.editable) setWordSelection(view, pos);
|
|
53248
53166
|
return;
|
|
@@ -53260,7 +53178,7 @@ createView_fn = function(element) {
|
|
|
53260
53178
|
const pm = this.view?.dom || this.options.element?.querySelector?.(".ProseMirror");
|
|
53261
53179
|
if (pm) {
|
|
53262
53180
|
pm.classList.remove("header-footer-edit");
|
|
53263
|
-
pm.setAttribute("aria-readonly", false);
|
|
53181
|
+
pm.setAttribute("aria-readonly", "false");
|
|
53264
53182
|
}
|
|
53265
53183
|
}
|
|
53266
53184
|
setWordSelection(view, pos);
|
|
@@ -53271,7 +53189,7 @@ createView_fn = function(element) {
|
|
|
53271
53189
|
});
|
|
53272
53190
|
this.view.updateState(newState);
|
|
53273
53191
|
this.createNodeViews();
|
|
53274
|
-
this.options.telemetry?.
|
|
53192
|
+
this.options.telemetry?.trackUsage?.("editor_initialized", {});
|
|
53275
53193
|
};
|
|
53276
53194
|
onCollaborationReady_fn = function({ editor, ydoc }) {
|
|
53277
53195
|
if (this.options.collaborationIsReady) return;
|
|
@@ -53289,7 +53207,7 @@ onCollaborationReady_fn = function({ editor, ydoc }) {
|
|
|
53289
53207
|
if (!this.options.isNewFile) {
|
|
53290
53208
|
__privateMethod$1(this, _Editor_instances, initPagination_fn).call(this);
|
|
53291
53209
|
__privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
|
|
53292
|
-
updateYdocDocxData(this);
|
|
53210
|
+
updateYdocDocxData(this, this.options.ydoc);
|
|
53293
53211
|
}
|
|
53294
53212
|
};
|
|
53295
53213
|
initComments_fn = function() {
|
|
@@ -53297,7 +53215,11 @@ initComments_fn = function() {
|
|
|
53297
53215
|
if (this.options.isHeadless) return;
|
|
53298
53216
|
if (!this.options.shouldLoadComments) return;
|
|
53299
53217
|
const replacedFile = this.options.replacedFile;
|
|
53300
|
-
this.emit("commentsLoaded", {
|
|
53218
|
+
this.emit("commentsLoaded", {
|
|
53219
|
+
editor: this,
|
|
53220
|
+
replacedFile,
|
|
53221
|
+
comments: this.converter.comments || []
|
|
53222
|
+
});
|
|
53301
53223
|
setTimeout(() => {
|
|
53302
53224
|
this.options.replacedFile = false;
|
|
53303
53225
|
const { state: state2, dispatch } = this.view;
|
|
@@ -53414,11 +53336,12 @@ endCollaboration_fn = function() {
|
|
|
53414
53336
|
if (!this.options.ydoc) return;
|
|
53415
53337
|
try {
|
|
53416
53338
|
console.debug("🔗 [super-editor] Ending collaboration");
|
|
53417
|
-
|
|
53418
|
-
|
|
53339
|
+
this.options.collaborationProvider?.disconnect?.();
|
|
53340
|
+
this.options.ydoc.destroy();
|
|
53419
53341
|
} catch (error) {
|
|
53420
|
-
|
|
53421
|
-
|
|
53342
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
53343
|
+
this.emit("exception", { error: err, editor: this });
|
|
53344
|
+
console.error(err);
|
|
53422
53345
|
}
|
|
53423
53346
|
};
|
|
53424
53347
|
validateDocumentInit_fn = function() {
|
|
@@ -55707,6 +55630,7 @@ const DocumentSection = Node$1.create({
|
|
|
55707
55630
|
return new DocumentSectionView(node, getPos, decorations, editor);
|
|
55708
55631
|
};
|
|
55709
55632
|
},
|
|
55633
|
+
// @ts-expect-error - Command signatures will be fixed in TS migration
|
|
55710
55634
|
addCommands() {
|
|
55711
55635
|
return {
|
|
55712
55636
|
/**
|
|
@@ -55964,6 +55888,7 @@ const Document = Node$1.create({
|
|
|
55964
55888
|
}
|
|
55965
55889
|
};
|
|
55966
55890
|
},
|
|
55891
|
+
// @ts-expect-error - Command signatures will be fixed in TS migration
|
|
55967
55892
|
addCommands() {
|
|
55968
55893
|
return {
|
|
55969
55894
|
/**
|
|
@@ -56101,6 +56026,7 @@ const Run = OxmlNode.create({
|
|
|
56101
56026
|
}
|
|
56102
56027
|
};
|
|
56103
56028
|
},
|
|
56029
|
+
// @ts-expect-error - Command signatures will be fixed in TS migration
|
|
56104
56030
|
addCommands() {
|
|
56105
56031
|
return {
|
|
56106
56032
|
splitRun
|
|
@@ -58635,6 +58561,9 @@ const TabNode = Node$1.create({
|
|
|
58635
58561
|
};
|
|
58636
58562
|
},
|
|
58637
58563
|
addPmPlugins() {
|
|
58564
|
+
if (isHeadless(this.editor)) {
|
|
58565
|
+
return [];
|
|
58566
|
+
}
|
|
58638
58567
|
const { view, helpers: helpers2 } = this.editor;
|
|
58639
58568
|
const mergeRanges2 = (ranges) => {
|
|
58640
58569
|
if (ranges.length === 0) return [];
|
|
@@ -58752,6 +58681,7 @@ const LineBreak = Node$1.create({
|
|
|
58752
58681
|
clear: { rendered: false }
|
|
58753
58682
|
};
|
|
58754
58683
|
},
|
|
58684
|
+
// @ts-expect-error - Command signatures will be fixed in TS migration
|
|
58755
58685
|
addCommands() {
|
|
58756
58686
|
return {
|
|
58757
58687
|
/**
|
|
@@ -58814,6 +58744,7 @@ const HardBreak = Node$1.create({
|
|
|
58814
58744
|
renderDOM({ htmlAttributes }) {
|
|
58815
58745
|
return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
58816
58746
|
},
|
|
58747
|
+
// @ts-expect-error - Command signatures will be fixed in TS migration
|
|
58817
58748
|
addCommands() {
|
|
58818
58749
|
return {
|
|
58819
58750
|
/**
|
|
@@ -61560,9 +61491,9 @@ const Table = Node$1.create({
|
|
|
61560
61491
|
const attrs = Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
|
|
61561
61492
|
style: tableWidth ? `width: ${tableWidth}` : `min-width: ${tableMinWidth}`
|
|
61562
61493
|
});
|
|
61563
|
-
|
|
61564
|
-
return table;
|
|
61494
|
+
return ["table", attrs, colgroup, ["tbody", 0]];
|
|
61565
61495
|
},
|
|
61496
|
+
// @ts-expect-error - Command signatures will be fixed in TS migration
|
|
61566
61497
|
addCommands() {
|
|
61567
61498
|
return {
|
|
61568
61499
|
/**
|
|
@@ -62084,9 +62015,13 @@ const Table = Node$1.create({
|
|
|
62084
62015
|
return [
|
|
62085
62016
|
...resizable ? [
|
|
62086
62017
|
columnResizing({
|
|
62018
|
+
// @ts-expect-error - Options types will be fixed in TS migration
|
|
62087
62019
|
handleWidth: this.options.handleWidth,
|
|
62020
|
+
// @ts-expect-error - Options types will be fixed in TS migration
|
|
62088
62021
|
cellMinWidth: this.options.cellMinWidth,
|
|
62022
|
+
// @ts-expect-error - Options types will be fixed in TS migration
|
|
62089
62023
|
defaultCellMinWidth: this.options.cellMinWidth,
|
|
62024
|
+
// @ts-expect-error - Options types will be fixed in TS migration
|
|
62090
62025
|
lastColumnResizable: this.options.lastColumnResizable,
|
|
62091
62026
|
View: createTableView({
|
|
62092
62027
|
editor: this.editor
|
|
@@ -62094,6 +62029,7 @@ const Table = Node$1.create({
|
|
|
62094
62029
|
})
|
|
62095
62030
|
] : [],
|
|
62096
62031
|
tableEditing({
|
|
62032
|
+
// @ts-expect-error - Options types will be fixed in TS migration
|
|
62097
62033
|
allowTableNodeSelection: this.options.allowTableNodeSelection
|
|
62098
62034
|
})
|
|
62099
62035
|
];
|
|
@@ -62156,6 +62092,7 @@ const TableHeader = Node$1.create({
|
|
|
62156
62092
|
renderDOM: (attrs) => {
|
|
62157
62093
|
if (!attrs.colwidth) return {};
|
|
62158
62094
|
return {
|
|
62095
|
+
// @ts-expect-error - colwidth is known to be an array at runtime
|
|
62159
62096
|
"data-colwidth": attrs.colwidth.join(",")
|
|
62160
62097
|
};
|
|
62161
62098
|
}
|
|
@@ -62279,6 +62216,7 @@ const TableCell = Node$1.create({
|
|
|
62279
62216
|
renderDOM: (attrs) => {
|
|
62280
62217
|
if (!attrs.colwidth) return {};
|
|
62281
62218
|
return {
|
|
62219
|
+
// @ts-expect-error - colwidth is known to be an array at runtime
|
|
62282
62220
|
"data-colwidth": attrs.colwidth.join(",")
|
|
62283
62221
|
};
|
|
62284
62222
|
}
|
|
@@ -65374,6 +65312,7 @@ const BookmarkStart = Node$1.create({
|
|
|
65374
65312
|
renderDOM({ htmlAttributes }) {
|
|
65375
65313
|
return ["a", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
65376
65314
|
},
|
|
65315
|
+
// @ts-expect-error - Command signatures will be fixed in TS migration
|
|
65377
65316
|
addCommands() {
|
|
65378
65317
|
return {
|
|
65379
65318
|
/**
|
|
@@ -65477,6 +65416,7 @@ const BookmarkEnd = Node$1.create({
|
|
|
65477
65416
|
renderDOM({ htmlAttributes }) {
|
|
65478
65417
|
return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
65479
65418
|
},
|
|
65419
|
+
// @ts-expect-error - Command signatures will be fixed in TS migration
|
|
65480
65420
|
addCommands() {
|
|
65481
65421
|
return {
|
|
65482
65422
|
/**
|
|
@@ -65982,8 +65922,10 @@ const ContentBlock = Node$1.create({
|
|
|
65982
65922
|
if (size2.top) style2 += `top: ${size2.top}px; `;
|
|
65983
65923
|
if (size2.left) style2 += `left: ${size2.left}px; `;
|
|
65984
65924
|
if (size2.width) style2 += `width: ${size2.width.toString().endsWith("%") ? size2.width : `${size2.width}px`}; `;
|
|
65985
|
-
if (size2.height)
|
|
65986
|
-
|
|
65925
|
+
if (size2.height) {
|
|
65926
|
+
const heightValue = size2.height.toString().endsWith("%") ? size2.height : `${size2.height}px`;
|
|
65927
|
+
style2 += `height: ${heightValue}; `;
|
|
65928
|
+
}
|
|
65987
65929
|
return { style: style2 };
|
|
65988
65930
|
}
|
|
65989
65931
|
},
|
|
@@ -66014,6 +65956,7 @@ const ContentBlock = Node$1.create({
|
|
|
66014
65956
|
renderDOM({ htmlAttributes }) {
|
|
66015
65957
|
return ["div", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes, { "data-type": this.name })];
|
|
66016
65958
|
},
|
|
65959
|
+
// @ts-expect-error - Command signatures will be fixed in TS migration
|
|
66017
65960
|
addCommands() {
|
|
66018
65961
|
return {
|
|
66019
65962
|
/**
|
|
@@ -75338,6 +75281,7 @@ function setSearchState(tr, query, range2 = null) {
|
|
|
75338
75281
|
}
|
|
75339
75282
|
const isRegExp = (value) => Object.prototype.toString.call(value) === "[object RegExp]";
|
|
75340
75283
|
const Search = Extension.create({
|
|
75284
|
+
// @ts-expect-error - Storage type mismatch will be fixed in TS migration
|
|
75341
75285
|
addStorage() {
|
|
75342
75286
|
return {
|
|
75343
75287
|
/**
|