superdoc 0.30.0-next.9 → 0.30.0
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-BvzVIj2M.es.js → PdfViewer-D_iKMNQq.es.js} +1 -1
- package/dist/chunks/{PdfViewer-DdqF0Jz2.cjs → PdfViewer-soUG7IDt.cjs} +1 -1
- package/dist/chunks/{index-CHYe9g4y.es.js → index-CkMyo2zy.es.js} +6 -7
- package/dist/chunks/{index-CGz3-6gE-C6-Xar1o.cjs → index-D04RPnYX-C9XCLJFR.cjs} +1 -1
- package/dist/chunks/{index-CGz3-6gE-Cujvn9Pw.es.js → index-D04RPnYX-D4QY0wzH.es.js} +1 -1
- package/dist/chunks/{index-BS99f4H2.cjs → index-D4zMX0uJ.cjs} +6 -7
- package/dist/chunks/{super-editor.es--fmalU7v.es.js → super-editor.es-B2pA2Nu-.es.js} +16459 -14928
- package/dist/chunks/{super-editor.es-CO_az6Oa.cjs → super-editor.es-DmA8JlL1.cjs} +16459 -14928
- package/dist/packages/superdoc/src/core/SuperDoc.d.ts.map +1 -1
- package/dist/packages/superdoc/src/core/types/index.d.ts.map +1 -1
- package/dist/packages/superdoc/src/stores/comments-store.d.ts.map +1 -1
- package/dist/shared/common/Telemetry.d.ts +237 -0
- package/dist/shared/common/Telemetry.d.ts.map +1 -0
- package/dist/shared/common/collaboration/awareness.d.ts +39 -0
- package/dist/shared/common/collaboration/awareness.d.ts.map +1 -0
- package/dist/shared/common/document-types.d.ts +10 -0
- package/dist/shared/common/document-types.d.ts.map +1 -0
- package/dist/shared/common/event-types.d.ts +14 -0
- package/dist/shared/common/event-types.d.ts.map +1 -0
- package/dist/shared/common/helpers/compare-superdoc-versions.d.ts +8 -0
- package/dist/shared/common/helpers/compare-superdoc-versions.d.ts.map +1 -0
- package/dist/shared/common/helpers/get-file-object.d.ts +50 -0
- package/dist/shared/common/helpers/get-file-object.d.ts.map +1 -0
- package/dist/shared/common/helpers/v-click-outside.d.ts +11 -0
- package/dist/shared/common/helpers/v-click-outside.d.ts.map +1 -0
- package/dist/shared/common/index.d.ts +10 -0
- package/dist/shared/common/index.d.ts.map +1 -0
- package/dist/shared/common/key-transform.d.ts +44 -0
- package/dist/shared/common/key-transform.d.ts.map +1 -0
- package/dist/style.css +31 -11
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-a0L8wNod.js → converter-DrPdSxVd.js} +13843 -13341
- package/dist/super-editor/chunks/{docx-zipper-S0E2rgnn.js → docx-zipper-IcLp4qO8.js} +1 -1
- package/dist/super-editor/chunks/{editor-DmfydVEc.js → editor-CNJV20ln.js} +2522 -1507
- package/dist/super-editor/chunks/{index-CGz3-6gE.js → index-D04RPnYX.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-D5SCPeci.js → toolbar-D9Y3NWGF.js} +2 -2
- package/dist/super-editor/converter.es.js +2 -2
- 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/style.css +31 -11
- package/dist/super-editor/super-editor/src/components/slash-menu/utils.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/components/toolbar/defaultItems.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/components/toolbar/super-toolbar.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/ExtensionService.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/InputRule.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/commands/__tests__/schemaWithLists.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/commands/backspaceNextToList.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/commands/backspaceNextToList.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/commands/decreaseListIndent.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/commands/decreaseListIndent.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/commands/deleteListItem.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/commands/deleteListItem.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/commands/deleteNextToList.d.ts +15 -0
- package/dist/super-editor/super-editor/src/core/commands/deleteNextToList.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/commands/increaseListIndent.d.ts +1 -2
- package/dist/super-editor/super-editor/src/core/commands/increaseListIndent.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/commands/index.d.ts +7 -2
- package/dist/super-editor/super-editor/src/core/commands/liftListItem.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/commands/liftListItem.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/commands/list-helpers/is-list.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/commands/list-helpers/is-list.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/commands/list-helpers/list-indent-helpers.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/commands/list-helpers/list-indent-helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/commands/sinkListItem.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/commands/sinkListItem.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/commands/splitBlock.d.ts +1 -2
- package/dist/super-editor/super-editor/src/core/commands/splitBlock.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/commands/splitListItem.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/commands/splitListItem.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/commands/tests/test-schema.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/commands/toggleList.d.ts +56 -6
- package/dist/super-editor/super-editor/src/core/commands/toggleList.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/commands/wrapInList.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/commands/wrapInList.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/extensions/keymap.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/helpers/contentProcessor.d.ts +3 -3
- package/dist/super-editor/super-editor/src/core/helpers/createNodeFromContent.d.ts +2 -2
- package/dist/super-editor/super-editor/src/core/helpers/createNodeFromContent.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/helpers/importHtml.d.ts +2 -2
- package/dist/super-editor/super-editor/src/core/helpers/importHtml.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/helpers/importMarkdown.d.ts +2 -2
- package/dist/super-editor/super-editor/src/core/helpers/list-numbering-helpers.d.ts +42 -15
- 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/helpers/orderedListUtils.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/helpers/pasteListHelpers.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/helpers/pasteListHelpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/inputRules/docx-paste/docx-paste.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/inputRules/html/html-helpers.d.ts +5 -2
- package/dist/super-editor/super-editor/src/core/inputRules/html/html-helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/SuperConverter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts +1 -3
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/listImporter.d.ts +97 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/listImporter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts +0 -11
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/markImporter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/trackChangesImporter.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/index.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/utils.d.ts +4 -30
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/utils.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/index.d.ts +4 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/w-val.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/w-val.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/b-translator.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/b-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/caps/caps-translator.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/caps/caps-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/index.d.ts +3 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-color.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-color.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-shade.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-shade.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-tint.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-tint.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-val.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-val.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/color-translator.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/color-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/headers/headers-translator.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/headers/headers-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/index.d.ts +3 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/w-val.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/w-val.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/i/i-translator.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/i/i-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/legacy-handle-paragraph-node.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pict/helpers/handle-v-rect-import.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pict/helpers/handle-v-rect-import.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/helpers.d.ts +37 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/index.d.ts +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/split-run-properties.d.ts +10 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/split-run-properties.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/r/r-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/index.d.ts +3 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-ascii.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-ascii.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-cs.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-cs.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-east-asia.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-east-asia.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-hansi.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-hansi.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-val.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-val.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/rFonts-translator.d.ts +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/rFonts-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/index.d.ts +3 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/w-val.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/w-val.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rStyle/rstyle-translator.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rStyle/rstyle-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rpr/rpr-translator.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rpr/rpr-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rpr/run-property-translators.d.ts +12 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rpr/run-property-translators.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/index.d.ts +3 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/w-val.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/w-val.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/strike-translator.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/strike-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/index.d.ts +3 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/w-val.d.ts +5 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/w-val.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/sz-translator.d.ts +3 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/sz-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/szcs/szcs-translator.d.ts +3 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/szcs/szcs-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-pos.d.ts +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-pos.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/{w-tab-type.d.ts → w-tab-size.d.ts} +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-size.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tab/tab-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tblGrid/tblGrid-translator.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/bullet-list/bullet-list.d.ts +15 -0
- package/dist/super-editor/super-editor/src/extensions/bullet-list/bullet-list.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/bullet-list/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/extensions/bullet-list/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/field-annotation/cleanup-commands/cleanUpListsWithAnnotations.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/field-annotation/cleanup-commands/index.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/index.d.ts +4 -1
- package/dist/super-editor/super-editor/src/extensions/index.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/linked-styles/helpers.d.ts +1 -1
- package/dist/super-editor/super-editor/src/extensions/linked-styles/helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/list-item/ListItemNodeView.d.ts +43 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/ListItemNodeView.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/helpers/listItemTypography.d.ts +68 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/helpers/listItemTypography.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/helpers/styledListMarkerPlugin.d.ts +13 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/helpers/styledListMarkerPlugin.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/list-item.d.ts +51 -0
- package/dist/super-editor/super-editor/src/extensions/list-item/list-item.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/ordered-list/helpers/orderedListMarkerPlugin.d.ts +3 -0
- package/dist/super-editor/super-editor/src/extensions/ordered-list/helpers/orderedListMarkerPlugin.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/ordered-list/helpers/orderedListSyncPlugin.d.ts +6 -0
- package/dist/super-editor/super-editor/src/extensions/ordered-list/helpers/orderedListSyncPlugin.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/ordered-list/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/extensions/ordered-list/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/ordered-list/ordered-list.d.ts +38 -0
- package/dist/super-editor/super-editor/src/extensions/ordered-list/ordered-list.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/paragraph/helpers/getDefaultSpacing.d.ts +4 -4
- package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/run/commands/split-run.d.ts +0 -1
- package/dist/super-editor/super-editor/src/extensions/run/commands/split-run.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts +2 -14
- package/dist/super-editor/super-editor/src/extensions/tab/helpers/tabDecorations.d.ts.map +1 -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/track-changes/permission-helpers.d.ts.map +1 -1
- package/dist/super-editor/super-editor.es.js +59 -98
- 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 +16509 -14979
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/super-editor/super-editor/src/core/commands/changeListLevel.d.ts +0 -15
- package/dist/super-editor/super-editor/src/core/commands/changeListLevel.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/commands/removeNumberingProperties.d.ts +0 -4
- package/dist/super-editor/super-editor/src/core/commands/removeNumberingProperties.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/commands/restartNumbering.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/commands/restartNumbering.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/styles.d.ts +0 -26
- package/dist/super-editor/super-editor/src/core/super-converter/styles.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/adjustRightInd/adjustRightInd-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/adjustRightInd/adjustRightInd-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/adjustRightInd/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/adjustRightInd/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDE/autoSpaceDE-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDE/autoSpaceDE-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDE/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDE/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDN/autoSpaceDN-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDN/autoSpaceDN-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDN/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDN/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bCs/bCs-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bCs/bCs-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bCs/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bCs/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bar/bar-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bar/bar-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bar/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bar/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/between/between-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/between/between-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/between/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/between/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bidi/bidi-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bidi/bidi-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bidi/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bidi/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/contextualSpacing/contextualSpacing-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/contextualSpacing/contextualSpacing-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/contextualSpacing/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/contextualSpacing/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/dstrike/dstrike-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/dstrike/dstrike-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/framePr/framePr-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/framePr/framePr-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/framePr/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/framePr/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ilvl/ilvl-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ilvl/ilvl-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ilvl/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ilvl/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ind/ind-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ind/ind-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ind/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ind/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepLines/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepLines/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepLines/keepLines-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepLines/keepLines-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepNext/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepNext/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepNext/keepNext-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepNext/keepNext-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/kinsoku/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/kinsoku/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/kinsoku/kinsoku-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/kinsoku/kinsoku-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/lang/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/lang/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/lang/lang-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/lang/lang-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/mirrorIndents/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/mirrorIndents/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/mirrorIndents/mirrorIndents-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/mirrorIndents/mirrorIndents-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numId/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numId/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numId/numId-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numId/numId-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numPr/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numPr/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numPr/numPr-translator.d.ts +0 -6
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numPr/numPr-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/outlineLvl/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/outlineLvl/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/outlineLvl/outlineLvl-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/outlineLvl/outlineLvl-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/overflowPunct/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/overflowPunct/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/overflowPunct/overflowPunct-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/overflowPunct/overflowPunct-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pBdr/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pBdr/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pBdr/pBdr-translator.d.ts +0 -6
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pBdr/pBdr-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pPr/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pPr/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pPr/pPr-translator.d.ts +0 -6
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pPr/pPr-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pStyle/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pStyle/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pStyle/pStyle-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pStyle/pStyle-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pageBreakBefore/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pageBreakBefore/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pageBreakBefore/pageBreakBefore-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pageBreakBefore/pageBreakBefore-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/snapToGrid/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/snapToGrid/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/snapToGrid/snapToGrid-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/snapToGrid/snapToGrid-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/letter-spacing-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/letter-spacing-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/spacing-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/spacing-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressAutoHyphens/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressAutoHyphens/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressAutoHyphens/suppressAutoHyphens-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressAutoHyphens/suppressAutoHyphens-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressLineNumbers/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressLineNumbers/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressLineNumbers/suppressLineNumbers-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressLineNumbers/suppressLineNumbers-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressOverlap/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressOverlap/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressOverlap/suppressOverlap-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressOverlap/suppressOverlap-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-type.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tabs/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tabs/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tabs/tabs-translator.d.ts +0 -6
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tabs/tabs-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textAlignment/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textAlignment/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textAlignment/textAlignment-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textAlignment/textAlignment-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textboxTightWrap/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textboxTightWrap/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textboxTightWrap/textboxTightWrap-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textboxTightWrap/textboxTightWrap-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/topLinePunct/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/topLinePunct/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/topLinePunct/topLinePunct-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/topLinePunct/topLinePunct-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/widowControl/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/widowControl/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/widowControl/widowControl-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/widowControl/widowControl-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/wordWrap/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/wordWrap/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/wordWrap/wordWrap-translator.d.ts +0 -7
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/wordWrap/wordWrap-translator.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/paragraph/NumberingManager.d.ts +0 -30
- package/dist/super-editor/super-editor/src/extensions/paragraph/NumberingManager.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/paragraph/ParagraphNodeView.d.ts +0 -37
- package/dist/super-editor/super-editor/src/extensions/paragraph/ParagraphNodeView.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/paragraph/numberingPlugin.d.ts +0 -9
- package/dist/super-editor/super-editor/src/extensions/paragraph/numberingPlugin.d.ts.map +0 -1
|
@@ -9,11 +9,11 @@ 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, 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,
|
|
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
|
|
16
|
-
import { D as DocxZipper } from "./docx-zipper-
|
|
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-DrPdSxVd.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-IcLp4qO8.js";
|
|
17
17
|
import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
|
|
18
18
|
var GOOD_LEAF_SIZE = 200;
|
|
19
19
|
var RopeSequence = function RopeSequence2() {
|
|
@@ -8251,15 +8251,12 @@ const ensureMarks = (state, splittableMarks) => {
|
|
|
8251
8251
|
state.tr.ensureMarks(filtered);
|
|
8252
8252
|
}
|
|
8253
8253
|
};
|
|
8254
|
-
const splitBlock$1 = ({ keepMarks = true
|
|
8254
|
+
const splitBlock$1 = ({ keepMarks = true } = {}) => (props) => {
|
|
8255
8255
|
const { tr, state, dispatch, editor } = props;
|
|
8256
8256
|
const { selection, doc: doc2 } = tr;
|
|
8257
8257
|
const { $from, $to } = selection;
|
|
8258
8258
|
const extensionAttrs = editor.extensionService.attributes;
|
|
8259
|
-
|
|
8260
|
-
if (attrsToRemoveOverride.length > 0) {
|
|
8261
|
-
newAttrs = deleteAttributes(newAttrs, attrsToRemoveOverride);
|
|
8262
|
-
}
|
|
8259
|
+
const newAttrs = Attribute.getSplittedAttributes(extensionAttrs, $from.node().type.name, $from.node().attrs);
|
|
8263
8260
|
if (selection instanceof NodeSelection && selection.node.isBlock) {
|
|
8264
8261
|
if (!$from.parentOffset || !canSplit(doc2, $from.pos)) return false;
|
|
8265
8262
|
if (dispatch) {
|
|
@@ -8294,23 +8291,6 @@ const splitBlock$1 = ({ keepMarks = true, attrsToRemoveOverride = [] } = {}) =>
|
|
|
8294
8291
|
}
|
|
8295
8292
|
return true;
|
|
8296
8293
|
};
|
|
8297
|
-
function deleteAttributes(attrs, attrsToRemove) {
|
|
8298
|
-
const newAttrs = { ...attrs };
|
|
8299
|
-
attrsToRemove.forEach((attrName) => {
|
|
8300
|
-
const parts = attrName.split(".");
|
|
8301
|
-
if (parts.length === 1) {
|
|
8302
|
-
delete newAttrs[attrName];
|
|
8303
|
-
} else {
|
|
8304
|
-
let current = newAttrs;
|
|
8305
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
8306
|
-
if (current[parts[i]] == null) return;
|
|
8307
|
-
current = current[parts[i]];
|
|
8308
|
-
}
|
|
8309
|
-
delete current[parts[parts.length - 1]];
|
|
8310
|
-
}
|
|
8311
|
-
});
|
|
8312
|
-
return newAttrs;
|
|
8313
|
-
}
|
|
8314
8294
|
const deleteSelection$1 = (state, dispatch) => {
|
|
8315
8295
|
if (state.selection.empty)
|
|
8316
8296
|
return false;
|
|
@@ -9131,7 +9111,7 @@ const selectNodeBackward = () => ({ state, dispatch }) => {
|
|
|
9131
9111
|
const selectNodeForward = () => ({ state, dispatch }) => selectNodeForward$1(state, dispatch);
|
|
9132
9112
|
const selectTextblockStart = () => ({ state, dispatch }) => selectTextblockStart$1(state, dispatch);
|
|
9133
9113
|
const selectTextblockEnd = () => ({ state, dispatch }) => selectTextblockEnd$1(state, dispatch);
|
|
9134
|
-
const insertContent = (value, options = {}) => ({ tr, commands: commands2, editor }) => {
|
|
9114
|
+
const insertContent = (value, options = {}) => ({ tr, state, commands: commands2, editor }) => {
|
|
9135
9115
|
if (options.contentType) {
|
|
9136
9116
|
const validTypes = ["html", "markdown", "text", "schema"];
|
|
9137
9117
|
if (!validTypes.includes(options.contentType)) {
|
|
@@ -9142,7 +9122,7 @@ const insertContent = (value, options = {}) => ({ tr, commands: commands2, edito
|
|
|
9142
9122
|
const processedDoc = processContent({
|
|
9143
9123
|
content: value,
|
|
9144
9124
|
type: options.contentType,
|
|
9145
|
-
|
|
9125
|
+
schema: state.schema
|
|
9146
9126
|
});
|
|
9147
9127
|
const jsonContent = processedDoc.toJSON();
|
|
9148
9128
|
const ok = commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, jsonContent, options);
|
|
@@ -9169,13 +9149,12 @@ const removeWhitespaces = (node) => {
|
|
|
9169
9149
|
}
|
|
9170
9150
|
return node;
|
|
9171
9151
|
};
|
|
9172
|
-
function elementFromString(value
|
|
9152
|
+
function elementFromString(value) {
|
|
9173
9153
|
const wrappedValue = `<body>${value}</body>`;
|
|
9174
|
-
const html =
|
|
9154
|
+
const html = new window.DOMParser().parseFromString(wrappedValue, "text/html").body;
|
|
9175
9155
|
return removeWhitespaces(html);
|
|
9176
9156
|
}
|
|
9177
|
-
function createNodeFromContent(content,
|
|
9178
|
-
const schema = editor.schema;
|
|
9157
|
+
function createNodeFromContent(content, schema, options) {
|
|
9179
9158
|
options = {
|
|
9180
9159
|
slice: true,
|
|
9181
9160
|
parseOptions: {},
|
|
@@ -9199,7 +9178,7 @@ function createNodeFromContent(content, editor, options) {
|
|
|
9199
9178
|
throw new Error("[super-editor error]: Invalid JSON content", { cause: error });
|
|
9200
9179
|
}
|
|
9201
9180
|
console.warn("[super-editor warn]: Invalid content.", "Passed value:", content, "Error:", error);
|
|
9202
|
-
return createNodeFromContent("",
|
|
9181
|
+
return createNodeFromContent("", schema, options);
|
|
9203
9182
|
}
|
|
9204
9183
|
}
|
|
9205
9184
|
if (isTextContent) {
|
|
@@ -9229,9 +9208,9 @@ function createNodeFromContent(content, editor, options) {
|
|
|
9229
9208
|
})
|
|
9230
9209
|
});
|
|
9231
9210
|
if (options.slice) {
|
|
9232
|
-
DOMParser$1.fromSchema(contentCheckSchema).parseSlice(elementFromString(content
|
|
9211
|
+
DOMParser$1.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);
|
|
9233
9212
|
} else {
|
|
9234
|
-
DOMParser$1.fromSchema(contentCheckSchema).parse(elementFromString(content
|
|
9213
|
+
DOMParser$1.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);
|
|
9235
9214
|
}
|
|
9236
9215
|
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
9237
9216
|
throw new Error("[super-editor error]: Invalid HTML content", {
|
|
@@ -9241,11 +9220,11 @@ function createNodeFromContent(content, editor, options) {
|
|
|
9241
9220
|
}
|
|
9242
9221
|
const parser = DOMParser$1.fromSchema(schema);
|
|
9243
9222
|
if (options.slice) {
|
|
9244
|
-
return parser.parseSlice(elementFromString(content
|
|
9223
|
+
return parser.parseSlice(elementFromString(content), options.parseOptions).content;
|
|
9245
9224
|
}
|
|
9246
|
-
return parser.parse(elementFromString(content
|
|
9225
|
+
return parser.parse(elementFromString(content), options.parseOptions);
|
|
9247
9226
|
}
|
|
9248
|
-
return createNodeFromContent("",
|
|
9227
|
+
return createNodeFromContent("", schema, options);
|
|
9249
9228
|
}
|
|
9250
9229
|
function selectionToInsertionEnd(tr, startLen, bias) {
|
|
9251
9230
|
const last = tr.steps.length - 1;
|
|
@@ -9281,7 +9260,7 @@ const insertContentAt = (position, value, options) => ({ tr, dispatch, editor })
|
|
|
9281
9260
|
};
|
|
9282
9261
|
let content;
|
|
9283
9262
|
try {
|
|
9284
|
-
content = createNodeFromContent(value, editor, {
|
|
9263
|
+
content = createNodeFromContent(value, editor.schema, {
|
|
9285
9264
|
parseOptions: {
|
|
9286
9265
|
preserveWhitespace: "full",
|
|
9287
9266
|
...options.parseOptions
|
|
@@ -9368,112 +9347,539 @@ const undoInputRule = () => ({ state, dispatch }) => {
|
|
|
9368
9347
|
}
|
|
9369
9348
|
return false;
|
|
9370
9349
|
};
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9350
|
+
function wrapInList$1(listType, attrs = null) {
|
|
9351
|
+
return function(state, dispatch) {
|
|
9352
|
+
let { $from, $to } = state.selection;
|
|
9353
|
+
let range = $from.blockRange($to);
|
|
9354
|
+
if (!range)
|
|
9355
|
+
return false;
|
|
9356
|
+
let tr = dispatch ? state.tr : null;
|
|
9357
|
+
if (!wrapRangeInList(tr, range, listType, attrs))
|
|
9358
|
+
return false;
|
|
9359
|
+
if (dispatch)
|
|
9360
|
+
dispatch(tr.scrollIntoView());
|
|
9361
|
+
return true;
|
|
9362
|
+
};
|
|
9363
|
+
}
|
|
9364
|
+
function wrapRangeInList(tr, range, listType, attrs = null) {
|
|
9365
|
+
let doJoin = false, outerRange = range, doc2 = range.$from.doc;
|
|
9366
|
+
if (range.depth >= 2 && range.$from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {
|
|
9367
|
+
if (range.$from.index(range.depth - 1) == 0)
|
|
9368
|
+
return false;
|
|
9369
|
+
let $insert = doc2.resolve(range.start - 2);
|
|
9370
|
+
outerRange = new NodeRange($insert, $insert, range.depth);
|
|
9371
|
+
if (range.endIndex < range.parent.childCount)
|
|
9372
|
+
range = new NodeRange(range.$from, doc2.resolve(range.$to.end(range.depth)), range.depth);
|
|
9373
|
+
doJoin = true;
|
|
9374
|
+
}
|
|
9375
|
+
let wrap = findWrapping(outerRange, listType, attrs, range);
|
|
9376
|
+
if (!wrap)
|
|
9378
9377
|
return false;
|
|
9378
|
+
if (tr)
|
|
9379
|
+
doWrapInList(tr, range, wrap, doJoin, listType);
|
|
9380
|
+
return true;
|
|
9381
|
+
}
|
|
9382
|
+
function doWrapInList(tr, range, wrappers, joinBefore, listType) {
|
|
9383
|
+
let content = Fragment.empty;
|
|
9384
|
+
for (let i = wrappers.length - 1; i >= 0; i--)
|
|
9385
|
+
content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
|
|
9386
|
+
tr.step(new ReplaceAroundStep$1(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));
|
|
9387
|
+
let found = 0;
|
|
9388
|
+
for (let i = 0; i < wrappers.length; i++)
|
|
9389
|
+
if (wrappers[i].type == listType)
|
|
9390
|
+
found = i + 1;
|
|
9391
|
+
let splitDepth = wrappers.length - found;
|
|
9392
|
+
let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;
|
|
9393
|
+
for (let i = range.startIndex, e = range.endIndex, first2 = true; i < e; i++, first2 = false) {
|
|
9394
|
+
if (!first2 && canSplit(tr.doc, splitPos, splitDepth)) {
|
|
9395
|
+
tr.split(splitPos, splitDepth);
|
|
9396
|
+
splitPos += 2 * splitDepth;
|
|
9397
|
+
}
|
|
9398
|
+
splitPos += parent.child(i).nodeSize;
|
|
9379
9399
|
}
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
if (
|
|
9387
|
-
paragraphsInSelection.push({ node, pos });
|
|
9388
|
-
if (!firstListNode && predicate(node)) {
|
|
9389
|
-
firstListNode = node;
|
|
9390
|
-
} else if (!predicate(node)) {
|
|
9391
|
-
hasNonListParagraphs = true;
|
|
9392
|
-
}
|
|
9400
|
+
return tr;
|
|
9401
|
+
}
|
|
9402
|
+
function liftListItem$1(itemType) {
|
|
9403
|
+
return function(state, dispatch) {
|
|
9404
|
+
let { $from, $to } = state.selection;
|
|
9405
|
+
let range = $from.blockRange($to, (node) => node.childCount > 0 && node.firstChild.type == itemType);
|
|
9406
|
+
if (!range)
|
|
9393
9407
|
return false;
|
|
9408
|
+
if (!dispatch)
|
|
9409
|
+
return true;
|
|
9410
|
+
if ($from.node(range.depth - 1).type == itemType)
|
|
9411
|
+
return liftToOuterList(state, dispatch, itemType, range);
|
|
9412
|
+
else
|
|
9413
|
+
return liftOutOfList(state, dispatch, range);
|
|
9414
|
+
};
|
|
9415
|
+
}
|
|
9416
|
+
function liftToOuterList(state, dispatch, itemType, range) {
|
|
9417
|
+
let tr = state.tr, end2 = range.end, endOfList = range.$to.end(range.depth);
|
|
9418
|
+
if (end2 < endOfList) {
|
|
9419
|
+
tr.step(new ReplaceAroundStep$1(end2 - 1, endOfList, end2, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
|
|
9420
|
+
range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);
|
|
9421
|
+
}
|
|
9422
|
+
const target = liftTarget(range);
|
|
9423
|
+
if (target == null)
|
|
9424
|
+
return false;
|
|
9425
|
+
tr.lift(range, target);
|
|
9426
|
+
let $after = tr.doc.resolve(tr.mapping.map(end2, -1) - 1);
|
|
9427
|
+
if (canJoin(tr.doc, $after.pos) && $after.nodeBefore.type == $after.nodeAfter.type)
|
|
9428
|
+
tr.join($after.pos);
|
|
9429
|
+
dispatch(tr.scrollIntoView());
|
|
9430
|
+
return true;
|
|
9431
|
+
}
|
|
9432
|
+
function liftOutOfList(state, dispatch, range) {
|
|
9433
|
+
let tr = state.tr, list = range.parent;
|
|
9434
|
+
for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {
|
|
9435
|
+
pos -= list.child(i).nodeSize;
|
|
9436
|
+
tr.delete(pos - 1, pos + 1);
|
|
9437
|
+
}
|
|
9438
|
+
let $start = tr.doc.resolve(range.start), item = $start.nodeAfter;
|
|
9439
|
+
if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize)
|
|
9440
|
+
return false;
|
|
9441
|
+
let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;
|
|
9442
|
+
let parent = $start.node(-1), indexBefore = $start.index(-1);
|
|
9443
|
+
if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))
|
|
9444
|
+
return false;
|
|
9445
|
+
let start2 = $start.pos, end2 = start2 + item.nodeSize;
|
|
9446
|
+
tr.step(new ReplaceAroundStep$1(start2 - (atStart ? 1 : 0), end2 + (atEnd ? 1 : 0), start2 + 1, end2 - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
|
|
9447
|
+
dispatch(tr.scrollIntoView());
|
|
9448
|
+
return true;
|
|
9449
|
+
}
|
|
9450
|
+
function sinkListItem$1(itemType) {
|
|
9451
|
+
return function(state, dispatch) {
|
|
9452
|
+
let { $from, $to } = state.selection;
|
|
9453
|
+
let range = $from.blockRange($to, (node) => node.childCount > 0 && node.firstChild.type == itemType);
|
|
9454
|
+
if (!range)
|
|
9455
|
+
return false;
|
|
9456
|
+
let startIndex = range.startIndex;
|
|
9457
|
+
if (startIndex == 0)
|
|
9458
|
+
return false;
|
|
9459
|
+
let parent = range.parent, nodeBefore = parent.child(startIndex - 1);
|
|
9460
|
+
if (nodeBefore.type != itemType)
|
|
9461
|
+
return false;
|
|
9462
|
+
if (dispatch) {
|
|
9463
|
+
let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
|
|
9464
|
+
let inner = Fragment.from(nestedBefore ? itemType.create() : null);
|
|
9465
|
+
let slice2 = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
|
|
9466
|
+
let before = range.start, after = range.end;
|
|
9467
|
+
dispatch(state.tr.step(new ReplaceAroundStep$1(before - (nestedBefore ? 3 : 1), after, before, after, slice2, 1, true)).scrollIntoView());
|
|
9394
9468
|
}
|
|
9395
9469
|
return true;
|
|
9396
|
-
}
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9470
|
+
};
|
|
9471
|
+
}
|
|
9472
|
+
const wrapInList = (typeOrName, attrs = {}) => ({ state, dispatch }) => {
|
|
9473
|
+
const type = getNodeType(typeOrName, state.schema);
|
|
9474
|
+
return wrapInList$1(type, attrs)(state, dispatch);
|
|
9475
|
+
};
|
|
9476
|
+
function nearestListAt($pos, OrderedType, BulletType) {
|
|
9477
|
+
for (let d2 = $pos.depth; d2 >= 0; d2--) {
|
|
9478
|
+
const node = $pos.node(d2);
|
|
9479
|
+
if (node.type === OrderedType || node.type === BulletType) {
|
|
9480
|
+
return { node, pos: $pos.before(d2), depth: d2 };
|
|
9405
9481
|
}
|
|
9406
9482
|
}
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9483
|
+
return null;
|
|
9484
|
+
}
|
|
9485
|
+
function getEffectiveListKind(node) {
|
|
9486
|
+
if (!node) return null;
|
|
9487
|
+
const typeName = node.type?.name;
|
|
9488
|
+
const style = node.attrs?.["list-style-type"];
|
|
9489
|
+
if (typeName === "bulletList") return "bullet";
|
|
9490
|
+
if (typeName === "orderedList") {
|
|
9491
|
+
if (style === "bullet") return "bullet";
|
|
9492
|
+
const firstLI = node.firstChild;
|
|
9493
|
+
const liFmt = firstLI?.attrs?.listNumberingType;
|
|
9494
|
+
if (liFmt === "bullet") return "bullet";
|
|
9495
|
+
return "ordered";
|
|
9496
|
+
}
|
|
9497
|
+
return null;
|
|
9498
|
+
}
|
|
9499
|
+
function collectIntersectingTopLists({ doc: doc2, selection, OrderedType, BulletType }) {
|
|
9500
|
+
const { from: from2, to, $from, $to } = selection;
|
|
9501
|
+
const hit = /* @__PURE__ */ new Map();
|
|
9502
|
+
const startList = nearestListAt($from, OrderedType, BulletType);
|
|
9503
|
+
if (startList) hit.set(startList.pos, startList);
|
|
9504
|
+
const endList = nearestListAt($to, OrderedType, BulletType);
|
|
9505
|
+
if (endList) hit.set(endList.pos, endList);
|
|
9506
|
+
const a = $from.nodeAfter;
|
|
9507
|
+
if (a && (a.type === OrderedType || a.type === BulletType)) {
|
|
9508
|
+
hit.set($from.pos, { node: a, pos: $from.pos, depth: null });
|
|
9509
|
+
}
|
|
9510
|
+
const b = $to.nodeBefore;
|
|
9511
|
+
if (b && (b.type === OrderedType || b.type === BulletType)) {
|
|
9512
|
+
const posB = $to.pos - b.nodeSize;
|
|
9513
|
+
hit.set(posB, { node: b, pos: posB, depth: null });
|
|
9514
|
+
}
|
|
9515
|
+
doc2.nodesBetween(from2, to, (node, pos, parent) => {
|
|
9516
|
+
const isList2 = node.type === OrderedType || node.type === BulletType;
|
|
9517
|
+
if (!isList2) return true;
|
|
9518
|
+
const parentIsList = parent && (parent.type === OrderedType || parent.type === BulletType);
|
|
9519
|
+
if (!parentIsList) hit.set(pos, { node, pos, depth: null });
|
|
9520
|
+
return false;
|
|
9521
|
+
});
|
|
9522
|
+
return Array.from(hit.values()).sort((a2, b2) => b2.pos - a2.pos);
|
|
9523
|
+
}
|
|
9524
|
+
function computeListLevels(liNodes) {
|
|
9525
|
+
const levelsOut = [];
|
|
9526
|
+
const counters = [];
|
|
9527
|
+
for (let i = 0; i < liNodes.length; i++) {
|
|
9528
|
+
const lvl = Math.max(0, Number(liNodes[i]?.attrs?.level ?? 0));
|
|
9529
|
+
while (counters.length <= lvl) counters.push(0);
|
|
9530
|
+
counters.splice(lvl + 1);
|
|
9531
|
+
counters[lvl] = (counters[lvl] ?? 0) + 1;
|
|
9532
|
+
levelsOut.push(counters.slice(0, lvl + 1));
|
|
9533
|
+
}
|
|
9534
|
+
return levelsOut;
|
|
9535
|
+
}
|
|
9536
|
+
function rebuildListNodeWithNewNum({ oldList, toType, editor, schema, fixedNumId }) {
|
|
9537
|
+
const OrderedType = schema.nodes.orderedList;
|
|
9538
|
+
const isOrdered = toType === OrderedType;
|
|
9539
|
+
const numId = fixedNumId ?? ListHelpers.getNewListId(editor);
|
|
9540
|
+
if (fixedNumId == null) {
|
|
9541
|
+
ListHelpers.generateNewListDefinition?.({ numId: Number(numId), listType: toType, editor });
|
|
9542
|
+
}
|
|
9543
|
+
const liNodes = [];
|
|
9544
|
+
for (let i = 0; i < oldList.childCount; i++) {
|
|
9545
|
+
const li = oldList.child(i);
|
|
9546
|
+
if (li?.type?.name === "listItem") liNodes.push(li);
|
|
9547
|
+
}
|
|
9548
|
+
const computedLevels = isOrdered ? computeListLevels(liNodes) : [];
|
|
9549
|
+
const items = [];
|
|
9550
|
+
for (let i = 0; i < liNodes.length; i++) {
|
|
9551
|
+
const li = liNodes[i];
|
|
9552
|
+
const level = Math.max(0, Number(li.attrs?.level ?? 0));
|
|
9553
|
+
const listLevel = isOrdered ? computedLevels[i] ?? [i + 1] : Array.isArray(li.attrs?.listLevel) ? li.attrs.listLevel : [level + 1];
|
|
9554
|
+
const details = ListHelpers.getListDefinitionDetails?.({ numId: Number(numId), level, listType: toType, editor }) || {};
|
|
9555
|
+
const effectiveFmt = isOrdered ? details.numFmt || "decimal" : details.numFmt || "bullet";
|
|
9556
|
+
const effectiveLvlText = isOrdered ? details.lvlText || "%1." : details.lvlText || "•";
|
|
9557
|
+
const baseAttrs = li.attrs || {};
|
|
9558
|
+
const itemAttrs = {
|
|
9559
|
+
...baseAttrs,
|
|
9560
|
+
level,
|
|
9561
|
+
listLevel,
|
|
9562
|
+
numId,
|
|
9563
|
+
numPrType: "inline",
|
|
9564
|
+
listNumberingType: effectiveFmt,
|
|
9565
|
+
lvlText: effectiveLvlText
|
|
9566
|
+
};
|
|
9567
|
+
const contentJSON = li.content && li.content.size > 0 ? li.content.toJSON() : [{ type: "paragraph", content: [] }];
|
|
9568
|
+
items.push({
|
|
9569
|
+
type: "listItem",
|
|
9570
|
+
attrs: itemAttrs,
|
|
9571
|
+
content: contentJSON
|
|
9572
|
+
});
|
|
9573
|
+
}
|
|
9574
|
+
const containerJSON = {
|
|
9575
|
+
type: isOrdered ? "orderedList" : "bulletList",
|
|
9576
|
+
attrs: {
|
|
9577
|
+
listId: numId,
|
|
9578
|
+
"list-style-type": isOrdered ? items[0]?.attrs?.listNumberingType ?? "decimal" : items[0]?.attrs?.listNumberingType ?? "bullet",
|
|
9579
|
+
...isOrdered ? { order: 1 } : {}
|
|
9580
|
+
},
|
|
9581
|
+
content: items
|
|
9582
|
+
};
|
|
9583
|
+
return editor.schema.nodeFromJSON(containerJSON);
|
|
9584
|
+
}
|
|
9585
|
+
function buildListContainersFromParagraphs({ paragraphs, targetKind, editor, schema }) {
|
|
9586
|
+
const OrderedType = schema.nodes.orderedList;
|
|
9587
|
+
const BulletType = schema.nodes.bulletList;
|
|
9588
|
+
const toType = targetKind === "ordered" ? OrderedType : BulletType;
|
|
9589
|
+
const numId = ListHelpers.getNewListId(editor);
|
|
9590
|
+
ListHelpers.generateNewListDefinition?.({ numId, listType: toType, editor });
|
|
9591
|
+
const isOrdered = targetKind === "ordered";
|
|
9592
|
+
const containers = [];
|
|
9593
|
+
for (let i = 0; i < paragraphs.length; i++) {
|
|
9594
|
+
const { node } = paragraphs[i];
|
|
9595
|
+
const level = 0;
|
|
9596
|
+
const listLevel = [1];
|
|
9597
|
+
const numFmt = isOrdered ? "decimal" : "bullet";
|
|
9598
|
+
const lvlText = isOrdered ? "%1." : "•";
|
|
9599
|
+
const itemJSON = ListHelpers.createListItemNodeJSON({
|
|
9600
|
+
level,
|
|
9601
|
+
listLevel,
|
|
9602
|
+
numId,
|
|
9603
|
+
numFmt,
|
|
9604
|
+
lvlText,
|
|
9605
|
+
contentNode: node.toJSON()
|
|
9606
|
+
// preserve runs
|
|
9607
|
+
});
|
|
9608
|
+
itemJSON.attrs = {
|
|
9609
|
+
...itemJSON.attrs || {},
|
|
9610
|
+
level,
|
|
9611
|
+
listLevel,
|
|
9612
|
+
numId,
|
|
9613
|
+
numPrType: "inline",
|
|
9614
|
+
listNumberingType: numFmt,
|
|
9615
|
+
lvlText
|
|
9616
|
+
};
|
|
9617
|
+
const containerJSON = {
|
|
9618
|
+
type: isOrdered ? "orderedList" : "bulletList",
|
|
9619
|
+
attrs: {
|
|
9620
|
+
listId: numId,
|
|
9621
|
+
"list-style-type": isOrdered ? "decimal" : "bullet",
|
|
9622
|
+
...isOrdered ? { order: 1 } : {}
|
|
9623
|
+
},
|
|
9624
|
+
content: [itemJSON]
|
|
9625
|
+
};
|
|
9626
|
+
containers.push(editor.schema.nodeFromJSON(containerJSON));
|
|
9627
|
+
}
|
|
9628
|
+
return containers;
|
|
9629
|
+
}
|
|
9630
|
+
function setMappedSelectionSpan(tr, fromBefore, toBefore) {
|
|
9631
|
+
const mappedFrom = tr.mapping.map(fromBefore, -1);
|
|
9632
|
+
const mappedTo = tr.mapping.map(toBefore, 1);
|
|
9633
|
+
const $from = tr.doc.resolve(Math.max(1, Math.min(mappedFrom, tr.doc.content.size)));
|
|
9634
|
+
const $to = tr.doc.resolve(Math.max(1, Math.min(mappedTo, tr.doc.content.size)));
|
|
9635
|
+
tr.setSelection(TextSelection.between($from, $to));
|
|
9636
|
+
}
|
|
9637
|
+
function setCaretInsideFirstTextblockOfNodeAt(tr, containerPos) {
|
|
9638
|
+
const node = tr.doc.nodeAt(containerPos);
|
|
9639
|
+
if (!node) return;
|
|
9640
|
+
let found = null;
|
|
9641
|
+
node.descendants((n, p) => {
|
|
9642
|
+
if (n.isTextblock) {
|
|
9643
|
+
found = containerPos + p + 2;
|
|
9644
|
+
return false;
|
|
9419
9645
|
}
|
|
9646
|
+
return true;
|
|
9647
|
+
});
|
|
9648
|
+
if (found != null) {
|
|
9649
|
+
tr.setSelection(TextSelection.create(tr.doc, found, found));
|
|
9420
9650
|
} else {
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
ListHelpers.generateNewListDefinition({ numId: Number(numId), listType, editor });
|
|
9424
|
-
sharedNumberingProperties = {
|
|
9425
|
-
numId: Number(numId),
|
|
9426
|
-
ilvl: 0
|
|
9427
|
-
};
|
|
9651
|
+
const fallback = Math.min(tr.doc.content.size, Math.max(1, containerPos + 1));
|
|
9652
|
+
tr.setSelection(TextSelection.create(tr.doc, fallback, fallback));
|
|
9428
9653
|
}
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9654
|
+
}
|
|
9655
|
+
const toggleList = (listType) => ({ editor, state, tr, dispatch }) => {
|
|
9656
|
+
const { selection, doc: doc2 } = state;
|
|
9657
|
+
const OrderedType = editor.schema.nodes.orderedList;
|
|
9658
|
+
const BulletType = editor.schema.nodes.bulletList;
|
|
9659
|
+
const TargetType = typeof listType === "string" ? editor.schema.nodes[listType] : listType;
|
|
9660
|
+
const targetKind = TargetType === OrderedType ? "ordered" : "bullet";
|
|
9661
|
+
const isListNode = (n) => !!n && (n.type === OrderedType || n.type === BulletType);
|
|
9662
|
+
let near = nearestListAt(selection.$from, OrderedType, BulletType);
|
|
9663
|
+
if (!near) {
|
|
9664
|
+
const after = selection.$from.nodeAfter;
|
|
9665
|
+
if (isListNode(after)) {
|
|
9666
|
+
near = { node: after, pos: selection.$from.pos, depth: selection.$from.depth + 1 };
|
|
9667
|
+
} else {
|
|
9668
|
+
const before = selection.$from.nodeBefore;
|
|
9669
|
+
if (isListNode(before)) {
|
|
9670
|
+
const pos2 = selection.$from.pos - before.nodeSize;
|
|
9671
|
+
near = { node: before, pos: pos2, depth: selection.$from.depth + 1 };
|
|
9672
|
+
}
|
|
9673
|
+
}
|
|
9674
|
+
}
|
|
9675
|
+
const nearKind = near ? getEffectiveListKind(near.node) : null;
|
|
9676
|
+
if (near) {
|
|
9677
|
+
const isSameAsTarget = nearKind === targetKind;
|
|
9678
|
+
if (isSameAsTarget) {
|
|
9679
|
+
const candidateLists = collectIntersectingTopLists({ doc: doc2, selection, OrderedType, BulletType });
|
|
9680
|
+
let listsToUnwrap = candidateLists.filter(({ node }) => getEffectiveListKind(node) === targetKind);
|
|
9681
|
+
if (listsToUnwrap.length === 0 && getEffectiveListKind(near.node) === targetKind) {
|
|
9682
|
+
listsToUnwrap = [{ node: near.node, pos: near.pos, depth: near.depth ?? null }];
|
|
9683
|
+
}
|
|
9684
|
+
if (listsToUnwrap.length === 0) return false;
|
|
9685
|
+
let spanFromBefore2 = listsToUnwrap[0].pos;
|
|
9686
|
+
let spanToBefore2 = listsToUnwrap[0].pos + listsToUnwrap[0].node.nodeSize;
|
|
9687
|
+
for (let i = 1; i < listsToUnwrap.length; i++) {
|
|
9688
|
+
const { node, pos: pos2 } = listsToUnwrap[i];
|
|
9689
|
+
spanFromBefore2 = Math.min(spanFromBefore2, pos2);
|
|
9690
|
+
spanToBefore2 = Math.max(spanToBefore2, pos2 + node.nodeSize);
|
|
9691
|
+
}
|
|
9692
|
+
const ParagraphType = editor.schema.nodes.paragraph;
|
|
9693
|
+
listsToUnwrap.sort((a, b) => b.pos - a.pos);
|
|
9694
|
+
for (const { node, pos: pos2 } of listsToUnwrap) {
|
|
9695
|
+
const mappedFrom = tr.mapping.map(pos2, -1);
|
|
9696
|
+
const mappedTo = tr.mapping.map(pos2 + node.nodeSize, 1);
|
|
9697
|
+
const currentListNode = tr.doc.nodeAt(mappedFrom);
|
|
9698
|
+
const sourceListNode = currentListNode && (currentListNode.type === OrderedType || currentListNode.type === BulletType) ? currentListNode : node;
|
|
9699
|
+
const paragraphs = [];
|
|
9700
|
+
for (let i = 0; i < sourceListNode.childCount; i++) {
|
|
9701
|
+
const li = sourceListNode.child(i);
|
|
9702
|
+
if (li.type !== editor.schema.nodes.listItem) continue;
|
|
9703
|
+
const firstChild = li.firstChild;
|
|
9704
|
+
paragraphs.push(firstChild || ParagraphType.create());
|
|
9705
|
+
}
|
|
9706
|
+
if (paragraphs.length === 0) {
|
|
9707
|
+
paragraphs.push(ParagraphType.create());
|
|
9708
|
+
}
|
|
9709
|
+
const replacement = paragraphs.length === 1 ? paragraphs[0] : Fragment.from(paragraphs);
|
|
9710
|
+
tr.replaceWith(mappedFrom, mappedTo, replacement);
|
|
9711
|
+
}
|
|
9712
|
+
setMappedSelectionSpan(tr, spanFromBefore2, spanToBefore2);
|
|
9713
|
+
if (dispatch) dispatch(tr);
|
|
9714
|
+
return true;
|
|
9433
9715
|
}
|
|
9434
|
-
|
|
9435
|
-
|
|
9716
|
+
let touchedLists = collectIntersectingTopLists({ doc: doc2, selection, OrderedType, BulletType });
|
|
9717
|
+
if (touchedLists.length === 0) {
|
|
9718
|
+
touchedLists = [{ node: near.node, pos: near.pos, depth: near.depth }];
|
|
9719
|
+
}
|
|
9720
|
+
let spanFromBefore = Infinity;
|
|
9721
|
+
let spanToBefore = -Infinity;
|
|
9722
|
+
for (const { node, pos: pos2 } of touchedLists) {
|
|
9723
|
+
spanFromBefore = Math.min(spanFromBefore, pos2);
|
|
9724
|
+
spanToBefore = Math.max(spanToBefore, pos2 + node.nodeSize);
|
|
9725
|
+
}
|
|
9726
|
+
const sharedNumId = ListHelpers.getNewListId(editor);
|
|
9727
|
+
ListHelpers.generateNewListDefinition?.({ numId: sharedNumId, listType: TargetType, editor });
|
|
9728
|
+
touchedLists.sort((a, b) => b.pos - a.pos);
|
|
9729
|
+
for (const { node: oldList, pos: pos2 } of touchedLists) {
|
|
9730
|
+
const mapped = tr.mapping.map(pos2);
|
|
9731
|
+
const newList = rebuildListNodeWithNewNum({
|
|
9732
|
+
oldList,
|
|
9733
|
+
toType: TargetType,
|
|
9734
|
+
editor,
|
|
9735
|
+
schema: editor.schema,
|
|
9736
|
+
fixedNumId: String(sharedNumId)
|
|
9737
|
+
});
|
|
9738
|
+
tr.replaceWith(mapped, mapped + oldList.nodeSize, newList);
|
|
9739
|
+
}
|
|
9740
|
+
setMappedSelectionSpan(tr, spanFromBefore, spanToBefore);
|
|
9741
|
+
if (dispatch) dispatch(tr);
|
|
9742
|
+
return true;
|
|
9743
|
+
}
|
|
9744
|
+
const { from: from2, to, empty: empty2 } = selection;
|
|
9745
|
+
const collectParagraphs = () => {
|
|
9746
|
+
const out = [];
|
|
9747
|
+
doc2.nodesBetween(from2, to, (node, pos2) => {
|
|
9748
|
+
if (node.type.name === "paragraph") {
|
|
9749
|
+
const nodeFrom = pos2;
|
|
9750
|
+
const nodeTo = pos2 + node.nodeSize;
|
|
9751
|
+
if (nodeFrom < to && nodeTo > from2) out.push({ node, pos: pos2 });
|
|
9752
|
+
return false;
|
|
9753
|
+
}
|
|
9754
|
+
return true;
|
|
9755
|
+
});
|
|
9756
|
+
return out;
|
|
9757
|
+
};
|
|
9758
|
+
if (!empty2 && from2 !== to) {
|
|
9759
|
+
const paragraphs = collectParagraphs();
|
|
9760
|
+
if (paragraphs.length >= 1) {
|
|
9761
|
+
const first2 = paragraphs[0];
|
|
9762
|
+
const last = paragraphs[paragraphs.length - 1];
|
|
9763
|
+
const spanFromBefore = first2.pos;
|
|
9764
|
+
const spanToBefore = last.pos + last.node.nodeSize;
|
|
9765
|
+
const containers2 = buildListContainersFromParagraphs({
|
|
9766
|
+
paragraphs,
|
|
9767
|
+
targetKind,
|
|
9768
|
+
editor,
|
|
9769
|
+
schema: editor.schema
|
|
9770
|
+
});
|
|
9771
|
+
const replacement = paragraphs.length === 1 ? containers2[0] : Fragment.from(containers2);
|
|
9772
|
+
tr.replaceWith(spanFromBefore, spanToBefore, replacement);
|
|
9773
|
+
if (paragraphs.length === 1) {
|
|
9774
|
+
setCaretInsideFirstTextblockOfNodeAt(tr, spanFromBefore);
|
|
9775
|
+
} else {
|
|
9776
|
+
setMappedSelectionSpan(tr, spanFromBefore, spanToBefore);
|
|
9777
|
+
}
|
|
9778
|
+
if (dispatch) dispatch(tr);
|
|
9779
|
+
return true;
|
|
9436
9780
|
}
|
|
9437
|
-
updateNumberingProperties(sharedNumberingProperties, node, pos, editor, tr);
|
|
9438
9781
|
}
|
|
9782
|
+
const paraAtCursor = findParentNode((n) => n.type.name === "paragraph")(selection);
|
|
9783
|
+
if (!paraAtCursor) return false;
|
|
9784
|
+
const { node: paragraph, pos } = paraAtCursor;
|
|
9785
|
+
const containers = buildListContainersFromParagraphs({
|
|
9786
|
+
paragraphs: [{ node: paragraph, pos }],
|
|
9787
|
+
targetKind,
|
|
9788
|
+
editor,
|
|
9789
|
+
schema: editor.schema
|
|
9790
|
+
});
|
|
9791
|
+
tr.replaceWith(pos, pos + paragraph.nodeSize, containers[0]);
|
|
9792
|
+
setCaretInsideFirstTextblockOfNodeAt(tr, pos);
|
|
9439
9793
|
if (dispatch) dispatch(tr);
|
|
9440
9794
|
return true;
|
|
9441
9795
|
};
|
|
9442
|
-
const
|
|
9443
|
-
|
|
9444
|
-
if (
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
return handled;
|
|
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;
|
|
9448
9801
|
};
|
|
9449
|
-
const
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
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
|
+
}
|
|
9453
9809
|
}
|
|
9454
|
-
return
|
|
9810
|
+
return null;
|
|
9455
9811
|
};
|
|
9456
|
-
const
|
|
9457
|
-
const
|
|
9458
|
-
const
|
|
9459
|
-
if (!
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
if (outdented) {
|
|
9469
|
-
tr.scrollIntoView();
|
|
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 });
|
|
9470
9824
|
}
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9825
|
+
});
|
|
9826
|
+
if (!candidates.length && typeof fallbackPos === "number") {
|
|
9827
|
+
return [fallbackPos];
|
|
9474
9828
|
}
|
|
9475
|
-
|
|
9476
|
-
|
|
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 }) => {
|
|
9836
|
+
const { state } = editor;
|
|
9837
|
+
const currentItem = ListHelpers.getCurrentListItem && ListHelpers.getCurrentListItem(state) || findParentNode((n) => n.type && n.type.name === "listItem")(state.selection);
|
|
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
|
|
9880
|
+
});
|
|
9881
|
+
});
|
|
9882
|
+
return Object.values(parentListsMap).length ? !Object.values(parentListsMap).every((pos) => !pos) : true;
|
|
9477
9883
|
};
|
|
9478
9884
|
function isVisuallyEmptyParagraph(node) {
|
|
9479
9885
|
if (!node || node.type.name !== "paragraph") return false;
|
|
@@ -9490,7 +9896,7 @@ function isVisuallyEmptyParagraph(node) {
|
|
|
9490
9896
|
if (text.length > 0) return false;
|
|
9491
9897
|
let hasInlineLeaf = false;
|
|
9492
9898
|
node.descendants((n) => {
|
|
9493
|
-
if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak"
|
|
9899
|
+
if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak") {
|
|
9494
9900
|
hasInlineLeaf = true;
|
|
9495
9901
|
return false;
|
|
9496
9902
|
}
|
|
@@ -9499,6 +9905,468 @@ function isVisuallyEmptyParagraph(node) {
|
|
|
9499
9905
|
if (hasInlineLeaf) return false;
|
|
9500
9906
|
return true;
|
|
9501
9907
|
}
|
|
9908
|
+
function tryOutdentOneLevel(props) {
|
|
9909
|
+
return decreaseListIndent()(props);
|
|
9910
|
+
}
|
|
9911
|
+
const splitListItem = () => (props) => {
|
|
9912
|
+
const { tr, state, dispatch } = props;
|
|
9913
|
+
const type = getNodeType("listItem", state.schema);
|
|
9914
|
+
const { $from, $to, empty: empty2 } = state.selection;
|
|
9915
|
+
tr.setMeta("updateListSync", true);
|
|
9916
|
+
const listItemPM = findParentNode((n) => n.type === type)(state.selection);
|
|
9917
|
+
if (!listItemPM) return false;
|
|
9918
|
+
const { node: listItemNode } = listItemPM;
|
|
9919
|
+
if (state.selection.node && state.selection.node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {
|
|
9920
|
+
return false;
|
|
9921
|
+
}
|
|
9922
|
+
const paraPM = findParentNode((n) => n.type.name === "paragraph")(state.selection);
|
|
9923
|
+
if (!paraPM) return false;
|
|
9924
|
+
const originalParagraphNode = paraPM.node;
|
|
9925
|
+
const paraStart = paraPM.pos + 1;
|
|
9926
|
+
const listPM = findParentNode((n) => ["orderedList", "bulletList"].includes(n.type.name))(state.selection);
|
|
9927
|
+
if (!listPM) return false;
|
|
9928
|
+
const { node: parentListNode, pos: listStart } = listPM;
|
|
9929
|
+
const listEnd = listStart + parentListNode.nodeSize;
|
|
9930
|
+
let offsetInParagraph;
|
|
9931
|
+
if (empty2) {
|
|
9932
|
+
offsetInParagraph = state.selection.from - paraStart;
|
|
9933
|
+
} else {
|
|
9934
|
+
offsetInParagraph = $from.pos - paraStart;
|
|
9935
|
+
}
|
|
9936
|
+
const parentPara = $from.parent;
|
|
9937
|
+
const isEmptyPara = isVisuallyEmptyParagraph(parentPara);
|
|
9938
|
+
const atEndOfListItem = $from.node(-1).childCount === $from.indexAfter(-1);
|
|
9939
|
+
if (isEmptyPara && atEndOfListItem) {
|
|
9940
|
+
const currentLevel = typeof listItemNode?.attrs?.level === "number" ? listItemNode.attrs.level : 0;
|
|
9941
|
+
if (currentLevel > 0) {
|
|
9942
|
+
const outdented = tryOutdentOneLevel(props);
|
|
9943
|
+
if (outdented) {
|
|
9944
|
+
tr.scrollIntoView();
|
|
9945
|
+
if (dispatch) dispatch(tr);
|
|
9946
|
+
return true;
|
|
9947
|
+
}
|
|
9948
|
+
}
|
|
9949
|
+
return handleSplitInEmptyBlock(props, listItemPM);
|
|
9950
|
+
}
|
|
9951
|
+
if (isVisuallyEmptyParagraph(originalParagraphNode)) {
|
|
9952
|
+
const currentLevel = typeof listItemNode?.attrs?.level === "number" ? listItemNode.attrs.level : 0;
|
|
9953
|
+
if (currentLevel > 0) {
|
|
9954
|
+
const outdented = tryOutdentOneLevel(props);
|
|
9955
|
+
if (outdented) {
|
|
9956
|
+
tr.scrollIntoView();
|
|
9957
|
+
if (dispatch) dispatch(tr);
|
|
9958
|
+
return true;
|
|
9959
|
+
}
|
|
9960
|
+
}
|
|
9961
|
+
return handleSplitInEmptyBlock(props, listItemPM);
|
|
9962
|
+
}
|
|
9963
|
+
let paragraphContentToSplit = originalParagraphNode.content;
|
|
9964
|
+
if (!empty2) {
|
|
9965
|
+
const selectionStart = $from.pos - paraStart;
|
|
9966
|
+
const selectionEnd = $to.pos - paraStart;
|
|
9967
|
+
paragraphContentToSplit = originalParagraphNode.content.cut(0, selectionStart).append(originalParagraphNode.content.cut(selectionEnd));
|
|
9968
|
+
offsetInParagraph = selectionStart;
|
|
9969
|
+
}
|
|
9970
|
+
const beforeCursor = paragraphContentToSplit.cut(0, Math.max(0, offsetInParagraph));
|
|
9971
|
+
const afterCursor = paragraphContentToSplit.cut(Math.max(0, offsetInParagraph));
|
|
9972
|
+
const paragraphIndex = $from.index(-1);
|
|
9973
|
+
const listItemHasMultipleParagraphs = listItemNode.childCount > 1;
|
|
9974
|
+
let firstLI, secondLI;
|
|
9975
|
+
if (listItemHasMultipleParagraphs) {
|
|
9976
|
+
const contentBefore = [];
|
|
9977
|
+
for (let i = 0; i < paragraphIndex; i++) contentBefore.push(listItemNode.child(i));
|
|
9978
|
+
const contentAfter = [];
|
|
9979
|
+
for (let i = paragraphIndex + 1; i < listItemNode.childCount; i++) contentAfter.push(listItemNode.child(i));
|
|
9980
|
+
const firstParas = [
|
|
9981
|
+
...contentBefore,
|
|
9982
|
+
originalParagraphNode.type.create(originalParagraphNode.attrs, beforeCursor.size ? beforeCursor : null)
|
|
9983
|
+
].filter(Boolean);
|
|
9984
|
+
if (firstParas.length === 0) {
|
|
9985
|
+
firstParas.push(state.schema.nodes.paragraph.create(originalParagraphNode.attrs));
|
|
9986
|
+
}
|
|
9987
|
+
const secondParas = [
|
|
9988
|
+
originalParagraphNode.type.create(originalParagraphNode.attrs, afterCursor.size ? afterCursor : null),
|
|
9989
|
+
...contentAfter
|
|
9990
|
+
].filter(Boolean);
|
|
9991
|
+
if (secondParas.length === 0) {
|
|
9992
|
+
secondParas.push(state.schema.nodes.paragraph.create(originalParagraphNode.attrs));
|
|
9993
|
+
}
|
|
9994
|
+
firstLI = state.schema.nodes.listItem.create({ ...listItemNode.attrs }, Fragment.from(firstParas));
|
|
9995
|
+
secondLI = state.schema.nodes.listItem.create({ ...listItemNode.attrs }, Fragment.from(secondParas));
|
|
9996
|
+
} else {
|
|
9997
|
+
const firstParagraph = originalParagraphNode.type.create(
|
|
9998
|
+
originalParagraphNode.attrs,
|
|
9999
|
+
beforeCursor.size ? beforeCursor : null
|
|
10000
|
+
);
|
|
10001
|
+
const secondParagraph = originalParagraphNode.type.create(
|
|
10002
|
+
originalParagraphNode.attrs,
|
|
10003
|
+
afterCursor.size ? afterCursor : null
|
|
10004
|
+
);
|
|
10005
|
+
firstLI = state.schema.nodes.listItem.create({ ...listItemNode.attrs }, firstParagraph);
|
|
10006
|
+
secondLI = state.schema.nodes.listItem.create({ ...listItemNode.attrs }, secondParagraph);
|
|
10007
|
+
}
|
|
10008
|
+
if (!firstLI || !secondLI) return false;
|
|
10009
|
+
const ListType = parentListNode.type;
|
|
10010
|
+
const firstList = ListType.createAndFill(parentListNode.attrs, Fragment.from(firstLI));
|
|
10011
|
+
const secondList = ListType.createAndFill(parentListNode.attrs, Fragment.from(secondLI));
|
|
10012
|
+
if (!firstList || !secondList) return false;
|
|
10013
|
+
tr.replaceWith(listStart, listEnd, firstList);
|
|
10014
|
+
const insertAfterFirst = listStart + firstList.nodeSize;
|
|
10015
|
+
tr.insert(insertAfterFirst, secondList);
|
|
10016
|
+
const cursorPos = insertAfterFirst + 3;
|
|
10017
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(cursorPos), 1)).scrollIntoView();
|
|
10018
|
+
tr.setMeta("splitListItem", true);
|
|
10019
|
+
if (dispatch) dispatch(tr);
|
|
10020
|
+
return true;
|
|
10021
|
+
};
|
|
10022
|
+
const handleSplitInEmptyBlock = (props, currentListItem) => {
|
|
10023
|
+
const { state, editor, tr } = props;
|
|
10024
|
+
const { schema } = state;
|
|
10025
|
+
const { $from } = state.selection;
|
|
10026
|
+
const extensionAttrs = editor.extensionService.attributes;
|
|
10027
|
+
const listItemNode = currentListItem.node;
|
|
10028
|
+
const isEmptyParagraph = isVisuallyEmptyParagraph($from.parent);
|
|
10029
|
+
const listItemHasOtherContent = listItemNode.content.size > $from.parent.nodeSize;
|
|
10030
|
+
const isAtEndOfListItem = $from.indexAfter(-1) === $from.node(-1).childCount;
|
|
10031
|
+
if (isEmptyParagraph && listItemHasOtherContent && isAtEndOfListItem) {
|
|
10032
|
+
try {
|
|
10033
|
+
const listTypes2 = ["orderedList", "bulletList"];
|
|
10034
|
+
const parentList2 = findParentNode((n) => listTypes2.includes(n.type.name))(state.selection);
|
|
10035
|
+
if (!parentList2) return false;
|
|
10036
|
+
const newParagraphAttrs2 = Attribute.getSplittedAttributes(extensionAttrs, "paragraph", {});
|
|
10037
|
+
const newParagraph2 = schema.nodes.paragraph.create(newParagraphAttrs2);
|
|
10038
|
+
const newListItem = schema.nodes.listItem.create({ ...listItemNode.attrs }, newParagraph2);
|
|
10039
|
+
const ListType = parentList2.node.type;
|
|
10040
|
+
const newList = ListType.createAndFill(parentList2.node.attrs, Fragment.from(newListItem));
|
|
10041
|
+
if (!newList) return false;
|
|
10042
|
+
const insertPos = parentList2.pos + parentList2.node.nodeSize;
|
|
10043
|
+
tr.insert(insertPos, newList);
|
|
10044
|
+
const newPos2 = insertPos + 3;
|
|
10045
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(newPos2)));
|
|
10046
|
+
tr.scrollIntoView();
|
|
10047
|
+
return true;
|
|
10048
|
+
} catch (e) {
|
|
10049
|
+
console.error("Error creating new list item:", e);
|
|
10050
|
+
return false;
|
|
10051
|
+
}
|
|
10052
|
+
}
|
|
10053
|
+
if (isEmptyParagraph && listItemHasOtherContent && !isAtEndOfListItem) return false;
|
|
10054
|
+
const listTypes = ["orderedList", "bulletList"];
|
|
10055
|
+
const parentList = findParentNode((n) => listTypes.includes(n.type.name))(state.selection);
|
|
10056
|
+
if (!parentList) return false;
|
|
10057
|
+
const newParagraphAttrs = Attribute.getSplittedAttributes(extensionAttrs, "paragraph", {});
|
|
10058
|
+
let newParagraph = schema.nodes.paragraph.createAndFill(newParagraphAttrs);
|
|
10059
|
+
if (!newParagraph) newParagraph = schema.nodes.paragraph.create();
|
|
10060
|
+
const listStart = parentList.pos;
|
|
10061
|
+
const listEnd = parentList.pos + parentList.node.nodeSize;
|
|
10062
|
+
tr.replaceWith(listStart, listEnd, newParagraph);
|
|
10063
|
+
const newPos = listStart + 1;
|
|
10064
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(newPos)));
|
|
10065
|
+
tr.scrollIntoView();
|
|
10066
|
+
return true;
|
|
10067
|
+
};
|
|
10068
|
+
const sinkListItem = (typeOrName) => ({ state, dispatch }) => {
|
|
10069
|
+
const type = getNodeType(typeOrName, state.schema);
|
|
10070
|
+
return sinkListItem$1(type)(state, dispatch);
|
|
10071
|
+
};
|
|
10072
|
+
const liftListItem = (typeOrName) => ({ state, dispatch }) => {
|
|
10073
|
+
const type = getNodeType(typeOrName, state.schema);
|
|
10074
|
+
return liftListItem$1(type)(state, dispatch);
|
|
10075
|
+
};
|
|
10076
|
+
const deleteListItem = () => (props) => {
|
|
10077
|
+
const { tr, state } = props;
|
|
10078
|
+
const { selection } = state;
|
|
10079
|
+
tr.setMeta("updateListSync", true);
|
|
10080
|
+
if (!selection.empty) {
|
|
10081
|
+
const { from: from2, to } = selection;
|
|
10082
|
+
const fullySelectedBlocks = [];
|
|
10083
|
+
state.doc.nodesBetween(from2, to, (node, pos) => {
|
|
10084
|
+
if (node.isBlock && pos >= from2 && pos + node.nodeSize <= to) {
|
|
10085
|
+
fullySelectedBlocks.push({ pos, size: node.nodeSize });
|
|
10086
|
+
}
|
|
10087
|
+
});
|
|
10088
|
+
if (fullySelectedBlocks.length) {
|
|
10089
|
+
fullySelectedBlocks.sort((a, b) => b.pos - a.pos).forEach(({ pos, size }) => {
|
|
10090
|
+
tr.delete(pos, pos + size);
|
|
10091
|
+
});
|
|
10092
|
+
const $new = tr.doc.resolve(from2);
|
|
10093
|
+
tr.setSelection(TextSelection.near($new));
|
|
10094
|
+
return true;
|
|
10095
|
+
}
|
|
10096
|
+
return false;
|
|
10097
|
+
}
|
|
10098
|
+
const { $from } = state.selection;
|
|
10099
|
+
if ($from.parentOffset !== 0) return false;
|
|
10100
|
+
const currentListItem = findParentNode((n) => n.type.name === "listItem")(state.selection);
|
|
10101
|
+
if (!currentListItem) return false;
|
|
10102
|
+
const listTypes = ["orderedList", "bulletList"];
|
|
10103
|
+
const parentList = findParentNode((n) => listTypes.includes(n.type.name))(state.selection);
|
|
10104
|
+
if (!parentList) return false;
|
|
10105
|
+
const currentParagraphNode = findParentNode((n) => n.type.name === "paragraph")(state.selection);
|
|
10106
|
+
const paragraphNode = currentListItem.node.content.firstChild;
|
|
10107
|
+
if (paragraphNode !== currentParagraphNode.node) return false;
|
|
10108
|
+
const listFrom = parentList.pos;
|
|
10109
|
+
const listTo = listFrom + parentList.node.nodeSize;
|
|
10110
|
+
if (currentListItem.node.content.size === 0) {
|
|
10111
|
+
tr.delete(listFrom, listTo);
|
|
10112
|
+
return true;
|
|
10113
|
+
}
|
|
10114
|
+
const listItemContent = currentListItem.node.content;
|
|
10115
|
+
const nodes = [];
|
|
10116
|
+
listItemContent.forEach((child) => {
|
|
10117
|
+
nodes.push(child);
|
|
10118
|
+
});
|
|
10119
|
+
tr.replaceWith(listFrom, listTo, nodes);
|
|
10120
|
+
const $pos = tr.doc.resolve(listFrom + 1);
|
|
10121
|
+
tr.setSelection(TextSelection.near($pos));
|
|
10122
|
+
return true;
|
|
10123
|
+
};
|
|
10124
|
+
const increaseListIndent = (_targetPositions) => ({ editor, tr }) => {
|
|
10125
|
+
const { state } = editor;
|
|
10126
|
+
const currentItem = ListHelpers.getCurrentListItem && ListHelpers.getCurrentListItem(state) || findParentNode((n) => n.type && n.type.name === "listItem")(state.selection);
|
|
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 };
|
|
10136
|
+
});
|
|
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;
|
|
10167
|
+
};
|
|
10168
|
+
const isList = (n) => !!n && (n.type?.name === "orderedList" || n.type?.name === "bulletList");
|
|
10169
|
+
const findNodePosition = (doc2, targetNode) => {
|
|
10170
|
+
let nodePos = null;
|
|
10171
|
+
doc2.descendants((node, pos) => {
|
|
10172
|
+
if (node === targetNode) {
|
|
10173
|
+
nodePos = pos;
|
|
10174
|
+
return false;
|
|
10175
|
+
}
|
|
10176
|
+
return true;
|
|
10177
|
+
});
|
|
10178
|
+
return nodePos;
|
|
10179
|
+
};
|
|
10180
|
+
function getListContext(state) {
|
|
10181
|
+
const { $from } = state.selection;
|
|
10182
|
+
for (let d2 = $from.depth; d2 > 0; d2--) {
|
|
10183
|
+
const node = $from.node(d2 - 1);
|
|
10184
|
+
if (isList(node)) {
|
|
10185
|
+
const listDepth = d2 - 1;
|
|
10186
|
+
const listPos = $from.before(listDepth);
|
|
10187
|
+
const listNode = node;
|
|
10188
|
+
const liNode = listNode.firstChild || null;
|
|
10189
|
+
if (!liNode || liNode.type.name !== "listItem") return null;
|
|
10190
|
+
return { listDepth, listPos, listNode, liNode };
|
|
10191
|
+
}
|
|
10192
|
+
}
|
|
10193
|
+
return null;
|
|
10194
|
+
}
|
|
10195
|
+
const handleBackspaceNextToList = () => ({ state, dispatch, editor }) => {
|
|
10196
|
+
const { selection, doc: doc2, schema } = state;
|
|
10197
|
+
const { $from } = selection;
|
|
10198
|
+
if (!selection.empty) return false;
|
|
10199
|
+
if ($from.parent.type.name !== "paragraph") return false;
|
|
10200
|
+
const ctx = getListContext(state);
|
|
10201
|
+
if (ctx) {
|
|
10202
|
+
const { listPos, listNode, liNode } = ctx;
|
|
10203
|
+
const atStartOfParagraph = $from.parentOffset === 0;
|
|
10204
|
+
const itemIsEmpty = liNode.childCount > 0 ? liNode.firstChild?.content.size === 0 : true;
|
|
10205
|
+
if (!atStartOfParagraph && !itemIsEmpty) return false;
|
|
10206
|
+
const level = Number(liNode.attrs?.level ?? 0);
|
|
10207
|
+
if (level > 0) {
|
|
10208
|
+
const tr1 = state.tr.setMeta("updateListSync", true);
|
|
10209
|
+
const didOutdent = typeof decreaseListIndent === "function" && decreaseListIndent()({
|
|
10210
|
+
editor,
|
|
10211
|
+
state,
|
|
10212
|
+
tr: tr1,
|
|
10213
|
+
dispatch: (t) => dispatch && t && dispatch(t)
|
|
10214
|
+
});
|
|
10215
|
+
if (didOutdent) return true;
|
|
10216
|
+
const liPos = listPos + 1;
|
|
10217
|
+
const newLevel = Math.max(0, level - 1);
|
|
10218
|
+
const trFallback = state.tr.setMeta("updateListSync", true);
|
|
10219
|
+
trFallback.setNodeMarkup(liPos, null, { ...liNode.attrs, level: newLevel });
|
|
10220
|
+
dispatch(trFallback);
|
|
10221
|
+
return true;
|
|
10222
|
+
}
|
|
10223
|
+
const replacement = liNode && liNode.content && liNode.content.size > 0 ? liNode.content : Fragment.from(schema.nodes.paragraph.create());
|
|
10224
|
+
const from2 = listPos;
|
|
10225
|
+
const to = listPos + listNode.nodeSize;
|
|
10226
|
+
const tr2 = state.tr.setMeta("updateListSync", true);
|
|
10227
|
+
tr2.replaceWith(from2, to, replacement);
|
|
10228
|
+
const newPos = from2 + 1;
|
|
10229
|
+
tr2.setSelection(TextSelection.near(tr2.doc.resolve(newPos), 1)).scrollIntoView();
|
|
10230
|
+
dispatch(tr2);
|
|
10231
|
+
return true;
|
|
10232
|
+
}
|
|
10233
|
+
if ($from.parentOffset !== 0) return false;
|
|
10234
|
+
const parentDepth = $from.depth - 1;
|
|
10235
|
+
if (parentDepth < 0) return false;
|
|
10236
|
+
const container = $from.node(parentDepth);
|
|
10237
|
+
const idx = $from.index(parentDepth);
|
|
10238
|
+
if (idx === 0) return false;
|
|
10239
|
+
const beforeNode = container.child(idx - 1);
|
|
10240
|
+
if (!beforeNode || !isList(beforeNode)) return false;
|
|
10241
|
+
const listItem = beforeNode.lastChild;
|
|
10242
|
+
if (!listItem || listItem.type.name !== "listItem") return false;
|
|
10243
|
+
const targetPara = listItem.lastChild;
|
|
10244
|
+
if (!targetPara || targetPara.type.name !== "paragraph") return false;
|
|
10245
|
+
const paraStartPos = findNodePosition(doc2, targetPara);
|
|
10246
|
+
if (paraStartPos == null) return false;
|
|
10247
|
+
const inlineContent = Fragment.from($from.parent.content);
|
|
10248
|
+
const tr = state.tr.setMeta("updateListSync", true);
|
|
10249
|
+
const thisParaStart = $from.before();
|
|
10250
|
+
tr.delete(thisParaStart, thisParaStart + $from.parent.nodeSize);
|
|
10251
|
+
const insertPos = paraStartPos + 1 + targetPara.content.size;
|
|
10252
|
+
tr.insert(insertPos, inlineContent);
|
|
10253
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos), 1));
|
|
10254
|
+
dispatch(tr);
|
|
10255
|
+
return true;
|
|
10256
|
+
};
|
|
10257
|
+
function getParaCtx(state) {
|
|
10258
|
+
const { $from } = state.selection;
|
|
10259
|
+
for (let d2 = $from.depth; d2 >= 0; d2--) {
|
|
10260
|
+
const n = $from.node(d2);
|
|
10261
|
+
if (n.type.name === "paragraph") {
|
|
10262
|
+
const before = $from.before(d2);
|
|
10263
|
+
const endInside = before + 1 + n.content.size;
|
|
10264
|
+
return { para: n, paraDepth: d2, before, endInside };
|
|
10265
|
+
}
|
|
10266
|
+
}
|
|
10267
|
+
return null;
|
|
10268
|
+
}
|
|
10269
|
+
function atVisualParaEnd(state, ctx) {
|
|
10270
|
+
const { $from } = state.selection;
|
|
10271
|
+
const { para, paraDepth, endInside } = ctx;
|
|
10272
|
+
if ($from.parent.type.name === "paragraph" && $from.parentOffset === $from.parent.content.size) return true;
|
|
10273
|
+
if ($from.parent.type.name === "run" && $from.parentOffset === $from.parent.content.size) {
|
|
10274
|
+
const idxInPara = $from.index(paraDepth);
|
|
10275
|
+
return idxInPara === para.childCount - 1;
|
|
10276
|
+
}
|
|
10277
|
+
return $from.pos === endInside;
|
|
10278
|
+
}
|
|
10279
|
+
function getNextSiblingAtDepth(state, depth) {
|
|
10280
|
+
const pos = state.selection.$from.after(depth);
|
|
10281
|
+
if (pos == null) return { pos: null, next: null };
|
|
10282
|
+
const $pos = state.doc.resolve(pos);
|
|
10283
|
+
return { pos, next: $pos.nodeAfter || null };
|
|
10284
|
+
}
|
|
10285
|
+
const handleDeleteNextToList = () => ({ state, dispatch }) => {
|
|
10286
|
+
const { selection } = state;
|
|
10287
|
+
const { $from } = selection;
|
|
10288
|
+
if (!selection.empty) return false;
|
|
10289
|
+
const ctx = getParaCtx(state);
|
|
10290
|
+
if (!ctx) return false;
|
|
10291
|
+
const { paraDepth, endInside: paraEnd } = ctx;
|
|
10292
|
+
if (!atVisualParaEnd(state, ctx)) return false;
|
|
10293
|
+
const tr = state.tr;
|
|
10294
|
+
tr.setMeta("suppressAutoList", true);
|
|
10295
|
+
const insertAtParaEnd = (frag) => {
|
|
10296
|
+
const mapped = tr.mapping.map(paraEnd, 1);
|
|
10297
|
+
tr.insert(mapped, frag);
|
|
10298
|
+
return mapped;
|
|
10299
|
+
};
|
|
10300
|
+
let listItemDepth = -1;
|
|
10301
|
+
let listDepth = -1;
|
|
10302
|
+
for (let d2 = $from.depth; d2 > 0; d2--) {
|
|
10303
|
+
const maybeLI = $from.node(d2 - 1);
|
|
10304
|
+
if (maybeLI.type.name === "listItem") {
|
|
10305
|
+
listItemDepth = d2 - 1;
|
|
10306
|
+
if (d2 - 2 >= 0 && isList($from.node(d2 - 2))) listDepth = d2 - 2;
|
|
10307
|
+
break;
|
|
10308
|
+
}
|
|
10309
|
+
}
|
|
10310
|
+
if (listItemDepth !== -1 && listDepth !== -1) {
|
|
10311
|
+
const li = $from.node(listItemDepth);
|
|
10312
|
+
const paraIdxInLI = $from.index(listItemDepth + 1);
|
|
10313
|
+
if (paraIdxInLI < li.childCount - 1) return false;
|
|
10314
|
+
}
|
|
10315
|
+
const currentBlockDepth = listItemDepth !== -1 && listDepth !== -1 ? listDepth : paraDepth;
|
|
10316
|
+
const { pos: nextBeforePos, next: nextNode } = getNextSiblingAtDepth(state, currentBlockDepth);
|
|
10317
|
+
if (nextBeforePos == null || !nextNode) return false;
|
|
10318
|
+
const mergeParagraphAt = (beforePos) => {
|
|
10319
|
+
const livePara = tr.doc.resolve(beforePos).nodeAfter;
|
|
10320
|
+
if (!livePara || livePara.type.name !== "paragraph") return false;
|
|
10321
|
+
if (livePara.content.size === 0) {
|
|
10322
|
+
tr.delete(beforePos, beforePos + livePara.nodeSize);
|
|
10323
|
+
dispatch?.(tr);
|
|
10324
|
+
return true;
|
|
10325
|
+
}
|
|
10326
|
+
const ins = insertAtParaEnd(Fragment.from(livePara.content));
|
|
10327
|
+
const delFrom = tr.mapping.map(beforePos, 1);
|
|
10328
|
+
const delTo = tr.mapping.map(beforePos + livePara.nodeSize, 1);
|
|
10329
|
+
tr.delete(delFrom, delTo);
|
|
10330
|
+
const selPos = tr.mapping.map(ins + livePara.content.size, -1);
|
|
10331
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(selPos), -1)).scrollIntoView();
|
|
10332
|
+
dispatch?.(tr);
|
|
10333
|
+
return true;
|
|
10334
|
+
};
|
|
10335
|
+
const mergeListAt = (beforePos) => {
|
|
10336
|
+
const liveList = tr.doc.resolve(beforePos).nodeAfter;
|
|
10337
|
+
if (!liveList || !isList(liveList)) return true;
|
|
10338
|
+
const li = liveList.firstChild;
|
|
10339
|
+
if (!li || li.type.name !== "listItem" || li.childCount === 0) {
|
|
10340
|
+
tr.delete(beforePos, beforePos + liveList.nodeSize);
|
|
10341
|
+
dispatch?.(tr);
|
|
10342
|
+
return true;
|
|
10343
|
+
}
|
|
10344
|
+
let content = null;
|
|
10345
|
+
for (let i = 0; i < li.childCount; i++) {
|
|
10346
|
+
const ch = li.child(i);
|
|
10347
|
+
if (ch.type.name === "paragraph" && ch.content.size > 0) {
|
|
10348
|
+
content = ch.content;
|
|
10349
|
+
break;
|
|
10350
|
+
}
|
|
10351
|
+
}
|
|
10352
|
+
if (content) insertAtParaEnd(Fragment.from(content));
|
|
10353
|
+
const delFrom = tr.mapping.map(beforePos, 1);
|
|
10354
|
+
const delTo = tr.mapping.map(beforePos + liveList.nodeSize, 1);
|
|
10355
|
+
tr.delete(delFrom, delTo);
|
|
10356
|
+
const endPos = tr.mapping.map(paraEnd + (content ? content.size : 0), -1);
|
|
10357
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(endPos), -1)).scrollIntoView();
|
|
10358
|
+
dispatch?.(tr);
|
|
10359
|
+
return true;
|
|
10360
|
+
};
|
|
10361
|
+
if (nextNode.isTextblock) {
|
|
10362
|
+
const changed = mergeParagraphAt(nextBeforePos);
|
|
10363
|
+
return changed ? true : false;
|
|
10364
|
+
}
|
|
10365
|
+
if (isList(nextNode)) {
|
|
10366
|
+
return mergeListAt(nextBeforePos);
|
|
10367
|
+
}
|
|
10368
|
+
return false;
|
|
10369
|
+
};
|
|
9502
10370
|
const restoreSelection = () => ({ editor, state, tr }) => {
|
|
9503
10371
|
if (editor.options.lastSelection) {
|
|
9504
10372
|
const selectionTr = tr.setSelection(
|
|
@@ -9552,18 +10420,23 @@ const getSelectionMarks = () => ({ state, tr }) => {
|
|
|
9552
10420
|
};
|
|
9553
10421
|
const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9554
10422
|
__proto__: null,
|
|
9555
|
-
|
|
10423
|
+
atVisualParaEnd,
|
|
9556
10424
|
clearNodes,
|
|
10425
|
+
collectIntersectingTopLists,
|
|
9557
10426
|
command,
|
|
9558
10427
|
createParagraphNear,
|
|
9559
10428
|
decreaseListIndent,
|
|
9560
10429
|
defaultStyleDetector,
|
|
10430
|
+
deleteListItem,
|
|
9561
10431
|
deleteSelection,
|
|
9562
10432
|
exitCode,
|
|
9563
10433
|
first,
|
|
9564
10434
|
getEffectiveStyleId,
|
|
10435
|
+
getParaCtx,
|
|
9565
10436
|
getSelectionMarks,
|
|
9566
10437
|
getStyleIdFromMarks,
|
|
10438
|
+
handleBackspaceNextToList,
|
|
10439
|
+
handleDeleteNextToList,
|
|
9567
10440
|
increaseListIndent,
|
|
9568
10441
|
insertContent,
|
|
9569
10442
|
insertContentAt,
|
|
@@ -9576,9 +10449,11 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
9576
10449
|
joinForward,
|
|
9577
10450
|
joinUp,
|
|
9578
10451
|
liftEmptyBlock,
|
|
10452
|
+
liftListItem,
|
|
9579
10453
|
mapMarkToStyleKey,
|
|
10454
|
+
nearestListAt,
|
|
9580
10455
|
newlineInCode,
|
|
9581
|
-
|
|
10456
|
+
rebuildListNodeWithNewNum,
|
|
9582
10457
|
resetAttributes,
|
|
9583
10458
|
restoreSelection,
|
|
9584
10459
|
selectAll,
|
|
@@ -9586,11 +10461,14 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
9586
10461
|
selectNodeForward,
|
|
9587
10462
|
selectTextblockEnd,
|
|
9588
10463
|
selectTextblockStart,
|
|
10464
|
+
setMappedSelectionSpan,
|
|
9589
10465
|
setMark,
|
|
9590
10466
|
setMeta,
|
|
9591
10467
|
setNode,
|
|
9592
10468
|
setTextSelection,
|
|
10469
|
+
sinkListItem,
|
|
9593
10470
|
splitBlock: splitBlock$1,
|
|
10471
|
+
splitListItem,
|
|
9594
10472
|
toggleList,
|
|
9595
10473
|
toggleMark,
|
|
9596
10474
|
toggleMarkCascade,
|
|
@@ -9599,7 +10477,7 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
9599
10477
|
unsetAllMarks,
|
|
9600
10478
|
unsetMark,
|
|
9601
10479
|
updateAttributes,
|
|
9602
|
-
|
|
10480
|
+
wrapInList
|
|
9603
10481
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
9604
10482
|
const Commands = Extension.create({
|
|
9605
10483
|
name: "commands",
|
|
@@ -9624,7 +10502,8 @@ const handleBackspace = (editor) => {
|
|
|
9624
10502
|
return false;
|
|
9625
10503
|
},
|
|
9626
10504
|
() => commands2.deleteSelection(),
|
|
9627
|
-
() => commands2.
|
|
10505
|
+
() => commands2.handleBackspaceNextToList(),
|
|
10506
|
+
() => commands2.deleteListItem(),
|
|
9628
10507
|
() => commands2.joinBackward(),
|
|
9629
10508
|
() => commands2.selectNodeBackward()
|
|
9630
10509
|
]);
|
|
@@ -9632,6 +10511,7 @@ const handleBackspace = (editor) => {
|
|
|
9632
10511
|
const handleDelete = (editor) => {
|
|
9633
10512
|
return editor.commands.first(({ commands: commands2 }) => [
|
|
9634
10513
|
() => commands2.deleteSelection(),
|
|
10514
|
+
() => commands2.handleDeleteNextToList(),
|
|
9635
10515
|
() => commands2.joinForward(),
|
|
9636
10516
|
() => commands2.selectNodeForward()
|
|
9637
10517
|
]);
|
|
@@ -10148,8 +11028,7 @@ const _ExtensionService = class _ExtensionService {
|
|
|
10148
11028
|
getPos,
|
|
10149
11029
|
decorations,
|
|
10150
11030
|
htmlAttributes,
|
|
10151
|
-
extension
|
|
10152
|
-
extensionAttrs
|
|
11031
|
+
extension
|
|
10153
11032
|
});
|
|
10154
11033
|
};
|
|
10155
11034
|
return [extension.name, nodeview];
|
|
@@ -14202,7 +15081,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14202
15081
|
{ default: remarkStringify },
|
|
14203
15082
|
{ default: remarkGfm }
|
|
14204
15083
|
] = await Promise.all([
|
|
14205
|
-
import("./index-
|
|
15084
|
+
import("./index-D04RPnYX.js"),
|
|
14206
15085
|
import("./index-DRCvimau.js"),
|
|
14207
15086
|
import("./index-C_x_N6Uh.js"),
|
|
14208
15087
|
import("./index-D_sWOSiG.js"),
|
|
@@ -14420,7 +15299,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14420
15299
|
* @returns {Object | void} Migration results
|
|
14421
15300
|
*/
|
|
14422
15301
|
processCollaborationMigrations() {
|
|
14423
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.30.0
|
|
15302
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.30.0");
|
|
14424
15303
|
if (!this.options.ydoc) return;
|
|
14425
15304
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
14426
15305
|
let docVersion = metaMap.get("version");
|
|
@@ -14525,7 +15404,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
14525
15404
|
if (!targetNode || !html) return;
|
|
14526
15405
|
const start2 = targetNode.pos;
|
|
14527
15406
|
const end2 = start2 + targetNode.node.nodeSize;
|
|
14528
|
-
const htmlNode = createDocFromHTML(html, this);
|
|
15407
|
+
const htmlNode = createDocFromHTML(html, this.schema);
|
|
14529
15408
|
tr.replaceWith(start2, end2, htmlNode);
|
|
14530
15409
|
dispatch(tr);
|
|
14531
15410
|
}
|
|
@@ -14900,14 +15779,14 @@ generatePmData_fn = function() {
|
|
|
14900
15779
|
doc2 = createDocument(this.converter, this.schema, this);
|
|
14901
15780
|
doc2 = __privateMethod(this, _Editor_instances, prepareDocumentForImport_fn).call(this, doc2);
|
|
14902
15781
|
if (this.options.markdown) {
|
|
14903
|
-
doc2 = createDocFromMarkdown(this.options.markdown, this, { isImport: true });
|
|
14904
|
-
} else if (this.options.html) doc2 = createDocFromHTML(this.options.html, this, { isImport: true });
|
|
15782
|
+
doc2 = createDocFromMarkdown(this.options.markdown, this.schema, { isImport: true });
|
|
15783
|
+
} else if (this.options.html) doc2 = createDocFromHTML(this.options.html, this.schema, { isImport: true });
|
|
14905
15784
|
else if (this.options.jsonOverride) doc2 = this.schema.nodeFromJSON(this.options.jsonOverride);
|
|
14906
15785
|
if (fragment) doc2 = yXmlFragmentToProseMirrorRootNode(fragment, this.schema);
|
|
14907
15786
|
}
|
|
14908
15787
|
} else if (mode === "text" || mode === "html") {
|
|
14909
15788
|
if (loadFromSchema) doc2 = this.schema.nodeFromJSON(content);
|
|
14910
|
-
else if (content) doc2 = createDocFromHTML(content, this);
|
|
15789
|
+
else if (content) doc2 = createDocFromHTML(content, this.schema);
|
|
14911
15790
|
else doc2 = this.schema.topNodeType.createAndFill();
|
|
14912
15791
|
}
|
|
14913
15792
|
} catch (err) {
|
|
@@ -17749,7 +18628,7 @@ const splitRun = () => (props) => {
|
|
|
17749
18628
|
const { $from, empty: empty2 } = state.selection;
|
|
17750
18629
|
if (!empty2) return false;
|
|
17751
18630
|
if ($from.parent.type.name !== "run") return false;
|
|
17752
|
-
const handled =
|
|
18631
|
+
const handled = splitBlock(state, (transaction) => {
|
|
17753
18632
|
view.dispatch(transaction);
|
|
17754
18633
|
});
|
|
17755
18634
|
if (handled) {
|
|
@@ -17757,48 +18636,6 @@ const splitRun = () => (props) => {
|
|
|
17757
18636
|
}
|
|
17758
18637
|
return handled;
|
|
17759
18638
|
};
|
|
17760
|
-
function splitBlockPatch(state, dispatch) {
|
|
17761
|
-
let { $from } = state.selection;
|
|
17762
|
-
if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {
|
|
17763
|
-
if (!$from.parentOffset || !canSplit(state.doc, $from.pos)) return false;
|
|
17764
|
-
if (dispatch) dispatch(state.tr.split($from.pos).scrollIntoView());
|
|
17765
|
-
return true;
|
|
17766
|
-
}
|
|
17767
|
-
if (!$from.depth) return false;
|
|
17768
|
-
let types = [];
|
|
17769
|
-
let splitDepth, deflt, atEnd = false, atStart = false;
|
|
17770
|
-
for (let d2 = $from.depth; ; d2--) {
|
|
17771
|
-
let node = $from.node(d2);
|
|
17772
|
-
if (node.isBlock) {
|
|
17773
|
-
atEnd = $from.end(d2) == $from.pos + ($from.depth - d2);
|
|
17774
|
-
atStart = $from.start(d2) == $from.pos - ($from.depth - d2);
|
|
17775
|
-
deflt = defaultBlockAt$1($from.node(d2 - 1).contentMatchAt($from.indexAfter(d2 - 1)));
|
|
17776
|
-
types.unshift(null);
|
|
17777
|
-
splitDepth = d2;
|
|
17778
|
-
break;
|
|
17779
|
-
} else {
|
|
17780
|
-
if (d2 == 1) return false;
|
|
17781
|
-
types.unshift(null);
|
|
17782
|
-
}
|
|
17783
|
-
}
|
|
17784
|
-
let tr = state.tr;
|
|
17785
|
-
if (state.selection instanceof TextSelection || state.selection instanceof AllSelection) tr.deleteSelection();
|
|
17786
|
-
let splitPos = tr.mapping.map($from.pos);
|
|
17787
|
-
let can = canSplit(tr.doc, splitPos, types.length, types);
|
|
17788
|
-
if (!can) {
|
|
17789
|
-
types[0] = deflt ? { type: deflt } : null;
|
|
17790
|
-
can = canSplit(tr.doc, splitPos, types.length, types);
|
|
17791
|
-
}
|
|
17792
|
-
if (!can) return false;
|
|
17793
|
-
tr.split(splitPos, types.length, types);
|
|
17794
|
-
if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {
|
|
17795
|
-
let first2 = tr.mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first2);
|
|
17796
|
-
if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt))
|
|
17797
|
-
tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)), deflt);
|
|
17798
|
-
}
|
|
17799
|
-
if (dispatch) dispatch(tr.scrollIntoView());
|
|
17800
|
-
return true;
|
|
17801
|
-
}
|
|
17802
18639
|
const Run = OxmlNode.create({
|
|
17803
18640
|
name: "run",
|
|
17804
18641
|
oXmlName: "w:r",
|
|
@@ -17851,6 +18688,387 @@ const Run = OxmlNode.create({
|
|
|
17851
18688
|
return ["span", base2, 0];
|
|
17852
18689
|
}
|
|
17853
18690
|
});
|
|
18691
|
+
const inputRegex$1 = /^\s*([-+*])\s$/;
|
|
18692
|
+
const BulletList = Node$1.create({
|
|
18693
|
+
name: "bulletList",
|
|
18694
|
+
group: "block list",
|
|
18695
|
+
selectable: false,
|
|
18696
|
+
content() {
|
|
18697
|
+
return `${this.options.itemTypeName}+`;
|
|
18698
|
+
},
|
|
18699
|
+
addOptions() {
|
|
18700
|
+
return {
|
|
18701
|
+
itemTypeName: "listItem",
|
|
18702
|
+
htmlAttributes: {
|
|
18703
|
+
"aria-label": "Bullet list node"
|
|
18704
|
+
},
|
|
18705
|
+
keepMarks: true,
|
|
18706
|
+
keepAttributes: false
|
|
18707
|
+
};
|
|
18708
|
+
},
|
|
18709
|
+
parseDOM() {
|
|
18710
|
+
return [{ tag: "ul" }];
|
|
18711
|
+
},
|
|
18712
|
+
renderDOM({ htmlAttributes }) {
|
|
18713
|
+
const attributes = Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
18714
|
+
return ["ul", attributes, 0];
|
|
18715
|
+
},
|
|
18716
|
+
addAttributes() {
|
|
18717
|
+
return {
|
|
18718
|
+
"list-style-type": {
|
|
18719
|
+
default: "bullet",
|
|
18720
|
+
rendered: false
|
|
18721
|
+
},
|
|
18722
|
+
listId: {
|
|
18723
|
+
rendered: false
|
|
18724
|
+
},
|
|
18725
|
+
sdBlockId: {
|
|
18726
|
+
default: null,
|
|
18727
|
+
keepOnSplit: false,
|
|
18728
|
+
parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
|
|
18729
|
+
renderDOM: (attrs) => {
|
|
18730
|
+
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
18731
|
+
}
|
|
18732
|
+
},
|
|
18733
|
+
attributes: {
|
|
18734
|
+
rendered: false,
|
|
18735
|
+
keepOnSplit: true
|
|
18736
|
+
}
|
|
18737
|
+
};
|
|
18738
|
+
},
|
|
18739
|
+
addCommands() {
|
|
18740
|
+
return {
|
|
18741
|
+
/**
|
|
18742
|
+
* Toggle a bullet list at the current selection
|
|
18743
|
+
* @category Command
|
|
18744
|
+
* @example
|
|
18745
|
+
* // Toggle bullet list on selected text
|
|
18746
|
+
* editor.commands.toggleBulletList()
|
|
18747
|
+
* @note Converts selected paragraphs to list items or removes list formatting
|
|
18748
|
+
*/
|
|
18749
|
+
toggleBulletList: () => (params2) => {
|
|
18750
|
+
return toggleList(this.type)(params2);
|
|
18751
|
+
}
|
|
18752
|
+
};
|
|
18753
|
+
},
|
|
18754
|
+
addShortcuts() {
|
|
18755
|
+
return {
|
|
18756
|
+
"Mod-Shift-8": () => {
|
|
18757
|
+
return this.editor.commands.toggleBulletList();
|
|
18758
|
+
}
|
|
18759
|
+
};
|
|
18760
|
+
},
|
|
18761
|
+
addInputRules() {
|
|
18762
|
+
return [
|
|
18763
|
+
new InputRule({
|
|
18764
|
+
match: inputRegex$1,
|
|
18765
|
+
handler: ({ state, range }) => {
|
|
18766
|
+
const $pos = state.selection.$from;
|
|
18767
|
+
const listItemType = state.schema.nodes.listItem;
|
|
18768
|
+
for (let depth = $pos.depth; depth >= 0; depth--) {
|
|
18769
|
+
if ($pos.node(depth).type === listItemType) {
|
|
18770
|
+
return null;
|
|
18771
|
+
}
|
|
18772
|
+
}
|
|
18773
|
+
const { tr } = state;
|
|
18774
|
+
tr.delete(range.from, range.to);
|
|
18775
|
+
ListHelpers.createNewList({
|
|
18776
|
+
listType: this.type,
|
|
18777
|
+
tr,
|
|
18778
|
+
editor: this.editor
|
|
18779
|
+
});
|
|
18780
|
+
}
|
|
18781
|
+
})
|
|
18782
|
+
];
|
|
18783
|
+
}
|
|
18784
|
+
});
|
|
18785
|
+
const inputRegex = /^(\d+)\.\s$/;
|
|
18786
|
+
const OrderedList = Node$1.create({
|
|
18787
|
+
name: "orderedList",
|
|
18788
|
+
group: "block list",
|
|
18789
|
+
selectable: false,
|
|
18790
|
+
content() {
|
|
18791
|
+
return `${this.options.itemTypeName}+`;
|
|
18792
|
+
},
|
|
18793
|
+
addOptions() {
|
|
18794
|
+
return {
|
|
18795
|
+
itemTypeName: "listItem",
|
|
18796
|
+
htmlAttributes: {
|
|
18797
|
+
"aria-label": "Ordered list node"
|
|
18798
|
+
},
|
|
18799
|
+
keepMarks: true,
|
|
18800
|
+
keepAttributes: false,
|
|
18801
|
+
listStyleTypes: ["decimal", "lowerAlpha", "lowerRoman"]
|
|
18802
|
+
};
|
|
18803
|
+
},
|
|
18804
|
+
addAttributes() {
|
|
18805
|
+
return {
|
|
18806
|
+
order: {
|
|
18807
|
+
default: 1,
|
|
18808
|
+
parseDOM: (element) => {
|
|
18809
|
+
return element.hasAttribute("start") ? parseInt(element.getAttribute("start") || "", 10) : 1;
|
|
18810
|
+
},
|
|
18811
|
+
renderDOM: (attrs) => {
|
|
18812
|
+
return {
|
|
18813
|
+
start: attrs.order
|
|
18814
|
+
};
|
|
18815
|
+
}
|
|
18816
|
+
},
|
|
18817
|
+
sdBlockId: {
|
|
18818
|
+
default: null,
|
|
18819
|
+
keepOnSplit: false,
|
|
18820
|
+
parseDOM: (elem) => elem.getAttribute("data-sd-block-id"),
|
|
18821
|
+
renderDOM: (attrs) => {
|
|
18822
|
+
return attrs.sdBlockId ? { "data-sd-block-id": attrs.sdBlockId } : {};
|
|
18823
|
+
}
|
|
18824
|
+
},
|
|
18825
|
+
syncId: {
|
|
18826
|
+
default: null,
|
|
18827
|
+
parseDOM: (elem) => elem.getAttribute("data-sync-id"),
|
|
18828
|
+
renderDOM: (attrs) => {
|
|
18829
|
+
if (!attrs.syncId) return {};
|
|
18830
|
+
return {
|
|
18831
|
+
"data-sync-id": attrs.syncId
|
|
18832
|
+
};
|
|
18833
|
+
}
|
|
18834
|
+
// rendered: false,
|
|
18835
|
+
},
|
|
18836
|
+
listId: {
|
|
18837
|
+
keepOnSplit: true,
|
|
18838
|
+
parseDOM: (elem) => elem.getAttribute("data-list-id"),
|
|
18839
|
+
renderDOM: (attrs) => {
|
|
18840
|
+
if (!attrs.listId) return {};
|
|
18841
|
+
return {
|
|
18842
|
+
"data-list-id": attrs.listId
|
|
18843
|
+
};
|
|
18844
|
+
}
|
|
18845
|
+
},
|
|
18846
|
+
"list-style-type": {
|
|
18847
|
+
default: "decimal",
|
|
18848
|
+
rendered: false
|
|
18849
|
+
},
|
|
18850
|
+
attributes: {
|
|
18851
|
+
rendered: false,
|
|
18852
|
+
keepOnSplit: true
|
|
18853
|
+
}
|
|
18854
|
+
};
|
|
18855
|
+
},
|
|
18856
|
+
parseDOM() {
|
|
18857
|
+
return [{ tag: "ol" }];
|
|
18858
|
+
},
|
|
18859
|
+
renderDOM({ htmlAttributes }) {
|
|
18860
|
+
const { start: start2, ...restAttributes } = htmlAttributes;
|
|
18861
|
+
return start2 === 1 ? ["ol", Attribute.mergeAttributes(this.options.htmlAttributes, restAttributes), 0] : ["ol", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
18862
|
+
},
|
|
18863
|
+
addCommands() {
|
|
18864
|
+
return {
|
|
18865
|
+
/**
|
|
18866
|
+
* Toggle ordered list formatting
|
|
18867
|
+
* @category Command
|
|
18868
|
+
* @example
|
|
18869
|
+
* editor.commands.toggleOrderedList()
|
|
18870
|
+
* @note Converts selection to ordered list or back to paragraphs
|
|
18871
|
+
*/
|
|
18872
|
+
toggleOrderedList: () => (params2) => {
|
|
18873
|
+
return toggleList(this.type)(params2);
|
|
18874
|
+
},
|
|
18875
|
+
/**
|
|
18876
|
+
* Restart list node numbering
|
|
18877
|
+
* @category Command
|
|
18878
|
+
* @param {Array} followingNodes - Nodes to restart
|
|
18879
|
+
* @param {number} pos - Starting position
|
|
18880
|
+
* @example
|
|
18881
|
+
* editor.commands.restartListNodes(nodes, position)
|
|
18882
|
+
* @note Resets list numbering for specified nodes
|
|
18883
|
+
*/
|
|
18884
|
+
restartListNodes: (followingNodes, pos) => ({ tr }) => {
|
|
18885
|
+
let currentNodePos = pos;
|
|
18886
|
+
const nodes = followingNodes.map((node) => {
|
|
18887
|
+
const resultNode = {
|
|
18888
|
+
node,
|
|
18889
|
+
pos: currentNodePos
|
|
18890
|
+
};
|
|
18891
|
+
currentNodePos += node.nodeSize;
|
|
18892
|
+
return resultNode;
|
|
18893
|
+
});
|
|
18894
|
+
nodes.forEach((item) => {
|
|
18895
|
+
const { pos: pos2 } = item;
|
|
18896
|
+
const newPos = tr.mapping.map(pos2);
|
|
18897
|
+
tr.setNodeMarkup(newPos, void 0, {});
|
|
18898
|
+
});
|
|
18899
|
+
return true;
|
|
18900
|
+
},
|
|
18901
|
+
/**
|
|
18902
|
+
* Update ordered list style type based on nesting level
|
|
18903
|
+
* @category Command
|
|
18904
|
+
* @example
|
|
18905
|
+
* editor.commands.updateOrderedListStyleType()
|
|
18906
|
+
* @note Cycles through decimal -> lowerAlpha -> lowerRoman based on depth
|
|
18907
|
+
*/
|
|
18908
|
+
updateOrderedListStyleType: () => ({ dispatch, tr }) => {
|
|
18909
|
+
let list = findParentNode((node) => node.type.name === this.name)(tr.selection);
|
|
18910
|
+
if (!list) {
|
|
18911
|
+
return true;
|
|
18912
|
+
}
|
|
18913
|
+
if (dispatch) {
|
|
18914
|
+
let listLevel = (list.depth - 1) / 2;
|
|
18915
|
+
let listStyleTypes = this.options.listStyleTypes;
|
|
18916
|
+
let listStyle = listStyleTypes[listLevel % listStyleTypes.length];
|
|
18917
|
+
let currentListStyle = list.node.attrs["list-style-type"];
|
|
18918
|
+
let nodeAtPos = tr.doc.nodeAt(list.pos);
|
|
18919
|
+
if (currentListStyle !== listStyle && nodeAtPos.eq(list.node)) {
|
|
18920
|
+
tr.setNodeMarkup(list.pos, void 0, {
|
|
18921
|
+
...list.node.attrs,
|
|
18922
|
+
...{
|
|
18923
|
+
"list-style-type": listStyle
|
|
18924
|
+
}
|
|
18925
|
+
});
|
|
18926
|
+
}
|
|
18927
|
+
}
|
|
18928
|
+
return true;
|
|
18929
|
+
}
|
|
18930
|
+
};
|
|
18931
|
+
},
|
|
18932
|
+
addShortcuts() {
|
|
18933
|
+
return {
|
|
18934
|
+
"Mod-Shift-7": () => {
|
|
18935
|
+
return this.editor.commands.toggleOrderedList();
|
|
18936
|
+
}
|
|
18937
|
+
};
|
|
18938
|
+
},
|
|
18939
|
+
addInputRules() {
|
|
18940
|
+
return [
|
|
18941
|
+
new InputRule({
|
|
18942
|
+
match: inputRegex,
|
|
18943
|
+
handler: ({ state, range }) => {
|
|
18944
|
+
const $pos = state.selection.$from;
|
|
18945
|
+
const listItemType = state.schema.nodes.listItem;
|
|
18946
|
+
for (let depth = $pos.depth; depth >= 0; depth--) {
|
|
18947
|
+
if ($pos.node(depth).type === listItemType) {
|
|
18948
|
+
return null;
|
|
18949
|
+
}
|
|
18950
|
+
}
|
|
18951
|
+
const { tr } = state;
|
|
18952
|
+
tr.delete(range.from, range.to);
|
|
18953
|
+
ListHelpers.createNewList({
|
|
18954
|
+
listType: this.type,
|
|
18955
|
+
tr,
|
|
18956
|
+
editor: this.editor
|
|
18957
|
+
});
|
|
18958
|
+
}
|
|
18959
|
+
})
|
|
18960
|
+
];
|
|
18961
|
+
}
|
|
18962
|
+
});
|
|
18963
|
+
const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
|
|
18964
|
+
const handler = listIndexMap[listNumberingType];
|
|
18965
|
+
return handler ? handler(listLevel, lvlText, customFormat) : null;
|
|
18966
|
+
};
|
|
18967
|
+
const handleDecimal = (path, lvlText) => generateNumbering(path, lvlText, String);
|
|
18968
|
+
const handleRoman = (path, lvlText) => generateNumbering(path, lvlText, intToRoman);
|
|
18969
|
+
const handleLowerRoman = (path, lvlText) => handleRoman(path, lvlText).toLowerCase();
|
|
18970
|
+
const handleLowerAlpha = (path, lvlText) => handleAlpha(path, lvlText).toLowerCase();
|
|
18971
|
+
const handleAlpha = (path, lvlText) => generateNumbering(path, lvlText, (p) => intToAlpha(p));
|
|
18972
|
+
const handleOrdinal = (path, lvlText) => generateNumbering(path, lvlText, ordinalFormatter);
|
|
18973
|
+
const handleCustom = (path, lvlText, customFormat) => generateFromCustom(path, lvlText, customFormat);
|
|
18974
|
+
const handleJapaneseCounting = (path, lvlText) => generateNumbering(path, lvlText, intToJapaneseCounting);
|
|
18975
|
+
const listIndexMap = {
|
|
18976
|
+
decimal: handleDecimal,
|
|
18977
|
+
lowerRoman: handleLowerRoman,
|
|
18978
|
+
upperRoman: handleRoman,
|
|
18979
|
+
lowerLetter: handleLowerAlpha,
|
|
18980
|
+
upperLetter: handleAlpha,
|
|
18981
|
+
ordinal: handleOrdinal,
|
|
18982
|
+
custom: handleCustom,
|
|
18983
|
+
japaneseCounting: handleJapaneseCounting
|
|
18984
|
+
};
|
|
18985
|
+
const createNumbering = (values, lvlText) => {
|
|
18986
|
+
return values.reduce((acc, value, index2) => {
|
|
18987
|
+
return value > 9 ? acc.replace(/^0/, "").replace(`%${index2 + 1}`, value) : acc.replace(`%${index2 + 1}`, value);
|
|
18988
|
+
}, lvlText);
|
|
18989
|
+
};
|
|
18990
|
+
const generateNumbering = (path, lvlText, formatter) => {
|
|
18991
|
+
const formattedValues = path.map(formatter);
|
|
18992
|
+
return createNumbering(formattedValues, lvlText);
|
|
18993
|
+
};
|
|
18994
|
+
const ordinalFormatter = (level) => {
|
|
18995
|
+
const suffixes = ["th", "st", "nd", "rd"];
|
|
18996
|
+
const value = level % 100;
|
|
18997
|
+
const suffix = suffixes[(value - 20) % 10] || suffixes[value] || suffixes[0];
|
|
18998
|
+
const p = level + suffix;
|
|
18999
|
+
return p;
|
|
19000
|
+
};
|
|
19001
|
+
const generateFromCustom = (path, lvlText, customFormat) => {
|
|
19002
|
+
if (customFormat !== "001, 002, 003, ...") return generateNumbering(path, lvlText, String);
|
|
19003
|
+
const match = customFormat.match(/(\d+)/);
|
|
19004
|
+
if (!match) throw new Error("Invalid format string: no numeric pattern found");
|
|
19005
|
+
const sample = match[1];
|
|
19006
|
+
const digitCount = sample.length;
|
|
19007
|
+
const index2 = path.pop();
|
|
19008
|
+
return String(index2).padStart(digitCount, "0");
|
|
19009
|
+
};
|
|
19010
|
+
const intToRoman = (num) => {
|
|
19011
|
+
const romanNumeralMap = [
|
|
19012
|
+
{ value: 1e3, numeral: "M" },
|
|
19013
|
+
{ value: 900, numeral: "CM" },
|
|
19014
|
+
{ value: 500, numeral: "D" },
|
|
19015
|
+
{ value: 400, numeral: "CD" },
|
|
19016
|
+
{ value: 100, numeral: "C" },
|
|
19017
|
+
{ value: 90, numeral: "XC" },
|
|
19018
|
+
{ value: 50, numeral: "L" },
|
|
19019
|
+
{ value: 40, numeral: "XL" },
|
|
19020
|
+
{ value: 10, numeral: "X" },
|
|
19021
|
+
{ value: 9, numeral: "IX" },
|
|
19022
|
+
{ value: 5, numeral: "V" },
|
|
19023
|
+
{ value: 4, numeral: "IV" },
|
|
19024
|
+
{ value: 1, numeral: "I" }
|
|
19025
|
+
];
|
|
19026
|
+
let result = "";
|
|
19027
|
+
for (const { value, numeral } of romanNumeralMap) {
|
|
19028
|
+
while (num >= value) {
|
|
19029
|
+
result += numeral;
|
|
19030
|
+
num -= value;
|
|
19031
|
+
}
|
|
19032
|
+
}
|
|
19033
|
+
return result;
|
|
19034
|
+
};
|
|
19035
|
+
const intToAlpha = (num) => {
|
|
19036
|
+
let result = "";
|
|
19037
|
+
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
19038
|
+
while (num > 0) {
|
|
19039
|
+
let index2 = (num - 1) % 26;
|
|
19040
|
+
result = alphabet[index2] + result;
|
|
19041
|
+
num = Math.floor((num - 1) / 26);
|
|
19042
|
+
}
|
|
19043
|
+
return result;
|
|
19044
|
+
};
|
|
19045
|
+
const intToJapaneseCounting = (num) => {
|
|
19046
|
+
const digits = ["", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
|
|
19047
|
+
const units = ["", "十", "百", "千"];
|
|
19048
|
+
if (num === 0) return "零";
|
|
19049
|
+
if (num < 10) return digits[num];
|
|
19050
|
+
let result = "";
|
|
19051
|
+
let tempNum = num;
|
|
19052
|
+
let unitIndex = 0;
|
|
19053
|
+
while (tempNum > 0) {
|
|
19054
|
+
const digit = tempNum % 10;
|
|
19055
|
+
if (digit !== 0) {
|
|
19056
|
+
const digitStr = digit === 1 && unitIndex > 0 ? "" : digits[digit];
|
|
19057
|
+
result = digitStr + (unitIndex > 0 ? units[unitIndex] : "") + result;
|
|
19058
|
+
} else if (result && tempNum > 0) {
|
|
19059
|
+
if (!result.startsWith("零") && tempNum % 100 !== 0) {
|
|
19060
|
+
result = "零" + result;
|
|
19061
|
+
}
|
|
19062
|
+
}
|
|
19063
|
+
tempNum = Math.floor(tempNum / 10);
|
|
19064
|
+
unitIndex++;
|
|
19065
|
+
if (unitIndex > 3) break;
|
|
19066
|
+
}
|
|
19067
|
+
if (num >= 10 && num < 20) {
|
|
19068
|
+
result = result.replace(/^一十/, "十");
|
|
19069
|
+
}
|
|
19070
|
+
return result;
|
|
19071
|
+
};
|
|
17854
19072
|
const isKeyboardInvocation = (event) => {
|
|
17855
19073
|
return event.type === "contextmenu" && typeof event.detail === "number" && event.detail === 0 && (event.button === 0 || event.button === void 0) && event.clientX === 0 && event.clientY === 0;
|
|
17856
19074
|
};
|
|
@@ -18139,53 +19357,20 @@ const getLinkedStyle = (styleId, styles = []) => {
|
|
|
18139
19357
|
return { linkedStyle, basedOnStyle };
|
|
18140
19358
|
};
|
|
18141
19359
|
const getSpacingStyle = (spacing) => {
|
|
18142
|
-
const { lineSpaceBefore, lineSpaceAfter, line, lineRule
|
|
19360
|
+
const { lineSpaceBefore, lineSpaceAfter, line, lineRule } = spacing;
|
|
18143
19361
|
const lineHeightResult = getLineHeightValueString(line, "", lineRule, true);
|
|
18144
19362
|
const lineHeightStyles = typeof lineHeightResult === "object" && lineHeightResult !== null ? lineHeightResult : {};
|
|
18145
|
-
const result = {};
|
|
18146
|
-
if (!beforeAutoSpacing) {
|
|
18147
|
-
result["margin-top"] = lineSpaceBefore + "px";
|
|
18148
|
-
}
|
|
18149
|
-
if (!afterAutoSpacing) {
|
|
18150
|
-
result["margin-bottom"] = lineSpaceAfter + "px";
|
|
18151
|
-
}
|
|
18152
19363
|
return {
|
|
18153
|
-
|
|
19364
|
+
"margin-top": lineSpaceBefore + "px",
|
|
19365
|
+
"margin-bottom": lineSpaceAfter + "px",
|
|
18154
19366
|
...lineHeightStyles
|
|
18155
19367
|
};
|
|
18156
19368
|
};
|
|
18157
|
-
const getSpacingStyleString = (spacing
|
|
18158
|
-
|
|
18159
|
-
line = twipsToLines(line);
|
|
18160
|
-
if (line != null && line < 1) {
|
|
18161
|
-
line = 1;
|
|
18162
|
-
}
|
|
18163
|
-
if (lineRule === "exact" && line) {
|
|
18164
|
-
line = String(line);
|
|
18165
|
-
}
|
|
18166
|
-
const textStyleMark = marks?.find((mark) => mark.type === "textStyle");
|
|
18167
|
-
const fontSize = textStyleMark?.attrs?.fontSize;
|
|
18168
|
-
before = twipsToPixels(before);
|
|
18169
|
-
if (beforeAutospacing) {
|
|
18170
|
-
if (fontSize) {
|
|
18171
|
-
before += halfPointToPixels(parseInt(fontSize) * 0.5);
|
|
18172
|
-
}
|
|
18173
|
-
if (isListItem) {
|
|
18174
|
-
before = 0;
|
|
18175
|
-
}
|
|
18176
|
-
}
|
|
18177
|
-
after = twipsToPixels(after);
|
|
18178
|
-
if (afterAutospacing) {
|
|
18179
|
-
if (fontSize) {
|
|
18180
|
-
after += halfPointToPixels(parseInt(fontSize) * 0.5);
|
|
18181
|
-
}
|
|
18182
|
-
if (isListItem) {
|
|
18183
|
-
after = 0;
|
|
18184
|
-
}
|
|
18185
|
-
}
|
|
19369
|
+
const getSpacingStyleString = (spacing) => {
|
|
19370
|
+
const { lineSpaceBefore, lineSpaceAfter, line } = spacing;
|
|
18186
19371
|
return `
|
|
18187
|
-
${
|
|
18188
|
-
${
|
|
19372
|
+
${lineSpaceBefore ? `margin-top: ${lineSpaceBefore}px;` : ""}
|
|
19373
|
+
${lineSpaceAfter ? `margin-bottom: ${lineSpaceAfter}px;` : ""}
|
|
18189
19374
|
${line ? getLineHeightValueString(line, "") : ""}
|
|
18190
19375
|
`.trim();
|
|
18191
19376
|
};
|
|
@@ -18683,1073 +19868,850 @@ const LinkedStyles = Extension.create({
|
|
|
18683
19868
|
};
|
|
18684
19869
|
}
|
|
18685
19870
|
});
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
}
|
|
18692
|
-
const
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18702
|
-
|
|
18703
|
-
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
|
|
18715
|
-
|
|
18716
|
-
|
|
18717
|
-
|
|
18718
|
-
|
|
18719
|
-
|
|
18720
|
-
|
|
18721
|
-
|
|
18722
|
-
|
|
18723
|
-
tr
|
|
18724
|
-
);
|
|
18725
|
-
});
|
|
18726
|
-
if (dispatch) dispatch(tr);
|
|
18727
|
-
return true;
|
|
18728
|
-
};
|
|
18729
|
-
const defaultTabDistance = 48;
|
|
18730
|
-
const defaultLineLength = 816;
|
|
18731
|
-
const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
18732
|
-
const decorations = [];
|
|
18733
|
-
const paragraphCache = /* @__PURE__ */ new Map();
|
|
18734
|
-
const coordCache = /* @__PURE__ */ new Map();
|
|
18735
|
-
const domPosCache = /* @__PURE__ */ new Map();
|
|
18736
|
-
const end2 = to ?? doc2.content.size;
|
|
18737
|
-
doc2.nodesBetween(from2, end2, (node, pos) => {
|
|
18738
|
-
if (node.type.name !== "tab") return;
|
|
18739
|
-
const $pos = doc2.resolve(pos);
|
|
18740
|
-
const paragraphContext = findParagraphContext($pos, paragraphCache, helpers2);
|
|
18741
|
-
if (!paragraphContext) return;
|
|
18742
|
-
const blockParent2 = $pos.node(paragraphContext.paragraphDepth);
|
|
18743
|
-
const style = calculateTabStyle(node.nodeSize, view, pos, blockParent2, paragraphContext, coordCache, domPosCache);
|
|
18744
|
-
if (style) {
|
|
18745
|
-
decorations.push(
|
|
18746
|
-
Decoration.node(pos, pos + node.nodeSize, {
|
|
18747
|
-
style
|
|
18748
|
-
})
|
|
18749
|
-
);
|
|
18750
|
-
}
|
|
18751
|
-
});
|
|
18752
|
-
return decorations;
|
|
18753
|
-
};
|
|
18754
|
-
function calculateTabStyle(nodeSize2, view, pos, blockParent2, paragraphContext, coordCache = null, domPosCache = null) {
|
|
18755
|
-
let extraStyles = "";
|
|
18756
|
-
try {
|
|
18757
|
-
const { tabStops, flattened, positionMap, startPos } = paragraphContext;
|
|
18758
|
-
if (paragraphContext.indentWidth === void 0) {
|
|
18759
|
-
paragraphContext.indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
|
|
18760
|
-
}
|
|
18761
|
-
if (paragraphContext.tabHeight === void 0) {
|
|
18762
|
-
paragraphContext.tabHeight = calcTabHeight(blockParent2);
|
|
18763
|
-
}
|
|
18764
|
-
if (paragraphContext.paragraphWidth === void 0) {
|
|
18765
|
-
paragraphContext.paragraphWidth = getBlockNodeWidth(view, startPos);
|
|
18766
|
-
}
|
|
18767
|
-
const indentWidth = paragraphContext.indentWidth;
|
|
18768
|
-
const hanging = twipsToPixels(Number(paragraphContext.indent.hanging) || 0);
|
|
18769
|
-
if (hanging > 0) {
|
|
18770
|
-
tabStops.unshift({ val: "start", pos: indentWidth + hanging });
|
|
18771
|
-
}
|
|
18772
|
-
const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
|
|
18773
|
-
const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
|
|
18774
|
-
let tabWidth;
|
|
18775
|
-
if (tabStops.length) {
|
|
18776
|
-
const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
|
|
18777
|
-
if (tabStop) {
|
|
18778
|
-
tabWidth = Math.min(tabStop.pos, paragraphContext.paragraphWidth) - currentWidth;
|
|
18779
|
-
let val = tabStop.val;
|
|
18780
|
-
const aliases = { left: "start", right: "end" };
|
|
18781
|
-
if (aliases[val]) val = aliases[val];
|
|
18782
|
-
if (val === "center" || val === "end" || val === "right") {
|
|
18783
|
-
const entryIndex = positionMap.get(pos);
|
|
18784
|
-
if (entryIndex === void 0) return;
|
|
18785
|
-
const nextTabIndex = findNextTabIndex(flattened, entryIndex + 1);
|
|
18786
|
-
const segmentStartPos = pos + nodeSize2;
|
|
18787
|
-
const segmentEndPos = nextTabIndex === -1 ? startPos + paragraphContext.paragraph.nodeSize - 1 : flattened[nextTabIndex].pos;
|
|
18788
|
-
const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos, coordCache, domPosCache);
|
|
18789
|
-
tabWidth -= val === "center" ? segmentWidth / 2 : segmentWidth;
|
|
18790
|
-
} else if (val === "decimal" || val === "num") {
|
|
18791
|
-
const entryIndex = positionMap.get(pos);
|
|
18792
|
-
if (entryIndex === void 0) return;
|
|
18793
|
-
const breakChar = tabStop.decimalChar || ".";
|
|
18794
|
-
const decimalPos = findDecimalBreakPos(flattened, entryIndex + 1, breakChar);
|
|
18795
|
-
const integralWidth = decimalPos ? measureRangeWidth(view, pos + nodeSize2, decimalPos, coordCache, domPosCache) : measureRangeWidth(
|
|
18796
|
-
view,
|
|
18797
|
-
pos + nodeSize2,
|
|
18798
|
-
startPos + paragraphContext.paragraph.nodeSize - 1,
|
|
18799
|
-
coordCache,
|
|
18800
|
-
domPosCache
|
|
18801
|
-
);
|
|
18802
|
-
tabWidth -= integralWidth;
|
|
18803
|
-
}
|
|
18804
|
-
if (tabStop.leader) {
|
|
18805
|
-
const leaderStyles = {
|
|
18806
|
-
dot: "border-bottom: 1px dotted black;",
|
|
18807
|
-
heavy: "border-bottom: 2px solid black;",
|
|
18808
|
-
hyphen: "border-bottom: 1px solid black;",
|
|
18809
|
-
middleDot: "border-bottom: 1px dotted black; margin-bottom: 2px;",
|
|
18810
|
-
underscore: "border-bottom: 1px solid black;"
|
|
18811
|
-
};
|
|
18812
|
-
extraStyles += leaderStyles[tabStop.leader] || "";
|
|
18813
|
-
}
|
|
19871
|
+
function getUnderlineCssString({ type = "single", color = null, thickness = null, approximate = true } = {}) {
|
|
19872
|
+
const parts = [];
|
|
19873
|
+
const add = (k2, v) => {
|
|
19874
|
+
if (!v) return;
|
|
19875
|
+
parts.push(`${k2}: ${v}`);
|
|
19876
|
+
};
|
|
19877
|
+
const lower = String(type || "single").toLowerCase();
|
|
19878
|
+
if (lower === "none" || lower === "0") {
|
|
19879
|
+
add("text-decoration", "none");
|
|
19880
|
+
return parts.join("; ");
|
|
19881
|
+
}
|
|
19882
|
+
add("text-decoration-line", "underline");
|
|
19883
|
+
const HEAVY = thickness || "0.2em";
|
|
19884
|
+
const THICK = thickness || "0.15em";
|
|
19885
|
+
switch (lower) {
|
|
19886
|
+
case "single":
|
|
19887
|
+
break;
|
|
19888
|
+
case "double":
|
|
19889
|
+
add("text-decoration-style", "double");
|
|
19890
|
+
break;
|
|
19891
|
+
case "thick":
|
|
19892
|
+
add("text-decoration-thickness", THICK);
|
|
19893
|
+
break;
|
|
19894
|
+
case "dotted":
|
|
19895
|
+
add("text-decoration-style", "dotted");
|
|
19896
|
+
break;
|
|
19897
|
+
case "dash":
|
|
19898
|
+
case "dashed":
|
|
19899
|
+
add("text-decoration-style", "dashed");
|
|
19900
|
+
break;
|
|
19901
|
+
case "dotdash":
|
|
19902
|
+
case "dotdotdash":
|
|
19903
|
+
case "dashlong":
|
|
19904
|
+
case "dashlongheavy":
|
|
19905
|
+
if (approximate) {
|
|
19906
|
+
add("text-decoration-style", "dashed");
|
|
19907
|
+
if (lower.includes("heavy")) add("text-decoration-thickness", HEAVY);
|
|
18814
19908
|
}
|
|
18815
|
-
|
|
18816
|
-
|
|
18817
|
-
|
|
18818
|
-
|
|
18819
|
-
|
|
18820
|
-
|
|
18821
|
-
|
|
18822
|
-
|
|
18823
|
-
|
|
18824
|
-
|
|
18825
|
-
|
|
18826
|
-
|
|
18827
|
-
|
|
18828
|
-
|
|
18829
|
-
|
|
18830
|
-
|
|
18831
|
-
|
|
18832
|
-
if (
|
|
18833
|
-
|
|
18834
|
-
|
|
19909
|
+
break;
|
|
19910
|
+
case "dottedheavy":
|
|
19911
|
+
add("text-decoration-style", "dotted");
|
|
19912
|
+
add("text-decoration-thickness", HEAVY);
|
|
19913
|
+
break;
|
|
19914
|
+
case "dashedheavy":
|
|
19915
|
+
add("text-decoration-style", "dashed");
|
|
19916
|
+
add("text-decoration-thickness", HEAVY);
|
|
19917
|
+
break;
|
|
19918
|
+
case "wavy":
|
|
19919
|
+
add("text-decoration-style", "wavy");
|
|
19920
|
+
break;
|
|
19921
|
+
case "wavyheavy":
|
|
19922
|
+
add("text-decoration-style", "wavy");
|
|
19923
|
+
add("text-decoration-thickness", HEAVY);
|
|
19924
|
+
break;
|
|
19925
|
+
case "wavydouble":
|
|
19926
|
+
if (approximate) {
|
|
19927
|
+
add("text-decoration-style", "wavy");
|
|
19928
|
+
add("text-decoration-thickness", HEAVY);
|
|
18835
19929
|
}
|
|
18836
|
-
|
|
18837
|
-
}
|
|
19930
|
+
break;
|
|
18838
19931
|
}
|
|
18839
|
-
|
|
19932
|
+
if (color) add("text-decoration-color", color);
|
|
19933
|
+
return parts.join("; ");
|
|
18840
19934
|
}
|
|
18841
|
-
function
|
|
18842
|
-
|
|
18843
|
-
|
|
18844
|
-
|
|
18845
|
-
|
|
18846
|
-
|
|
18847
|
-
|
|
18848
|
-
|
|
18849
|
-
|
|
18850
|
-
leader: ref2.leader
|
|
18851
|
-
};
|
|
18852
|
-
}).filter(Boolean);
|
|
18853
|
-
} else {
|
|
18854
|
-
const style = helpers2.linkedStyles.getStyleById(node.attrs?.styleId);
|
|
18855
|
-
if (Array.isArray(style?.definition?.styles?.tabStops)) {
|
|
18856
|
-
tabStops = style.definition.styles.tabStops;
|
|
18857
|
-
}
|
|
19935
|
+
function collectTextStyleMarks(listItem, markType) {
|
|
19936
|
+
const textStyleMarks = [];
|
|
19937
|
+
const seenMarks = /* @__PURE__ */ new Set();
|
|
19938
|
+
const attrs = {};
|
|
19939
|
+
if (!markType) {
|
|
19940
|
+
return {
|
|
19941
|
+
marks: textStyleMarks,
|
|
19942
|
+
attrs
|
|
19943
|
+
};
|
|
18858
19944
|
}
|
|
18859
|
-
const
|
|
18860
|
-
return {
|
|
18861
|
-
paragraph: node,
|
|
18862
|
-
paragraphDepth: depth,
|
|
18863
|
-
startPos,
|
|
18864
|
-
indent: node.attrs?.indent || {},
|
|
18865
|
-
tabStops,
|
|
18866
|
-
flattened: entries,
|
|
18867
|
-
positionMap,
|
|
18868
|
-
// Store position map for O(1) lookups
|
|
18869
|
-
accumulatedTabWidth: 0
|
|
18870
|
-
};
|
|
18871
|
-
}
|
|
18872
|
-
function flattenParagraph(paragraph, paragraphStartPos) {
|
|
18873
|
-
const entries = [];
|
|
18874
|
-
const positionMap = /* @__PURE__ */ new Map();
|
|
18875
|
-
const walk = (node, basePos) => {
|
|
19945
|
+
const collectMarks = (node) => {
|
|
18876
19946
|
if (!node) return;
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
19947
|
+
const candidateMarks = Array.isArray(node.marks) ? node.marks : [];
|
|
19948
|
+
if (candidateMarks.length && typeof markType.isInSet === "function" && markType.isInSet(candidateMarks)) {
|
|
19949
|
+
candidateMarks.forEach((mark) => {
|
|
19950
|
+
if (mark.type === markType && !seenMarks.has(mark)) {
|
|
19951
|
+
seenMarks.add(mark);
|
|
19952
|
+
textStyleMarks.push(mark);
|
|
19953
|
+
}
|
|
18881
19954
|
});
|
|
18882
|
-
return;
|
|
18883
19955
|
}
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
|
|
18887
|
-
positionMap.set(pos, index2);
|
|
19956
|
+
if (!node.isText && node.childCount) {
|
|
19957
|
+
node.forEach((child) => collectMarks(child));
|
|
19958
|
+
}
|
|
18888
19959
|
};
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
19960
|
+
listItem.forEach((childNode) => {
|
|
19961
|
+
if (childNode.type?.name !== "paragraph") return;
|
|
19962
|
+
if (childNode.attrs?.lineHeight !== void 0) {
|
|
19963
|
+
attrs.lineHeight = childNode.attrs.lineHeight;
|
|
19964
|
+
}
|
|
19965
|
+
collectMarks(childNode);
|
|
18892
19966
|
});
|
|
18893
|
-
return {
|
|
19967
|
+
return {
|
|
19968
|
+
marks: textStyleMarks,
|
|
19969
|
+
attrs
|
|
19970
|
+
};
|
|
18894
19971
|
}
|
|
18895
|
-
function
|
|
18896
|
-
|
|
18897
|
-
|
|
18898
|
-
|
|
18899
|
-
|
|
19972
|
+
function parseSizeFromRunProperties(listRunProperties) {
|
|
19973
|
+
const val = listRunProperties?.["w:val"] || listRunProperties?.["w:sz"];
|
|
19974
|
+
if (val == null) return null;
|
|
19975
|
+
const numeric = Number(val);
|
|
19976
|
+
if (Number.isNaN(numeric) || numeric <= 0) return null;
|
|
19977
|
+
const sizeInPoints = numeric / 2;
|
|
19978
|
+
return `${sizeInPoints}pt`;
|
|
19979
|
+
}
|
|
19980
|
+
function parseFontFamilyFromRunProperties(listRunProperties) {
|
|
19981
|
+
const ascii = listRunProperties?.["w:ascii"];
|
|
19982
|
+
const hAnsi = listRunProperties?.["w:hAnsi"];
|
|
19983
|
+
const eastAsia = listRunProperties?.["w:eastAsia"];
|
|
19984
|
+
return ascii || hAnsi || eastAsia || null;
|
|
19985
|
+
}
|
|
19986
|
+
const computedStylesCache = /* @__PURE__ */ new WeakMap();
|
|
19987
|
+
function clearComputedStyleCache(domNode) {
|
|
19988
|
+
if (domNode) {
|
|
19989
|
+
computedStylesCache.delete(domNode);
|
|
18900
19990
|
}
|
|
18901
|
-
return -1;
|
|
18902
19991
|
}
|
|
18903
|
-
function
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
19992
|
+
function readNodeViewStyles(view) {
|
|
19993
|
+
const fallback = { fontSize: null, fontFamily: null, lineHeight: null };
|
|
19994
|
+
if (!view?.dom) return fallback;
|
|
19995
|
+
const inline = {
|
|
19996
|
+
fontSize: view.dom.style?.fontSize || null,
|
|
19997
|
+
fontFamily: view.dom.style?.fontFamily || null,
|
|
19998
|
+
lineHeight: view.dom.style?.lineHeight || null
|
|
19999
|
+
};
|
|
20000
|
+
if (inline.fontSize && inline.fontFamily && inline.lineHeight) return inline;
|
|
20001
|
+
if (computedStylesCache.has(view.dom)) {
|
|
20002
|
+
const cached = computedStylesCache.get(view.dom);
|
|
20003
|
+
return {
|
|
20004
|
+
fontSize: inline.fontSize || cached.fontSize,
|
|
20005
|
+
fontFamily: inline.fontFamily || cached.fontFamily,
|
|
20006
|
+
lineHeight: inline.lineHeight || cached.lineHeight
|
|
20007
|
+
};
|
|
18914
20008
|
}
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18927
|
-
|
|
18928
|
-
|
|
18929
|
-
const startLeft = getLeftCoord(view, from2, coordCache, domPosCache);
|
|
18930
|
-
const endLeft = getLeftCoord(view, to, coordCache, domPosCache);
|
|
18931
|
-
if (startLeft == null || endLeft == null) return 0;
|
|
18932
|
-
return Math.max(0, endLeft - startLeft);
|
|
20009
|
+
const globalWindow = typeof window !== "undefined" ? window : void 0;
|
|
20010
|
+
if (globalWindow?.getComputedStyle) {
|
|
20011
|
+
const computed2 = globalWindow.getComputedStyle(view.dom);
|
|
20012
|
+
const computedStyles = {
|
|
20013
|
+
fontSize: computed2.fontSize,
|
|
20014
|
+
fontFamily: computed2.fontFamily,
|
|
20015
|
+
lineHeight: computed2.lineHeight
|
|
20016
|
+
};
|
|
20017
|
+
computedStylesCache.set(view.dom, computedStyles);
|
|
20018
|
+
return {
|
|
20019
|
+
fontSize: inline.fontSize || computedStyles.fontSize,
|
|
20020
|
+
fontFamily: inline.fontFamily || computedStyles.fontFamily,
|
|
20021
|
+
lineHeight: inline.lineHeight || computedStyles.lineHeight
|
|
20022
|
+
};
|
|
18933
20023
|
}
|
|
20024
|
+
return inline;
|
|
18934
20025
|
}
|
|
18935
|
-
function
|
|
18936
|
-
|
|
18937
|
-
|
|
18938
|
-
|
|
18939
|
-
|
|
18940
|
-
|
|
18941
|
-
|
|
20026
|
+
function getAdjacentListItemNodeView({ nodeView, pos, direction, activeNodeViews }) {
|
|
20027
|
+
if (!activeNodeViews) return null;
|
|
20028
|
+
let candidate = null;
|
|
20029
|
+
activeNodeViews.forEach((view) => {
|
|
20030
|
+
if (view === nodeView) return;
|
|
20031
|
+
let viewPos;
|
|
20032
|
+
try {
|
|
20033
|
+
if (typeof view.getResolvedPos === "function") {
|
|
20034
|
+
viewPos = view.getResolvedPos();
|
|
20035
|
+
} else if (typeof view.getPos === "function") {
|
|
20036
|
+
viewPos = view.getPos();
|
|
20037
|
+
}
|
|
20038
|
+
} catch {
|
|
20039
|
+
return;
|
|
18942
20040
|
}
|
|
18943
|
-
|
|
18944
|
-
|
|
20041
|
+
if (typeof viewPos !== "number") return;
|
|
20042
|
+
if (viewPos < pos) {
|
|
20043
|
+
if (!candidate || viewPos > candidate.pos) candidate = { view, pos: viewPos };
|
|
20044
|
+
}
|
|
20045
|
+
});
|
|
20046
|
+
return candidate?.view ?? null;
|
|
18945
20047
|
}
|
|
18946
|
-
function
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
18951
|
-
|
|
20048
|
+
function findSiblingListItem({ editor, pos, direction }) {
|
|
20049
|
+
if (typeof pos !== "number" || !editor?.view) return null;
|
|
20050
|
+
const { state } = editor.view;
|
|
20051
|
+
const $pos = state.doc.resolve(pos);
|
|
20052
|
+
const parentDepth = $pos.depth - 1;
|
|
20053
|
+
if (parentDepth < 0) return null;
|
|
20054
|
+
const parent = $pos.node(parentDepth);
|
|
20055
|
+
if (!parent) return null;
|
|
20056
|
+
const indexInsideParent = $pos.index(parentDepth);
|
|
20057
|
+
const siblingIndex = indexInsideParent + direction;
|
|
20058
|
+
if (siblingIndex < 0 || siblingIndex >= parent.childCount) return null;
|
|
20059
|
+
const sibling = parent.child(siblingIndex);
|
|
20060
|
+
return sibling?.type?.name === "listItem" ? sibling : null;
|
|
20061
|
+
}
|
|
20062
|
+
function deriveFontStylesFromNode({ node, textStyleType, defaultFont, defaultSize, listRunProperties }) {
|
|
20063
|
+
const { marks: allMarks, attrs } = collectTextStyleMarks(node, textStyleType);
|
|
20064
|
+
const styleMarks = textStyleType ? allMarks.filter((m) => m.type === textStyleType) : [];
|
|
20065
|
+
const sizeMark = styleMarks.find((m) => m.attrs?.fontSize);
|
|
20066
|
+
const familyMark = styleMarks.find((m) => m.attrs?.fontFamily);
|
|
20067
|
+
let fontSize = defaultSize;
|
|
20068
|
+
if (sizeMark) {
|
|
20069
|
+
const [value, unit = "pt"] = parseSizeUnit(sizeMark.attrs.fontSize);
|
|
20070
|
+
if (!Number.isNaN(value)) {
|
|
20071
|
+
fontSize = `${value}${unit}`;
|
|
20072
|
+
}
|
|
20073
|
+
}
|
|
20074
|
+
let hasSize = Boolean(sizeMark);
|
|
20075
|
+
if (!hasSize && listRunProperties) {
|
|
20076
|
+
const sizeFromList = parseSizeFromRunProperties(listRunProperties);
|
|
20077
|
+
if (sizeFromList) {
|
|
20078
|
+
fontSize = sizeFromList;
|
|
20079
|
+
hasSize = true;
|
|
20080
|
+
}
|
|
20081
|
+
}
|
|
20082
|
+
let fontFamily = familyMark?.attrs?.fontFamily ?? defaultFont;
|
|
20083
|
+
let hasFamily = Boolean(familyMark);
|
|
20084
|
+
if (!hasFamily && listRunProperties) {
|
|
20085
|
+
const fontFromList = parseFontFamilyFromRunProperties(listRunProperties);
|
|
20086
|
+
if (fontFromList) {
|
|
20087
|
+
fontFamily = fontFromList;
|
|
20088
|
+
hasFamily = true;
|
|
20089
|
+
}
|
|
20090
|
+
}
|
|
20091
|
+
let lineHeight = attrs.lineHeight;
|
|
20092
|
+
const firstChild = node.firstChild;
|
|
20093
|
+
const hasOnlyOnePar = node.childCount === 1 && firstChild?.type?.name === "paragraph";
|
|
20094
|
+
if (hasOnlyOnePar) {
|
|
20095
|
+
const par = firstChild;
|
|
20096
|
+
const parFirstChild = par?.firstChild;
|
|
20097
|
+
if (par?.childCount === 1 && parFirstChild?.type?.name === "fieldAnnotation") {
|
|
20098
|
+
const aFontSize = parFirstChild.attrs?.fontSize;
|
|
20099
|
+
const aFontFamily = parFirstChild.attrs?.fontFamily;
|
|
20100
|
+
if (!sizeMark && aFontSize) fontSize = aFontSize;
|
|
20101
|
+
if (!familyMark && aFontFamily) fontFamily = aFontFamily;
|
|
20102
|
+
}
|
|
18952
20103
|
}
|
|
18953
|
-
return
|
|
20104
|
+
return {
|
|
20105
|
+
fontSize,
|
|
20106
|
+
fontFamily,
|
|
20107
|
+
lineHeight,
|
|
20108
|
+
hasSize,
|
|
20109
|
+
hasFamily
|
|
20110
|
+
};
|
|
18954
20111
|
}
|
|
18955
|
-
function
|
|
18956
|
-
|
|
18957
|
-
const
|
|
18958
|
-
const
|
|
18959
|
-
const
|
|
18960
|
-
|
|
18961
|
-
|
|
18962
|
-
|
|
18963
|
-
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
|
-
|
|
20112
|
+
function getStylesFromLinkedStyles({ node, pos, editor }) {
|
|
20113
|
+
const { state } = editor.view;
|
|
20114
|
+
const linkedStyles = LinkedStylesPluginKey.getState(state)?.decorations;
|
|
20115
|
+
const decorationsInPlace = linkedStyles?.find(pos, pos + node.nodeSize);
|
|
20116
|
+
const predicates = [
|
|
20117
|
+
(style2) => style2.includes("font-size") && style2.includes("font-family"),
|
|
20118
|
+
(style2) => style2.includes("font-size"),
|
|
20119
|
+
(style2) => style2.includes("font-family")
|
|
20120
|
+
];
|
|
20121
|
+
let styleDeco;
|
|
20122
|
+
for (const predicateFn of predicates) {
|
|
20123
|
+
styleDeco = decorationsInPlace?.find((dec) => {
|
|
20124
|
+
const style2 = dec.type?.attrs?.style || "";
|
|
20125
|
+
return style2 && predicateFn(style2);
|
|
20126
|
+
});
|
|
20127
|
+
if (styleDeco) break;
|
|
18967
20128
|
}
|
|
18968
|
-
|
|
18969
|
-
|
|
18970
|
-
|
|
20129
|
+
const style = styleDeco?.type?.attrs?.style;
|
|
20130
|
+
const stylesArray = style?.split(";") || [];
|
|
20131
|
+
const fontSizeFromStyles = stylesArray.find((s2) => s2.includes("font-size"))?.split(":")[1]?.trim();
|
|
20132
|
+
const fontFamilyFromStyles = stylesArray.find((s2) => s2.includes("font-family"))?.split(":")[1]?.trim();
|
|
20133
|
+
return {
|
|
20134
|
+
font: fontFamilyFromStyles,
|
|
20135
|
+
size: fontSizeFromStyles
|
|
20136
|
+
};
|
|
18971
20137
|
}
|
|
18972
|
-
function
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
|
|
18976
|
-
|
|
18977
|
-
|
|
18978
|
-
|
|
18979
|
-
|
|
18980
|
-
|
|
18981
|
-
|
|
18982
|
-
|
|
18983
|
-
|
|
18984
|
-
|
|
18985
|
-
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
|
|
18989
|
-
|
|
18990
|
-
|
|
20138
|
+
function resolveListItemTypography({ node, pos, editor, nodeView, activeNodeViews }) {
|
|
20139
|
+
const defaults = getStylesFromLinkedStyles({ node, pos, editor });
|
|
20140
|
+
const textStyleType = getMarkType("textStyle", editor.schema);
|
|
20141
|
+
const currentStyles = deriveFontStylesFromNode({
|
|
20142
|
+
node,
|
|
20143
|
+
textStyleType,
|
|
20144
|
+
defaultFont: defaults.font,
|
|
20145
|
+
defaultSize: defaults.size,
|
|
20146
|
+
listRunProperties: node.attrs?.listRunProperties
|
|
20147
|
+
});
|
|
20148
|
+
if ((!currentStyles.hasSize || !currentStyles.hasFamily || !currentStyles.lineHeight) && editor?.view) {
|
|
20149
|
+
const previousListItem = findSiblingListItem({ editor, pos, direction: -1 });
|
|
20150
|
+
if (previousListItem) {
|
|
20151
|
+
const previousStyles = deriveFontStylesFromNode({
|
|
20152
|
+
node: previousListItem,
|
|
20153
|
+
textStyleType,
|
|
20154
|
+
defaultFont: defaults.font,
|
|
20155
|
+
defaultSize: defaults.size,
|
|
20156
|
+
listRunProperties: previousListItem.attrs?.listRunProperties
|
|
20157
|
+
});
|
|
20158
|
+
if (!currentStyles.hasSize && previousStyles.fontSize) currentStyles.fontSize = previousStyles.fontSize;
|
|
20159
|
+
if (!currentStyles.hasFamily && previousStyles.fontFamily) currentStyles.fontFamily = previousStyles.fontFamily;
|
|
20160
|
+
if (!currentStyles.lineHeight && previousStyles.lineHeight) currentStyles.lineHeight = previousStyles.lineHeight;
|
|
18991
20161
|
}
|
|
18992
20162
|
}
|
|
18993
|
-
if (
|
|
18994
|
-
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
|
|
20163
|
+
if ((!currentStyles.fontSize || !currentStyles.fontFamily || !currentStyles.lineHeight) && nodeView) {
|
|
20164
|
+
const previousView = getAdjacentListItemNodeView({
|
|
20165
|
+
nodeView,
|
|
20166
|
+
pos,
|
|
20167
|
+
direction: -1,
|
|
20168
|
+
activeNodeViews
|
|
20169
|
+
});
|
|
20170
|
+
if (previousView) {
|
|
20171
|
+
const {
|
|
20172
|
+
fontSize: prevSize,
|
|
20173
|
+
fontFamily: prevFamily,
|
|
20174
|
+
lineHeight: prevLineHeight
|
|
20175
|
+
} = readNodeViewStyles(previousView);
|
|
20176
|
+
if (!currentStyles.fontSize && prevSize) currentStyles.fontSize = prevSize;
|
|
20177
|
+
if (!currentStyles.fontFamily && prevFamily) currentStyles.fontFamily = prevFamily;
|
|
20178
|
+
if (!currentStyles.lineHeight && prevLineHeight) currentStyles.lineHeight = prevLineHeight;
|
|
20179
|
+
}
|
|
19005
20180
|
}
|
|
19006
|
-
return
|
|
19007
|
-
|
|
19008
|
-
|
|
19009
|
-
|
|
19010
|
-
|
|
19011
|
-
const defaultLineHeight = 1.1;
|
|
19012
|
-
const parentTextStyleMark = blockParent2.firstChild?.marks?.find((mark) => mark.type.name === "textStyle");
|
|
19013
|
-
const fontSize = parseInt(parentTextStyleMark?.attrs.fontSize) * ptToPxRatio || defaultFontSize;
|
|
19014
|
-
return `${fontSize * defaultLineHeight}px`;
|
|
20181
|
+
return {
|
|
20182
|
+
fontSize: currentStyles.fontSize,
|
|
20183
|
+
fontFamily: currentStyles.fontFamily,
|
|
20184
|
+
lineHeight: currentStyles.lineHeight
|
|
20185
|
+
};
|
|
19015
20186
|
}
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
|
|
19020
|
-
|
|
19021
|
-
|
|
19022
|
-
|
|
19023
|
-
|
|
19024
|
-
constructor(node,
|
|
19025
|
-
__privateAdd(this,
|
|
20187
|
+
const MARKER_PADDING = 6;
|
|
20188
|
+
const MARKER_OFFSET_RIGHT = 4;
|
|
20189
|
+
const MIN_MARKER_WIDTH = 20;
|
|
20190
|
+
const POINT_TO_PIXEL_CONVERSION_FACTOR = 1.33;
|
|
20191
|
+
const DEFAULT_FONT_FAMILY = "Arial, sans-serif";
|
|
20192
|
+
const DEFAULT_FONT_SIZE = "10pt";
|
|
20193
|
+
const activeListItemNodeViews = /* @__PURE__ */ new Set();
|
|
20194
|
+
class ListItemNodeView {
|
|
20195
|
+
constructor(node, getPos, decorations, editor) {
|
|
20196
|
+
__privateAdd(this, _ListItemNodeView_instances);
|
|
20197
|
+
__publicField(this, "handleNumberingClick", () => {
|
|
20198
|
+
});
|
|
19026
20199
|
this.node = node;
|
|
19027
20200
|
this.editor = editor;
|
|
19028
|
-
this.getPos = getPos;
|
|
19029
20201
|
this.decorations = decorations;
|
|
19030
|
-
this.
|
|
19031
|
-
this.
|
|
19032
|
-
this.
|
|
19033
|
-
this.
|
|
19034
|
-
this.
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
|
|
19039
|
-
|
|
19040
|
-
|
|
19041
|
-
|
|
19042
|
-
|
|
20202
|
+
this.view = editor.view;
|
|
20203
|
+
this._rawGetPos = getPos;
|
|
20204
|
+
this._pendingIndentRefresh = null;
|
|
20205
|
+
this.getPos = () => this.getResolvedPos();
|
|
20206
|
+
__privateMethod(this, _ListItemNodeView_instances, init_fn3).call(this);
|
|
20207
|
+
activeListItemNodeViews.add(this);
|
|
20208
|
+
}
|
|
20209
|
+
getResolvedPos() {
|
|
20210
|
+
if (typeof this._rawGetPos !== "function") return null;
|
|
20211
|
+
try {
|
|
20212
|
+
const resolved = this._rawGetPos();
|
|
20213
|
+
return typeof resolved === "number" ? resolved : null;
|
|
20214
|
+
} catch {
|
|
20215
|
+
return null;
|
|
19043
20216
|
}
|
|
19044
|
-
__privateMethod(this, _ParagraphNodeView_instances, updateHTMLAttributes_fn).call(this);
|
|
19045
20217
|
}
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
|
|
19049
|
-
|
|
20218
|
+
invalidateResolvedPos() {
|
|
20219
|
+
}
|
|
20220
|
+
refreshIndentStyling({ immediate = false } = {}) {
|
|
20221
|
+
const raf = typeof globalThis !== "undefined" ? globalThis.requestAnimationFrame : void 0;
|
|
20222
|
+
const shouldSchedule = !immediate && typeof raf === "function";
|
|
20223
|
+
if (!shouldSchedule) {
|
|
20224
|
+
this._pendingIndentRefresh = null;
|
|
20225
|
+
__privateMethod(this, _ListItemNodeView_instances, applyIndentStyling_fn).call(this);
|
|
20226
|
+
return;
|
|
20227
|
+
}
|
|
20228
|
+
if (this._pendingIndentRefresh != null) return;
|
|
20229
|
+
this._pendingIndentRefresh = raf(() => {
|
|
20230
|
+
this._pendingIndentRefresh = null;
|
|
20231
|
+
__privateMethod(this, _ListItemNodeView_instances, applyIndentStyling_fn).call(this);
|
|
20232
|
+
});
|
|
20233
|
+
}
|
|
19050
20234
|
update(node, decorations) {
|
|
19051
|
-
const
|
|
19052
|
-
const newAttrs = node.attrs;
|
|
20235
|
+
const prevNode = this.node;
|
|
19053
20236
|
this.node = node;
|
|
19054
20237
|
this.decorations = decorations;
|
|
19055
|
-
|
|
19056
|
-
|
|
19057
|
-
|
|
19058
|
-
|
|
19059
|
-
if (!__privateMethod(this, _ParagraphNodeView_instances, checkIsList_fn).call(this)) {
|
|
19060
|
-
__privateMethod(this, _ParagraphNodeView_instances, removeList_fn).call(this);
|
|
19061
|
-
return true;
|
|
20238
|
+
this.invalidateResolvedPos();
|
|
20239
|
+
const stylingAttrsChanged = !prevNode || prevNode.attrs.styleId !== node.attrs.styleId || prevNode.attrs.numId !== node.attrs.numId || prevNode.attrs.level !== node.attrs.level;
|
|
20240
|
+
if (stylingAttrsChanged) {
|
|
20241
|
+
clearComputedStyleCache(this.dom);
|
|
19062
20242
|
}
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
20243
|
+
const { fontSize, fontFamily, lineHeight } = resolveListItemTypography({
|
|
20244
|
+
node,
|
|
20245
|
+
pos: this.getResolvedPos(),
|
|
20246
|
+
editor: this.editor,
|
|
20247
|
+
nodeView: this,
|
|
20248
|
+
activeNodeViews: activeListItemNodeViews
|
|
19067
20249
|
});
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
if (this.marker && (mutation.target === this.marker || this.marker.contains(mutation.target))) {
|
|
19075
|
-
return true;
|
|
19076
|
-
}
|
|
19077
|
-
if (this.separator && (mutation.target === this.separator || this.separator.contains(mutation.target))) {
|
|
19078
|
-
return true;
|
|
19079
|
-
}
|
|
19080
|
-
if (mutation.type === "attributes" && mutation.target === this.dom && mutation.attributeName === "style") {
|
|
19081
|
-
return true;
|
|
20250
|
+
this.dom.style.fontSize = fontSize;
|
|
20251
|
+
this.dom.style.fontFamily = fontFamily || "inherit";
|
|
20252
|
+
this.dom.style.lineHeight = lineHeight || "";
|
|
20253
|
+
const attrsChanged = stylingAttrsChanged || prevNode?.attrs.indent !== node.attrs.indent;
|
|
20254
|
+
if (attrsChanged) {
|
|
20255
|
+
this.refreshIndentStyling();
|
|
19082
20256
|
}
|
|
19083
|
-
if (mutation.type === "childList") {
|
|
19084
|
-
if (this.marker && Array.from(mutation.removedNodes).includes(this.marker)) {
|
|
19085
|
-
return true;
|
|
19086
|
-
}
|
|
19087
|
-
if (this.marker && Array.from(mutation.addedNodes).includes(this.marker)) {
|
|
19088
|
-
return true;
|
|
19089
|
-
}
|
|
19090
|
-
if (this.separator && Array.from(mutation.removedNodes).includes(this.separator)) {
|
|
19091
|
-
return true;
|
|
19092
|
-
}
|
|
19093
|
-
if (this.separator && Array.from(mutation.addedNodes).includes(this.separator)) {
|
|
19094
|
-
return true;
|
|
19095
|
-
}
|
|
19096
|
-
}
|
|
19097
|
-
return false;
|
|
19098
20257
|
}
|
|
19099
20258
|
destroy() {
|
|
19100
|
-
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19104
|
-
|
|
19105
|
-
|
|
19106
|
-
htmlAttributes.style = htmlAttributes.style || "";
|
|
19107
|
-
for (const [key2, value] of Object.entries(htmlAttributes || {})) {
|
|
19108
|
-
if (value == null) {
|
|
19109
|
-
this.dom.removeAttribute(key2);
|
|
19110
|
-
continue;
|
|
20259
|
+
activeListItemNodeViews.delete(this);
|
|
20260
|
+
this.numberingDOM.removeEventListener("click", this.handleNumberingClick);
|
|
20261
|
+
clearComputedStyleCache(this.dom);
|
|
20262
|
+
const caf = typeof globalThis !== "undefined" ? globalThis.cancelAnimationFrame : void 0;
|
|
20263
|
+
if (this._pendingIndentRefresh != null && typeof caf === "function") {
|
|
20264
|
+
caf(this._pendingIndentRefresh);
|
|
19111
20265
|
}
|
|
19112
|
-
this.
|
|
19113
|
-
}
|
|
19114
|
-
};
|
|
19115
|
-
updateListStyles_fn = function() {
|
|
19116
|
-
let { suffix, justification } = this.node.attrs.listRendering;
|
|
19117
|
-
suffix = suffix ?? "tab";
|
|
19118
|
-
__privateMethod(this, _ParagraphNodeView_instances, calculateMarkerStyle_fn).call(this, justification);
|
|
19119
|
-
if (suffix === "tab") {
|
|
19120
|
-
__privateMethod(this, _ParagraphNodeView_instances, calculateTabSeparatorStyle_fn).call(this, justification, this.node.attrs.indent);
|
|
19121
|
-
} else {
|
|
19122
|
-
this.separator.textContent = suffix === "space" ? " " : "";
|
|
20266
|
+
this._pendingIndentRefresh = null;
|
|
19123
20267
|
}
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
|
|
19135
|
-
|
|
19136
|
-
|
|
19137
|
-
|
|
19138
|
-
*/
|
|
19139
|
-
createMarker_fn = function(markerText) {
|
|
19140
|
-
if (!this.marker) {
|
|
19141
|
-
this.marker = document.createElement("span");
|
|
19142
|
-
this.dom.insertBefore(this.marker, this.contentDOM);
|
|
19143
|
-
}
|
|
19144
|
-
this.marker.contentEditable = "false";
|
|
19145
|
-
this.marker.className = "list-marker";
|
|
19146
|
-
this.marker.textContent = markerText;
|
|
19147
|
-
};
|
|
19148
|
-
/**
|
|
19149
|
-
* @param {'tab' | 'space' | 'nothing'} [suffix]
|
|
19150
|
-
*/
|
|
19151
|
-
createSeparator_fn = function(suffix) {
|
|
19152
|
-
if (suffix === "tab" || suffix == null) {
|
|
19153
|
-
if (this.separator == null || this.separator.tagName?.toLowerCase() !== "span") {
|
|
19154
|
-
this.separator?.parentNode?.removeChild(this.separator);
|
|
19155
|
-
this.separator = document.createElement("span");
|
|
19156
|
-
this.marker.after(this.separator);
|
|
19157
|
-
}
|
|
19158
|
-
this.separator.className = "sd-editor-tab";
|
|
19159
|
-
this.separator.contentEditable = "false";
|
|
19160
|
-
} else if (suffix === "space") {
|
|
19161
|
-
if (this.separator == null || this.separator.nodeType !== Node.TEXT_NODE) {
|
|
19162
|
-
this.separator?.parentNode?.removeChild(this.separator);
|
|
19163
|
-
this.separator = document.createTextNode(" ");
|
|
19164
|
-
this.marker.after(this.separator);
|
|
19165
|
-
}
|
|
19166
|
-
this.separator.textContent = " ";
|
|
19167
|
-
} else if (suffix === "nothing") {
|
|
19168
|
-
if (this.separator == null || this.separator.nodeType !== Node.TEXT_NODE) {
|
|
19169
|
-
this.separator?.parentNode?.removeChild(this.separator);
|
|
19170
|
-
this.separator = document.createTextNode("");
|
|
19171
|
-
this.marker.after(this.separator);
|
|
19172
|
-
}
|
|
19173
|
-
this.separator.textContent = "";
|
|
19174
|
-
}
|
|
19175
|
-
};
|
|
19176
|
-
/**
|
|
19177
|
-
* This is the logic behind the calculation:
|
|
19178
|
-
*
|
|
19179
|
-
* For left alignment:
|
|
19180
|
-
* - The tab character extends to the next tab stop
|
|
19181
|
-
*
|
|
19182
|
-
* For right alignment:
|
|
19183
|
-
* When: hanging is defined OR hanging is not defined and neither is firstLine
|
|
19184
|
-
* - The tab character extends to the hanging position only and never goes beyond it.
|
|
19185
|
-
*
|
|
19186
|
-
* When: firstLine is defined
|
|
19187
|
-
* - The tab character extends to the next tab stop
|
|
19188
|
-
*
|
|
19189
|
-
* For center alignment:
|
|
19190
|
-
* - The tab character extends to the next tab stop
|
|
19191
|
-
*/
|
|
19192
|
-
/**
|
|
19193
|
-
* @param {'left' | 'right' | 'center'} justification
|
|
19194
|
-
* @param {{ hanging?: number, firstLine?: number } | null} indent
|
|
19195
|
-
*/
|
|
19196
|
-
calculateTabSeparatorStyle_fn = function(justification, indent) {
|
|
19197
|
-
const markerWidth = this.marker.getBoundingClientRect().width;
|
|
19198
|
-
let tabStyle;
|
|
19199
|
-
let { paragraphContext, start: start2 } = __privateMethod(this, _ParagraphNodeView_instances, getParagraphContext_fn).call(this);
|
|
19200
|
-
if (justification === "right") {
|
|
19201
|
-
if (indent?.hanging || !indent?.hanging && !indent?.firstLine) {
|
|
19202
|
-
const hanging = indent?.hanging ? twipsToPixels(indent.hanging) : 0;
|
|
19203
|
-
tabStyle = `width: ${hanging}px;`;
|
|
20268
|
+
}
|
|
20269
|
+
_ListItemNodeView_instances = new WeakSet();
|
|
20270
|
+
init_fn3 = function() {
|
|
20271
|
+
const { attrs } = this.node;
|
|
20272
|
+
const { listLevel, listNumberingType, lvlText, numId, level, customFormat } = attrs;
|
|
20273
|
+
let orderMarker = "";
|
|
20274
|
+
if (listLevel) {
|
|
20275
|
+
if (listNumberingType !== "bullet") {
|
|
20276
|
+
orderMarker = generateOrderedListIndex({
|
|
20277
|
+
listLevel,
|
|
20278
|
+
lvlText,
|
|
20279
|
+
listNumberingType,
|
|
20280
|
+
customFormat
|
|
20281
|
+
});
|
|
19204
20282
|
} else {
|
|
19205
|
-
|
|
19206
|
-
|
|
19207
|
-
}
|
|
19208
|
-
} else if (justification === "center") {
|
|
19209
|
-
paragraphContext.accumulatedTabWidth = markerWidth / 2;
|
|
19210
|
-
const tabNode = this.editor.schema.nodes.tab.create(null);
|
|
19211
|
-
tabStyle = calculateTabStyle(tabNode.nodeSize, this.editor.view, start2, this.node, paragraphContext);
|
|
19212
|
-
tabStyle += `margin-left: ${markerWidth / 2}px;`;
|
|
19213
|
-
} else {
|
|
19214
|
-
paragraphContext.accumulatedTabWidth = markerWidth;
|
|
19215
|
-
const tabNode = this.editor.schema.nodes.tab.create(null);
|
|
19216
|
-
tabStyle = calculateTabStyle(tabNode.nodeSize, this.editor.view, start2, this.node, paragraphContext);
|
|
19217
|
-
}
|
|
19218
|
-
this.separator.style.cssText = tabStyle;
|
|
19219
|
-
};
|
|
19220
|
-
/**
|
|
19221
|
-
* This is the logic behind the calculation:
|
|
19222
|
-
* For left alignment:
|
|
19223
|
-
* - The marker text STARTS at the left indent
|
|
19224
|
-
*
|
|
19225
|
-
* For right alignment:
|
|
19226
|
-
* - The marker text ENDS at the left indent
|
|
19227
|
-
*
|
|
19228
|
-
* For center alignment:
|
|
19229
|
-
* - The marker text is centered around the left indent (pulled back by half its width)
|
|
19230
|
-
*
|
|
19231
|
-
* The left/center/right alignment positioning uses the left indent (+ firstLine if present) as the anchor point.
|
|
19232
|
-
*/
|
|
19233
|
-
/**
|
|
19234
|
-
* @param {'left' | 'right' | 'center'} justification
|
|
19235
|
-
*/
|
|
19236
|
-
calculateMarkerStyle_fn = function(justification) {
|
|
19237
|
-
const runProperties = resolveRunProperties(
|
|
19238
|
-
{ docx: this.editor.converter.convertedXml, numbering: this.editor.converter.numbering },
|
|
19239
|
-
this.node.attrs.paragraphProperties.runProperties || {},
|
|
19240
|
-
{ ...this.node.attrs.paragraphProperties, numberingProperties: this.node.attrs.numberingProperties },
|
|
19241
|
-
true,
|
|
19242
|
-
Boolean(this.node.attrs.paragraphProperties.numberingProperties)
|
|
19243
|
-
);
|
|
19244
|
-
const style = encodeCSSFromRPr(runProperties, this.editor.converter.convertedXml);
|
|
19245
|
-
this.marker.style.cssText = Object.entries(style).map(([k2, v]) => `${k2}: ${v};`).join(" ");
|
|
19246
|
-
let markerStyle = {
|
|
19247
|
-
position: "",
|
|
19248
|
-
left: "",
|
|
19249
|
-
bottom: ""
|
|
19250
|
-
};
|
|
19251
|
-
let domStyle = {
|
|
19252
|
-
position: ""
|
|
19253
|
-
};
|
|
19254
|
-
const calculateTop = () => {
|
|
19255
|
-
let top2 = "0";
|
|
19256
|
-
if (globalThis) {
|
|
19257
|
-
const computedStyle = globalThis.getComputedStyle(this.dom);
|
|
19258
|
-
const markerComputedStyle = globalThis.getComputedStyle(this.marker);
|
|
19259
|
-
const lineHeight = parseFloat(computedStyle.lineHeight);
|
|
19260
|
-
const markerLineHeight = parseFloat(markerComputedStyle.lineHeight);
|
|
19261
|
-
top2 = `${lineHeight - markerLineHeight}px`;
|
|
19262
|
-
}
|
|
19263
|
-
return top2;
|
|
19264
|
-
};
|
|
19265
|
-
const rect = this.marker.getBoundingClientRect();
|
|
19266
|
-
const markerWidth = rect.width;
|
|
19267
|
-
if (justification === "right") {
|
|
19268
|
-
markerStyle.position = "absolute";
|
|
19269
|
-
markerStyle.left = `${-markerWidth}px`;
|
|
19270
|
-
markerStyle.top = calculateTop();
|
|
19271
|
-
domStyle.position = "relative";
|
|
19272
|
-
} else if (justification === "center") {
|
|
19273
|
-
markerStyle.position = "absolute";
|
|
19274
|
-
markerStyle.left = `${-markerWidth / 2}px`;
|
|
19275
|
-
markerStyle.top = calculateTop();
|
|
19276
|
-
domStyle.position = "relative";
|
|
19277
|
-
}
|
|
19278
|
-
Object.entries(markerStyle).forEach(([k2, v]) => {
|
|
19279
|
-
this.marker.style[k2] = v;
|
|
19280
|
-
});
|
|
19281
|
-
Object.entries(domStyle).forEach(([k2, v]) => {
|
|
19282
|
-
this.dom.style[k2] = v;
|
|
19283
|
-
});
|
|
19284
|
-
};
|
|
19285
|
-
removeList_fn = function() {
|
|
19286
|
-
if (this.marker) {
|
|
19287
|
-
this.dom.removeChild(this.marker);
|
|
19288
|
-
this.marker = null;
|
|
19289
|
-
}
|
|
19290
|
-
if (this.separator) {
|
|
19291
|
-
this.dom.removeChild(this.separator);
|
|
19292
|
-
this.separator = null;
|
|
19293
|
-
}
|
|
19294
|
-
this.dom.style.position = "";
|
|
19295
|
-
};
|
|
19296
|
-
getParagraphContext_fn = function() {
|
|
19297
|
-
const $pos = this.editor.state.doc.resolve(this.getPos());
|
|
19298
|
-
const start2 = $pos.start($pos.depth + 1);
|
|
19299
|
-
const paragraphContext = extractParagraphContext(this.node, start2, this.editor.helpers);
|
|
19300
|
-
return { paragraphContext, start: start2 };
|
|
19301
|
-
};
|
|
19302
|
-
/**
|
|
19303
|
-
* @param {() => void} fn
|
|
19304
|
-
*/
|
|
19305
|
-
scheduleAnimation_fn = function(fn2) {
|
|
19306
|
-
if (typeof globalThis === "undefined") {
|
|
19307
|
-
return;
|
|
20283
|
+
orderMarker = docxNumberingHelpers.normalizeLvlTextChar(lvlText);
|
|
20284
|
+
}
|
|
19308
20285
|
}
|
|
19309
|
-
|
|
19310
|
-
|
|
19311
|
-
|
|
19312
|
-
|
|
20286
|
+
const pos = this.getResolvedPos();
|
|
20287
|
+
const { fontSize, fontFamily, lineHeight } = resolveListItemTypography({
|
|
20288
|
+
node: this.node,
|
|
20289
|
+
pos,
|
|
20290
|
+
editor: this.editor,
|
|
20291
|
+
nodeView: this,
|
|
20292
|
+
activeNodeViews: activeListItemNodeViews
|
|
19313
20293
|
});
|
|
20294
|
+
this.dom = document.createElement("li");
|
|
20295
|
+
this.dom.className = "sd-editor-list-item-node-view";
|
|
20296
|
+
this.dom.style.fontSize = fontSize;
|
|
20297
|
+
this.dom.style.fontFamily = fontFamily ? fontFamily : "inherit";
|
|
20298
|
+
this.dom.style.lineHeight = lineHeight || "";
|
|
20299
|
+
this.dom.setAttribute("data-marker-type", orderMarker);
|
|
20300
|
+
this.dom.setAttribute("data-num-id", numId);
|
|
20301
|
+
this.dom.setAttribute("data-list-level", JSON.stringify(listLevel));
|
|
20302
|
+
this.dom.setAttribute("data-list-numbering-type", listNumberingType);
|
|
20303
|
+
this.dom.setAttribute("data-level", level);
|
|
20304
|
+
this.numberingDOM = document.createElement("span");
|
|
20305
|
+
this.numberingDOM.className = "sd-editor-list-item-numbering";
|
|
20306
|
+
this.numberingDOM.textContent = orderMarker;
|
|
20307
|
+
this.numberingDOM.setAttribute("contenteditable", "false");
|
|
20308
|
+
this.numberingDOM.addEventListener("click", this.handleNumberingClick);
|
|
20309
|
+
this.contentDOM = document.createElement("div");
|
|
20310
|
+
this.contentDOM.className = "sd-editor-list-item-content-dom";
|
|
20311
|
+
this.dom.appendChild(this.numberingDOM);
|
|
20312
|
+
this.dom.appendChild(this.contentDOM);
|
|
20313
|
+
this.refreshIndentStyling({ immediate: true });
|
|
19314
20314
|
};
|
|
19315
|
-
|
|
19316
|
-
|
|
19317
|
-
|
|
19318
|
-
}
|
|
19319
|
-
|
|
19320
|
-
|
|
19321
|
-
|
|
19322
|
-
|
|
19323
|
-
|
|
19324
|
-
|
|
19325
|
-
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
* numId/level combination.
|
|
19334
|
-
*
|
|
19335
|
-
* @param {string | number} numId
|
|
19336
|
-
* @param {number} level
|
|
19337
|
-
* @param {number} startValue
|
|
19338
|
-
* @param {number} [restartValue]
|
|
19339
|
-
*/
|
|
19340
|
-
setStartSettings(numId, level, startValue, restartValue) {
|
|
19341
|
-
if (!startsMap[numId]) {
|
|
19342
|
-
startsMap[numId] = {};
|
|
19343
|
-
}
|
|
19344
|
-
if (!startsMap[numId][level]) {
|
|
19345
|
-
startsMap[numId][level] = {};
|
|
19346
|
-
}
|
|
19347
|
-
startsMap[numId][level].start = startValue;
|
|
19348
|
-
startsMap[numId][level].restart = restartValue;
|
|
19349
|
-
},
|
|
19350
|
-
/**
|
|
19351
|
-
* Record the computed counter for a specific node position. When caching is
|
|
19352
|
-
* enabled this also tracks the latest position to speed up lookups.
|
|
19353
|
-
*
|
|
19354
|
-
* @param {string | number} numId
|
|
19355
|
-
* @param {number} level
|
|
19356
|
-
* @param {number} pos
|
|
19357
|
-
* @param {number} value
|
|
19358
|
-
*/
|
|
19359
|
-
setCounter(numId, level, pos, value, abstractId) {
|
|
19360
|
-
if (!countersMap[numId]) {
|
|
19361
|
-
countersMap[numId] = {};
|
|
19362
|
-
}
|
|
19363
|
-
if (!countersMap[numId][level]) {
|
|
19364
|
-
countersMap[numId][level] = {};
|
|
19365
|
-
}
|
|
19366
|
-
countersMap[numId][level][pos] = value;
|
|
19367
|
-
abstractIdMap[numId] = abstractId;
|
|
19368
|
-
if (!abstractCountersMap[abstractId]) {
|
|
19369
|
-
abstractCountersMap[abstractId] = {};
|
|
19370
|
-
}
|
|
19371
|
-
if (!abstractCountersMap[abstractId][level]) {
|
|
19372
|
-
abstractCountersMap[abstractId][level] = {};
|
|
19373
|
-
}
|
|
19374
|
-
abstractCountersMap[abstractId][level][pos] = value;
|
|
19375
|
-
if (!cacheEnabled) {
|
|
19376
|
-
return;
|
|
19377
|
-
}
|
|
19378
|
-
if (!lastSeenMap[numId]) {
|
|
19379
|
-
lastSeenMap[numId] = {};
|
|
19380
|
-
}
|
|
19381
|
-
const lastSeen = lastSeenMap[numId][level];
|
|
19382
|
-
if (!lastSeen || pos > lastSeen.pos) {
|
|
19383
|
-
lastSeenMap[numId][level] = { pos, count: value };
|
|
19384
|
-
}
|
|
19385
|
-
},
|
|
19386
|
-
/**
|
|
19387
|
-
* Retrieve a previously stored counter for the provided position.
|
|
19388
|
-
*
|
|
19389
|
-
* @param {string | number} numId
|
|
19390
|
-
* @param {number} level
|
|
19391
|
-
* @param {number} pos
|
|
19392
|
-
* @returns {number | null}
|
|
19393
|
-
*/
|
|
19394
|
-
getCounter(numId, level, pos) {
|
|
19395
|
-
if (countersMap[numId] && countersMap[numId][level] && countersMap[numId][level][pos] != null) {
|
|
19396
|
-
return countersMap[numId][level][pos];
|
|
19397
|
-
}
|
|
19398
|
-
return null;
|
|
19399
|
-
},
|
|
19400
|
-
/**
|
|
19401
|
-
* Calculate the counter value that should be used for the given position,
|
|
19402
|
-
* respecting restart rules, ancestor usage, and cached history.
|
|
19403
|
-
*
|
|
19404
|
-
* @param {string | number} numId
|
|
19405
|
-
* @param {number} level
|
|
19406
|
-
* @param {number} pos
|
|
19407
|
-
* @returns {number}
|
|
19408
|
-
*/
|
|
19409
|
-
calculateCounter(numId, level, pos, abstractId) {
|
|
19410
|
-
abstractIdMap[numId] = abstractId;
|
|
19411
|
-
const restartSetting = startsMap?.[numId]?.[level]?.restart;
|
|
19412
|
-
const startValue = startsMap?.[numId]?.[level]?.start ?? 1;
|
|
19413
|
-
const levelData = abstractCountersMap?.[abstractId]?.[level] || {};
|
|
19414
|
-
let previousPos = null;
|
|
19415
|
-
let previousCount = startValue - 1;
|
|
19416
|
-
if (cacheEnabled) {
|
|
19417
|
-
const cachedLast = lastSeenMap?.[numId]?.[level];
|
|
19418
|
-
if (cachedLast && cachedLast.pos < pos) {
|
|
19419
|
-
previousPos = cachedLast.pos;
|
|
19420
|
-
previousCount = cachedLast.count;
|
|
19421
|
-
}
|
|
19422
|
-
}
|
|
19423
|
-
if (previousPos == null) {
|
|
19424
|
-
const fallbackPos = Object.keys(levelData).map((p) => parseInt(p)).filter((p) => p < pos).pop();
|
|
19425
|
-
if (fallbackPos != null) {
|
|
19426
|
-
previousPos = fallbackPos;
|
|
19427
|
-
previousCount = levelData[fallbackPos];
|
|
19428
|
-
}
|
|
19429
|
-
}
|
|
19430
|
-
if (restartSetting === 0) {
|
|
19431
|
-
return previousCount + 1;
|
|
19432
|
-
}
|
|
19433
|
-
if (previousPos == null) {
|
|
19434
|
-
return startValue;
|
|
19435
|
-
}
|
|
19436
|
-
const usedLevels = [];
|
|
19437
|
-
for (let lvl = 0; lvl < level; lvl++) {
|
|
19438
|
-
const levelData2 = abstractCountersMap?.[abstractId]?.[lvl] || {};
|
|
19439
|
-
const hasUsed = Object.keys(levelData2).map((p) => parseInt(p)).some((p) => p > previousPos && p < pos);
|
|
19440
|
-
if (hasUsed) {
|
|
19441
|
-
usedLevels.push(lvl);
|
|
19442
|
-
}
|
|
19443
|
-
}
|
|
19444
|
-
if (usedLevels.length === 0) {
|
|
19445
|
-
return previousCount + 1;
|
|
19446
|
-
}
|
|
19447
|
-
if (restartSetting == null) {
|
|
19448
|
-
return startValue;
|
|
19449
|
-
}
|
|
19450
|
-
const shouldRestart = usedLevels.some((lvl) => lvl <= restartSetting);
|
|
19451
|
-
if (shouldRestart) {
|
|
19452
|
-
return startValue;
|
|
19453
|
-
}
|
|
19454
|
-
return previousCount + 1;
|
|
19455
|
-
},
|
|
19456
|
-
/**
|
|
19457
|
-
* Resolve the counter values for every ancestor level preceding the given
|
|
19458
|
-
* position. All numbering definitions that have the same abstract id
|
|
19459
|
-
* are considered. Results are cached when cache mode is active.
|
|
19460
|
-
*
|
|
19461
|
-
* @param {string | number} numId
|
|
19462
|
-
* @param {number} level
|
|
19463
|
-
* @param {number} pos
|
|
19464
|
-
* @returns {number[]}
|
|
19465
|
-
*/
|
|
19466
|
-
getAncestorsPath(numId, level, pos) {
|
|
19467
|
-
if (cacheEnabled && pathCache?.[numId]?.[level]?.[pos]) {
|
|
19468
|
-
return pathCache[numId][level][pos];
|
|
19469
|
-
}
|
|
19470
|
-
const path = [];
|
|
19471
|
-
const abstractId = abstractIdMap[numId];
|
|
19472
|
-
for (let lvl = 0; lvl < level; lvl++) {
|
|
19473
|
-
const startCount = startsMap?.[numId]?.[lvl]?.start ?? 1;
|
|
19474
|
-
const levelData = abstractCountersMap?.[abstractId]?.[lvl] || {};
|
|
19475
|
-
if (levelData == null) {
|
|
19476
|
-
path.push(startCount);
|
|
19477
|
-
continue;
|
|
19478
|
-
}
|
|
19479
|
-
const previousPos = Object.keys(levelData).map((p) => parseInt(p)).filter((p) => p < pos).pop();
|
|
19480
|
-
if (previousPos == null) {
|
|
19481
|
-
path.push(startCount);
|
|
19482
|
-
} else {
|
|
19483
|
-
path.push(levelData[previousPos]);
|
|
19484
|
-
}
|
|
19485
|
-
}
|
|
19486
|
-
if (cacheEnabled) {
|
|
19487
|
-
if (!pathCache[numId]) {
|
|
19488
|
-
pathCache[numId] = {};
|
|
19489
|
-
}
|
|
19490
|
-
if (!pathCache[numId][level]) {
|
|
19491
|
-
pathCache[numId][level] = {};
|
|
19492
|
-
}
|
|
19493
|
-
pathCache[numId][level][pos] = path;
|
|
19494
|
-
}
|
|
19495
|
-
return path;
|
|
19496
|
-
},
|
|
19497
|
-
/**
|
|
19498
|
-
* Convenience helper that appends the current level counter on top of the
|
|
19499
|
-
* ancestor path.
|
|
19500
|
-
*
|
|
19501
|
-
* @param {string | number} numId
|
|
19502
|
-
* @param {number} level
|
|
19503
|
-
* @param {number} pos
|
|
19504
|
-
* @returns {number[]}
|
|
19505
|
-
*/
|
|
19506
|
-
calculatePath(numId, level, pos) {
|
|
19507
|
-
const path = this.getAncestorsPath(numId, level, pos);
|
|
19508
|
-
const myCount = this.getCounter(numId, level, pos);
|
|
19509
|
-
path.push(myCount);
|
|
19510
|
-
return path;
|
|
19511
|
-
},
|
|
19512
|
-
/**
|
|
19513
|
-
* Expose the internal counters map mainly for debugging and tests.
|
|
19514
|
-
*
|
|
19515
|
-
* @returns {Record<string, Record<string, Record<string, number>>>}
|
|
19516
|
-
*/
|
|
19517
|
-
getCountersMap() {
|
|
19518
|
-
return countersMap;
|
|
19519
|
-
},
|
|
19520
|
-
/**
|
|
19521
|
-
* Reset cached counter/path structures. Intended for internal use only.
|
|
19522
|
-
*/
|
|
19523
|
-
_clearCache() {
|
|
19524
|
-
lastSeenMap = {};
|
|
19525
|
-
pathCache = {};
|
|
19526
|
-
countersMap = {};
|
|
19527
|
-
abstractCountersMap = {};
|
|
19528
|
-
abstractIdMap = {};
|
|
19529
|
-
},
|
|
19530
|
-
/**
|
|
19531
|
-
* Enable cache-aware logic (used during document scans) and drop stale data.
|
|
19532
|
-
*/
|
|
19533
|
-
enableCache() {
|
|
19534
|
-
cacheEnabled = true;
|
|
19535
|
-
this._clearCache();
|
|
20315
|
+
applyIndentStyling_fn = function() {
|
|
20316
|
+
const { attrs } = this.node;
|
|
20317
|
+
const { styleId, numId, level, indent: inlineIndent } = attrs;
|
|
20318
|
+
const defs = getListItemStyleDefinitions({ styleId, node: this.node, numId, level, editor: this.editor });
|
|
20319
|
+
const visibleIndent = getVisibleIndent(defs.stylePpr, defs.numDefPpr, inlineIndent);
|
|
20320
|
+
const lvlJc = defs.numLvlJs?.attributes?.["w:val"] || "left";
|
|
20321
|
+
const contentLeft = visibleIndent.left || 0;
|
|
20322
|
+
const hanging = visibleIndent.hanging || 0;
|
|
20323
|
+
const handlers2 = {
|
|
20324
|
+
right: () => {
|
|
20325
|
+
const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM, this.editor);
|
|
20326
|
+
const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
|
|
20327
|
+
const effectiveHanging = Math.max(hanging, minMarkerWidth);
|
|
20328
|
+
const markerLeft = contentLeft - effectiveHanging - MARKER_OFFSET_RIGHT;
|
|
20329
|
+
this.contentDOM.style.marginLeft = `${contentLeft}px`;
|
|
20330
|
+
this.numberingDOM.style.left = `${markerLeft}px`;
|
|
20331
|
+
this.numberingDOM.style.width = `${effectiveHanging}px`;
|
|
20332
|
+
this.numberingDOM.style.textAlign = "right";
|
|
19536
20333
|
},
|
|
19537
|
-
|
|
19538
|
-
|
|
19539
|
-
|
|
19540
|
-
|
|
19541
|
-
|
|
19542
|
-
|
|
20334
|
+
left: () => {
|
|
20335
|
+
const calculatedWidth = calculateMarkerWidth(this.dom, this.numberingDOM, this.editor);
|
|
20336
|
+
const minMarkerWidth = Math.max(calculatedWidth, MIN_MARKER_WIDTH);
|
|
20337
|
+
let markerLeft = contentLeft - hanging;
|
|
20338
|
+
if (markerLeft === contentLeft) {
|
|
20339
|
+
markerLeft -= minMarkerWidth;
|
|
20340
|
+
} else if (minMarkerWidth > hanging) {
|
|
20341
|
+
const diff = minMarkerWidth - hanging;
|
|
20342
|
+
markerLeft -= diff;
|
|
20343
|
+
}
|
|
20344
|
+
this.contentDOM.style.marginLeft = `${contentLeft}px`;
|
|
20345
|
+
this.numberingDOM.style.left = `${markerLeft}px`;
|
|
20346
|
+
this.numberingDOM.style.width = "";
|
|
20347
|
+
this.numberingDOM.style.textAlign = "";
|
|
19543
20348
|
}
|
|
19544
20349
|
};
|
|
19545
|
-
|
|
19546
|
-
|
|
19547
|
-
const handler = listIndexMap[listNumberingType];
|
|
19548
|
-
return handler ? handler(listLevel, lvlText, customFormat) : null;
|
|
19549
|
-
};
|
|
19550
|
-
const handleDecimal = (path, lvlText) => generateNumbering(path, lvlText, String);
|
|
19551
|
-
const handleRoman = (path, lvlText) => generateNumbering(path, lvlText, intToRoman);
|
|
19552
|
-
const handleLowerRoman = (path, lvlText) => handleRoman(path, lvlText).toLowerCase();
|
|
19553
|
-
const handleLowerAlpha = (path, lvlText) => handleAlpha(path, lvlText).toLowerCase();
|
|
19554
|
-
const handleAlpha = (path, lvlText) => generateNumbering(path, lvlText, (p) => intToAlpha(p));
|
|
19555
|
-
const handleOrdinal = (path, lvlText) => generateNumbering(path, lvlText, ordinalFormatter);
|
|
19556
|
-
const handleCustom = (path, lvlText, customFormat) => generateFromCustom(path, lvlText, customFormat);
|
|
19557
|
-
const handleJapaneseCounting = (path, lvlText) => generateNumbering(path, lvlText, intToJapaneseCounting);
|
|
19558
|
-
const listIndexMap = {
|
|
19559
|
-
decimal: handleDecimal,
|
|
19560
|
-
lowerRoman: handleLowerRoman,
|
|
19561
|
-
upperRoman: handleRoman,
|
|
19562
|
-
lowerLetter: handleLowerAlpha,
|
|
19563
|
-
upperLetter: handleAlpha,
|
|
19564
|
-
ordinal: handleOrdinal,
|
|
19565
|
-
custom: handleCustom,
|
|
19566
|
-
japaneseCounting: handleJapaneseCounting
|
|
19567
|
-
};
|
|
19568
|
-
const createNumbering = (values, lvlText) => {
|
|
19569
|
-
return values.reduce((acc, value, index2) => {
|
|
19570
|
-
return value > 9 ? acc.replace(/^0/, "").replace(`%${index2 + 1}`, value) : acc.replace(`%${index2 + 1}`, value);
|
|
19571
|
-
}, lvlText);
|
|
19572
|
-
};
|
|
19573
|
-
const generateNumbering = (path, lvlText, formatter) => {
|
|
19574
|
-
const formattedValues = path.map(formatter);
|
|
19575
|
-
return createNumbering(formattedValues, lvlText);
|
|
19576
|
-
};
|
|
19577
|
-
const ordinalFormatter = (level) => {
|
|
19578
|
-
const suffixes = ["th", "st", "nd", "rd"];
|
|
19579
|
-
const value = level % 100;
|
|
19580
|
-
const suffix = suffixes[(value - 20) % 10] || suffixes[value] || suffixes[0];
|
|
19581
|
-
const p = level + suffix;
|
|
19582
|
-
return p;
|
|
19583
|
-
};
|
|
19584
|
-
const generateFromCustom = (path, lvlText, customFormat) => {
|
|
19585
|
-
if (customFormat.match(/(?:[0]+\d,\s){3}\.{3}/) == null) return generateNumbering(path, lvlText, String);
|
|
19586
|
-
const match = customFormat.match(/(\d+)/);
|
|
19587
|
-
if (!match) throw new Error("Invalid format string: no numeric pattern found");
|
|
19588
|
-
const sample = match[1];
|
|
19589
|
-
const digitCount = sample.length;
|
|
19590
|
-
return generateNumbering(path, lvlText, (p) => String(p).padStart(digitCount, "0"));
|
|
19591
|
-
};
|
|
19592
|
-
const intToRoman = (num) => {
|
|
19593
|
-
const romanNumeralMap = [
|
|
19594
|
-
{ value: 1e3, numeral: "M" },
|
|
19595
|
-
{ value: 900, numeral: "CM" },
|
|
19596
|
-
{ value: 500, numeral: "D" },
|
|
19597
|
-
{ value: 400, numeral: "CD" },
|
|
19598
|
-
{ value: 100, numeral: "C" },
|
|
19599
|
-
{ value: 90, numeral: "XC" },
|
|
19600
|
-
{ value: 50, numeral: "L" },
|
|
19601
|
-
{ value: 40, numeral: "XL" },
|
|
19602
|
-
{ value: 10, numeral: "X" },
|
|
19603
|
-
{ value: 9, numeral: "IX" },
|
|
19604
|
-
{ value: 5, numeral: "V" },
|
|
19605
|
-
{ value: 4, numeral: "IV" },
|
|
19606
|
-
{ value: 1, numeral: "I" }
|
|
19607
|
-
];
|
|
19608
|
-
let result = "";
|
|
19609
|
-
for (const { value, numeral } of romanNumeralMap) {
|
|
19610
|
-
while (num >= value) {
|
|
19611
|
-
result += numeral;
|
|
19612
|
-
num -= value;
|
|
19613
|
-
}
|
|
19614
|
-
}
|
|
19615
|
-
return result;
|
|
19616
|
-
};
|
|
19617
|
-
const intToAlpha = (num) => {
|
|
19618
|
-
let result = "";
|
|
19619
|
-
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
19620
|
-
while (num > 0) {
|
|
19621
|
-
let index2 = (num - 1) % 26;
|
|
19622
|
-
result = alphabet[index2] + result;
|
|
19623
|
-
num = Math.floor((num - 1) / 26);
|
|
19624
|
-
}
|
|
19625
|
-
return result;
|
|
20350
|
+
const handleStyles = handlers2[lvlJc] ?? handlers2.left;
|
|
20351
|
+
handleStyles();
|
|
19626
20352
|
};
|
|
19627
|
-
|
|
19628
|
-
|
|
19629
|
-
|
|
19630
|
-
|
|
19631
|
-
|
|
19632
|
-
|
|
19633
|
-
|
|
19634
|
-
let unitIndex = 0;
|
|
19635
|
-
while (tempNum > 0) {
|
|
19636
|
-
const digit = tempNum % 10;
|
|
19637
|
-
if (digit !== 0) {
|
|
19638
|
-
const digitStr = digit === 1 && unitIndex > 0 ? "" : digits[digit];
|
|
19639
|
-
result = digitStr + (unitIndex > 0 ? units[unitIndex] : "") + result;
|
|
19640
|
-
} else if (result && tempNum > 0) {
|
|
19641
|
-
if (!result.startsWith("零") && tempNum % 100 !== 0) {
|
|
19642
|
-
result = "零" + result;
|
|
19643
|
-
}
|
|
20353
|
+
function refreshAllListItemNodeViews() {
|
|
20354
|
+
activeListItemNodeViews.forEach((nodeView) => {
|
|
20355
|
+
try {
|
|
20356
|
+
nodeView.refreshIndentStyling({ immediate: true });
|
|
20357
|
+
} catch (error) {
|
|
20358
|
+
console.error("Error refreshing list item node view:", error);
|
|
20359
|
+
activeListItemNodeViews.delete(nodeView);
|
|
19644
20360
|
}
|
|
19645
|
-
|
|
19646
|
-
|
|
19647
|
-
|
|
19648
|
-
}
|
|
19649
|
-
|
|
19650
|
-
|
|
19651
|
-
|
|
20361
|
+
});
|
|
20362
|
+
}
|
|
20363
|
+
const getVisibleIndent = (stylePpr, numDefPpr, inlineIndent) => {
|
|
20364
|
+
const styleIndentTag = stylePpr?.elements?.find((el) => el.name === "w:ind") || {};
|
|
20365
|
+
const styleIndent = parseIndentElement(styleIndentTag);
|
|
20366
|
+
const numDefIndentTag = numDefPpr?.elements?.find((el) => el.name === "w:ind") || {};
|
|
20367
|
+
const numDefIndent = parseIndentElement(numDefIndentTag);
|
|
20368
|
+
const indent = combineIndents(styleIndent, numDefIndent);
|
|
20369
|
+
const result = combineIndents(indent, inlineIndent);
|
|
19652
20370
|
return result;
|
|
19653
20371
|
};
|
|
19654
|
-
function
|
|
19655
|
-
const
|
|
19656
|
-
const
|
|
19657
|
-
|
|
19658
|
-
|
|
19659
|
-
|
|
19660
|
-
|
|
19661
|
-
|
|
19662
|
-
|
|
19663
|
-
|
|
19664
|
-
|
|
19665
|
-
|
|
19666
|
-
|
|
19667
|
-
|
|
19668
|
-
|
|
19669
|
-
const
|
|
19670
|
-
|
|
19671
|
-
|
|
19672
|
-
|
|
19673
|
-
|
|
19674
|
-
editor.on("list-definitions-change", refreshStartSettings);
|
|
19675
|
-
if (typeof editor?.off === "function") {
|
|
19676
|
-
const cleanupListDefinitionListener = () => {
|
|
19677
|
-
editor.off("list-definitions-change", refreshStartSettings);
|
|
19678
|
-
editor.off?.("destroy", cleanupListDefinitionListener);
|
|
19679
|
-
};
|
|
19680
|
-
editor.on("destroy", cleanupListDefinitionListener);
|
|
19681
|
-
}
|
|
20372
|
+
function calculateMarkerWidth(dom, numberingDOM, editor, { withPadding = true } = {}) {
|
|
20373
|
+
const markerText = numberingDOM.textContent || "";
|
|
20374
|
+
const fontSize = dom.style.fontSize || DEFAULT_FONT_SIZE;
|
|
20375
|
+
const fontValue = dom.style.fontFamily;
|
|
20376
|
+
const fontFamily = fontValue && fontValue !== "inherit" ? fontValue : DEFAULT_FONT_FAMILY;
|
|
20377
|
+
if (!markerText.trim()) return 0;
|
|
20378
|
+
try {
|
|
20379
|
+
if (editor?.options?.isHeadless) return 0;
|
|
20380
|
+
if (typeof globalThis.CanvasRenderingContext2D === "undefined") return 0;
|
|
20381
|
+
const canvas = document.createElement("canvas");
|
|
20382
|
+
if (typeof canvas.getContext !== "function") return 0;
|
|
20383
|
+
const context = canvas.getContext("2d");
|
|
20384
|
+
if (!context) return 0;
|
|
20385
|
+
const fontSizePx = fontSize.includes("pt") ? Number.parseFloat(fontSize) * POINT_TO_PIXEL_CONVERSION_FACTOR : Number.parseFloat(fontSize);
|
|
20386
|
+
context.font = `${fontSizePx}px ${fontFamily}`;
|
|
20387
|
+
const textWidth = context.measureText(markerText).width;
|
|
20388
|
+
const resultWidth = withPadding ? Math.ceil(textWidth + MARKER_PADDING) : Math.ceil(textWidth);
|
|
20389
|
+
return resultWidth;
|
|
20390
|
+
} catch {
|
|
20391
|
+
return 0;
|
|
19682
20392
|
}
|
|
20393
|
+
}
|
|
20394
|
+
const orderedListSyncPluginKey = new PluginKey("orderedListSync");
|
|
20395
|
+
function orderedListSync(editor) {
|
|
20396
|
+
let hasInitialized = false;
|
|
20397
|
+
const docx = editor.converter.convertedXml;
|
|
19683
20398
|
return new Plugin({
|
|
19684
|
-
|
|
19685
|
-
key: new PluginKey("numberingPlugin"),
|
|
19686
|
-
/**
|
|
19687
|
-
* Scan document changes and collect fresh numbering metadata for list
|
|
19688
|
-
* paragraphs. The incoming transactions are marked to avoid reprocessing.
|
|
19689
|
-
*
|
|
19690
|
-
* @param {import('prosemirror-state').Transaction[]} transactions
|
|
19691
|
-
* @param {import('prosemirror-state').EditorState} oldState
|
|
19692
|
-
* @param {import('prosemirror-state').EditorState} newState
|
|
19693
|
-
* @returns {import('prosemirror-state').Transaction | null}
|
|
19694
|
-
*/
|
|
20399
|
+
key: orderedListSyncPluginKey,
|
|
19695
20400
|
appendTransaction(transactions, oldState, newState) {
|
|
20401
|
+
if (transactions.every((tr2) => tr2.getMeta("y-sync$"))) return null;
|
|
20402
|
+
const updateNodeViews = transactions.some((tr2) => tr2.getMeta("updatedListItemNodeViews"));
|
|
20403
|
+
if (updateNodeViews || !hasInitialized) {
|
|
20404
|
+
refreshAllListItemNodeViews();
|
|
20405
|
+
}
|
|
19696
20406
|
const isFromPlugin = transactions.some((tr2) => tr2.getMeta("orderedListSync"));
|
|
19697
|
-
|
|
20407
|
+
const docChanged = transactions.some((tr2) => tr2.docChanged) && !oldState.doc.eq(newState.doc);
|
|
20408
|
+
if (isFromPlugin || !docChanged) {
|
|
19698
20409
|
return null;
|
|
19699
20410
|
}
|
|
20411
|
+
hasInitialized = true;
|
|
19700
20412
|
const tr = newState.tr;
|
|
19701
20413
|
tr.setMeta("orderedListSync", true);
|
|
19702
|
-
|
|
20414
|
+
const listMap = /* @__PURE__ */ new Map();
|
|
20415
|
+
const listInitialized = /* @__PURE__ */ new Map();
|
|
20416
|
+
const shouldProcess = transactions.some((tr2) => {
|
|
20417
|
+
if (tr2.getMeta("updateListSync")) return true;
|
|
20418
|
+
return tr2.steps.some((step) => {
|
|
20419
|
+
const stepJSON = step.toJSON();
|
|
20420
|
+
if (step.slice?.content) {
|
|
20421
|
+
let hasListItem = false;
|
|
20422
|
+
step.slice.content.descendants((node) => {
|
|
20423
|
+
if (node.type.name === "listItem") {
|
|
20424
|
+
hasListItem = true;
|
|
20425
|
+
return false;
|
|
20426
|
+
}
|
|
20427
|
+
});
|
|
20428
|
+
if (hasListItem) return true;
|
|
20429
|
+
}
|
|
20430
|
+
if (stepJSON && stepJSON.slice) {
|
|
20431
|
+
const jsonStr = JSON.stringify(stepJSON);
|
|
20432
|
+
if (jsonStr.includes('"listItem"')) return true;
|
|
20433
|
+
}
|
|
20434
|
+
return false;
|
|
20435
|
+
});
|
|
20436
|
+
});
|
|
20437
|
+
if (!shouldProcess) return null;
|
|
19703
20438
|
newState.doc.descendants((node, pos) => {
|
|
19704
|
-
if (node.type.name !== "
|
|
19705
|
-
|
|
20439
|
+
if (node.type.name !== "listItem") return;
|
|
20440
|
+
const { level: attrLvl, numId: attrNumId, styleId } = node.attrs;
|
|
20441
|
+
const level = parseInt(attrLvl);
|
|
20442
|
+
const numId = parseInt(attrNumId);
|
|
20443
|
+
let {
|
|
20444
|
+
lvlText,
|
|
20445
|
+
customFormat,
|
|
20446
|
+
listNumberingType,
|
|
20447
|
+
start: numberingDefStart
|
|
20448
|
+
} = ListHelpers.getListDefinitionDetails({ numId, level, editor });
|
|
20449
|
+
const start2 = parseInt(numberingDefStart) || 1;
|
|
20450
|
+
if (!listMap.has(numId)) {
|
|
20451
|
+
const generatedLevels = {};
|
|
20452
|
+
const initialPath = docxNumberingHelpers.generateListPath(level, numId, styleId, generatedLevels, docx);
|
|
20453
|
+
listMap.set(numId, initialPath || []);
|
|
20454
|
+
listInitialized.set(numId, false);
|
|
20455
|
+
}
|
|
20456
|
+
let currentListLevels = [...listMap.get(numId)];
|
|
20457
|
+
if (!listInitialized.get(numId)) {
|
|
20458
|
+
listInitialized.set(numId, true);
|
|
20459
|
+
if (typeof start2 === "number") {
|
|
20460
|
+
while (currentListLevels.length <= level) {
|
|
20461
|
+
currentListLevels.push(0);
|
|
20462
|
+
}
|
|
20463
|
+
currentListLevels[level] = start2;
|
|
20464
|
+
for (let i = level + 1; i < currentListLevels.length; i++) {
|
|
20465
|
+
currentListLevels[i] = 0;
|
|
20466
|
+
}
|
|
20467
|
+
}
|
|
20468
|
+
} else {
|
|
20469
|
+
while (currentListLevels.length <= level) {
|
|
20470
|
+
currentListLevels.push(0);
|
|
20471
|
+
}
|
|
20472
|
+
currentListLevels[level] = (currentListLevels[level] || 0) + 1;
|
|
20473
|
+
for (let i = level + 1; i < currentListLevels.length; i++) {
|
|
20474
|
+
currentListLevels[i] = 0;
|
|
20475
|
+
}
|
|
19706
20476
|
}
|
|
19707
|
-
|
|
19708
|
-
|
|
19709
|
-
if (!definitionDetails || Object.keys(definitionDetails).length === 0) {
|
|
19710
|
-
tr.setNodeAttribute(pos, "listRendering", null);
|
|
19711
|
-
return;
|
|
20477
|
+
if (currentListLevels.length === 0) {
|
|
20478
|
+
currentListLevels = [1];
|
|
19712
20479
|
}
|
|
19713
|
-
|
|
19714
|
-
|
|
19715
|
-
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
|
|
19719
|
-
|
|
19720
|
-
|
|
19721
|
-
|
|
19722
|
-
|
|
19723
|
-
|
|
19724
|
-
|
|
19725
|
-
});
|
|
19726
|
-
} else {
|
|
19727
|
-
markerText = docxNumberingHelpers.normalizeLvlTextChar(lvlText);
|
|
19728
|
-
}
|
|
19729
|
-
if (JSON.stringify(node.attrs.listRendering) !== JSON.stringify({
|
|
19730
|
-
markerText,
|
|
19731
|
-
suffix,
|
|
19732
|
-
justification,
|
|
19733
|
-
path,
|
|
19734
|
-
numberingType: listNumberingType
|
|
19735
|
-
})) {
|
|
19736
|
-
tr.setNodeAttribute(pos, "listRendering", {
|
|
19737
|
-
markerText,
|
|
19738
|
-
suffix,
|
|
19739
|
-
justification,
|
|
19740
|
-
path,
|
|
19741
|
-
numberingType: listNumberingType
|
|
19742
|
-
});
|
|
20480
|
+
listMap.set(numId, currentListLevels);
|
|
20481
|
+
const updatedAttrs = {
|
|
20482
|
+
...node.attrs,
|
|
20483
|
+
listLevel: [...currentListLevels],
|
|
20484
|
+
level,
|
|
20485
|
+
lvlText,
|
|
20486
|
+
listNumberingType,
|
|
20487
|
+
customFormat
|
|
20488
|
+
};
|
|
20489
|
+
const keysChanged = Object.keys(updatedAttrs).some((key2) => node.attrs[key2] !== updatedAttrs[key2]);
|
|
20490
|
+
if (keysChanged) {
|
|
20491
|
+
tr.setNodeMarkup(pos, void 0, updatedAttrs);
|
|
19743
20492
|
}
|
|
19744
|
-
return false;
|
|
19745
20493
|
});
|
|
19746
|
-
|
|
19747
|
-
return tr.docChanged ? tr : null;
|
|
20494
|
+
return tr;
|
|
19748
20495
|
}
|
|
19749
20496
|
});
|
|
19750
20497
|
}
|
|
19751
|
-
const
|
|
19752
|
-
|
|
20498
|
+
const ListItem = Node$1.create({
|
|
20499
|
+
name: "listItem",
|
|
20500
|
+
content: "paragraph* block*",
|
|
20501
|
+
defining: true,
|
|
20502
|
+
priority: 101,
|
|
20503
|
+
// to run listItem commands first
|
|
20504
|
+
addOptions() {
|
|
20505
|
+
return {
|
|
20506
|
+
htmlAttributes: {
|
|
20507
|
+
"aria-label": "List item node"
|
|
20508
|
+
},
|
|
20509
|
+
bulletListTypeName: "bulletList",
|
|
20510
|
+
orderedListTypeName: "orderedList"
|
|
20511
|
+
};
|
|
20512
|
+
},
|
|
20513
|
+
parseDOM() {
|
|
20514
|
+
return [{ tag: "li" }];
|
|
20515
|
+
},
|
|
20516
|
+
renderDOM({ htmlAttributes }) {
|
|
20517
|
+
return ["li", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
20518
|
+
},
|
|
20519
|
+
addPmPlugins() {
|
|
20520
|
+
return this.editor?.converter?.convertedXml ? [orderedListSync(this.editor)] : [];
|
|
20521
|
+
},
|
|
20522
|
+
/**
|
|
20523
|
+
* Important: The listItem node uses a custom node view.
|
|
20524
|
+
* Skip node view in headless mode for performance.
|
|
20525
|
+
* @returns {import('@core/NodeView.js').NodeView|null}
|
|
20526
|
+
*/
|
|
20527
|
+
addNodeView() {
|
|
20528
|
+
if (shouldSkipNodeView(this.editor)) return null;
|
|
20529
|
+
return ({ node, editor, getPos, decorations }) => {
|
|
20530
|
+
return new ListItemNodeView(node, getPos, decorations, editor);
|
|
20531
|
+
};
|
|
20532
|
+
},
|
|
20533
|
+
addAttributes() {
|
|
20534
|
+
return {
|
|
20535
|
+
// Virtual attribute.
|
|
20536
|
+
markerType: {
|
|
20537
|
+
default: null,
|
|
20538
|
+
renderDOM: (attrs) => {
|
|
20539
|
+
let { listLevel, listNumberingType, lvlText } = attrs;
|
|
20540
|
+
let hasListLevel = !!listLevel?.length;
|
|
20541
|
+
if (!hasListLevel || !lvlText) {
|
|
20542
|
+
return {};
|
|
20543
|
+
}
|
|
20544
|
+
let orderMarker = generateOrderedListIndex({
|
|
20545
|
+
listLevel,
|
|
20546
|
+
lvlText,
|
|
20547
|
+
listNumberingType
|
|
20548
|
+
});
|
|
20549
|
+
if (!orderMarker) return {};
|
|
20550
|
+
return {
|
|
20551
|
+
"data-marker-type": orderMarker
|
|
20552
|
+
};
|
|
20553
|
+
}
|
|
20554
|
+
},
|
|
20555
|
+
lvlText: {
|
|
20556
|
+
default: null,
|
|
20557
|
+
keepOnSplit: true,
|
|
20558
|
+
parseDOM: (elem) => elem.getAttribute("data-lvl-text"),
|
|
20559
|
+
renderDOM: (attrs) => {
|
|
20560
|
+
if (!attrs.lvlText) return {};
|
|
20561
|
+
return {
|
|
20562
|
+
"data-lvl-text": attrs.lvlText
|
|
20563
|
+
};
|
|
20564
|
+
}
|
|
20565
|
+
},
|
|
20566
|
+
listNumberingType: {
|
|
20567
|
+
default: null,
|
|
20568
|
+
keepOnSplit: true,
|
|
20569
|
+
parseDOM: (elem) => elem.getAttribute("data-num-fmt"),
|
|
20570
|
+
renderDOM: (attrs) => {
|
|
20571
|
+
if (!attrs.listNumberingType) return {};
|
|
20572
|
+
return {
|
|
20573
|
+
"data-num-fmt": attrs.listNumberingType
|
|
20574
|
+
};
|
|
20575
|
+
}
|
|
20576
|
+
},
|
|
20577
|
+
listLevel: {
|
|
20578
|
+
default: null,
|
|
20579
|
+
parseDOM: (elem) => {
|
|
20580
|
+
let listLevel = elem.getAttribute("data-list-level");
|
|
20581
|
+
try {
|
|
20582
|
+
listLevel = JSON.parse(listLevel);
|
|
20583
|
+
} catch {
|
|
20584
|
+
}
|
|
20585
|
+
return listLevel;
|
|
20586
|
+
},
|
|
20587
|
+
renderDOM: (attrs) => {
|
|
20588
|
+
if (!attrs.listLevel) return {};
|
|
20589
|
+
return {
|
|
20590
|
+
"data-list-level": JSON.stringify(attrs.listLevel)
|
|
20591
|
+
};
|
|
20592
|
+
}
|
|
20593
|
+
},
|
|
20594
|
+
// JC = justification. Expect left, right, center
|
|
20595
|
+
lvlJc: {
|
|
20596
|
+
keepOnSplit: true,
|
|
20597
|
+
default: null,
|
|
20598
|
+
rendered: false
|
|
20599
|
+
},
|
|
20600
|
+
// This will contain indentation and space info.
|
|
20601
|
+
// ie: w:left (left indent), w:hanging (hanging indent)
|
|
20602
|
+
listParagraphProperties: {
|
|
20603
|
+
keepOnSplit: true,
|
|
20604
|
+
default: null,
|
|
20605
|
+
rendered: false
|
|
20606
|
+
},
|
|
20607
|
+
// This will contain run properties for the list item
|
|
20608
|
+
listRunProperties: {
|
|
20609
|
+
keepOnSplit: true,
|
|
20610
|
+
default: null,
|
|
20611
|
+
rendered: false
|
|
20612
|
+
},
|
|
20613
|
+
numId: {
|
|
20614
|
+
keepOnSplit: true,
|
|
20615
|
+
default: null,
|
|
20616
|
+
parseDOM: (elem) => elem.getAttribute("data-num-id"),
|
|
20617
|
+
renderDOM: (attrs) => {
|
|
20618
|
+
if (!attrs.numId) return {};
|
|
20619
|
+
return {
|
|
20620
|
+
"data-num-id": attrs.numId
|
|
20621
|
+
};
|
|
20622
|
+
}
|
|
20623
|
+
},
|
|
20624
|
+
numPrType: {
|
|
20625
|
+
rendered: false,
|
|
20626
|
+
default: "inline",
|
|
20627
|
+
keepOnSplit: true
|
|
20628
|
+
},
|
|
20629
|
+
level: {
|
|
20630
|
+
parseDOM: (elem) => {
|
|
20631
|
+
return elem.getAttribute("data-level");
|
|
20632
|
+
},
|
|
20633
|
+
renderDOM: (attrs) => {
|
|
20634
|
+
if (attrs.level === void 0 || attrs.level === null) return {};
|
|
20635
|
+
return {
|
|
20636
|
+
"data-level": attrs.level
|
|
20637
|
+
};
|
|
20638
|
+
}
|
|
20639
|
+
},
|
|
20640
|
+
attributes: {
|
|
20641
|
+
keepOnSplit: true,
|
|
20642
|
+
rendered: false
|
|
20643
|
+
},
|
|
20644
|
+
spacing: {
|
|
20645
|
+
keepOnSplit: true,
|
|
20646
|
+
default: null,
|
|
20647
|
+
rendered: false
|
|
20648
|
+
},
|
|
20649
|
+
indent: {
|
|
20650
|
+
parseDOM: (elem) => JSON.parse(elem.getAttribute("data-indent")),
|
|
20651
|
+
keepOnSplit: true,
|
|
20652
|
+
default: null,
|
|
20653
|
+
rendered: false
|
|
20654
|
+
},
|
|
20655
|
+
markerStyle: {
|
|
20656
|
+
default: null,
|
|
20657
|
+
rendered: false,
|
|
20658
|
+
keepOnSplit: true
|
|
20659
|
+
},
|
|
20660
|
+
styleId: {
|
|
20661
|
+
rendered: false,
|
|
20662
|
+
keepOnSplit: true
|
|
20663
|
+
},
|
|
20664
|
+
customFormat: {
|
|
20665
|
+
default: null,
|
|
20666
|
+
rendered: false,
|
|
20667
|
+
keepOnSplit: true
|
|
20668
|
+
},
|
|
20669
|
+
importedFontFamily: {
|
|
20670
|
+
parseDOM: (elem) => elem.getAttribute("data-font-family"),
|
|
20671
|
+
renderDOM: (attrs) => {
|
|
20672
|
+
if (!attrs.importedFontFamily) return {};
|
|
20673
|
+
return {
|
|
20674
|
+
"data-font-family": attrs.importedFontFamily
|
|
20675
|
+
};
|
|
20676
|
+
}
|
|
20677
|
+
},
|
|
20678
|
+
importedFontSize: {
|
|
20679
|
+
parseDOM: (elem) => elem.getAttribute("data-font-size"),
|
|
20680
|
+
renderDOM: (attrs) => {
|
|
20681
|
+
if (!attrs.importedFontSize) return {};
|
|
20682
|
+
return {
|
|
20683
|
+
"data-font-size": attrs.importedFontSize
|
|
20684
|
+
};
|
|
20685
|
+
}
|
|
20686
|
+
}
|
|
20687
|
+
};
|
|
20688
|
+
},
|
|
20689
|
+
addShortcuts() {
|
|
20690
|
+
return {
|
|
20691
|
+
Enter: () => {
|
|
20692
|
+
return this.editor.commands.splitListItem();
|
|
20693
|
+
},
|
|
20694
|
+
"Shift-Enter": () => {
|
|
20695
|
+
return this.editor.commands.first(({ commands: commands2 }) => [
|
|
20696
|
+
() => commands2.createParagraphNear(),
|
|
20697
|
+
() => commands2.splitBlock()
|
|
20698
|
+
]);
|
|
20699
|
+
},
|
|
20700
|
+
Tab: () => {
|
|
20701
|
+
return this.editor.commands.first(({ commands: commands2 }) => [() => commands2.increaseListIndent()]);
|
|
20702
|
+
},
|
|
20703
|
+
"Shift-Tab": () => {
|
|
20704
|
+
return this.editor.commands.first(({ commands: commands2 }) => [() => commands2.decreaseListIndent()]);
|
|
20705
|
+
}
|
|
20706
|
+
};
|
|
20707
|
+
}
|
|
20708
|
+
});
|
|
20709
|
+
const getDefaultSpacing = () => ({
|
|
20710
|
+
lineSpaceAfter: 0,
|
|
20711
|
+
lineSpaceBefore: 0,
|
|
20712
|
+
line: 0,
|
|
20713
|
+
lineRule: null
|
|
20714
|
+
});
|
|
19753
20715
|
const Paragraph = OxmlNode.create({
|
|
19754
20716
|
name: "paragraph",
|
|
19755
20717
|
oXmlName: "w:p",
|
|
@@ -19777,26 +20739,22 @@ const Paragraph = OxmlNode.create({
|
|
|
19777
20739
|
parseDOM: (element) => {
|
|
19778
20740
|
if (element && element.closest("[data-superdoc-import]")) {
|
|
19779
20741
|
return {
|
|
19780
|
-
|
|
19781
|
-
|
|
19782
|
-
line:
|
|
20742
|
+
lineSpaceAfter: 11,
|
|
20743
|
+
lineSpaceBefore: 0,
|
|
20744
|
+
line: 1.15,
|
|
19783
20745
|
lineRule: "auto"
|
|
19784
20746
|
};
|
|
19785
20747
|
}
|
|
19786
20748
|
return void 0;
|
|
19787
20749
|
},
|
|
19788
20750
|
renderDOM: (attrs) => {
|
|
19789
|
-
const { spacing
|
|
19790
|
-
if (!spacing) return {
|
|
20751
|
+
const { spacing } = attrs;
|
|
20752
|
+
if (!spacing) return {};
|
|
19791
20753
|
const spacingCopy = { ...spacing };
|
|
19792
20754
|
if (attrs.lineHeight) delete spacingCopy.line;
|
|
19793
|
-
const style = getSpacingStyleString(
|
|
19794
|
-
spacingCopy,
|
|
19795
|
-
marksAttrs ?? [],
|
|
19796
|
-
Boolean(attrs.paragraphProperties?.numberingProperties)
|
|
19797
|
-
);
|
|
20755
|
+
const style = getSpacingStyleString(spacingCopy);
|
|
19798
20756
|
if (style) return { style };
|
|
19799
|
-
return {
|
|
20757
|
+
return {};
|
|
19800
20758
|
}
|
|
19801
20759
|
},
|
|
19802
20760
|
extraAttrs: {
|
|
@@ -19824,17 +20782,17 @@ const Paragraph = OxmlNode.create({
|
|
|
19824
20782
|
indent: {
|
|
19825
20783
|
default: null,
|
|
19826
20784
|
renderDOM: ({ indent }) => {
|
|
19827
|
-
if (!indent) return {
|
|
20785
|
+
if (!indent) return {};
|
|
19828
20786
|
const { left: left2, right: right2, firstLine, hanging } = indent;
|
|
19829
20787
|
if (indent && Object.values(indent).every((v) => v === 0)) {
|
|
19830
|
-
return {
|
|
20788
|
+
return {};
|
|
19831
20789
|
}
|
|
19832
20790
|
let style = "";
|
|
19833
|
-
if (left2) style += `margin-left: ${
|
|
19834
|
-
if (right2) style += `margin-right: ${
|
|
19835
|
-
if (firstLine && !hanging) style += `text-indent: ${
|
|
19836
|
-
if (firstLine && hanging) style += `text-indent: ${
|
|
19837
|
-
if (!firstLine && hanging) style += `text-indent: ${
|
|
20791
|
+
if (left2) style += `margin-left: ${left2}px;`;
|
|
20792
|
+
if (right2) style += `margin-right: ${right2}px;`;
|
|
20793
|
+
if (firstLine && !hanging) style += `text-indent: ${firstLine}px;`;
|
|
20794
|
+
if (firstLine && hanging) style += `text-indent: ${firstLine - hanging}px;`;
|
|
20795
|
+
if (!firstLine && hanging) style += `text-indent: ${-hanging}px;`;
|
|
19838
20796
|
return { style };
|
|
19839
20797
|
}
|
|
19840
20798
|
},
|
|
@@ -19853,16 +20811,12 @@ const Paragraph = OxmlNode.create({
|
|
|
19853
20811
|
sideOrder.forEach((side) => {
|
|
19854
20812
|
const b = borders[side];
|
|
19855
20813
|
if (!b) return;
|
|
19856
|
-
|
|
19857
|
-
style += `border-${side}: none;`;
|
|
19858
|
-
return;
|
|
19859
|
-
}
|
|
19860
|
-
const width = b.size != null ? `${eighthPointsToPixels(b.size)}px` : "1px";
|
|
20814
|
+
const width = b.size != null ? `${b.size}px` : "1px";
|
|
19861
20815
|
const cssStyle = valToCss[b.val] || "solid";
|
|
19862
|
-
const color =
|
|
20816
|
+
const color = b.color || "#000000";
|
|
19863
20817
|
style += `border-${side}: ${width} ${cssStyle} ${color};`;
|
|
19864
20818
|
if (b.space != null && side === "bottom") {
|
|
19865
|
-
style += `padding-bottom: ${
|
|
20819
|
+
style += `padding-bottom: ${b.space}px;`;
|
|
19866
20820
|
}
|
|
19867
20821
|
});
|
|
19868
20822
|
return style ? { style } : {};
|
|
@@ -19876,12 +20830,7 @@ const Paragraph = OxmlNode.create({
|
|
|
19876
20830
|
return null;
|
|
19877
20831
|
}
|
|
19878
20832
|
},
|
|
19879
|
-
styleId: {
|
|
19880
|
-
renderDOM: (attrs) => {
|
|
19881
|
-
if (!attrs.styleId) return {};
|
|
19882
|
-
return { styleid: attrs.styleId };
|
|
19883
|
-
}
|
|
19884
|
-
},
|
|
20833
|
+
styleId: {},
|
|
19885
20834
|
sdBlockId: {
|
|
19886
20835
|
default: null,
|
|
19887
20836
|
keepOnSplit: false,
|
|
@@ -19899,37 +20848,19 @@ const Paragraph = OxmlNode.create({
|
|
|
19899
20848
|
paragraphProperties: { rendered: false },
|
|
19900
20849
|
dropcap: { rendered: false },
|
|
19901
20850
|
pageBreakSource: { rendered: false },
|
|
19902
|
-
|
|
19903
|
-
renderDOM: ({
|
|
19904
|
-
|
|
20851
|
+
justify: {
|
|
20852
|
+
renderDOM: ({ justify }) => {
|
|
20853
|
+
const { val: jc } = justify || {};
|
|
20854
|
+
if (!jc) return {};
|
|
19905
20855
|
let style = "";
|
|
19906
|
-
if (
|
|
19907
|
-
else if (
|
|
19908
|
-
else if (
|
|
19909
|
-
else if (
|
|
20856
|
+
if (jc === "left") style += "text-align: left;";
|
|
20857
|
+
else if (jc === "right") style += "text-align: right;";
|
|
20858
|
+
else if (jc === "center") style += "text-align: center;";
|
|
20859
|
+
else if (jc === "both") style += "text-align: justify;";
|
|
19910
20860
|
return { style };
|
|
19911
20861
|
}
|
|
19912
20862
|
},
|
|
19913
|
-
tabStops: { rendered: false }
|
|
19914
|
-
listRendering: {
|
|
19915
|
-
keepOnSplit: false,
|
|
19916
|
-
renderDOM: ({ listRendering }) => {
|
|
19917
|
-
return {
|
|
19918
|
-
"data-marker-type": listRendering?.markerText,
|
|
19919
|
-
"data-list-level": listRendering?.path ? JSON.stringify(listRendering.path) : null,
|
|
19920
|
-
"data-list-numbering-type": listRendering?.numberingType
|
|
19921
|
-
};
|
|
19922
|
-
}
|
|
19923
|
-
},
|
|
19924
|
-
numberingProperties: {
|
|
19925
|
-
keepOnSplit: true,
|
|
19926
|
-
renderDOM: ({ numberingProperties }) => {
|
|
19927
|
-
return {
|
|
19928
|
-
"data-num-id": numberingProperties?.numId,
|
|
19929
|
-
"data-level": numberingProperties?.ilvl
|
|
19930
|
-
};
|
|
19931
|
-
}
|
|
19932
|
-
}
|
|
20863
|
+
tabStops: { rendered: false }
|
|
19933
20864
|
};
|
|
19934
20865
|
},
|
|
19935
20866
|
parseDOM() {
|
|
@@ -19937,59 +20868,12 @@ const Paragraph = OxmlNode.create({
|
|
|
19937
20868
|
{
|
|
19938
20869
|
tag: "p",
|
|
19939
20870
|
getAttrs: (node) => {
|
|
19940
|
-
const
|
|
19941
|
-
|
|
19942
|
-
const { styleid: styleId, ...extraAttrs } = Array.from(node.attributes).reduce((acc, attr) => {
|
|
19943
|
-
if (attr.name === "data-num-id") {
|
|
19944
|
-
numberingProperties.numId = parseInt(attr.value);
|
|
19945
|
-
} else if (attr.name === "data-level") {
|
|
19946
|
-
numberingProperties.ilvl = parseInt(attr.value);
|
|
19947
|
-
} else if (attr.name === "data-indent") {
|
|
19948
|
-
try {
|
|
19949
|
-
indent = JSON.parse(attr.value);
|
|
19950
|
-
Object.keys(indent).forEach((key2) => {
|
|
19951
|
-
indent[key2] = Number(indent[key2]);
|
|
19952
|
-
});
|
|
19953
|
-
} catch {
|
|
19954
|
-
}
|
|
19955
|
-
} else if (attr.name === "data-spacing") {
|
|
19956
|
-
try {
|
|
19957
|
-
spacing = JSON.parse(attr.value);
|
|
19958
|
-
Object.keys(spacing).forEach((key2) => {
|
|
19959
|
-
spacing[key2] = Number(spacing[key2]);
|
|
19960
|
-
});
|
|
19961
|
-
} catch {
|
|
19962
|
-
}
|
|
19963
|
-
} else {
|
|
19964
|
-
acc[attr.name] = attr.value;
|
|
19965
|
-
}
|
|
20871
|
+
const { styleid, ...extraAttrs } = Array.from(node.attributes).reduce((acc, attr) => {
|
|
20872
|
+
acc[attr.name] = attr.value;
|
|
19966
20873
|
return acc;
|
|
19967
20874
|
}, {});
|
|
19968
|
-
if (Object.keys(numberingProperties).length > 0) {
|
|
19969
|
-
const resolvedParagraphProperties = resolveParagraphProperties(
|
|
19970
|
-
{ docx: this.editor.converter.convertedXml, numbering: this.editor.converter.numbering },
|
|
19971
|
-
{ styleId, numberingProperties, indent, spacing },
|
|
19972
|
-
false,
|
|
19973
|
-
true
|
|
19974
|
-
);
|
|
19975
|
-
return {
|
|
19976
|
-
paragraphProperties: {
|
|
19977
|
-
numberingProperties,
|
|
19978
|
-
indent,
|
|
19979
|
-
spacing,
|
|
19980
|
-
styleId: styleId || null
|
|
19981
|
-
},
|
|
19982
|
-
indent: resolvedParagraphProperties.indent,
|
|
19983
|
-
spacing: resolvedParagraphProperties.spacing,
|
|
19984
|
-
numberingProperties,
|
|
19985
|
-
styleId: styleId || null,
|
|
19986
|
-
extraAttrs
|
|
19987
|
-
};
|
|
19988
|
-
}
|
|
19989
20875
|
return {
|
|
19990
|
-
styleId:
|
|
19991
|
-
indent,
|
|
19992
|
-
spacing,
|
|
20876
|
+
styleId: styleid || null,
|
|
19993
20877
|
extraAttrs
|
|
19994
20878
|
};
|
|
19995
20879
|
}
|
|
@@ -20017,101 +20901,6 @@ const Paragraph = OxmlNode.create({
|
|
|
20017
20901
|
renderDOM({ htmlAttributes }) {
|
|
20018
20902
|
return ["p", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
20019
20903
|
},
|
|
20020
|
-
addNodeView() {
|
|
20021
|
-
if (shouldSkipNodeView(this.editor)) return null;
|
|
20022
|
-
return ({ node, editor, getPos, decorations, extensionAttrs }) => {
|
|
20023
|
-
return new ParagraphNodeView(node, editor, getPos, decorations, extensionAttrs);
|
|
20024
|
-
};
|
|
20025
|
-
},
|
|
20026
|
-
addShortcuts() {
|
|
20027
|
-
return {
|
|
20028
|
-
"Mod-Shift-7": () => {
|
|
20029
|
-
return this.editor.commands.toggleOrderedList();
|
|
20030
|
-
},
|
|
20031
|
-
"Mod-Shift-8": () => {
|
|
20032
|
-
return this.editor.commands.toggleBulletList();
|
|
20033
|
-
},
|
|
20034
|
-
Enter: (params2) => {
|
|
20035
|
-
return removeNumberingProperties({ checkType: "empty" })({
|
|
20036
|
-
...params2,
|
|
20037
|
-
tr: this.editor.state.tr,
|
|
20038
|
-
state: this.editor.state,
|
|
20039
|
-
dispatch: this.editor.view.dispatch
|
|
20040
|
-
});
|
|
20041
|
-
},
|
|
20042
|
-
"Shift-Enter": () => {
|
|
20043
|
-
return this.editor.commands.first(({ commands: commands2 }) => [
|
|
20044
|
-
() => commands2.createParagraphNear(),
|
|
20045
|
-
splitBlock$1({
|
|
20046
|
-
attrsToRemoveOverride: ["paragraphProperties.numberingProperties", "listRendering", "numberingProperties"]
|
|
20047
|
-
})
|
|
20048
|
-
]);
|
|
20049
|
-
},
|
|
20050
|
-
Tab: () => {
|
|
20051
|
-
return this.editor.commands.first(({ commands: commands2 }) => [() => commands2.increaseListIndent()]);
|
|
20052
|
-
},
|
|
20053
|
-
"Shift-Tab": () => {
|
|
20054
|
-
return this.editor.commands.first(({ commands: commands2 }) => [() => commands2.decreaseListIndent()]);
|
|
20055
|
-
}
|
|
20056
|
-
};
|
|
20057
|
-
},
|
|
20058
|
-
addInputRules() {
|
|
20059
|
-
return [
|
|
20060
|
-
{ regex: orderedInputRegex, type: "orderedList" },
|
|
20061
|
-
{ regex: bulletInputRegex, type: "bulletList" }
|
|
20062
|
-
].map(
|
|
20063
|
-
({ regex, type }) => new InputRule({
|
|
20064
|
-
match: regex,
|
|
20065
|
-
handler: ({ state, range }) => {
|
|
20066
|
-
const parentListItem = findParentNode(isList)(state.selection);
|
|
20067
|
-
if (parentListItem) {
|
|
20068
|
-
return null;
|
|
20069
|
-
}
|
|
20070
|
-
const { tr } = state;
|
|
20071
|
-
tr.delete(range.from, range.to);
|
|
20072
|
-
ListHelpers.createNewList({
|
|
20073
|
-
listType: type,
|
|
20074
|
-
tr,
|
|
20075
|
-
editor: this.editor
|
|
20076
|
-
});
|
|
20077
|
-
}
|
|
20078
|
-
})
|
|
20079
|
-
);
|
|
20080
|
-
},
|
|
20081
|
-
addCommands() {
|
|
20082
|
-
return {
|
|
20083
|
-
/**
|
|
20084
|
-
* Toggle ordered list formatting
|
|
20085
|
-
* @category Command
|
|
20086
|
-
* @example
|
|
20087
|
-
* editor.commands.toggleOrderedList()
|
|
20088
|
-
* @note Converts selection to ordered list or back to paragraphs
|
|
20089
|
-
*/
|
|
20090
|
-
toggleOrderedList: () => (params2) => {
|
|
20091
|
-
return toggleList("orderedList")(params2);
|
|
20092
|
-
},
|
|
20093
|
-
/**
|
|
20094
|
-
* Toggle a bullet list at the current selection
|
|
20095
|
-
* @category Command
|
|
20096
|
-
* @example
|
|
20097
|
-
* // Toggle bullet list on selected text
|
|
20098
|
-
* editor.commands.toggleBulletList()
|
|
20099
|
-
* @note Converts selected paragraphs to list items or removes list formatting
|
|
20100
|
-
*/
|
|
20101
|
-
toggleBulletList: () => (params2) => {
|
|
20102
|
-
return toggleList("bulletList")(params2);
|
|
20103
|
-
},
|
|
20104
|
-
/**
|
|
20105
|
-
* Restart numbering for the current list
|
|
20106
|
-
* @category Command
|
|
20107
|
-
* @example
|
|
20108
|
-
* // Restart numbering for the current list item
|
|
20109
|
-
* editor.commands.restartNumbering()
|
|
20110
|
-
* @note Resets list numbering for the current list item and following items
|
|
20111
|
-
*/
|
|
20112
|
-
restartNumbering: () => restartNumbering
|
|
20113
|
-
};
|
|
20114
|
-
},
|
|
20115
20904
|
addPmPlugins() {
|
|
20116
20905
|
const { view } = this.editor;
|
|
20117
20906
|
const dropcapWidthCache = /* @__PURE__ */ new Map();
|
|
@@ -20185,8 +20974,7 @@ const Paragraph = OxmlNode.create({
|
|
|
20185
20974
|
}
|
|
20186
20975
|
}
|
|
20187
20976
|
});
|
|
20188
|
-
|
|
20189
|
-
return [dropcapPlugin, numberingPlugin];
|
|
20977
|
+
return [dropcapPlugin];
|
|
20190
20978
|
}
|
|
20191
20979
|
});
|
|
20192
20980
|
const getDropcapDecorations = (state, view, widthCache) => {
|
|
@@ -20383,6 +21171,259 @@ const CommentsMark = Mark.create({
|
|
|
20383
21171
|
return [CommentMarkName, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
20384
21172
|
}
|
|
20385
21173
|
});
|
|
21174
|
+
const defaultTabDistance = 48;
|
|
21175
|
+
const defaultLineLength = 816;
|
|
21176
|
+
const getTabDecorations = (doc2, view, helpers2, from2 = 0, to = null) => {
|
|
21177
|
+
const decorations = [];
|
|
21178
|
+
const paragraphCache = /* @__PURE__ */ new Map();
|
|
21179
|
+
const coordCache = /* @__PURE__ */ new Map();
|
|
21180
|
+
const domPosCache = /* @__PURE__ */ new Map();
|
|
21181
|
+
const end2 = to ?? doc2.content.size;
|
|
21182
|
+
doc2.nodesBetween(from2, end2, (node, pos) => {
|
|
21183
|
+
if (node.type.name !== "tab") return;
|
|
21184
|
+
let extraStyles = "";
|
|
21185
|
+
const $pos = doc2.resolve(pos);
|
|
21186
|
+
const paragraphContext = getParagraphContext($pos, paragraphCache, helpers2);
|
|
21187
|
+
if (!paragraphContext) return;
|
|
21188
|
+
try {
|
|
21189
|
+
const { tabStops, flattened, positionMap, startPos } = paragraphContext;
|
|
21190
|
+
const entryIndex = positionMap.get(pos);
|
|
21191
|
+
if (entryIndex === void 0) return;
|
|
21192
|
+
if (paragraphContext.indentWidth === void 0) {
|
|
21193
|
+
paragraphContext.indentWidth = getIndentWidth(view, startPos, paragraphContext.indent, coordCache, domPosCache);
|
|
21194
|
+
}
|
|
21195
|
+
if (paragraphContext.tabHeight === void 0) {
|
|
21196
|
+
paragraphContext.tabHeight = calcTabHeight($pos);
|
|
21197
|
+
}
|
|
21198
|
+
const indentWidth = paragraphContext.indentWidth;
|
|
21199
|
+
const accumulatedTabWidth = paragraphContext.accumulatedTabWidth || 0;
|
|
21200
|
+
const currentWidth = indentWidth + measureRangeWidth(view, startPos + 1, pos, coordCache, domPosCache) + accumulatedTabWidth;
|
|
21201
|
+
let tabWidth;
|
|
21202
|
+
if (tabStops.length) {
|
|
21203
|
+
const tabStop = tabStops.find((stop) => stop.pos > currentWidth && stop.val !== "clear");
|
|
21204
|
+
if (tabStop) {
|
|
21205
|
+
tabWidth = tabStop.pos - currentWidth;
|
|
21206
|
+
if (tabStop.val === "center" || tabStop.val === "end" || tabStop.val === "right") {
|
|
21207
|
+
const nextTabIndex = findNextTabIndex(flattened, entryIndex + 1);
|
|
21208
|
+
const segmentStartPos = pos + node.nodeSize;
|
|
21209
|
+
const segmentEndPos = nextTabIndex === -1 ? startPos + paragraphContext.paragraph.nodeSize - 1 : flattened[nextTabIndex].pos;
|
|
21210
|
+
const segmentWidth = measureRangeWidth(view, segmentStartPos, segmentEndPos, coordCache, domPosCache);
|
|
21211
|
+
tabWidth -= tabStop.val === "center" ? segmentWidth / 2 : segmentWidth;
|
|
21212
|
+
} else if (tabStop.val === "decimal" || tabStop.val === "num") {
|
|
21213
|
+
const breakChar = tabStop.decimalChar || ".";
|
|
21214
|
+
const decimalPos = findDecimalBreakPos(flattened, entryIndex + 1, breakChar);
|
|
21215
|
+
const integralWidth = decimalPos ? measureRangeWidth(view, pos + node.nodeSize, decimalPos, coordCache, domPosCache) : measureRangeWidth(
|
|
21216
|
+
view,
|
|
21217
|
+
pos + node.nodeSize,
|
|
21218
|
+
startPos + paragraphContext.paragraph.nodeSize - 1,
|
|
21219
|
+
coordCache,
|
|
21220
|
+
domPosCache
|
|
21221
|
+
);
|
|
21222
|
+
tabWidth -= integralWidth;
|
|
21223
|
+
}
|
|
21224
|
+
if (tabStop.leader) {
|
|
21225
|
+
const leaderStyles = {
|
|
21226
|
+
dot: "border-bottom: 1px dotted black;",
|
|
21227
|
+
heavy: "border-bottom: 2px solid black;",
|
|
21228
|
+
hyphen: "border-bottom: 1px solid black;",
|
|
21229
|
+
middleDot: "border-bottom: 1px dotted black; margin-bottom: 2px;",
|
|
21230
|
+
underscore: "border-bottom: 1px solid black;"
|
|
21231
|
+
};
|
|
21232
|
+
extraStyles += leaderStyles[tabStop.leader] || "";
|
|
21233
|
+
}
|
|
21234
|
+
}
|
|
21235
|
+
}
|
|
21236
|
+
if (!tabWidth || tabWidth < 1) {
|
|
21237
|
+
tabWidth = defaultTabDistance - currentWidth % defaultLineLength % defaultTabDistance;
|
|
21238
|
+
if (tabWidth === 0) tabWidth = defaultTabDistance;
|
|
21239
|
+
}
|
|
21240
|
+
const tabHeight = paragraphContext.tabHeight;
|
|
21241
|
+
decorations.push(
|
|
21242
|
+
Decoration.node(pos, pos + node.nodeSize, {
|
|
21243
|
+
style: `width: ${tabWidth}px; height: ${tabHeight};${extraStyles}`
|
|
21244
|
+
})
|
|
21245
|
+
);
|
|
21246
|
+
paragraphContext.accumulatedTabWidth = accumulatedTabWidth + tabWidth;
|
|
21247
|
+
} catch (error) {
|
|
21248
|
+
console.error("tab decoration error", error);
|
|
21249
|
+
}
|
|
21250
|
+
});
|
|
21251
|
+
return decorations;
|
|
21252
|
+
};
|
|
21253
|
+
function getParagraphContext($pos, cache, helpers2) {
|
|
21254
|
+
for (let depth = $pos.depth; depth >= 0; depth--) {
|
|
21255
|
+
const node = $pos.node(depth);
|
|
21256
|
+
if (node?.type?.name === "paragraph") {
|
|
21257
|
+
const startPos = $pos.start(depth);
|
|
21258
|
+
if (!cache.has(startPos)) {
|
|
21259
|
+
let tabStops = [];
|
|
21260
|
+
if (Array.isArray(node.attrs?.tabStops)) {
|
|
21261
|
+
tabStops = node.attrs.tabStops;
|
|
21262
|
+
} else {
|
|
21263
|
+
const style = helpers2.linkedStyles.getStyleById(node.attrs?.styleId);
|
|
21264
|
+
if (Array.isArray(style?.definition?.styles?.tabStops)) {
|
|
21265
|
+
tabStops = style.definition.styles.tabStops;
|
|
21266
|
+
}
|
|
21267
|
+
}
|
|
21268
|
+
const { entries, positionMap } = flattenParagraph(node, startPos);
|
|
21269
|
+
cache.set(startPos, {
|
|
21270
|
+
paragraph: node,
|
|
21271
|
+
paragraphDepth: depth,
|
|
21272
|
+
startPos,
|
|
21273
|
+
indent: node.attrs?.indent || {},
|
|
21274
|
+
tabStops,
|
|
21275
|
+
flattened: entries,
|
|
21276
|
+
positionMap,
|
|
21277
|
+
// Store position map for O(1) lookups
|
|
21278
|
+
accumulatedTabWidth: 0
|
|
21279
|
+
});
|
|
21280
|
+
}
|
|
21281
|
+
return cache.get(startPos);
|
|
21282
|
+
}
|
|
21283
|
+
}
|
|
21284
|
+
return null;
|
|
21285
|
+
}
|
|
21286
|
+
function flattenParagraph(paragraph, paragraphStartPos) {
|
|
21287
|
+
const entries = [];
|
|
21288
|
+
const positionMap = /* @__PURE__ */ new Map();
|
|
21289
|
+
const walk = (node, basePos) => {
|
|
21290
|
+
if (!node) return;
|
|
21291
|
+
if (node.type?.name === "run") {
|
|
21292
|
+
node.forEach((child, offset2) => {
|
|
21293
|
+
const childPos = basePos + offset2 + 1;
|
|
21294
|
+
walk(child, childPos);
|
|
21295
|
+
});
|
|
21296
|
+
return;
|
|
21297
|
+
}
|
|
21298
|
+
const pos = basePos - 1;
|
|
21299
|
+
const index2 = entries.length;
|
|
21300
|
+
entries.push({ node, pos });
|
|
21301
|
+
positionMap.set(pos, index2);
|
|
21302
|
+
};
|
|
21303
|
+
paragraph.forEach((child, offset2) => {
|
|
21304
|
+
const childPos = paragraphStartPos + offset2 + 1;
|
|
21305
|
+
walk(child, childPos);
|
|
21306
|
+
});
|
|
21307
|
+
return { entries, positionMap };
|
|
21308
|
+
}
|
|
21309
|
+
function findNextTabIndex(flattened, fromIndex) {
|
|
21310
|
+
for (let i = fromIndex; i < flattened.length; i++) {
|
|
21311
|
+
if (flattened[i]?.node?.type?.name === "tab") {
|
|
21312
|
+
return i;
|
|
21313
|
+
}
|
|
21314
|
+
}
|
|
21315
|
+
return -1;
|
|
21316
|
+
}
|
|
21317
|
+
function findDecimalBreakPos(flattened, startIndex, breakChar) {
|
|
21318
|
+
for (let i = startIndex; i < flattened.length; i++) {
|
|
21319
|
+
const entry = flattened[i];
|
|
21320
|
+
if (!entry) break;
|
|
21321
|
+
if (entry.node.type?.name === "tab") break;
|
|
21322
|
+
if (entry.node.type?.name === "text") {
|
|
21323
|
+
const index2 = entry.node.text?.indexOf(breakChar);
|
|
21324
|
+
if (index2 !== void 0 && index2 !== -1) {
|
|
21325
|
+
return entry.pos + index2 + 1;
|
|
21326
|
+
}
|
|
21327
|
+
}
|
|
21328
|
+
}
|
|
21329
|
+
return null;
|
|
21330
|
+
}
|
|
21331
|
+
function measureRangeWidth(view, from2, to, coordCache = null, domPosCache = null) {
|
|
21332
|
+
if (!Number.isFinite(from2) || !Number.isFinite(to) || to <= from2) return 0;
|
|
21333
|
+
try {
|
|
21334
|
+
const range = document.createRange();
|
|
21335
|
+
const fromRef = getCachedDomAtPos(view, from2, domPosCache);
|
|
21336
|
+
const toRef = getCachedDomAtPos(view, to, domPosCache);
|
|
21337
|
+
range.setStart(fromRef.node, fromRef.offset);
|
|
21338
|
+
range.setEnd(toRef.node, toRef.offset);
|
|
21339
|
+
const rect = range.getBoundingClientRect();
|
|
21340
|
+
range.detach?.();
|
|
21341
|
+
return rect.width || 0;
|
|
21342
|
+
} catch {
|
|
21343
|
+
const startLeft = getLeftCoord(view, from2, coordCache, domPosCache);
|
|
21344
|
+
const endLeft = getLeftCoord(view, to, coordCache, domPosCache);
|
|
21345
|
+
if (startLeft == null || endLeft == null) return 0;
|
|
21346
|
+
return Math.max(0, endLeft - startLeft);
|
|
21347
|
+
}
|
|
21348
|
+
}
|
|
21349
|
+
function getIndentWidth(view, paragraphStartPos, indentAttrs = {}, coordCache = null, domPosCache = null) {
|
|
21350
|
+
const marginLeft = getLeftCoord(view, paragraphStartPos, coordCache, domPosCache);
|
|
21351
|
+
const lineLeft = getLeftCoord(view, paragraphStartPos + 1, coordCache, domPosCache);
|
|
21352
|
+
if (marginLeft != null && lineLeft != null) {
|
|
21353
|
+
const diff = lineLeft - marginLeft;
|
|
21354
|
+
if (!Number.isNaN(diff) && Math.abs(diff) > 0.5) {
|
|
21355
|
+
return diff;
|
|
21356
|
+
}
|
|
21357
|
+
}
|
|
21358
|
+
return calculateIndentFallback(indentAttrs);
|
|
21359
|
+
}
|
|
21360
|
+
function calculateIndentFallback(indentAttrs = {}) {
|
|
21361
|
+
if (!indentAttrs) return 0;
|
|
21362
|
+
const left2 = Number(indentAttrs.left) || 0;
|
|
21363
|
+
const firstLine = Number(indentAttrs.firstLine) || 0;
|
|
21364
|
+
const hanging = Number(indentAttrs.hanging) || 0;
|
|
21365
|
+
let textIndent = 0;
|
|
21366
|
+
if (firstLine && hanging) {
|
|
21367
|
+
textIndent = firstLine - hanging;
|
|
21368
|
+
} else if (firstLine) {
|
|
21369
|
+
textIndent = firstLine;
|
|
21370
|
+
} else if (hanging) {
|
|
21371
|
+
textIndent = -hanging;
|
|
21372
|
+
} else if (typeof indentAttrs.textIndent === "string") {
|
|
21373
|
+
const match = indentAttrs.textIndent.match(/(-?\d*\.?\d+)in$/);
|
|
21374
|
+
if (match) {
|
|
21375
|
+
textIndent = Number(match[1]) * 96;
|
|
21376
|
+
}
|
|
21377
|
+
}
|
|
21378
|
+
if (textIndent) return left2 + textIndent;
|
|
21379
|
+
if (left2) return left2;
|
|
21380
|
+
return 0;
|
|
21381
|
+
}
|
|
21382
|
+
function getLeftCoord(view, pos, coordCache = null, domPosCache = null) {
|
|
21383
|
+
if (!Number.isFinite(pos)) return null;
|
|
21384
|
+
if (coordCache && coordCache.has(pos)) {
|
|
21385
|
+
return coordCache.get(pos);
|
|
21386
|
+
}
|
|
21387
|
+
let result = null;
|
|
21388
|
+
try {
|
|
21389
|
+
result = view.coordsAtPos(pos).left;
|
|
21390
|
+
} catch {
|
|
21391
|
+
try {
|
|
21392
|
+
const ref2 = getCachedDomAtPos(view, pos, domPosCache);
|
|
21393
|
+
const range = document.createRange();
|
|
21394
|
+
range.setStart(ref2.node, ref2.offset);
|
|
21395
|
+
range.setEnd(ref2.node, ref2.offset);
|
|
21396
|
+
const rect = range.getBoundingClientRect();
|
|
21397
|
+
range.detach?.();
|
|
21398
|
+
result = rect.left;
|
|
21399
|
+
} catch {
|
|
21400
|
+
result = null;
|
|
21401
|
+
}
|
|
21402
|
+
}
|
|
21403
|
+
if (coordCache) {
|
|
21404
|
+
coordCache.set(pos, result);
|
|
21405
|
+
}
|
|
21406
|
+
return result;
|
|
21407
|
+
}
|
|
21408
|
+
function getCachedDomAtPos(view, pos, domPosCache = null) {
|
|
21409
|
+
if (domPosCache && domPosCache.has(pos)) {
|
|
21410
|
+
return domPosCache.get(pos);
|
|
21411
|
+
}
|
|
21412
|
+
const result = view.domAtPos(pos);
|
|
21413
|
+
if (domPosCache) {
|
|
21414
|
+
domPosCache.set(pos, result);
|
|
21415
|
+
}
|
|
21416
|
+
return result;
|
|
21417
|
+
}
|
|
21418
|
+
function calcTabHeight(pos) {
|
|
21419
|
+
const ptToPxRatio = 1.333;
|
|
21420
|
+
const defaultFontSize = 16;
|
|
21421
|
+
const defaultLineHeight = 1.1;
|
|
21422
|
+
const blockParent2 = pos.node(1);
|
|
21423
|
+
const parentTextStyleMark = blockParent2.firstChild.marks.find((mark) => mark.type.name === "textStyle");
|
|
21424
|
+
const fontSize = parseInt(parentTextStyleMark?.attrs.fontSize) * ptToPxRatio || defaultFontSize;
|
|
21425
|
+
return `${fontSize * defaultLineHeight}px`;
|
|
21426
|
+
}
|
|
20386
21427
|
const TabNode = Node$1.create({
|
|
20387
21428
|
name: "tab",
|
|
20388
21429
|
group: "inline",
|
|
@@ -24734,60 +25775,42 @@ function toHex(color) {
|
|
|
24734
25775
|
};
|
|
24735
25776
|
return `#${hex(r2)}${hex(g)}${hex(b)}${a < 1 ? hex(Math.round(a * 255)) : ""}`;
|
|
24736
25777
|
}
|
|
24737
|
-
const summarizeListContent = (node, fieldsToDeleteSet) => {
|
|
24738
|
-
const summary = {
|
|
24739
|
-
totalFieldAnnotations: 0,
|
|
24740
|
-
deletableFieldAnnotations: 0,
|
|
24741
|
-
hasOtherInlineContent: false
|
|
24742
|
-
};
|
|
24743
|
-
if (typeof node?.descendants !== "function") {
|
|
24744
|
-
return summary;
|
|
24745
|
-
}
|
|
24746
|
-
node.descendants((child) => {
|
|
24747
|
-
if (!child) return true;
|
|
24748
|
-
if (child.type?.name === "fieldAnnotation") {
|
|
24749
|
-
summary.totalFieldAnnotations += 1;
|
|
24750
|
-
const fieldId = child.attrs?.fieldId;
|
|
24751
|
-
if (fieldId && fieldsToDeleteSet.has(fieldId)) {
|
|
24752
|
-
summary.deletableFieldAnnotations += 1;
|
|
24753
|
-
} else {
|
|
24754
|
-
summary.hasOtherInlineContent = true;
|
|
24755
|
-
}
|
|
24756
|
-
return false;
|
|
24757
|
-
}
|
|
24758
|
-
if (child.isText) {
|
|
24759
|
-
if (child.text?.trim()) {
|
|
24760
|
-
summary.hasOtherInlineContent = true;
|
|
24761
|
-
}
|
|
24762
|
-
return false;
|
|
24763
|
-
}
|
|
24764
|
-
if (child.isInline || child.isAtom) {
|
|
24765
|
-
summary.hasOtherInlineContent = true;
|
|
24766
|
-
return false;
|
|
24767
|
-
}
|
|
24768
|
-
return true;
|
|
24769
|
-
});
|
|
24770
|
-
return summary;
|
|
24771
|
-
};
|
|
24772
25778
|
const cleanUpListsWithAnnotations = (fieldsToDelete = []) => ({ dispatch, tr, state }) => {
|
|
24773
25779
|
if (!dispatch) return true;
|
|
24774
25780
|
if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
|
|
24775
|
-
const fieldsToDeleteSet = new Set(fieldsToDelete);
|
|
24776
25781
|
const { doc: doc2 } = state;
|
|
24777
25782
|
const docxAnnotations = getAllFieldAnnotations(state) || [];
|
|
24778
25783
|
const nodesToDelete = [];
|
|
24779
25784
|
fieldsToDelete.forEach((fieldId) => {
|
|
24780
25785
|
const matched = docxAnnotations.find((a) => a.node.attrs.fieldId === fieldId);
|
|
24781
25786
|
if (!matched) return;
|
|
24782
|
-
const listItem = findParentNodeClosestToPos(doc2.resolve(matched.pos),
|
|
25787
|
+
const listItem = findParentNodeClosestToPos(doc2.resolve(matched.pos), (node2) => node2.type.name === "listItem");
|
|
24783
25788
|
if (!listItem) return;
|
|
24784
|
-
|
|
24785
|
-
|
|
24786
|
-
|
|
24787
|
-
|
|
24788
|
-
|
|
24789
|
-
|
|
24790
|
-
|
|
25789
|
+
let remainingNodes = 0;
|
|
25790
|
+
listItem.node.descendants((node2) => {
|
|
25791
|
+
if (node2.type.name === "fieldAnnotation") {
|
|
25792
|
+
remainingNodes += 1;
|
|
25793
|
+
}
|
|
25794
|
+
});
|
|
25795
|
+
let matchingNodesFound = 0;
|
|
25796
|
+
let hasOtherNodes = false;
|
|
25797
|
+
listItem.node.children.forEach((child) => {
|
|
25798
|
+
const { type } = child;
|
|
25799
|
+
if (type.name !== "paragraph" && type.name !== "fieldAnnotation") return;
|
|
25800
|
+
child.children.forEach((inline) => {
|
|
25801
|
+
const isFieldToDelete = fieldsToDelete.includes(inline.attrs.fieldId);
|
|
25802
|
+
const isFieldType = inline.type.name === "fieldAnnotation";
|
|
25803
|
+
const isMatchingField = isFieldType && isFieldToDelete;
|
|
25804
|
+
if (!isFieldType && !isMatchingField) hasOtherNodes = true;
|
|
25805
|
+
if (isMatchingField) matchingNodesFound += 1;
|
|
25806
|
+
});
|
|
25807
|
+
});
|
|
25808
|
+
if (!hasOtherNodes && matchingNodesFound > 0) {
|
|
25809
|
+
remainingNodes -= matchingNodesFound;
|
|
25810
|
+
}
|
|
25811
|
+
if (remainingNodes > 0) {
|
|
25812
|
+
return;
|
|
25813
|
+
}
|
|
24791
25814
|
let { pos, node, depth } = listItem;
|
|
24792
25815
|
let $pos = doc2.resolve(pos);
|
|
24793
25816
|
while (depth > 0) {
|
|
@@ -30717,21 +31740,6 @@ const TextStyle = Mark.create({
|
|
|
30717
31740
|
if (!hasStyles || isAnnotation) return false;
|
|
30718
31741
|
return {};
|
|
30719
31742
|
}
|
|
30720
|
-
},
|
|
30721
|
-
{
|
|
30722
|
-
getAttrs: (node) => {
|
|
30723
|
-
const fontFamily = node.style.fontFamily?.replace(/['"]+/g, "");
|
|
30724
|
-
const fontSize = node.style.fontSize;
|
|
30725
|
-
const textTransform = node.style.textTransform;
|
|
30726
|
-
if (fontFamily || fontSize || textTransform) {
|
|
30727
|
-
return {
|
|
30728
|
-
fontFamily: fontFamily || null,
|
|
30729
|
-
fontSize: fontSize || null,
|
|
30730
|
-
textTransform: textTransform || null
|
|
30731
|
-
};
|
|
30732
|
-
}
|
|
30733
|
-
return false;
|
|
30734
|
-
}
|
|
30735
31743
|
}
|
|
30736
31744
|
];
|
|
30737
31745
|
},
|
|
@@ -30802,8 +31810,8 @@ const Bold = Mark.create({
|
|
|
30802
31810
|
value: {
|
|
30803
31811
|
default: null,
|
|
30804
31812
|
renderDOM: (attrs) => {
|
|
30805
|
-
if (attrs.value
|
|
30806
|
-
if (attrs.value === "0"
|
|
31813
|
+
if (!attrs.value) return {};
|
|
31814
|
+
if (attrs.value === "0") {
|
|
30807
31815
|
return { style: "font-weight: normal" };
|
|
30808
31816
|
}
|
|
30809
31817
|
return {};
|
|
@@ -30880,8 +31888,8 @@ const Italic = Mark.create({
|
|
|
30880
31888
|
value: {
|
|
30881
31889
|
default: null,
|
|
30882
31890
|
renderDOM: (attrs) => {
|
|
30883
|
-
if (attrs.value
|
|
30884
|
-
if (attrs.value === "0"
|
|
31891
|
+
if (!attrs.value) return {};
|
|
31892
|
+
if (attrs.value === "0") return { style: "font-style: normal" };
|
|
30885
31893
|
return {};
|
|
30886
31894
|
}
|
|
30887
31895
|
}
|
|
@@ -31100,7 +32108,7 @@ const Strike = Mark.create({
|
|
|
31100
32108
|
const merged = Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
31101
32109
|
const { value } = mark.attrs;
|
|
31102
32110
|
const { ...rest } = merged || {};
|
|
31103
|
-
if (value === "0"
|
|
32111
|
+
if (value === "0") {
|
|
31104
32112
|
return ["span", rest, 0];
|
|
31105
32113
|
}
|
|
31106
32114
|
return ["s", rest, 0];
|
|
@@ -31143,8 +32151,8 @@ const Strike = Mark.create({
|
|
|
31143
32151
|
value: {
|
|
31144
32152
|
default: null,
|
|
31145
32153
|
renderDOM: (attrs) => {
|
|
31146
|
-
if (attrs.value
|
|
31147
|
-
if (attrs.value === "0"
|
|
32154
|
+
if (!attrs.value) return {};
|
|
32155
|
+
if (attrs.value === "0") {
|
|
31148
32156
|
return { style: "text-decoration: none" };
|
|
31149
32157
|
}
|
|
31150
32158
|
return {};
|
|
@@ -37515,6 +38523,7 @@ const NodeResizer = Extension.create({
|
|
|
37515
38523
|
const getRichTextExtensions = () => {
|
|
37516
38524
|
return [
|
|
37517
38525
|
Bold,
|
|
38526
|
+
BulletList,
|
|
37518
38527
|
Color,
|
|
37519
38528
|
Document,
|
|
37520
38529
|
FontFamily,
|
|
@@ -37522,8 +38531,10 @@ const getRichTextExtensions = () => {
|
|
|
37522
38531
|
History,
|
|
37523
38532
|
Heading,
|
|
37524
38533
|
Italic,
|
|
38534
|
+
ListItem,
|
|
37525
38535
|
LineHeight,
|
|
37526
38536
|
Link,
|
|
38537
|
+
OrderedList,
|
|
37527
38538
|
Paragraph,
|
|
37528
38539
|
Strike,
|
|
37529
38540
|
Text,
|
|
@@ -37555,6 +38566,7 @@ const getStarterExtensions = () => {
|
|
|
37555
38566
|
return [
|
|
37556
38567
|
Bold,
|
|
37557
38568
|
BlockNode,
|
|
38569
|
+
BulletList,
|
|
37558
38570
|
Color,
|
|
37559
38571
|
CommentRangeStart,
|
|
37560
38572
|
CommentRangeEnd,
|
|
@@ -37565,8 +38577,10 @@ const getStarterExtensions = () => {
|
|
|
37565
38577
|
History,
|
|
37566
38578
|
Heading,
|
|
37567
38579
|
Italic,
|
|
38580
|
+
ListItem,
|
|
37568
38581
|
LineHeight,
|
|
37569
38582
|
Link,
|
|
38583
|
+
OrderedList,
|
|
37570
38584
|
Paragraph,
|
|
37571
38585
|
LineBreak,
|
|
37572
38586
|
HardBreak,
|
|
@@ -37639,27 +38653,28 @@ export {
|
|
|
37639
38653
|
_export_sfc as _,
|
|
37640
38654
|
getQuickFormatList as a,
|
|
37641
38655
|
generateLinkedStyleString as b,
|
|
37642
|
-
|
|
37643
|
-
|
|
37644
|
-
|
|
37645
|
-
|
|
38656
|
+
collectTargetListItemPositions as c,
|
|
38657
|
+
getFileOpener as d,
|
|
38658
|
+
checkAndProcessImage as e,
|
|
38659
|
+
uploadAndInsertImage as f,
|
|
37646
38660
|
global as g,
|
|
37647
|
-
|
|
38661
|
+
collectTrackedChanges as h,
|
|
37648
38662
|
isTrackedChangeActionAllowed as i,
|
|
37649
|
-
|
|
37650
|
-
|
|
37651
|
-
|
|
37652
|
-
|
|
37653
|
-
|
|
37654
|
-
|
|
37655
|
-
|
|
37656
|
-
|
|
38663
|
+
undoDepth as j,
|
|
38664
|
+
redoDepth as k,
|
|
38665
|
+
collectTrackedChangesForContext as l,
|
|
38666
|
+
isHeadless as m,
|
|
38667
|
+
getStarterExtensions as n,
|
|
38668
|
+
getRichTextExtensions as o,
|
|
38669
|
+
Decoration as p,
|
|
38670
|
+
Extension as q,
|
|
37657
38671
|
replaceSelectionWithImagePlaceholder as r,
|
|
37658
38672
|
shouldBypassContextMenu as s,
|
|
37659
|
-
index as t,
|
|
38673
|
+
index$1 as t,
|
|
37660
38674
|
useHighContrastMode as u,
|
|
37661
|
-
|
|
37662
|
-
|
|
37663
|
-
|
|
37664
|
-
yUndoPluginKey as y
|
|
38675
|
+
index as v,
|
|
38676
|
+
AnnotatorHelpers as w,
|
|
38677
|
+
SectionHelpers as x,
|
|
38678
|
+
yUndoPluginKey as y,
|
|
38679
|
+
getAllowedImageDimensions as z
|
|
37665
38680
|
};
|