superdoc 0.30.0 → 0.31.0-next.1
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-soUG7IDt.cjs → PdfViewer-CSZtzevK.cjs} +1 -1
- package/dist/chunks/{PdfViewer-D_iKMNQq.es.js → PdfViewer-DYfpBL2P.es.js} +1 -1
- package/dist/chunks/{index-D04RPnYX-D4QY0wzH.es.js → index-0zP7LFOd-CQ5IRTwG.es.js} +1 -1
- package/dist/chunks/{index-D04RPnYX-C9XCLJFR.cjs → index-0zP7LFOd-PDPveafF.cjs} +1 -1
- package/dist/chunks/{index-D4zMX0uJ.cjs → index-9j37gBmK.cjs} +7 -6
- package/dist/chunks/{index-CkMyo2zy.es.js → index-BiYSI2c3.es.js} +7 -6
- package/dist/chunks/{super-editor.es-B2pA2Nu-.es.js → super-editor.es-BzhuUuJx.es.js} +13984 -15515
- package/dist/chunks/{super-editor.es-DmA8JlL1.cjs → super-editor.es-D8j9E-4h.cjs} +13984 -15515
- 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/style.css +11 -31
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DrPdSxVd.js → converter-B3mE6WPB.js} +13667 -14169
- package/dist/super-editor/chunks/{docx-zipper-IcLp4qO8.js → docx-zipper-FgUekv4g.js} +1 -1
- package/dist/super-editor/chunks/{editor-CNJV20ln.js → editor-B0PiO07g.js} +1507 -2522
- package/dist/super-editor/chunks/{index-D04RPnYX.js → index-0zP7LFOd.js} +1 -1
- package/dist/super-editor/chunks/{toolbar-D9Y3NWGF.js → toolbar-Bj9E8rmT.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 +11 -31
- 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/changeListLevel.d.ts +15 -0
- package/dist/super-editor/super-editor/src/core/commands/changeListLevel.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/increaseListIndent.d.ts +2 -1
- 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 +2 -7
- 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 +0 -1
- 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/removeNumberingProperties.d.ts +4 -0
- package/dist/super-editor/super-editor/src/core/commands/removeNumberingProperties.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/commands/restartNumbering.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/commands/restartNumbering.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/commands/splitBlock.d.ts +2 -1
- package/dist/super-editor/super-editor/src/core/commands/splitBlock.d.ts.map +1 -1
- 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 +6 -56
- package/dist/super-editor/super-editor/src/core/commands/toggleList.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/extensions/keymap.d.ts.map +1 -1
- package/dist/super-editor/super-editor/src/core/helpers/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 +15 -42
- 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 +2 -0
- 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 +2 -5
- 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 +2 -0
- 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/styles.d.ts +26 -0
- package/dist/super-editor/super-editor/src/core/super-converter/styles.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v2/importer/docxImporter.d.ts +3 -1
- 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 +0 -97
- 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 +11 -0
- 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 +30 -4
- 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/adjustRightInd/adjustRightInd-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/adjustRightInd/adjustRightInd-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/adjustRightInd/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/adjustRightInd/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDE/autoSpaceDE-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDE/autoSpaceDE-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDE/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDE/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDN/autoSpaceDN-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDN/autoSpaceDN-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDN/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/autoSpaceDN/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/b-translator.d.ts +1 -2
- 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/bCs/bCs-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bCs/bCs-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bCs/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bCs/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bar/bar-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bar/bar-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bar/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bar/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/between/between-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/between/between-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/between/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/between/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bidi/bidi-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bidi/bidi-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bidi/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/bidi/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/caps/caps-translator.d.ts +1 -2
- 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/color-translator.d.ts +1 -2
- 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/contextualSpacing/contextualSpacing-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/contextualSpacing/contextualSpacing-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/contextualSpacing/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/contextualSpacing/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/dstrike/dstrike-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/dstrike/dstrike-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/framePr/framePr-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/framePr/framePr-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/framePr/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/framePr/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/headers/headers-translator.d.ts +0 -2
- 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/i-translator.d.ts +1 -2
- 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/ilvl/ilvl-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ilvl/ilvl-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ilvl/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ilvl/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ind/ind-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ind/ind-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ind/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/ind/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepLines/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepLines/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepLines/keepLines-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepLines/keepLines-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepNext/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepNext/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepNext/keepNext-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/keepNext/keepNext-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/kinsoku/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/kinsoku/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/kinsoku/kinsoku-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/kinsoku/kinsoku-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/lang/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/lang/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/lang/lang-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/lang/lang-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/mirrorIndents/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/mirrorIndents/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/mirrorIndents/mirrorIndents-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/mirrorIndents/mirrorIndents-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numId/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numId/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numId/numId-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numId/numId-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numPr/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numPr/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numPr/numPr-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/numPr/numPr-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/outlineLvl/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/outlineLvl/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/outlineLvl/outlineLvl-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/outlineLvl/outlineLvl-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/overflowPunct/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/overflowPunct/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/overflowPunct/overflowPunct-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/overflowPunct/overflowPunct-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/index.d.ts +0 -1
- 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/pBdr/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pBdr/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pBdr/pBdr-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pBdr/pBdr-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pPr/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pPr/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pPr/pPr-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pPr/pPr-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pStyle/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pStyle/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pStyle/pStyle-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pStyle/pStyle-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pageBreakBefore/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pageBreakBefore/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pageBreakBefore/pageBreakBefore-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/pageBreakBefore/pageBreakBefore-translator.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 +1 -37
- 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 +0 -1
- 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/rFonts-translator.d.ts +1 -0
- 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/rstyle-translator.d.ts +1 -2
- 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 +2 -0
- 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/snapToGrid/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/snapToGrid/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/snapToGrid/snapToGrid-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/snapToGrid/snapToGrid-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/letter-spacing-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/letter-spacing-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/spacing-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/spacing/spacing-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/strike-translator.d.ts +1 -2
- 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/suppressAutoHyphens/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressAutoHyphens/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressAutoHyphens/suppressAutoHyphens-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressAutoHyphens/suppressAutoHyphens-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressLineNumbers/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressLineNumbers/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressLineNumbers/suppressLineNumbers-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressLineNumbers/suppressLineNumbers-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressOverlap/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressOverlap/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressOverlap/suppressOverlap-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/suppressOverlap/suppressOverlap-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/sz-translator.d.ts +5 -3
- 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 +5 -3
- 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-size.d.ts → w-tab-type.d.ts} +1 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-type.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/tabs/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tabs/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tabs/tabs-translator.d.ts +6 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tabs/tabs-translator.d.ts.map +1 -0
- 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/core/super-converter/v3/handlers/w/textAlignment/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textAlignment/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textAlignment/textAlignment-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textAlignment/textAlignment-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textboxTightWrap/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textboxTightWrap/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textboxTightWrap/textboxTightWrap-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/textboxTightWrap/textboxTightWrap-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/topLinePunct/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/topLinePunct/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/topLinePunct/topLinePunct-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/topLinePunct/topLinePunct-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/widowControl/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/widowControl/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/widowControl/widowControl-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/widowControl/widowControl-translator.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/wordWrap/index.d.ts +2 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/wordWrap/index.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/wordWrap/wordWrap-translator.d.ts +7 -0
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/wordWrap/wordWrap-translator.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 +1 -4
- 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/paragraph/NumberingManager.d.ts +30 -0
- package/dist/super-editor/super-editor/src/extensions/paragraph/NumberingManager.d.ts.map +1 -0
- package/dist/super-editor/super-editor/src/extensions/paragraph/ParagraphNodeView.d.ts +37 -0
- package/dist/super-editor/super-editor/src/extensions/paragraph/ParagraphNodeView.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/numberingPlugin.d.ts +9 -0
- package/dist/super-editor/super-editor/src/extensions/paragraph/numberingPlugin.d.ts.map +1 -0
- 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 +1 -0
- 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 +14 -2
- 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 +98 -59
- 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 +14008 -15538
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/shared/common/Telemetry.d.ts +0 -237
- package/dist/shared/common/Telemetry.d.ts.map +0 -1
- package/dist/shared/common/collaboration/awareness.d.ts +0 -39
- package/dist/shared/common/collaboration/awareness.d.ts.map +0 -1
- package/dist/shared/common/document-types.d.ts +0 -10
- package/dist/shared/common/document-types.d.ts.map +0 -1
- package/dist/shared/common/event-types.d.ts +0 -14
- package/dist/shared/common/event-types.d.ts.map +0 -1
- package/dist/shared/common/helpers/compare-superdoc-versions.d.ts +0 -8
- package/dist/shared/common/helpers/compare-superdoc-versions.d.ts.map +0 -1
- package/dist/shared/common/helpers/get-file-object.d.ts +0 -50
- package/dist/shared/common/helpers/get-file-object.d.ts.map +0 -1
- package/dist/shared/common/helpers/v-click-outside.d.ts +0 -11
- package/dist/shared/common/helpers/v-click-outside.d.ts.map +0 -1
- package/dist/shared/common/index.d.ts +0 -10
- package/dist/shared/common/index.d.ts.map +0 -1
- package/dist/shared/common/key-transform.d.ts +0 -44
- package/dist/shared/common/key-transform.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/commands/backspaceNextToList.d.ts +0 -6
- package/dist/super-editor/super-editor/src/core/commands/backspaceNextToList.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/commands/deleteListItem.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/commands/deleteListItem.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/commands/deleteNextToList.d.ts +0 -15
- package/dist/super-editor/super-editor/src/core/commands/deleteNextToList.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/commands/liftListItem.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/commands/liftListItem.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/commands/sinkListItem.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/commands/sinkListItem.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/commands/splitListItem.d.ts +0 -2
- package/dist/super-editor/super-editor/src/core/commands/splitListItem.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/commands/wrapInList.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/commands/wrapInList.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/index.d.ts +0 -4
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/w-val.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/b/attributes/w-val.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/index.d.ts +0 -3
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-color.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-color.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-shade.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-shade.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-tint.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-theme-tint.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-val.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/color/attributes/w-val.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/index.d.ts +0 -3
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/w-val.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/i/attributes/w-val.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/w-p-helpers.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/split-run-properties.d.ts +0 -10
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/r/helpers/split-run-properties.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/index.d.ts +0 -3
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-ascii.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-ascii.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-cs.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-cs.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-east-asia.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-east-asia.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-hansi.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-hansi.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-val.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rFonts/attributes/w-val.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/index.d.ts +0 -3
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/w-val.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rStyle/attributes/w-val.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rpr/run-property-translators.d.ts +0 -12
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/rpr/run-property-translators.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/index.d.ts +0 -3
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/w-val.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/strike/attributes/w-val.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/index.d.ts +0 -3
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/w-val.d.ts +0 -5
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sz/attributes/w-val.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-size.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/bullet-list/bullet-list.d.ts +0 -15
- package/dist/super-editor/super-editor/src/extensions/bullet-list/bullet-list.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/bullet-list/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/extensions/bullet-list/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/list-item/ListItemNodeView.d.ts +0 -43
- package/dist/super-editor/super-editor/src/extensions/list-item/ListItemNodeView.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/list-item/helpers/listItemTypography.d.ts +0 -68
- package/dist/super-editor/super-editor/src/extensions/list-item/helpers/listItemTypography.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/list-item/helpers/styledListMarkerPlugin.d.ts +0 -13
- package/dist/super-editor/super-editor/src/extensions/list-item/helpers/styledListMarkerPlugin.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/list-item/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/extensions/list-item/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/list-item/list-item.d.ts +0 -51
- package/dist/super-editor/super-editor/src/extensions/list-item/list-item.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/ordered-list/helpers/orderedListMarkerPlugin.d.ts +0 -3
- package/dist/super-editor/super-editor/src/extensions/ordered-list/helpers/orderedListMarkerPlugin.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/ordered-list/helpers/orderedListSyncPlugin.d.ts +0 -6
- package/dist/super-editor/super-editor/src/extensions/ordered-list/helpers/orderedListSyncPlugin.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/ordered-list/index.d.ts +0 -2
- package/dist/super-editor/super-editor/src/extensions/ordered-list/index.d.ts.map +0 -1
- package/dist/super-editor/super-editor/src/extensions/ordered-list/ordered-list.d.ts +0 -38
- package/dist/super-editor/super-editor/src/extensions/ordered-list/ordered-list.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, _ParagraphNodeView_instances, updateHTMLAttributes_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
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 htmlHandler, E as ReplaceStep, L as ListHelpers, G as updateNumberingProperties, H as changeListLevel, I as findParentNode, J as isList, K as isMacOS, O as isIOS, Q as getSchemaTypeByName, U as inputRulesPlugin, V as TrackDeleteMarkName, W as TrackInsertMarkName, X as v4, Y as TrackFormatMarkName, Z as comments_module_events, _ as findMark, $ as objectIncludes, a0 as AddMarkStep, a1 as RemoveMarkStep, a2 as twipsToLines, a3 as pixelsToTwips, a4 as helpers, a5 as posToDOMRect, a6 as CommandService, a7 as SuperConverter, a8 as createDocument, a9 as createDocFromMarkdown, aa as createDocFromHTML, ab as EditorState, ac as hasSomeParentWithClass, ad as isActive, ae as unflattenListsInHtml, af as parseSizeUnit, ag as minMax, ah as getLineHeightValueString, ai as updateDOMAttributes, aj as findChildren$5, ak as generateRandomSigned32BitIntStrId, al as kebabCase, am as twipsToPixels, an as halfPointToPixels, ao as getUnderlineCssString, ap as findParentNodeClosestToPos, aq as resolveRunProperties, ar as encodeCSSFromRPr, as as docxNumberingHelpers, at as InputRule, au as resolveParagraphProperties, av as eighthPointsToPixels, aw as linesToTwips, ax as PIXELS_PER_INCH, ay as SelectionRange, az as Transform, aA as isInTable$1, aB as generateDocxRandomId, aC as insertNewRelationship, aD as inchesToPixels } from "./converter-B3mE6WPB.js";
|
|
16
|
+
import { D as DocxZipper } from "./docx-zipper-FgUekv4g.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,12 +8251,15 @@ const ensureMarks = (state, splittableMarks) => {
|
|
|
8251
8251
|
state.tr.ensureMarks(filtered);
|
|
8252
8252
|
}
|
|
8253
8253
|
};
|
|
8254
|
-
const splitBlock$1 = ({ keepMarks = true } = {}) => (props) => {
|
|
8254
|
+
const splitBlock$1 = ({ keepMarks = true, attrsToRemoveOverride = [] } = {}) => (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
|
-
|
|
8259
|
+
let newAttrs = Attribute.getSplittedAttributes(extensionAttrs, $from.node().type.name, $from.node().attrs);
|
|
8260
|
+
if (attrsToRemoveOverride.length > 0) {
|
|
8261
|
+
newAttrs = deleteAttributes(newAttrs, attrsToRemoveOverride);
|
|
8262
|
+
}
|
|
8260
8263
|
if (selection instanceof NodeSelection && selection.node.isBlock) {
|
|
8261
8264
|
if (!$from.parentOffset || !canSplit(doc2, $from.pos)) return false;
|
|
8262
8265
|
if (dispatch) {
|
|
@@ -8291,6 +8294,23 @@ const splitBlock$1 = ({ keepMarks = true } = {}) => (props) => {
|
|
|
8291
8294
|
}
|
|
8292
8295
|
return true;
|
|
8293
8296
|
};
|
|
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
|
+
}
|
|
8294
8314
|
const deleteSelection$1 = (state, dispatch) => {
|
|
8295
8315
|
if (state.selection.empty)
|
|
8296
8316
|
return false;
|
|
@@ -9111,7 +9131,7 @@ const selectNodeBackward = () => ({ state, dispatch }) => {
|
|
|
9111
9131
|
const selectNodeForward = () => ({ state, dispatch }) => selectNodeForward$1(state, dispatch);
|
|
9112
9132
|
const selectTextblockStart = () => ({ state, dispatch }) => selectTextblockStart$1(state, dispatch);
|
|
9113
9133
|
const selectTextblockEnd = () => ({ state, dispatch }) => selectTextblockEnd$1(state, dispatch);
|
|
9114
|
-
const insertContent = (value, options = {}) => ({ tr,
|
|
9134
|
+
const insertContent = (value, options = {}) => ({ tr, commands: commands2, editor }) => {
|
|
9115
9135
|
if (options.contentType) {
|
|
9116
9136
|
const validTypes = ["html", "markdown", "text", "schema"];
|
|
9117
9137
|
if (!validTypes.includes(options.contentType)) {
|
|
@@ -9122,7 +9142,7 @@ const insertContent = (value, options = {}) => ({ tr, state, commands: commands2
|
|
|
9122
9142
|
const processedDoc = processContent({
|
|
9123
9143
|
content: value,
|
|
9124
9144
|
type: options.contentType,
|
|
9125
|
-
|
|
9145
|
+
editor
|
|
9126
9146
|
});
|
|
9127
9147
|
const jsonContent = processedDoc.toJSON();
|
|
9128
9148
|
const ok = commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, jsonContent, options);
|
|
@@ -9149,12 +9169,13 @@ const removeWhitespaces = (node) => {
|
|
|
9149
9169
|
}
|
|
9150
9170
|
return node;
|
|
9151
9171
|
};
|
|
9152
|
-
function elementFromString(value) {
|
|
9172
|
+
function elementFromString(value, editor) {
|
|
9153
9173
|
const wrappedValue = `<body>${value}</body>`;
|
|
9154
|
-
const html =
|
|
9174
|
+
const html = htmlHandler(wrappedValue, editor);
|
|
9155
9175
|
return removeWhitespaces(html);
|
|
9156
9176
|
}
|
|
9157
|
-
function createNodeFromContent(content,
|
|
9177
|
+
function createNodeFromContent(content, editor, options) {
|
|
9178
|
+
const schema = editor.schema;
|
|
9158
9179
|
options = {
|
|
9159
9180
|
slice: true,
|
|
9160
9181
|
parseOptions: {},
|
|
@@ -9178,7 +9199,7 @@ function createNodeFromContent(content, schema, options) {
|
|
|
9178
9199
|
throw new Error("[super-editor error]: Invalid JSON content", { cause: error });
|
|
9179
9200
|
}
|
|
9180
9201
|
console.warn("[super-editor warn]: Invalid content.", "Passed value:", content, "Error:", error);
|
|
9181
|
-
return createNodeFromContent("",
|
|
9202
|
+
return createNodeFromContent("", editor, options);
|
|
9182
9203
|
}
|
|
9183
9204
|
}
|
|
9184
9205
|
if (isTextContent) {
|
|
@@ -9208,9 +9229,9 @@ function createNodeFromContent(content, schema, options) {
|
|
|
9208
9229
|
})
|
|
9209
9230
|
});
|
|
9210
9231
|
if (options.slice) {
|
|
9211
|
-
DOMParser$1.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);
|
|
9232
|
+
DOMParser$1.fromSchema(contentCheckSchema).parseSlice(elementFromString(content, editor), options.parseOptions);
|
|
9212
9233
|
} else {
|
|
9213
|
-
DOMParser$1.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);
|
|
9234
|
+
DOMParser$1.fromSchema(contentCheckSchema).parse(elementFromString(content, editor), options.parseOptions);
|
|
9214
9235
|
}
|
|
9215
9236
|
if (options.errorOnInvalidContent && hasInvalidContent) {
|
|
9216
9237
|
throw new Error("[super-editor error]: Invalid HTML content", {
|
|
@@ -9220,11 +9241,11 @@ function createNodeFromContent(content, schema, options) {
|
|
|
9220
9241
|
}
|
|
9221
9242
|
const parser = DOMParser$1.fromSchema(schema);
|
|
9222
9243
|
if (options.slice) {
|
|
9223
|
-
return parser.parseSlice(elementFromString(content), options.parseOptions).content;
|
|
9244
|
+
return parser.parseSlice(elementFromString(content, editor), options.parseOptions).content;
|
|
9224
9245
|
}
|
|
9225
|
-
return parser.parse(elementFromString(content), options.parseOptions);
|
|
9246
|
+
return parser.parse(elementFromString(content, editor), options.parseOptions);
|
|
9226
9247
|
}
|
|
9227
|
-
return createNodeFromContent("",
|
|
9248
|
+
return createNodeFromContent("", editor, options);
|
|
9228
9249
|
}
|
|
9229
9250
|
function selectionToInsertionEnd(tr, startLen, bias) {
|
|
9230
9251
|
const last = tr.steps.length - 1;
|
|
@@ -9260,7 +9281,7 @@ const insertContentAt = (position, value, options) => ({ tr, dispatch, editor })
|
|
|
9260
9281
|
};
|
|
9261
9282
|
let content;
|
|
9262
9283
|
try {
|
|
9263
|
-
content = createNodeFromContent(value, editor
|
|
9284
|
+
content = createNodeFromContent(value, editor, {
|
|
9264
9285
|
parseOptions: {
|
|
9265
9286
|
preserveWhitespace: "full",
|
|
9266
9287
|
...options.parseOptions
|
|
@@ -9347,539 +9368,112 @@ const undoInputRule = () => ({ state, dispatch }) => {
|
|
|
9347
9368
|
}
|
|
9348
9369
|
return false;
|
|
9349
9370
|
};
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
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)
|
|
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;
|
|
9399
|
-
}
|
|
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)
|
|
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)
|
|
9371
|
+
const toggleList = (listType) => ({ editor, state, tr, dispatch }) => {
|
|
9372
|
+
let predicate;
|
|
9373
|
+
if (listType === "orderedList") {
|
|
9374
|
+
predicate = (n) => n.attrs.numberingProperties && n.attrs.listRendering && n.attrs.listRendering.numberingType !== "bullet";
|
|
9375
|
+
} else if (listType === "bulletList") {
|
|
9376
|
+
predicate = (n) => n.attrs.numberingProperties && n.attrs.listRendering && n.attrs.listRendering.numberingType === "bullet";
|
|
9377
|
+
} else {
|
|
9424
9378
|
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
9379
|
}
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
let
|
|
9442
|
-
let
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
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)
|
|
9380
|
+
const { selection } = state;
|
|
9381
|
+
const { from: from2, to } = selection;
|
|
9382
|
+
let firstListNode = null;
|
|
9383
|
+
let hasNonListParagraphs = false;
|
|
9384
|
+
let paragraphsInSelection = [];
|
|
9385
|
+
state.doc.nodesBetween(from2, to, (node, pos) => {
|
|
9386
|
+
if (node.type.name === "paragraph") {
|
|
9387
|
+
paragraphsInSelection.push({ node, pos });
|
|
9388
|
+
if (!firstListNode && predicate(node)) {
|
|
9389
|
+
firstListNode = node;
|
|
9390
|
+
} else if (!predicate(node)) {
|
|
9391
|
+
hasNonListParagraphs = true;
|
|
9392
|
+
}
|
|
9461
9393
|
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());
|
|
9468
9394
|
}
|
|
9469
9395
|
return true;
|
|
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 };
|
|
9481
|
-
}
|
|
9482
|
-
}
|
|
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
9396
|
});
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
|
|
9525
|
-
|
|
9526
|
-
|
|
9527
|
-
|
|
9528
|
-
|
|
9529
|
-
|
|
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;
|
|
9397
|
+
if (!firstListNode && from2 > 0) {
|
|
9398
|
+
const $from = state.doc.resolve(from2);
|
|
9399
|
+
const parentIndex = $from.index(-1);
|
|
9400
|
+
if (parentIndex > 0) {
|
|
9401
|
+
const beforeNode = $from.node(-1).child(parentIndex - 1);
|
|
9402
|
+
if (beforeNode && beforeNode.type.name === "paragraph" && predicate(beforeNode)) {
|
|
9403
|
+
firstListNode = beforeNode;
|
|
9404
|
+
}
|
|
9645
9405
|
}
|
|
9646
|
-
return true;
|
|
9647
|
-
});
|
|
9648
|
-
if (found != null) {
|
|
9649
|
-
tr.setSelection(TextSelection.create(tr.doc, found, found));
|
|
9650
|
-
} else {
|
|
9651
|
-
const fallback = Math.min(tr.doc.content.size, Math.max(1, containerPos + 1));
|
|
9652
|
-
tr.setSelection(TextSelection.create(tr.doc, fallback, fallback));
|
|
9653
9406
|
}
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
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 };
|
|
9407
|
+
let mode = null;
|
|
9408
|
+
let sharedNumberingProperties = null;
|
|
9409
|
+
if (firstListNode) {
|
|
9410
|
+
if (!hasNonListParagraphs) {
|
|
9411
|
+
mode = "remove";
|
|
9667
9412
|
} else {
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
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;
|
|
9715
|
-
}
|
|
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);
|
|
9413
|
+
mode = "reuse";
|
|
9414
|
+
const baseNumbering = firstListNode.attrs.numberingProperties || {};
|
|
9415
|
+
sharedNumberingProperties = {
|
|
9416
|
+
...baseNumbering,
|
|
9417
|
+
ilvl: baseNumbering.ilvl ?? 0
|
|
9418
|
+
};
|
|
9739
9419
|
}
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9420
|
+
} else {
|
|
9421
|
+
mode = "create";
|
|
9422
|
+
const numId = ListHelpers.getNewListId(editor);
|
|
9423
|
+
ListHelpers.generateNewListDefinition({ numId: Number(numId), listType, editor });
|
|
9424
|
+
sharedNumberingProperties = {
|
|
9425
|
+
numId: Number(numId),
|
|
9426
|
+
ilvl: 0
|
|
9427
|
+
};
|
|
9743
9428
|
}
|
|
9744
|
-
const {
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
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;
|
|
9429
|
+
for (const { node, pos } of paragraphsInSelection) {
|
|
9430
|
+
if (mode === "remove") {
|
|
9431
|
+
updateNumberingProperties(null, node, pos, editor, tr);
|
|
9432
|
+
continue;
|
|
9780
9433
|
}
|
|
9434
|
+
if (mode === "reuse" && predicate(node)) {
|
|
9435
|
+
continue;
|
|
9436
|
+
}
|
|
9437
|
+
updateNumberingProperties(sharedNumberingProperties, node, pos, editor, tr);
|
|
9781
9438
|
}
|
|
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);
|
|
9793
9439
|
if (dispatch) dispatch(tr);
|
|
9794
9440
|
return true;
|
|
9795
9441
|
};
|
|
9796
|
-
const
|
|
9797
|
-
const
|
|
9798
|
-
if (
|
|
9799
|
-
|
|
9800
|
-
return Number.isNaN(parsed) ? 0 : parsed;
|
|
9801
|
-
};
|
|
9802
|
-
const resolveParentList = ($pos) => {
|
|
9803
|
-
if (!$pos) return null;
|
|
9804
|
-
for (let depth = $pos.depth; depth >= 0; depth--) {
|
|
9805
|
-
const node = $pos.node(depth);
|
|
9806
|
-
if (node?.type && LIST_NODE_NAMES.has(node.type.name)) {
|
|
9807
|
-
return node;
|
|
9808
|
-
}
|
|
9442
|
+
const increaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
9443
|
+
const handled = changeListLevel(1, editor, tr);
|
|
9444
|
+
if (handled && dispatch) {
|
|
9445
|
+
dispatch(tr);
|
|
9809
9446
|
}
|
|
9810
|
-
return
|
|
9447
|
+
return handled;
|
|
9811
9448
|
};
|
|
9812
|
-
const
|
|
9813
|
-
const
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
return typeof fallbackPos === "number" ? [fallbackPos] : [];
|
|
9817
|
-
}
|
|
9818
|
-
const candidates = [];
|
|
9819
|
-
const { from: from2, to } = state.selection;
|
|
9820
|
-
doc2.nodesBetween(from2, to, (node, pos) => {
|
|
9821
|
-
if (node.type === listItemType) {
|
|
9822
|
-
const size = typeof node.nodeSize === "number" ? node.nodeSize : 0;
|
|
9823
|
-
candidates.push({ node, pos, end: pos + size });
|
|
9824
|
-
}
|
|
9825
|
-
});
|
|
9826
|
-
if (!candidates.length && typeof fallbackPos === "number") {
|
|
9827
|
-
return [fallbackPos];
|
|
9449
|
+
const decreaseListIndent = () => ({ editor, tr, dispatch }) => {
|
|
9450
|
+
const handled = changeListLevel(-1, editor, tr);
|
|
9451
|
+
if (handled && dispatch) {
|
|
9452
|
+
dispatch(tr);
|
|
9828
9453
|
}
|
|
9829
|
-
|
|
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]);
|
|
9454
|
+
return handled;
|
|
9834
9455
|
};
|
|
9835
|
-
const
|
|
9836
|
-
const { state } =
|
|
9837
|
-
const
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
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
|
-
});
|
|
9456
|
+
const removeNumberingProperties = ({ checkType = "startParagraph" } = {}) => (props) => {
|
|
9457
|
+
const { tr, state, editor, dispatch } = props;
|
|
9458
|
+
const { node: paragraph, pos } = findParentNode(isList)(state.selection) || {};
|
|
9459
|
+
if (!paragraph) return false;
|
|
9460
|
+
if (checkType === "empty" && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
9461
|
+
if (checkType === "startParagraph") {
|
|
9462
|
+
const { $from, empty: empty2 } = state.selection;
|
|
9463
|
+
if ((!empty2 || $from.parentOffset !== 0) && !isVisuallyEmptyParagraph(paragraph)) return false;
|
|
9464
|
+
}
|
|
9465
|
+
const ilvl = paragraph.attrs.numberingProperties.ilvl;
|
|
9466
|
+
if (ilvl > 0) {
|
|
9467
|
+
const outdented = decreaseListIndent()(props);
|
|
9468
|
+
if (outdented) {
|
|
9469
|
+
tr.scrollIntoView();
|
|
9875
9470
|
}
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
return Object.values(parentListsMap).length ? !Object.values(parentListsMap).every((pos) => !pos) : true;
|
|
9471
|
+
return outdented;
|
|
9472
|
+
} else {
|
|
9473
|
+
updateNumberingProperties(null, paragraph, pos, editor, tr);
|
|
9474
|
+
}
|
|
9475
|
+
if (dispatch) dispatch(tr);
|
|
9476
|
+
return true;
|
|
9883
9477
|
};
|
|
9884
9478
|
function isVisuallyEmptyParagraph(node) {
|
|
9885
9479
|
if (!node || node.type.name !== "paragraph") return false;
|
|
@@ -9896,7 +9490,7 @@ function isVisuallyEmptyParagraph(node) {
|
|
|
9896
9490
|
if (text.length > 0) return false;
|
|
9897
9491
|
let hasInlineLeaf = false;
|
|
9898
9492
|
node.descendants((n) => {
|
|
9899
|
-
if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak") {
|
|
9493
|
+
if (n.isInline && n.isLeaf && n.type?.name !== "hardBreak" && n.type?.name !== "run") {
|
|
9900
9494
|
hasInlineLeaf = true;
|
|
9901
9495
|
return false;
|
|
9902
9496
|
}
|
|
@@ -9905,468 +9499,6 @@ function isVisuallyEmptyParagraph(node) {
|
|
|
9905
9499
|
if (hasInlineLeaf) return false;
|
|
9906
9500
|
return true;
|
|
9907
9501
|
}
|
|
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
|
-
};
|
|
10370
9502
|
const restoreSelection = () => ({ editor, state, tr }) => {
|
|
10371
9503
|
if (editor.options.lastSelection) {
|
|
10372
9504
|
const selectionTr = tr.setSelection(
|
|
@@ -10420,23 +9552,18 @@ const getSelectionMarks = () => ({ state, tr }) => {
|
|
|
10420
9552
|
};
|
|
10421
9553
|
const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10422
9554
|
__proto__: null,
|
|
10423
|
-
|
|
9555
|
+
changeListLevel,
|
|
10424
9556
|
clearNodes,
|
|
10425
|
-
collectIntersectingTopLists,
|
|
10426
9557
|
command,
|
|
10427
9558
|
createParagraphNear,
|
|
10428
9559
|
decreaseListIndent,
|
|
10429
9560
|
defaultStyleDetector,
|
|
10430
|
-
deleteListItem,
|
|
10431
9561
|
deleteSelection,
|
|
10432
9562
|
exitCode,
|
|
10433
9563
|
first,
|
|
10434
9564
|
getEffectiveStyleId,
|
|
10435
|
-
getParaCtx,
|
|
10436
9565
|
getSelectionMarks,
|
|
10437
9566
|
getStyleIdFromMarks,
|
|
10438
|
-
handleBackspaceNextToList,
|
|
10439
|
-
handleDeleteNextToList,
|
|
10440
9567
|
increaseListIndent,
|
|
10441
9568
|
insertContent,
|
|
10442
9569
|
insertContentAt,
|
|
@@ -10449,11 +9576,9 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
10449
9576
|
joinForward,
|
|
10450
9577
|
joinUp,
|
|
10451
9578
|
liftEmptyBlock,
|
|
10452
|
-
liftListItem,
|
|
10453
9579
|
mapMarkToStyleKey,
|
|
10454
|
-
nearestListAt,
|
|
10455
9580
|
newlineInCode,
|
|
10456
|
-
|
|
9581
|
+
removeNumberingProperties,
|
|
10457
9582
|
resetAttributes,
|
|
10458
9583
|
restoreSelection,
|
|
10459
9584
|
selectAll,
|
|
@@ -10461,14 +9586,11 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
10461
9586
|
selectNodeForward,
|
|
10462
9587
|
selectTextblockEnd,
|
|
10463
9588
|
selectTextblockStart,
|
|
10464
|
-
setMappedSelectionSpan,
|
|
10465
9589
|
setMark,
|
|
10466
9590
|
setMeta,
|
|
10467
9591
|
setNode,
|
|
10468
9592
|
setTextSelection,
|
|
10469
|
-
sinkListItem,
|
|
10470
9593
|
splitBlock: splitBlock$1,
|
|
10471
|
-
splitListItem,
|
|
10472
9594
|
toggleList,
|
|
10473
9595
|
toggleMark,
|
|
10474
9596
|
toggleMarkCascade,
|
|
@@ -10477,7 +9599,7 @@ const commands$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
10477
9599
|
unsetAllMarks,
|
|
10478
9600
|
unsetMark,
|
|
10479
9601
|
updateAttributes,
|
|
10480
|
-
|
|
9602
|
+
updateNumberingProperties
|
|
10481
9603
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10482
9604
|
const Commands = Extension.create({
|
|
10483
9605
|
name: "commands",
|
|
@@ -10502,8 +9624,7 @@ const handleBackspace = (editor) => {
|
|
|
10502
9624
|
return false;
|
|
10503
9625
|
},
|
|
10504
9626
|
() => commands2.deleteSelection(),
|
|
10505
|
-
() => commands2.
|
|
10506
|
-
() => commands2.deleteListItem(),
|
|
9627
|
+
() => commands2.removeNumberingProperties(),
|
|
10507
9628
|
() => commands2.joinBackward(),
|
|
10508
9629
|
() => commands2.selectNodeBackward()
|
|
10509
9630
|
]);
|
|
@@ -10511,7 +9632,6 @@ const handleBackspace = (editor) => {
|
|
|
10511
9632
|
const handleDelete = (editor) => {
|
|
10512
9633
|
return editor.commands.first(({ commands: commands2 }) => [
|
|
10513
9634
|
() => commands2.deleteSelection(),
|
|
10514
|
-
() => commands2.handleDeleteNextToList(),
|
|
10515
9635
|
() => commands2.joinForward(),
|
|
10516
9636
|
() => commands2.selectNodeForward()
|
|
10517
9637
|
]);
|
|
@@ -11028,7 +10148,8 @@ const _ExtensionService = class _ExtensionService {
|
|
|
11028
10148
|
getPos,
|
|
11029
10149
|
decorations,
|
|
11030
10150
|
htmlAttributes,
|
|
11031
|
-
extension
|
|
10151
|
+
extension,
|
|
10152
|
+
extensionAttrs
|
|
11032
10153
|
});
|
|
11033
10154
|
};
|
|
11034
10155
|
return [extension.name, nodeview];
|
|
@@ -15081,7 +14202,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
15081
14202
|
{ default: remarkStringify },
|
|
15082
14203
|
{ default: remarkGfm }
|
|
15083
14204
|
] = await Promise.all([
|
|
15084
|
-
import("./index-
|
|
14205
|
+
import("./index-0zP7LFOd.js"),
|
|
15085
14206
|
import("./index-DRCvimau.js"),
|
|
15086
14207
|
import("./index-C_x_N6Uh.js"),
|
|
15087
14208
|
import("./index-D_sWOSiG.js"),
|
|
@@ -15299,7 +14420,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
15299
14420
|
* @returns {Object | void} Migration results
|
|
15300
14421
|
*/
|
|
15301
14422
|
processCollaborationMigrations() {
|
|
15302
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.
|
|
14423
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.1");
|
|
15303
14424
|
if (!this.options.ydoc) return;
|
|
15304
14425
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
15305
14426
|
let docVersion = metaMap.get("version");
|
|
@@ -15404,7 +14525,7 @@ const _Editor = class _Editor extends EventEmitter {
|
|
|
15404
14525
|
if (!targetNode || !html) return;
|
|
15405
14526
|
const start2 = targetNode.pos;
|
|
15406
14527
|
const end2 = start2 + targetNode.node.nodeSize;
|
|
15407
|
-
const htmlNode = createDocFromHTML(html, this
|
|
14528
|
+
const htmlNode = createDocFromHTML(html, this);
|
|
15408
14529
|
tr.replaceWith(start2, end2, htmlNode);
|
|
15409
14530
|
dispatch(tr);
|
|
15410
14531
|
}
|
|
@@ -15779,14 +14900,14 @@ generatePmData_fn = function() {
|
|
|
15779
14900
|
doc2 = createDocument(this.converter, this.schema, this);
|
|
15780
14901
|
doc2 = __privateMethod(this, _Editor_instances, prepareDocumentForImport_fn).call(this, doc2);
|
|
15781
14902
|
if (this.options.markdown) {
|
|
15782
|
-
doc2 = createDocFromMarkdown(this.options.markdown, this
|
|
15783
|
-
} else if (this.options.html) doc2 = createDocFromHTML(this.options.html, this
|
|
14903
|
+
doc2 = createDocFromMarkdown(this.options.markdown, this, { isImport: true });
|
|
14904
|
+
} else if (this.options.html) doc2 = createDocFromHTML(this.options.html, this, { isImport: true });
|
|
15784
14905
|
else if (this.options.jsonOverride) doc2 = this.schema.nodeFromJSON(this.options.jsonOverride);
|
|
15785
14906
|
if (fragment) doc2 = yXmlFragmentToProseMirrorRootNode(fragment, this.schema);
|
|
15786
14907
|
}
|
|
15787
14908
|
} else if (mode === "text" || mode === "html") {
|
|
15788
14909
|
if (loadFromSchema) doc2 = this.schema.nodeFromJSON(content);
|
|
15789
|
-
else if (content) doc2 = createDocFromHTML(content, this
|
|
14910
|
+
else if (content) doc2 = createDocFromHTML(content, this);
|
|
15790
14911
|
else doc2 = this.schema.topNodeType.createAndFill();
|
|
15791
14912
|
}
|
|
15792
14913
|
} catch (err) {
|
|
@@ -18628,7 +17749,7 @@ const splitRun = () => (props) => {
|
|
|
18628
17749
|
const { $from, empty: empty2 } = state.selection;
|
|
18629
17750
|
if (!empty2) return false;
|
|
18630
17751
|
if ($from.parent.type.name !== "run") return false;
|
|
18631
|
-
const handled =
|
|
17752
|
+
const handled = splitBlockPatch(state, (transaction) => {
|
|
18632
17753
|
view.dispatch(transaction);
|
|
18633
17754
|
});
|
|
18634
17755
|
if (handled) {
|
|
@@ -18636,6 +17757,48 @@ const splitRun = () => (props) => {
|
|
|
18636
17757
|
}
|
|
18637
17758
|
return handled;
|
|
18638
17759
|
};
|
|
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
|
+
}
|
|
18639
17802
|
const Run = OxmlNode.create({
|
|
18640
17803
|
name: "run",
|
|
18641
17804
|
oXmlName: "w:r",
|
|
@@ -18688,387 +17851,6 @@ const Run = OxmlNode.create({
|
|
|
18688
17851
|
return ["span", base2, 0];
|
|
18689
17852
|
}
|
|
18690
17853
|
});
|
|
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
|
-
};
|
|
19072
17854
|
const isKeyboardInvocation = (event) => {
|
|
19073
17855
|
return event.type === "contextmenu" && typeof event.detail === "number" && event.detail === 0 && (event.button === 0 || event.button === void 0) && event.clientX === 0 && event.clientY === 0;
|
|
19074
17856
|
};
|
|
@@ -19357,20 +18139,53 @@ const getLinkedStyle = (styleId, styles = []) => {
|
|
|
19357
18139
|
return { linkedStyle, basedOnStyle };
|
|
19358
18140
|
};
|
|
19359
18141
|
const getSpacingStyle = (spacing) => {
|
|
19360
|
-
const { lineSpaceBefore, lineSpaceAfter, line, lineRule } = spacing;
|
|
18142
|
+
const { lineSpaceBefore, lineSpaceAfter, line, lineRule, beforeAutoSpacing, afterAutoSpacing } = spacing;
|
|
19361
18143
|
const lineHeightResult = getLineHeightValueString(line, "", lineRule, true);
|
|
19362
18144
|
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
|
+
}
|
|
19363
18152
|
return {
|
|
19364
|
-
|
|
19365
|
-
"margin-bottom": lineSpaceAfter + "px",
|
|
18153
|
+
...result,
|
|
19366
18154
|
...lineHeightStyles
|
|
19367
18155
|
};
|
|
19368
18156
|
};
|
|
19369
|
-
const getSpacingStyleString = (spacing) => {
|
|
19370
|
-
|
|
18157
|
+
const getSpacingStyleString = (spacing, marks, isListItem) => {
|
|
18158
|
+
let { before, after, line, lineRule, beforeAutospacing, afterAutospacing } = spacing;
|
|
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
|
+
}
|
|
19371
18186
|
return `
|
|
19372
|
-
${
|
|
19373
|
-
${
|
|
18187
|
+
${before ? `margin-top: ${before}px;` : ""}
|
|
18188
|
+
${after ? `margin-bottom: ${after}px;` : ""}
|
|
19374
18189
|
${line ? getLineHeightValueString(line, "") : ""}
|
|
19375
18190
|
`.trim();
|
|
19376
18191
|
};
|
|
@@ -19868,850 +18683,1073 @@ const LinkedStyles = Extension.create({
|
|
|
19868
18683
|
};
|
|
19869
18684
|
}
|
|
19870
18685
|
});
|
|
19871
|
-
|
|
19872
|
-
|
|
19873
|
-
|
|
19874
|
-
|
|
19875
|
-
|
|
19876
|
-
|
|
19877
|
-
|
|
19878
|
-
|
|
19879
|
-
|
|
19880
|
-
|
|
19881
|
-
|
|
19882
|
-
|
|
19883
|
-
|
|
19884
|
-
|
|
19885
|
-
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
|
|
19889
|
-
|
|
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);
|
|
18686
|
+
const getDefaultSpacing = () => ({
|
|
18687
|
+
after: null,
|
|
18688
|
+
before: null,
|
|
18689
|
+
line: null,
|
|
18690
|
+
lineRule: "auto"
|
|
18691
|
+
});
|
|
18692
|
+
const restartNumbering = ({ editor, tr, state, dispatch }) => {
|
|
18693
|
+
const { node: paragraph, pos } = findParentNode(isList)(state.selection) || {};
|
|
18694
|
+
if (!paragraph) return false;
|
|
18695
|
+
const allParagraphs = [{ node: paragraph, pos }];
|
|
18696
|
+
const startPos = pos + paragraph.nodeSize;
|
|
18697
|
+
const myNumId = paragraph.attrs.numberingProperties.numId;
|
|
18698
|
+
let stop = false;
|
|
18699
|
+
state.doc.nodesBetween(startPos, state.doc.content.size, (node, nodePos) => {
|
|
18700
|
+
if (node.type.name === "paragraph") {
|
|
18701
|
+
if (isList(node) && node.attrs.paragraphProperties?.numberingProperties?.numId === myNumId) {
|
|
18702
|
+
allParagraphs.push({ node, pos: nodePos });
|
|
18703
|
+
} else {
|
|
18704
|
+
stop = true;
|
|
19908
18705
|
}
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
-
|
|
19912
|
-
|
|
19913
|
-
|
|
19914
|
-
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
|
|
19919
|
-
|
|
19920
|
-
|
|
19921
|
-
|
|
19922
|
-
|
|
19923
|
-
|
|
19924
|
-
|
|
19925
|
-
|
|
19926
|
-
|
|
19927
|
-
|
|
19928
|
-
|
|
18706
|
+
return false;
|
|
18707
|
+
}
|
|
18708
|
+
return !stop;
|
|
18709
|
+
});
|
|
18710
|
+
const { numberingType } = paragraph.attrs.listRendering || {};
|
|
18711
|
+
const listType = numberingType === "bullet" ? "bulletList" : "orderedList";
|
|
18712
|
+
const numId = ListHelpers.getNewListId(editor);
|
|
18713
|
+
ListHelpers.generateNewListDefinition({ numId: Number(numId), listType, editor });
|
|
18714
|
+
allParagraphs.forEach(({ node, pos: pos2 }) => {
|
|
18715
|
+
updateNumberingProperties(
|
|
18716
|
+
{
|
|
18717
|
+
...node.attrs.numberingProperties,
|
|
18718
|
+
numId: Number(numId)
|
|
18719
|
+
},
|
|
18720
|
+
node,
|
|
18721
|
+
pos2,
|
|
18722
|
+
editor,
|
|
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
|
+
}
|
|
19929
18814
|
}
|
|
19930
|
-
|
|
18815
|
+
}
|
|
18816
|
+
if (!tabWidth || tabWidth < 1) {
|
|
18817
|
+
tabWidth = defaultTabDistance - currentWidth % defaultLineLength % defaultTabDistance;
|
|
18818
|
+
if (tabWidth === 0) tabWidth = defaultTabDistance;
|
|
18819
|
+
}
|
|
18820
|
+
const tabHeight = paragraphContext.tabHeight;
|
|
18821
|
+
paragraphContext.accumulatedTabWidth = accumulatedTabWidth + tabWidth;
|
|
18822
|
+
return `width: ${tabWidth}px; height: ${tabHeight}; ${extraStyles}`;
|
|
18823
|
+
} catch (error) {
|
|
18824
|
+
console.error("tab decoration error", error);
|
|
19931
18825
|
}
|
|
19932
|
-
if (color) add("text-decoration-color", color);
|
|
19933
|
-
return parts.join("; ");
|
|
19934
18826
|
}
|
|
19935
|
-
function
|
|
19936
|
-
|
|
19937
|
-
|
|
19938
|
-
|
|
19939
|
-
|
|
19940
|
-
|
|
19941
|
-
|
|
19942
|
-
|
|
19943
|
-
|
|
18827
|
+
function findParagraphContext($pos, cache, helpers2) {
|
|
18828
|
+
for (let depth = $pos.depth; depth >= 0; depth--) {
|
|
18829
|
+
const node = $pos.node(depth);
|
|
18830
|
+
if (node?.type?.name === "paragraph") {
|
|
18831
|
+
const startPos = $pos.start(depth);
|
|
18832
|
+
if (!cache.has(startPos)) {
|
|
18833
|
+
const paragraphContext = extractParagraphContext(node, startPos, helpers2, depth);
|
|
18834
|
+
cache.set(startPos, paragraphContext);
|
|
18835
|
+
}
|
|
18836
|
+
return cache.get(startPos);
|
|
18837
|
+
}
|
|
19944
18838
|
}
|
|
19945
|
-
|
|
18839
|
+
return null;
|
|
18840
|
+
}
|
|
18841
|
+
function extractParagraphContext(node, startPos, helpers2, depth = 0) {
|
|
18842
|
+
let tabStops = [];
|
|
18843
|
+
if (Array.isArray(node.attrs?.tabStops)) {
|
|
18844
|
+
tabStops = node.attrs.tabStops.map((stop) => {
|
|
18845
|
+
const ref2 = stop?.tab;
|
|
18846
|
+
if (!ref2) return stop || null;
|
|
18847
|
+
return {
|
|
18848
|
+
val: ref2.tabType || "start",
|
|
18849
|
+
pos: twipsToPixels(Number(ref2.pos) || 0),
|
|
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
|
+
}
|
|
18858
|
+
}
|
|
18859
|
+
const { entries, positionMap } = flattenParagraph(node, startPos);
|
|
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) => {
|
|
19946
18876
|
if (!node) return;
|
|
19947
|
-
|
|
19948
|
-
|
|
19949
|
-
|
|
19950
|
-
|
|
19951
|
-
seenMarks.add(mark);
|
|
19952
|
-
textStyleMarks.push(mark);
|
|
19953
|
-
}
|
|
18877
|
+
if (node.type?.name === "run") {
|
|
18878
|
+
node.forEach((child, offset2) => {
|
|
18879
|
+
const childPos = basePos + offset2 + 1;
|
|
18880
|
+
walk(child, childPos);
|
|
19954
18881
|
});
|
|
18882
|
+
return;
|
|
19955
18883
|
}
|
|
19956
|
-
|
|
19957
|
-
|
|
19958
|
-
}
|
|
18884
|
+
const pos = basePos - 1;
|
|
18885
|
+
const index2 = entries.length;
|
|
18886
|
+
entries.push({ node, pos });
|
|
18887
|
+
positionMap.set(pos, index2);
|
|
19959
18888
|
};
|
|
19960
|
-
|
|
19961
|
-
|
|
19962
|
-
|
|
19963
|
-
attrs.lineHeight = childNode.attrs.lineHeight;
|
|
19964
|
-
}
|
|
19965
|
-
collectMarks(childNode);
|
|
18889
|
+
paragraph.forEach((child, offset2) => {
|
|
18890
|
+
const childPos = paragraphStartPos + offset2 + 1;
|
|
18891
|
+
walk(child, childPos);
|
|
19966
18892
|
});
|
|
19967
|
-
return {
|
|
19968
|
-
marks: textStyleMarks,
|
|
19969
|
-
attrs
|
|
19970
|
-
};
|
|
18893
|
+
return { entries, positionMap };
|
|
19971
18894
|
}
|
|
19972
|
-
function
|
|
19973
|
-
|
|
19974
|
-
|
|
19975
|
-
|
|
19976
|
-
|
|
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);
|
|
18895
|
+
function findNextTabIndex(flattened, fromIndex) {
|
|
18896
|
+
for (let i = fromIndex; i < flattened.length; i++) {
|
|
18897
|
+
if (flattened[i]?.node?.type?.name === "tab") {
|
|
18898
|
+
return i;
|
|
18899
|
+
}
|
|
19990
18900
|
}
|
|
18901
|
+
return -1;
|
|
19991
18902
|
}
|
|
19992
|
-
function
|
|
19993
|
-
|
|
19994
|
-
|
|
19995
|
-
|
|
19996
|
-
|
|
19997
|
-
|
|
19998
|
-
|
|
19999
|
-
|
|
20000
|
-
|
|
20001
|
-
|
|
20002
|
-
|
|
20003
|
-
return {
|
|
20004
|
-
fontSize: inline.fontSize || cached.fontSize,
|
|
20005
|
-
fontFamily: inline.fontFamily || cached.fontFamily,
|
|
20006
|
-
lineHeight: inline.lineHeight || cached.lineHeight
|
|
20007
|
-
};
|
|
18903
|
+
function findDecimalBreakPos(flattened, startIndex, breakChar) {
|
|
18904
|
+
for (let i = startIndex; i < flattened.length; i++) {
|
|
18905
|
+
const entry = flattened[i];
|
|
18906
|
+
if (!entry) break;
|
|
18907
|
+
if (entry.node.type?.name === "tab") break;
|
|
18908
|
+
if (entry.node.type?.name === "text") {
|
|
18909
|
+
const index2 = entry.node.text?.indexOf(breakChar);
|
|
18910
|
+
if (index2 !== void 0 && index2 !== -1) {
|
|
18911
|
+
return entry.pos + index2 + 1;
|
|
18912
|
+
}
|
|
18913
|
+
}
|
|
20008
18914
|
}
|
|
20009
|
-
|
|
20010
|
-
|
|
20011
|
-
|
|
20012
|
-
|
|
20013
|
-
|
|
20014
|
-
|
|
20015
|
-
|
|
20016
|
-
|
|
20017
|
-
|
|
20018
|
-
|
|
20019
|
-
|
|
20020
|
-
|
|
20021
|
-
|
|
20022
|
-
|
|
18915
|
+
return null;
|
|
18916
|
+
}
|
|
18917
|
+
function measureRangeWidth(view, from2, to, coordCache = null, domPosCache = null) {
|
|
18918
|
+
if (!Number.isFinite(from2) || !Number.isFinite(to) || to <= from2) return 0;
|
|
18919
|
+
try {
|
|
18920
|
+
const range = document.createRange();
|
|
18921
|
+
const fromRef = getCachedDomAtPos(view, from2, domPosCache);
|
|
18922
|
+
const toRef = getCachedDomAtPos(view, to, domPosCache);
|
|
18923
|
+
range.setStart(fromRef.node, fromRef.offset);
|
|
18924
|
+
range.setEnd(toRef.node, toRef.offset);
|
|
18925
|
+
const rect = range.getBoundingClientRect();
|
|
18926
|
+
range.detach?.();
|
|
18927
|
+
return rect.width || 0;
|
|
18928
|
+
} catch {
|
|
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);
|
|
20023
18933
|
}
|
|
20024
|
-
return inline;
|
|
20025
18934
|
}
|
|
20026
|
-
function
|
|
20027
|
-
|
|
20028
|
-
|
|
20029
|
-
|
|
20030
|
-
|
|
20031
|
-
|
|
20032
|
-
|
|
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;
|
|
20040
|
-
}
|
|
20041
|
-
if (typeof viewPos !== "number") return;
|
|
20042
|
-
if (viewPos < pos) {
|
|
20043
|
-
if (!candidate || viewPos > candidate.pos) candidate = { view, pos: viewPos };
|
|
18935
|
+
function getIndentWidth(view, paragraphStartPos, indentAttrs = {}, coordCache = null, domPosCache = null) {
|
|
18936
|
+
const marginLeft = getLeftCoord(view, paragraphStartPos, coordCache, domPosCache);
|
|
18937
|
+
const lineLeft = getLeftCoord(view, paragraphStartPos + 1, coordCache, domPosCache);
|
|
18938
|
+
if (marginLeft != null && lineLeft != null) {
|
|
18939
|
+
const diff = lineLeft - marginLeft;
|
|
18940
|
+
if (!Number.isNaN(diff) && Math.abs(diff) > 0.5) {
|
|
18941
|
+
return diff;
|
|
20044
18942
|
}
|
|
20045
|
-
}
|
|
20046
|
-
return
|
|
18943
|
+
}
|
|
18944
|
+
return calculateIndentFallback(indentAttrs);
|
|
20047
18945
|
}
|
|
20048
|
-
function
|
|
20049
|
-
|
|
20050
|
-
|
|
20051
|
-
|
|
20052
|
-
|
|
20053
|
-
|
|
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
|
-
}
|
|
18946
|
+
function getBlockNodeWidth(view, blockStartPos) {
|
|
18947
|
+
const blockDom = view.nodeDOM(blockStartPos - 1);
|
|
18948
|
+
if (blockDom instanceof HTMLElement) {
|
|
18949
|
+
const styles = window.getComputedStyle(blockDom);
|
|
18950
|
+
const width = blockDom.clientWidth + parseFloat(styles.marginLeft || "0") + parseFloat(styles.marginRight || "0") + parseFloat(styles.borderLeftWidth || "0") + parseFloat(styles.borderRightWidth || "0") + parseFloat(styles.paddingLeft || "0") + parseFloat(styles.paddingRight || "0");
|
|
18951
|
+
return width;
|
|
20103
18952
|
}
|
|
20104
|
-
return
|
|
20105
|
-
fontSize,
|
|
20106
|
-
fontFamily,
|
|
20107
|
-
lineHeight,
|
|
20108
|
-
hasSize,
|
|
20109
|
-
hasFamily
|
|
20110
|
-
};
|
|
18953
|
+
return defaultLineLength;
|
|
20111
18954
|
}
|
|
20112
|
-
function
|
|
20113
|
-
|
|
20114
|
-
const
|
|
20115
|
-
const
|
|
20116
|
-
const
|
|
20117
|
-
|
|
20118
|
-
|
|
20119
|
-
|
|
20120
|
-
|
|
20121
|
-
|
|
20122
|
-
|
|
20123
|
-
|
|
20124
|
-
const style2 = dec.type?.attrs?.style || "";
|
|
20125
|
-
return style2 && predicateFn(style2);
|
|
20126
|
-
});
|
|
20127
|
-
if (styleDeco) break;
|
|
18955
|
+
function calculateIndentFallback(indentAttrs = {}) {
|
|
18956
|
+
if (!indentAttrs) return 0;
|
|
18957
|
+
const left2 = twipsToPixels(Number(indentAttrs.left) || 0);
|
|
18958
|
+
const firstLine = twipsToPixels(Number(indentAttrs.firstLine) || 0);
|
|
18959
|
+
const hanging = twipsToPixels(Number(indentAttrs.hanging) || 0);
|
|
18960
|
+
let textIndent = 0;
|
|
18961
|
+
if (firstLine && hanging) {
|
|
18962
|
+
textIndent = firstLine - hanging;
|
|
18963
|
+
} else if (firstLine) {
|
|
18964
|
+
textIndent = firstLine;
|
|
18965
|
+
} else if (hanging) {
|
|
18966
|
+
textIndent = -hanging;
|
|
20128
18967
|
}
|
|
20129
|
-
|
|
20130
|
-
|
|
20131
|
-
|
|
20132
|
-
const fontFamilyFromStyles = stylesArray.find((s2) => s2.includes("font-family"))?.split(":")[1]?.trim();
|
|
20133
|
-
return {
|
|
20134
|
-
font: fontFamilyFromStyles,
|
|
20135
|
-
size: fontSizeFromStyles
|
|
20136
|
-
};
|
|
18968
|
+
if (textIndent) return left2 + textIndent;
|
|
18969
|
+
if (left2) return left2;
|
|
18970
|
+
return 0;
|
|
20137
18971
|
}
|
|
20138
|
-
function
|
|
20139
|
-
|
|
20140
|
-
|
|
20141
|
-
|
|
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;
|
|
20161
|
-
}
|
|
18972
|
+
function getLeftCoord(view, pos, coordCache = null, domPosCache = null) {
|
|
18973
|
+
if (!Number.isFinite(pos)) return null;
|
|
18974
|
+
if (coordCache && coordCache.has(pos)) {
|
|
18975
|
+
return coordCache.get(pos);
|
|
20162
18976
|
}
|
|
20163
|
-
|
|
20164
|
-
|
|
20165
|
-
|
|
20166
|
-
|
|
20167
|
-
|
|
20168
|
-
|
|
20169
|
-
|
|
20170
|
-
|
|
20171
|
-
|
|
20172
|
-
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
if (!currentStyles.fontFamily && prevFamily) currentStyles.fontFamily = prevFamily;
|
|
20178
|
-
if (!currentStyles.lineHeight && prevLineHeight) currentStyles.lineHeight = prevLineHeight;
|
|
18977
|
+
let result = null;
|
|
18978
|
+
try {
|
|
18979
|
+
result = view.coordsAtPos(pos).left;
|
|
18980
|
+
} catch {
|
|
18981
|
+
try {
|
|
18982
|
+
const ref2 = getCachedDomAtPos(view, pos, domPosCache);
|
|
18983
|
+
const range = document.createRange();
|
|
18984
|
+
range.setStart(ref2.node, ref2.offset);
|
|
18985
|
+
range.setEnd(ref2.node, ref2.offset);
|
|
18986
|
+
const rect = range.getBoundingClientRect();
|
|
18987
|
+
range.detach?.();
|
|
18988
|
+
result = rect.left;
|
|
18989
|
+
} catch {
|
|
18990
|
+
result = null;
|
|
20179
18991
|
}
|
|
20180
18992
|
}
|
|
20181
|
-
|
|
20182
|
-
|
|
20183
|
-
|
|
20184
|
-
|
|
20185
|
-
};
|
|
18993
|
+
if (coordCache) {
|
|
18994
|
+
coordCache.set(pos, result);
|
|
18995
|
+
}
|
|
18996
|
+
return result;
|
|
20186
18997
|
}
|
|
20187
|
-
|
|
20188
|
-
|
|
20189
|
-
|
|
20190
|
-
|
|
20191
|
-
const
|
|
20192
|
-
|
|
20193
|
-
|
|
20194
|
-
|
|
20195
|
-
|
|
20196
|
-
|
|
20197
|
-
|
|
20198
|
-
|
|
18998
|
+
function getCachedDomAtPos(view, pos, domPosCache = null) {
|
|
18999
|
+
if (domPosCache && domPosCache.has(pos)) {
|
|
19000
|
+
return domPosCache.get(pos);
|
|
19001
|
+
}
|
|
19002
|
+
const result = view.domAtPos(pos);
|
|
19003
|
+
if (domPosCache) {
|
|
19004
|
+
domPosCache.set(pos, result);
|
|
19005
|
+
}
|
|
19006
|
+
return result;
|
|
19007
|
+
}
|
|
19008
|
+
function calcTabHeight(blockParent2) {
|
|
19009
|
+
const ptToPxRatio = 1.333;
|
|
19010
|
+
const defaultFontSize = 16;
|
|
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`;
|
|
19015
|
+
}
|
|
19016
|
+
class ParagraphNodeView {
|
|
19017
|
+
/**
|
|
19018
|
+
* @param {import('prosemirror-model').Node} node Current paragraph node.
|
|
19019
|
+
* @param {import('../../core/Editor').Editor} editor Editor instance providing schema/helpers.
|
|
19020
|
+
* @param {() => number} getPos Position getter provided by ProseMirror.
|
|
19021
|
+
* @param {import('prosemirror-view').Decoration[]} decorations Decorations applied to this node.
|
|
19022
|
+
* @param {Record<string, unknown>} extensionAttrs Extra attributes declared by the paragraph extension.
|
|
19023
|
+
*/
|
|
19024
|
+
constructor(node, editor, getPos, decorations, extensionAttrs) {
|
|
19025
|
+
__privateAdd(this, _ParagraphNodeView_instances);
|
|
20199
19026
|
this.node = node;
|
|
20200
19027
|
this.editor = editor;
|
|
19028
|
+
this.getPos = getPos;
|
|
20201
19029
|
this.decorations = decorations;
|
|
20202
|
-
this.
|
|
20203
|
-
this.
|
|
20204
|
-
this.
|
|
20205
|
-
this.
|
|
20206
|
-
|
|
20207
|
-
|
|
20208
|
-
|
|
20209
|
-
|
|
20210
|
-
|
|
20211
|
-
|
|
20212
|
-
|
|
20213
|
-
|
|
20214
|
-
|
|
20215
|
-
return null;
|
|
20216
|
-
}
|
|
20217
|
-
}
|
|
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;
|
|
19030
|
+
this.extensionAttrs = extensionAttrs;
|
|
19031
|
+
this._animationFrameRequest = null;
|
|
19032
|
+
this.dom = document.createElement("p");
|
|
19033
|
+
this.contentDOM = document.createElement("span");
|
|
19034
|
+
this.dom.appendChild(this.contentDOM);
|
|
19035
|
+
if (__privateMethod(this, _ParagraphNodeView_instances, checkIsList_fn).call(this)) {
|
|
19036
|
+
__privateMethod(this, _ParagraphNodeView_instances, initList_fn).call(this, node.attrs.listRendering);
|
|
19037
|
+
__privateMethod(this, _ParagraphNodeView_instances, scheduleAnimation_fn).call(this, () => {
|
|
19038
|
+
if (!__privateMethod(this, _ParagraphNodeView_instances, checkIsList_fn).call(this)) {
|
|
19039
|
+
return;
|
|
19040
|
+
}
|
|
19041
|
+
__privateMethod(this, _ParagraphNodeView_instances, updateListStyles_fn).call(this);
|
|
19042
|
+
});
|
|
20227
19043
|
}
|
|
20228
|
-
|
|
20229
|
-
this._pendingIndentRefresh = raf(() => {
|
|
20230
|
-
this._pendingIndentRefresh = null;
|
|
20231
|
-
__privateMethod(this, _ListItemNodeView_instances, applyIndentStyling_fn).call(this);
|
|
20232
|
-
});
|
|
19044
|
+
__privateMethod(this, _ParagraphNodeView_instances, updateHTMLAttributes_fn).call(this);
|
|
20233
19045
|
}
|
|
19046
|
+
/**
|
|
19047
|
+
* @param {import('prosemirror-model').Node} node
|
|
19048
|
+
* @param {import('prosemirror-view').Decoration[]} decorations
|
|
19049
|
+
*/
|
|
20234
19050
|
update(node, decorations) {
|
|
20235
|
-
const
|
|
19051
|
+
const oldAttrs = this.node.attrs;
|
|
19052
|
+
const newAttrs = node.attrs;
|
|
20236
19053
|
this.node = node;
|
|
20237
19054
|
this.decorations = decorations;
|
|
20238
|
-
|
|
20239
|
-
|
|
20240
|
-
if (stylingAttrsChanged) {
|
|
20241
|
-
clearComputedStyleCache(this.dom);
|
|
19055
|
+
if (JSON.stringify(oldAttrs) === JSON.stringify(newAttrs)) {
|
|
19056
|
+
return true;
|
|
20242
19057
|
}
|
|
20243
|
-
|
|
20244
|
-
|
|
20245
|
-
|
|
20246
|
-
|
|
20247
|
-
|
|
20248
|
-
|
|
19058
|
+
__privateMethod(this, _ParagraphNodeView_instances, updateHTMLAttributes_fn).call(this);
|
|
19059
|
+
if (!__privateMethod(this, _ParagraphNodeView_instances, checkIsList_fn).call(this)) {
|
|
19060
|
+
__privateMethod(this, _ParagraphNodeView_instances, removeList_fn).call(this);
|
|
19061
|
+
return true;
|
|
19062
|
+
}
|
|
19063
|
+
__privateMethod(this, _ParagraphNodeView_instances, initList_fn).call(this, node.attrs.listRendering);
|
|
19064
|
+
__privateMethod(this, _ParagraphNodeView_instances, scheduleAnimation_fn).call(this, () => {
|
|
19065
|
+
__privateMethod(this, _ParagraphNodeView_instances, initList_fn).call(this, node.attrs.listRendering);
|
|
19066
|
+
__privateMethod(this, _ParagraphNodeView_instances, updateListStyles_fn).call(this);
|
|
20249
19067
|
});
|
|
20250
|
-
|
|
20251
|
-
|
|
20252
|
-
|
|
20253
|
-
|
|
20254
|
-
|
|
20255
|
-
|
|
19068
|
+
return true;
|
|
19069
|
+
}
|
|
19070
|
+
/**
|
|
19071
|
+
* @param {MutationRecord} mutation
|
|
19072
|
+
*/
|
|
19073
|
+
ignoreMutation(mutation) {
|
|
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;
|
|
20256
19082
|
}
|
|
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;
|
|
20257
19098
|
}
|
|
20258
19099
|
destroy() {
|
|
20259
|
-
|
|
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);
|
|
20265
|
-
}
|
|
20266
|
-
this._pendingIndentRefresh = null;
|
|
19100
|
+
__privateMethod(this, _ParagraphNodeView_instances, cancelScheduledAnimation_fn).call(this);
|
|
20267
19101
|
}
|
|
20268
19102
|
}
|
|
20269
|
-
|
|
20270
|
-
|
|
20271
|
-
const
|
|
20272
|
-
|
|
20273
|
-
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
listLevel,
|
|
20278
|
-
lvlText,
|
|
20279
|
-
listNumberingType,
|
|
20280
|
-
customFormat
|
|
20281
|
-
});
|
|
20282
|
-
} else {
|
|
20283
|
-
orderMarker = docxNumberingHelpers.normalizeLvlTextChar(lvlText);
|
|
19103
|
+
_ParagraphNodeView_instances = new WeakSet();
|
|
19104
|
+
updateHTMLAttributes_fn = function() {
|
|
19105
|
+
const htmlAttributes = Attribute.getAttributesToRender(this.node, this.extensionAttrs);
|
|
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;
|
|
20284
19111
|
}
|
|
19112
|
+
this.dom.setAttribute(key2, value);
|
|
20285
19113
|
}
|
|
20286
|
-
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
|
|
20292
|
-
|
|
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" ? " " : "";
|
|
19123
|
+
}
|
|
19124
|
+
return true;
|
|
19125
|
+
};
|
|
19126
|
+
/**
|
|
19127
|
+
* @param {{ markerText: string, suffix?: string }} listRendering
|
|
19128
|
+
*/
|
|
19129
|
+
initList_fn = function(listRendering) {
|
|
19130
|
+
__privateMethod(this, _ParagraphNodeView_instances, createMarker_fn).call(this, listRendering.markerText);
|
|
19131
|
+
__privateMethod(this, _ParagraphNodeView_instances, createSeparator_fn).call(this, listRendering.suffix);
|
|
19132
|
+
};
|
|
19133
|
+
checkIsList_fn = function() {
|
|
19134
|
+
return isList(this.node);
|
|
19135
|
+
};
|
|
19136
|
+
/**
|
|
19137
|
+
* @param {string} markerText
|
|
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;`;
|
|
19204
|
+
} else {
|
|
19205
|
+
const tabNode = this.editor.schema.nodes.tab.create(null);
|
|
19206
|
+
tabStyle = calculateTabStyle(tabNode.nodeSize, this.editor.view, start2, this.node, paragraphContext);
|
|
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;
|
|
20293
19283
|
});
|
|
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 });
|
|
20314
19284
|
};
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
|
|
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;
|
|
19308
|
+
}
|
|
19309
|
+
__privateMethod(this, _ParagraphNodeView_instances, cancelScheduledAnimation_fn).call(this);
|
|
19310
|
+
this._animationFrameRequest = globalThis.requestAnimationFrame(() => {
|
|
19311
|
+
fn2();
|
|
19312
|
+
this._animationFrameRequest = null;
|
|
19313
|
+
});
|
|
19314
|
+
};
|
|
19315
|
+
cancelScheduledAnimation_fn = function() {
|
|
19316
|
+
if (typeof globalThis === "undefined" || !this._animationFrameRequest) {
|
|
19317
|
+
return;
|
|
19318
|
+
}
|
|
19319
|
+
globalThis.cancelAnimationFrame(this._animationFrameRequest);
|
|
19320
|
+
this._animationFrameRequest = null;
|
|
19321
|
+
};
|
|
19322
|
+
function NumberingManager() {
|
|
19323
|
+
let countersMap = {};
|
|
19324
|
+
let abstractCountersMap = {};
|
|
19325
|
+
let abstractIdMap = {};
|
|
19326
|
+
const startsMap = {};
|
|
19327
|
+
let lastSeenMap = {};
|
|
19328
|
+
let pathCache = {};
|
|
19329
|
+
let cacheEnabled = false;
|
|
19330
|
+
return {
|
|
19331
|
+
/**
|
|
19332
|
+
* Persist the base start value and optional restart limit for a given
|
|
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;
|
|
20333
19349
|
},
|
|
20334
|
-
|
|
20335
|
-
|
|
20336
|
-
|
|
20337
|
-
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
|
|
20341
|
-
|
|
20342
|
-
|
|
20343
|
-
|
|
20344
|
-
|
|
20345
|
-
|
|
20346
|
-
|
|
20347
|
-
|
|
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();
|
|
19536
|
+
},
|
|
19537
|
+
/**
|
|
19538
|
+
* Disable cache-aware logic and clear residual cache entries.
|
|
19539
|
+
*/
|
|
19540
|
+
disableCache() {
|
|
19541
|
+
cacheEnabled = false;
|
|
19542
|
+
this._clearCache();
|
|
20348
19543
|
}
|
|
20349
19544
|
};
|
|
20350
|
-
|
|
20351
|
-
|
|
19545
|
+
}
|
|
19546
|
+
const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
|
|
19547
|
+
const handler = listIndexMap[listNumberingType];
|
|
19548
|
+
return handler ? handler(listLevel, lvlText, customFormat) : null;
|
|
20352
19549
|
};
|
|
20353
|
-
|
|
20354
|
-
|
|
20355
|
-
|
|
20356
|
-
|
|
20357
|
-
|
|
20358
|
-
|
|
20359
|
-
|
|
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;
|
|
20360
19613
|
}
|
|
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);
|
|
19614
|
+
}
|
|
20370
19615
|
return result;
|
|
20371
19616
|
};
|
|
20372
|
-
|
|
20373
|
-
|
|
20374
|
-
const
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20380
|
-
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
20387
|
-
|
|
20388
|
-
|
|
20389
|
-
|
|
20390
|
-
|
|
20391
|
-
|
|
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;
|
|
19626
|
+
};
|
|
19627
|
+
const intToJapaneseCounting = (num) => {
|
|
19628
|
+
const digits = ["", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
|
|
19629
|
+
const units = ["", "十", "百", "千"];
|
|
19630
|
+
if (num === 0) return "零";
|
|
19631
|
+
if (num < 10) return digits[num];
|
|
19632
|
+
let result = "";
|
|
19633
|
+
let tempNum = num;
|
|
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
|
+
}
|
|
19644
|
+
}
|
|
19645
|
+
tempNum = Math.floor(tempNum / 10);
|
|
19646
|
+
unitIndex++;
|
|
19647
|
+
if (unitIndex > 3) break;
|
|
19648
|
+
}
|
|
19649
|
+
if (num >= 10 && num < 20) {
|
|
19650
|
+
result = result.replace(/^一十/, "十");
|
|
19651
|
+
}
|
|
19652
|
+
return result;
|
|
19653
|
+
};
|
|
19654
|
+
function createNumberingPlugin(editor) {
|
|
19655
|
+
const numberingManager = NumberingManager();
|
|
19656
|
+
const applyStartSettingsFromDefinitions = (definitionsMap) => {
|
|
19657
|
+
Object.entries(definitionsMap || {}).forEach(([numId, levels]) => {
|
|
19658
|
+
Object.entries(levels || {}).forEach(([level, def]) => {
|
|
19659
|
+
const start2 = parseInt(def?.start) || 1;
|
|
19660
|
+
let restart = def?.restart;
|
|
19661
|
+
if (restart != null) {
|
|
19662
|
+
restart = parseInt(restart);
|
|
19663
|
+
}
|
|
19664
|
+
numberingManager.setStartSettings(numId, parseInt(level), start2, restart);
|
|
19665
|
+
});
|
|
19666
|
+
});
|
|
19667
|
+
};
|
|
19668
|
+
const refreshStartSettings = () => {
|
|
19669
|
+
const definitions = ListHelpers.getAllListDefinitions(editor);
|
|
19670
|
+
applyStartSettingsFromDefinitions(definitions);
|
|
19671
|
+
};
|
|
19672
|
+
refreshStartSettings();
|
|
19673
|
+
if (typeof editor?.on === "function") {
|
|
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
|
+
}
|
|
20392
19682
|
}
|
|
20393
|
-
}
|
|
20394
|
-
const orderedListSyncPluginKey = new PluginKey("orderedListSync");
|
|
20395
|
-
function orderedListSync(editor) {
|
|
20396
|
-
let hasInitialized = false;
|
|
20397
|
-
const docx = editor.converter.convertedXml;
|
|
20398
19683
|
return new Plugin({
|
|
20399
|
-
|
|
19684
|
+
name: "numberingPlugin",
|
|
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
|
+
*/
|
|
20400
19695
|
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
|
-
}
|
|
20406
19696
|
const isFromPlugin = transactions.some((tr2) => tr2.getMeta("orderedListSync"));
|
|
20407
|
-
|
|
20408
|
-
if (isFromPlugin || !docChanged) {
|
|
19697
|
+
if (isFromPlugin || !transactions.some((tr2) => tr2.docChanged)) {
|
|
20409
19698
|
return null;
|
|
20410
19699
|
}
|
|
20411
|
-
hasInitialized = true;
|
|
20412
19700
|
const tr = newState.tr;
|
|
20413
19701
|
tr.setMeta("orderedListSync", true);
|
|
20414
|
-
|
|
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;
|
|
19702
|
+
numberingManager.enableCache();
|
|
20438
19703
|
newState.doc.descendants((node, pos) => {
|
|
20439
|
-
if (node.type.name !== "
|
|
20440
|
-
|
|
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
|
-
}
|
|
19704
|
+
if (node.type.name !== "paragraph" || !node.attrs.numberingProperties) {
|
|
19705
|
+
return;
|
|
20476
19706
|
}
|
|
20477
|
-
|
|
20478
|
-
|
|
19707
|
+
const { numId, ilvl: level = 0 } = node.attrs.numberingProperties;
|
|
19708
|
+
const definitionDetails = ListHelpers.getListDefinitionDetails({ numId, level, editor });
|
|
19709
|
+
if (!definitionDetails || Object.keys(definitionDetails).length === 0) {
|
|
19710
|
+
tr.setNodeAttribute(pos, "listRendering", null);
|
|
19711
|
+
return;
|
|
20479
19712
|
}
|
|
20480
|
-
|
|
20481
|
-
|
|
20482
|
-
|
|
20483
|
-
|
|
20484
|
-
|
|
20485
|
-
|
|
20486
|
-
|
|
20487
|
-
|
|
20488
|
-
|
|
20489
|
-
|
|
20490
|
-
|
|
20491
|
-
|
|
19713
|
+
let { lvlText, customFormat, listNumberingType, suffix, justification, abstractId } = definitionDetails;
|
|
19714
|
+
let markerText = "";
|
|
19715
|
+
listNumberingType = listNumberingType || "decimal";
|
|
19716
|
+
const count = numberingManager.calculateCounter(numId, level, pos, abstractId);
|
|
19717
|
+
numberingManager.setCounter(numId, level, pos, count, abstractId);
|
|
19718
|
+
const path = numberingManager.calculatePath(numId, level, pos);
|
|
19719
|
+
if (listNumberingType !== "bullet") {
|
|
19720
|
+
markerText = generateOrderedListIndex({
|
|
19721
|
+
listLevel: path,
|
|
19722
|
+
lvlText,
|
|
19723
|
+
listNumberingType,
|
|
19724
|
+
customFormat
|
|
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
|
+
});
|
|
20492
19743
|
}
|
|
19744
|
+
return false;
|
|
20493
19745
|
});
|
|
20494
|
-
|
|
19746
|
+
numberingManager.disableCache();
|
|
19747
|
+
return tr.docChanged ? tr : null;
|
|
20495
19748
|
}
|
|
20496
19749
|
});
|
|
20497
19750
|
}
|
|
20498
|
-
const
|
|
20499
|
-
|
|
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
|
-
});
|
|
19751
|
+
const bulletInputRegex = /^\s*([-+*])\s$/;
|
|
19752
|
+
const orderedInputRegex = /^(\d+)\.\s$/;
|
|
20715
19753
|
const Paragraph = OxmlNode.create({
|
|
20716
19754
|
name: "paragraph",
|
|
20717
19755
|
oXmlName: "w:p",
|
|
@@ -20739,22 +19777,26 @@ const Paragraph = OxmlNode.create({
|
|
|
20739
19777
|
parseDOM: (element) => {
|
|
20740
19778
|
if (element && element.closest("[data-superdoc-import]")) {
|
|
20741
19779
|
return {
|
|
20742
|
-
|
|
20743
|
-
|
|
20744
|
-
line: 1.15,
|
|
19780
|
+
after: pixelsToTwips(11),
|
|
19781
|
+
before: 0,
|
|
19782
|
+
line: linesToTwips(1.15),
|
|
20745
19783
|
lineRule: "auto"
|
|
20746
19784
|
};
|
|
20747
19785
|
}
|
|
20748
19786
|
return void 0;
|
|
20749
19787
|
},
|
|
20750
19788
|
renderDOM: (attrs) => {
|
|
20751
|
-
const { spacing } = attrs;
|
|
20752
|
-
if (!spacing) return {};
|
|
19789
|
+
const { spacing, marksAttrs } = attrs;
|
|
19790
|
+
if (!spacing) return { style: null };
|
|
20753
19791
|
const spacingCopy = { ...spacing };
|
|
20754
19792
|
if (attrs.lineHeight) delete spacingCopy.line;
|
|
20755
|
-
const style = getSpacingStyleString(
|
|
19793
|
+
const style = getSpacingStyleString(
|
|
19794
|
+
spacingCopy,
|
|
19795
|
+
marksAttrs ?? [],
|
|
19796
|
+
Boolean(attrs.paragraphProperties?.numberingProperties)
|
|
19797
|
+
);
|
|
20756
19798
|
if (style) return { style };
|
|
20757
|
-
return {};
|
|
19799
|
+
return { style: null };
|
|
20758
19800
|
}
|
|
20759
19801
|
},
|
|
20760
19802
|
extraAttrs: {
|
|
@@ -20782,17 +19824,17 @@ const Paragraph = OxmlNode.create({
|
|
|
20782
19824
|
indent: {
|
|
20783
19825
|
default: null,
|
|
20784
19826
|
renderDOM: ({ indent }) => {
|
|
20785
|
-
if (!indent) return {};
|
|
19827
|
+
if (!indent) return { style: null };
|
|
20786
19828
|
const { left: left2, right: right2, firstLine, hanging } = indent;
|
|
20787
19829
|
if (indent && Object.values(indent).every((v) => v === 0)) {
|
|
20788
|
-
return {};
|
|
19830
|
+
return { style: null };
|
|
20789
19831
|
}
|
|
20790
19832
|
let style = "";
|
|
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;`;
|
|
19833
|
+
if (left2) style += `margin-left: ${twipsToPixels(left2)}px;`;
|
|
19834
|
+
if (right2) style += `margin-right: ${twipsToPixels(right2)}px;`;
|
|
19835
|
+
if (firstLine && !hanging) style += `text-indent: ${twipsToPixels(firstLine)}px;`;
|
|
19836
|
+
if (firstLine && hanging) style += `text-indent: ${twipsToPixels(firstLine - hanging)}px;`;
|
|
19837
|
+
if (!firstLine && hanging) style += `text-indent: ${twipsToPixels(-hanging)}px;`;
|
|
20796
19838
|
return { style };
|
|
20797
19839
|
}
|
|
20798
19840
|
},
|
|
@@ -20811,12 +19853,16 @@ const Paragraph = OxmlNode.create({
|
|
|
20811
19853
|
sideOrder.forEach((side) => {
|
|
20812
19854
|
const b = borders[side];
|
|
20813
19855
|
if (!b) return;
|
|
20814
|
-
|
|
19856
|
+
if (["nil", "none", void 0, null].includes(b.val)) {
|
|
19857
|
+
style += `border-${side}: none;`;
|
|
19858
|
+
return;
|
|
19859
|
+
}
|
|
19860
|
+
const width = b.size != null ? `${eighthPointsToPixels(b.size)}px` : "1px";
|
|
20815
19861
|
const cssStyle = valToCss[b.val] || "solid";
|
|
20816
|
-
const color = b.color || "#000000"
|
|
19862
|
+
const color = !b.color || b.color === "auto" ? "#000000" : `#${b.color}`;
|
|
20817
19863
|
style += `border-${side}: ${width} ${cssStyle} ${color};`;
|
|
20818
19864
|
if (b.space != null && side === "bottom") {
|
|
20819
|
-
style += `padding-bottom: ${b.space}px;`;
|
|
19865
|
+
style += `padding-bottom: ${eighthPointsToPixels(b.space)}px;`;
|
|
20820
19866
|
}
|
|
20821
19867
|
});
|
|
20822
19868
|
return style ? { style } : {};
|
|
@@ -20830,7 +19876,12 @@ const Paragraph = OxmlNode.create({
|
|
|
20830
19876
|
return null;
|
|
20831
19877
|
}
|
|
20832
19878
|
},
|
|
20833
|
-
styleId: {
|
|
19879
|
+
styleId: {
|
|
19880
|
+
renderDOM: (attrs) => {
|
|
19881
|
+
if (!attrs.styleId) return {};
|
|
19882
|
+
return { styleid: attrs.styleId };
|
|
19883
|
+
}
|
|
19884
|
+
},
|
|
20834
19885
|
sdBlockId: {
|
|
20835
19886
|
default: null,
|
|
20836
19887
|
keepOnSplit: false,
|
|
@@ -20848,19 +19899,37 @@ const Paragraph = OxmlNode.create({
|
|
|
20848
19899
|
paragraphProperties: { rendered: false },
|
|
20849
19900
|
dropcap: { rendered: false },
|
|
20850
19901
|
pageBreakSource: { rendered: false },
|
|
20851
|
-
|
|
20852
|
-
renderDOM: ({
|
|
20853
|
-
|
|
20854
|
-
if (!jc) return {};
|
|
19902
|
+
textAlign: {
|
|
19903
|
+
renderDOM: ({ textAlign }) => {
|
|
19904
|
+
if (!textAlign) return {};
|
|
20855
19905
|
let style = "";
|
|
20856
|
-
if (
|
|
20857
|
-
else if (
|
|
20858
|
-
else if (
|
|
20859
|
-
else if (
|
|
19906
|
+
if (textAlign === "left") style += "text-align: left;";
|
|
19907
|
+
else if (textAlign === "right") style += "text-align: right;";
|
|
19908
|
+
else if (textAlign === "center") style += "text-align: center;";
|
|
19909
|
+
else if (textAlign === "both") style += "text-align: justify;";
|
|
20860
19910
|
return { style };
|
|
20861
19911
|
}
|
|
20862
19912
|
},
|
|
20863
|
-
tabStops: { rendered: false }
|
|
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
|
+
}
|
|
20864
19933
|
};
|
|
20865
19934
|
},
|
|
20866
19935
|
parseDOM() {
|
|
@@ -20868,12 +19937,59 @@ const Paragraph = OxmlNode.create({
|
|
|
20868
19937
|
{
|
|
20869
19938
|
tag: "p",
|
|
20870
19939
|
getAttrs: (node) => {
|
|
20871
|
-
const
|
|
20872
|
-
|
|
19940
|
+
const numberingProperties = {};
|
|
19941
|
+
let indent, spacing;
|
|
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
|
+
}
|
|
20873
19966
|
return acc;
|
|
20874
19967
|
}, {});
|
|
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
|
+
}
|
|
20875
19989
|
return {
|
|
20876
|
-
styleId:
|
|
19990
|
+
styleId: styleId || null,
|
|
19991
|
+
indent,
|
|
19992
|
+
spacing,
|
|
20877
19993
|
extraAttrs
|
|
20878
19994
|
};
|
|
20879
19995
|
}
|
|
@@ -20901,6 +20017,101 @@ const Paragraph = OxmlNode.create({
|
|
|
20901
20017
|
renderDOM({ htmlAttributes }) {
|
|
20902
20018
|
return ["p", Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
20903
20019
|
},
|
|
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
|
+
},
|
|
20904
20115
|
addPmPlugins() {
|
|
20905
20116
|
const { view } = this.editor;
|
|
20906
20117
|
const dropcapWidthCache = /* @__PURE__ */ new Map();
|
|
@@ -20974,7 +20185,8 @@ const Paragraph = OxmlNode.create({
|
|
|
20974
20185
|
}
|
|
20975
20186
|
}
|
|
20976
20187
|
});
|
|
20977
|
-
|
|
20188
|
+
const numberingPlugin = createNumberingPlugin(this.editor);
|
|
20189
|
+
return [dropcapPlugin, numberingPlugin];
|
|
20978
20190
|
}
|
|
20979
20191
|
});
|
|
20980
20192
|
const getDropcapDecorations = (state, view, widthCache) => {
|
|
@@ -21171,259 +20383,6 @@ const CommentsMark = Mark.create({
|
|
|
21171
20383
|
return [CommentMarkName, Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
21172
20384
|
}
|
|
21173
20385
|
});
|
|
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
|
-
}
|
|
21427
20386
|
const TabNode = Node$1.create({
|
|
21428
20387
|
name: "tab",
|
|
21429
20388
|
group: "inline",
|
|
@@ -25775,42 +24734,60 @@ function toHex(color) {
|
|
|
25775
24734
|
};
|
|
25776
24735
|
return `#${hex(r2)}${hex(g)}${hex(b)}${a < 1 ? hex(Math.round(a * 255)) : ""}`;
|
|
25777
24736
|
}
|
|
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
|
+
};
|
|
25778
24772
|
const cleanUpListsWithAnnotations = (fieldsToDelete = []) => ({ dispatch, tr, state }) => {
|
|
25779
24773
|
if (!dispatch) return true;
|
|
25780
24774
|
if (!Array.isArray(fieldsToDelete)) fieldsToDelete = [fieldsToDelete];
|
|
24775
|
+
const fieldsToDeleteSet = new Set(fieldsToDelete);
|
|
25781
24776
|
const { doc: doc2 } = state;
|
|
25782
24777
|
const docxAnnotations = getAllFieldAnnotations(state) || [];
|
|
25783
24778
|
const nodesToDelete = [];
|
|
25784
24779
|
fieldsToDelete.forEach((fieldId) => {
|
|
25785
24780
|
const matched = docxAnnotations.find((a) => a.node.attrs.fieldId === fieldId);
|
|
25786
24781
|
if (!matched) return;
|
|
25787
|
-
const listItem = findParentNodeClosestToPos(doc2.resolve(matched.pos),
|
|
24782
|
+
const listItem = findParentNodeClosestToPos(doc2.resolve(matched.pos), isList);
|
|
25788
24783
|
if (!listItem) return;
|
|
25789
|
-
|
|
25790
|
-
|
|
25791
|
-
|
|
25792
|
-
|
|
25793
|
-
|
|
25794
|
-
|
|
25795
|
-
|
|
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
|
-
}
|
|
24784
|
+
const { totalFieldAnnotations, deletableFieldAnnotations, hasOtherInlineContent } = summarizeListContent(
|
|
24785
|
+
listItem.node,
|
|
24786
|
+
fieldsToDeleteSet
|
|
24787
|
+
);
|
|
24788
|
+
if (!totalFieldAnnotations) return;
|
|
24789
|
+
if (hasOtherInlineContent) return;
|
|
24790
|
+
if (totalFieldAnnotations !== deletableFieldAnnotations) return;
|
|
25814
24791
|
let { pos, node, depth } = listItem;
|
|
25815
24792
|
let $pos = doc2.resolve(pos);
|
|
25816
24793
|
while (depth > 0) {
|
|
@@ -31740,6 +30717,21 @@ const TextStyle = Mark.create({
|
|
|
31740
30717
|
if (!hasStyles || isAnnotation) return false;
|
|
31741
30718
|
return {};
|
|
31742
30719
|
}
|
|
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
|
+
}
|
|
31743
30735
|
}
|
|
31744
30736
|
];
|
|
31745
30737
|
},
|
|
@@ -31810,8 +30802,8 @@ const Bold = Mark.create({
|
|
|
31810
30802
|
value: {
|
|
31811
30803
|
default: null,
|
|
31812
30804
|
renderDOM: (attrs) => {
|
|
31813
|
-
if (
|
|
31814
|
-
if (attrs.value === "0") {
|
|
30805
|
+
if (attrs.value == null) return {};
|
|
30806
|
+
if (attrs.value === "0" || !attrs.value) {
|
|
31815
30807
|
return { style: "font-weight: normal" };
|
|
31816
30808
|
}
|
|
31817
30809
|
return {};
|
|
@@ -31888,8 +30880,8 @@ const Italic = Mark.create({
|
|
|
31888
30880
|
value: {
|
|
31889
30881
|
default: null,
|
|
31890
30882
|
renderDOM: (attrs) => {
|
|
31891
|
-
if (
|
|
31892
|
-
if (attrs.value === "0") return { style: "font-style: normal" };
|
|
30883
|
+
if (attrs.value == null) return {};
|
|
30884
|
+
if (attrs.value === "0" || !attrs.value) return { style: "font-style: normal" };
|
|
31893
30885
|
return {};
|
|
31894
30886
|
}
|
|
31895
30887
|
}
|
|
@@ -32108,7 +31100,7 @@ const Strike = Mark.create({
|
|
|
32108
31100
|
const merged = Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes);
|
|
32109
31101
|
const { value } = mark.attrs;
|
|
32110
31102
|
const { ...rest } = merged || {};
|
|
32111
|
-
if (value === "0") {
|
|
31103
|
+
if (value === "0" || value === false) {
|
|
32112
31104
|
return ["span", rest, 0];
|
|
32113
31105
|
}
|
|
32114
31106
|
return ["s", rest, 0];
|
|
@@ -32151,8 +31143,8 @@ const Strike = Mark.create({
|
|
|
32151
31143
|
value: {
|
|
32152
31144
|
default: null,
|
|
32153
31145
|
renderDOM: (attrs) => {
|
|
32154
|
-
if (
|
|
32155
|
-
if (attrs.value === "0") {
|
|
31146
|
+
if (attrs.value == null) return {};
|
|
31147
|
+
if (attrs.value === "0" || !attrs.value) {
|
|
32156
31148
|
return { style: "text-decoration: none" };
|
|
32157
31149
|
}
|
|
32158
31150
|
return {};
|
|
@@ -38523,7 +37515,6 @@ const NodeResizer = Extension.create({
|
|
|
38523
37515
|
const getRichTextExtensions = () => {
|
|
38524
37516
|
return [
|
|
38525
37517
|
Bold,
|
|
38526
|
-
BulletList,
|
|
38527
37518
|
Color,
|
|
38528
37519
|
Document,
|
|
38529
37520
|
FontFamily,
|
|
@@ -38531,10 +37522,8 @@ const getRichTextExtensions = () => {
|
|
|
38531
37522
|
History,
|
|
38532
37523
|
Heading,
|
|
38533
37524
|
Italic,
|
|
38534
|
-
ListItem,
|
|
38535
37525
|
LineHeight,
|
|
38536
37526
|
Link,
|
|
38537
|
-
OrderedList,
|
|
38538
37527
|
Paragraph,
|
|
38539
37528
|
Strike,
|
|
38540
37529
|
Text,
|
|
@@ -38566,7 +37555,6 @@ const getStarterExtensions = () => {
|
|
|
38566
37555
|
return [
|
|
38567
37556
|
Bold,
|
|
38568
37557
|
BlockNode,
|
|
38569
|
-
BulletList,
|
|
38570
37558
|
Color,
|
|
38571
37559
|
CommentRangeStart,
|
|
38572
37560
|
CommentRangeEnd,
|
|
@@ -38577,10 +37565,8 @@ const getStarterExtensions = () => {
|
|
|
38577
37565
|
History,
|
|
38578
37566
|
Heading,
|
|
38579
37567
|
Italic,
|
|
38580
|
-
ListItem,
|
|
38581
37568
|
LineHeight,
|
|
38582
37569
|
Link,
|
|
38583
|
-
OrderedList,
|
|
38584
37570
|
Paragraph,
|
|
38585
37571
|
LineBreak,
|
|
38586
37572
|
HardBreak,
|
|
@@ -38653,28 +37639,27 @@ export {
|
|
|
38653
37639
|
_export_sfc as _,
|
|
38654
37640
|
getQuickFormatList as a,
|
|
38655
37641
|
generateLinkedStyleString as b,
|
|
38656
|
-
|
|
38657
|
-
|
|
38658
|
-
|
|
38659
|
-
|
|
37642
|
+
getFileOpener as c,
|
|
37643
|
+
checkAndProcessImage as d,
|
|
37644
|
+
uploadAndInsertImage as e,
|
|
37645
|
+
collectTrackedChanges as f,
|
|
38660
37646
|
global as g,
|
|
38661
|
-
|
|
37647
|
+
undoDepth as h,
|
|
38662
37648
|
isTrackedChangeActionAllowed as i,
|
|
38663
|
-
|
|
38664
|
-
|
|
38665
|
-
|
|
38666
|
-
|
|
38667
|
-
|
|
38668
|
-
|
|
38669
|
-
|
|
38670
|
-
|
|
37649
|
+
redoDepth as j,
|
|
37650
|
+
collectTrackedChangesForContext as k,
|
|
37651
|
+
isHeadless as l,
|
|
37652
|
+
getStarterExtensions as m,
|
|
37653
|
+
getRichTextExtensions as n,
|
|
37654
|
+
Decoration as o,
|
|
37655
|
+
Extension as p,
|
|
37656
|
+
index$1 as q,
|
|
38671
37657
|
replaceSelectionWithImagePlaceholder as r,
|
|
38672
37658
|
shouldBypassContextMenu as s,
|
|
38673
|
-
index
|
|
37659
|
+
index as t,
|
|
38674
37660
|
useHighContrastMode as u,
|
|
38675
|
-
|
|
38676
|
-
|
|
38677
|
-
|
|
38678
|
-
yUndoPluginKey as y
|
|
38679
|
-
getAllowedImageDimensions as z
|
|
37661
|
+
AnnotatorHelpers as v,
|
|
37662
|
+
SectionHelpers as w,
|
|
37663
|
+
getAllowedImageDimensions as x,
|
|
37664
|
+
yUndoPluginKey as y
|
|
38680
37665
|
};
|