@novaprose/core 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/dist/a11y.cjs +314 -0
- package/dist/a11y.cjs.map +1 -0
- package/dist/a11y.d.cts +51 -0
- package/dist/a11y.d.ts +51 -0
- package/dist/a11y.js +11 -0
- package/dist/a11y.js.map +1 -0
- package/dist/a11ychecker-6ES3UMU3.js +449 -0
- package/dist/a11ychecker-6ES3UMU3.js.map +1 -0
- package/dist/accordion-ui-B4I2FJXE.js +201 -0
- package/dist/accordion-ui-B4I2FJXE.js.map +1 -0
- package/dist/advcode-7S6N64C7.js +51 -0
- package/dist/advcode-7S6N64C7.js.map +1 -0
- package/dist/advcode-editor-ENCPFVLO.js +257 -0
- package/dist/advcode-editor-ENCPFVLO.js.map +1 -0
- package/dist/{advlist-5FNKPLUX.js → advlist-FEDGNLMQ.js} +10 -7
- package/dist/advlist-FEDGNLMQ.js.map +1 -0
- package/dist/advtable-ui-JAVJY4L4.js +364 -0
- package/dist/advtable-ui-JAVJY4L4.js.map +1 -0
- package/dist/ai-5KM776QW.js +1485 -0
- package/dist/ai-5KM776QW.js.map +1 -0
- package/dist/anchor-ui-VPKNKZ7J.js +81 -0
- package/dist/anchor-ui-VPKNKZ7J.js.map +1 -0
- package/dist/autocorrect-5QLICCRN.js +851 -0
- package/dist/autocorrect-5QLICCRN.js.map +1 -0
- package/dist/{autolink-45LTODWB.js → autolink-ZYIPRXBA.js} +11 -8
- package/dist/autolink-ZYIPRXBA.js.map +1 -0
- package/dist/{autoresize-UB3GOA6D.js → autoresize-YRZAVCNO.js} +2 -2
- package/dist/autoresize-YRZAVCNO.js.map +1 -0
- package/dist/{autosave-GMWJ5BPE.js → autosave-IC7YYG44.js} +7 -7
- package/dist/autosave-IC7YYG44.js.map +1 -0
- package/dist/casechange-R7IO2APS.js +201 -0
- package/dist/casechange-R7IO2APS.js.map +1 -0
- package/dist/{charmap-2GC7LF7G.js → charmap-CARYZFKD.js} +7 -7
- package/dist/charmap-CARYZFKD.js.map +1 -0
- package/dist/checklist-7E47QW6L.js +189 -0
- package/dist/checklist-7E47QW6L.js.map +1 -0
- package/dist/chunk-23ZLVT5D.js +163 -0
- package/dist/chunk-23ZLVT5D.js.map +1 -0
- package/dist/{chunk-ND2CWNVG.js → chunk-3BOK3S3T.js} +2 -27
- package/dist/chunk-3BOK3S3T.js.map +1 -0
- package/dist/chunk-3KBQEAX2.js +926 -0
- package/dist/chunk-3KBQEAX2.js.map +1 -0
- package/dist/chunk-3NNILZVB.js +259 -0
- package/dist/chunk-3NNILZVB.js.map +1 -0
- package/dist/{chunk-PVFKXRID.js → chunk-4VPDY3LF.js} +1 -1
- package/dist/chunk-4VPDY3LF.js.map +1 -0
- package/dist/chunk-53AY5NAF.js +214 -0
- package/dist/chunk-53AY5NAF.js.map +1 -0
- package/dist/{chunk-5AW2HHG6.js → chunk-5KERLFDD.js} +50 -3
- package/dist/chunk-5KERLFDD.js.map +1 -0
- package/dist/{chunk-FCMZ7TUQ.js → chunk-6BJEOL5V.js} +296 -43
- package/dist/chunk-6BJEOL5V.js.map +1 -0
- package/dist/chunk-6LQM7G4V.js +159 -0
- package/dist/chunk-6LQM7G4V.js.map +1 -0
- package/dist/chunk-AB67XUSR.js +178 -0
- package/dist/chunk-AB67XUSR.js.map +1 -0
- package/dist/chunk-ANE5ASXG.js +26 -0
- package/dist/chunk-ANE5ASXG.js.map +1 -0
- package/dist/{chunk-Z3ELZ77W.js → chunk-AP2PJFLB.js} +5 -2
- package/dist/chunk-AP2PJFLB.js.map +1 -0
- package/dist/chunk-ARBKIZZU.js +137 -0
- package/dist/chunk-ARBKIZZU.js.map +1 -0
- package/dist/chunk-AUQSATWL.js +322 -0
- package/dist/chunk-AUQSATWL.js.map +1 -0
- package/dist/chunk-BMCH63QN.js +165 -0
- package/dist/chunk-BMCH63QN.js.map +1 -0
- package/dist/chunk-BUABAYZL.js +160 -0
- package/dist/chunk-BUABAYZL.js.map +1 -0
- package/dist/chunk-DCMPJ25E.js +140 -0
- package/dist/chunk-DCMPJ25E.js.map +1 -0
- package/dist/chunk-DV7TGRU6.js +47 -0
- package/dist/chunk-DV7TGRU6.js.map +1 -0
- package/dist/chunk-F2WT77ZG.js +163 -0
- package/dist/chunk-F2WT77ZG.js.map +1 -0
- package/dist/chunk-FNJ7AEJK.js +955 -0
- package/dist/chunk-FNJ7AEJK.js.map +1 -0
- package/dist/chunk-G74HNSB6.js +9 -0
- package/dist/chunk-G74HNSB6.js.map +1 -0
- package/dist/chunk-GTLE2HEW.js +108 -0
- package/dist/chunk-GTLE2HEW.js.map +1 -0
- package/dist/chunk-GUZCRDK6.js +143 -0
- package/dist/chunk-GUZCRDK6.js.map +1 -0
- package/dist/chunk-HNEAVVBC.js +98 -0
- package/dist/chunk-HNEAVVBC.js.map +1 -0
- package/dist/chunk-HSVNJGK3.js +1149 -0
- package/dist/chunk-HSVNJGK3.js.map +1 -0
- package/dist/chunk-IFSD6O5M.js +29 -0
- package/dist/chunk-IFSD6O5M.js.map +1 -0
- package/dist/{table-SSNABG5W.js → chunk-IO5PU52K.js} +119 -61
- package/dist/chunk-IO5PU52K.js.map +1 -0
- package/dist/chunk-K4LFGNS7.js +137 -0
- package/dist/chunk-K4LFGNS7.js.map +1 -0
- package/dist/chunk-KGEHUWGL.js +79 -0
- package/dist/chunk-KGEHUWGL.js.map +1 -0
- package/dist/chunk-KW6ATQPN.js +151 -0
- package/dist/chunk-KW6ATQPN.js.map +1 -0
- package/dist/chunk-NX3KWIP5.js +207 -0
- package/dist/chunk-NX3KWIP5.js.map +1 -0
- package/dist/chunk-OOVNE6MB.js +28 -0
- package/dist/chunk-OOVNE6MB.js.map +1 -0
- package/dist/chunk-OQMMHWMZ.js +7 -0
- package/dist/chunk-OQMMHWMZ.js.map +1 -0
- package/dist/{chunk-JPJVTB45.js → chunk-QU3KXMYT.js} +8 -2
- package/dist/chunk-QU3KXMYT.js.map +1 -0
- package/dist/chunk-QWT56RVG.js +158 -0
- package/dist/chunk-QWT56RVG.js.map +1 -0
- package/dist/chunk-RJ7T56OH.js +3787 -0
- package/dist/chunk-RJ7T56OH.js.map +1 -0
- package/dist/{chunk-KWXFL4WS.js → chunk-RPHA4HRX.js} +8 -5
- package/dist/chunk-RPHA4HRX.js.map +1 -0
- package/dist/chunk-S4DCQA74.js +66 -0
- package/dist/chunk-S4DCQA74.js.map +1 -0
- package/dist/chunk-SCIRO4XK.js +144 -0
- package/dist/chunk-SCIRO4XK.js.map +1 -0
- package/dist/chunk-SNVYHGGO.js +127 -0
- package/dist/chunk-SNVYHGGO.js.map +1 -0
- package/dist/chunk-T4543CB2.js +67 -0
- package/dist/chunk-T4543CB2.js.map +1 -0
- package/dist/{chunk-T3GY6IVK.js → chunk-UHUOAQA6.js} +71 -9
- package/dist/chunk-UHUOAQA6.js.map +1 -0
- package/dist/chunk-UTMS2P2K.js +288 -0
- package/dist/chunk-UTMS2P2K.js.map +1 -0
- package/dist/{chunk-HPLT3XRZ.js → chunk-V7WUHUHM.js} +13 -1
- package/dist/chunk-V7WUHUHM.js.map +1 -0
- package/dist/chunk-WAOU5NGN.js +430 -0
- package/dist/chunk-WAOU5NGN.js.map +1 -0
- package/dist/{chunk-R2UMUCVI.js → chunk-XCXJD5DO.js} +53 -8
- package/dist/chunk-XCXJD5DO.js.map +1 -0
- package/dist/chunk-XIH4SCO6.js +112 -0
- package/dist/chunk-XIH4SCO6.js.map +1 -0
- package/dist/chunk-XR7CY4NI.js +11 -0
- package/dist/chunk-XR7CY4NI.js.map +1 -0
- package/dist/chunk-Y2OXWCM7.js +263 -0
- package/dist/chunk-Y2OXWCM7.js.map +1 -0
- package/dist/chunk-YDF55N6Z.js +164 -0
- package/dist/chunk-YDF55N6Z.js.map +1 -0
- package/dist/chunk-YOTA26H7.js +373 -0
- package/dist/chunk-YOTA26H7.js.map +1 -0
- package/dist/chunk-YP7N47QR.js +101 -0
- package/dist/chunk-YP7N47QR.js.map +1 -0
- package/dist/{chunk-KPE3QRPB.js → chunk-YYCDRUE2.js} +16 -315
- package/dist/chunk-YYCDRUE2.js.map +1 -0
- package/dist/codesample-FOWXMCTC.js +546 -0
- package/dist/codesample-FOWXMCTC.js.map +1 -0
- package/dist/{comments-panel-HXMWSRAW.js → comments-panel-SOLBZ46Q.js} +9 -5
- package/dist/comments-panel-SOLBZ46Q.js.map +1 -0
- package/dist/{directionality-5JLWQGP2.js → directionality-BXWXNPRZ.js} +13 -10
- package/dist/directionality-BXWXNPRZ.js.map +1 -0
- package/dist/document-B0hLRhuH.d.cts +39 -0
- package/dist/document-Dh-jz1SK.d.ts +39 -0
- package/dist/docx.cjs +23575 -0
- package/dist/docx.cjs.map +1 -0
- package/dist/docx.d.cts +83 -0
- package/dist/docx.d.ts +83 -0
- package/dist/docx.js +1826 -0
- package/dist/docx.js.map +1 -0
- package/dist/draghandle-3IBHVHDE.js +389 -0
- package/dist/draghandle-3IBHVHDE.js.map +1 -0
- package/dist/editimage-GTLFGHYU.js +683 -0
- package/dist/editimage-GTLFGHYU.js.map +1 -0
- package/dist/editor-DnAN9aPd.d.ts +2948 -0
- package/dist/editor-S8w_w5W0.d.cts +2948 -0
- package/dist/email-FDSENENR.js +177 -0
- package/dist/email-FDSENENR.js.map +1 -0
- package/dist/email.cjs +588 -0
- package/dist/email.cjs.map +1 -0
- package/dist/email.d.cts +7 -0
- package/dist/email.d.ts +7 -0
- package/dist/email.js +21 -0
- package/dist/email.js.map +1 -0
- package/dist/{emoticons-ZD6ZRIWG.js → emoticons-SHYSAEID.js} +7 -7
- package/dist/emoticons-SHYSAEID.js.map +1 -0
- package/dist/exportpdf-TEBDQZSN.js +91 -0
- package/dist/exportpdf-TEBDQZSN.js.map +1 -0
- package/dist/exportword-BGH2CZXO.js +16 -0
- package/dist/exportword-BGH2CZXO.js.map +1 -0
- package/dist/footnotes-ui-KPKFDSN7.js +449 -0
- package/dist/footnotes-ui-KPKFDSN7.js.map +1 -0
- package/dist/form-dialog-SNWFPM2K.js +379 -0
- package/dist/form-dialog-SNWFPM2K.js.map +1 -0
- package/dist/formatpainter-CB4ZTKR5.js +209 -0
- package/dist/formatpainter-CB4ZTKR5.js.map +1 -0
- package/dist/fullpagehtml-ui-JPGRMXHD.js +220 -0
- package/dist/fullpagehtml-ui-JPGRMXHD.js.map +1 -0
- package/dist/html-rules-api-BLDDW9MO.d.cts +42 -0
- package/dist/html-rules-api-BLDDW9MO.d.ts +42 -0
- package/dist/html-rules.cjs +21 -19
- package/dist/html-rules.cjs.map +1 -1
- package/dist/html-rules.d.cts +37 -35
- package/dist/html-rules.d.ts +37 -35
- package/dist/html-rules.js +26 -22
- package/dist/html-rules.js.map +1 -1
- package/dist/i18n/de.cjs +349 -0
- package/dist/i18n/de.cjs.map +1 -1
- package/dist/i18n/de.d.cts +1 -1
- package/dist/i18n/de.d.ts +1 -1
- package/dist/i18n/de.js +349 -0
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/es.cjs +349 -0
- package/dist/i18n/es.cjs.map +1 -1
- package/dist/i18n/es.d.cts +1 -1
- package/dist/i18n/es.d.ts +1 -1
- package/dist/i18n/es.js +349 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.cjs +349 -0
- package/dist/i18n/fr.cjs.map +1 -1
- package/dist/i18n/fr.d.cts +1 -1
- package/dist/i18n/fr.d.ts +1 -1
- package/dist/i18n/fr.js +349 -0
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/it.cjs +349 -0
- package/dist/i18n/it.cjs.map +1 -1
- package/dist/i18n/it.d.cts +1 -1
- package/dist/i18n/it.d.ts +1 -1
- package/dist/i18n/it.js +349 -0
- package/dist/i18n/it.js.map +1 -1
- package/dist/i18n/pt-BR.cjs +349 -0
- package/dist/i18n/pt-BR.cjs.map +1 -1
- package/dist/i18n/pt-BR.d.cts +1 -1
- package/dist/i18n/pt-BR.d.ts +1 -1
- package/dist/i18n/pt-BR.js +349 -0
- package/dist/i18n/pt-BR.js.map +1 -1
- package/dist/i18n/ru.cjs +349 -0
- package/dist/i18n/ru.cjs.map +1 -1
- package/dist/i18n/ru.d.cts +3 -3
- package/dist/i18n/ru.d.ts +3 -3
- package/dist/i18n/ru.js +349 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/importcss-JLNIRKGH.js +127 -0
- package/dist/importcss-JLNIRKGH.js.map +1 -0
- package/dist/importword-ZOWLUWSN.js +73 -0
- package/dist/importword-ZOWLUWSN.js.map +1 -0
- package/dist/{index-C603bU6r.d.ts → index-Pb2r0V-S.d.cts} +39 -17
- package/dist/{index-C603bU6r.d.cts → index-Pb2r0V-S.d.ts} +39 -17
- package/dist/index.cjs +29422 -10640
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +139 -64
- package/dist/index.d.ts +139 -64
- package/dist/index.js +204 -1412
- package/dist/index.js.map +1 -1
- package/dist/{insertdatetime-CRO7TJAQ.js → insertdatetime-BXQ3XXPH.js} +7 -7
- package/dist/insertdatetime-BXQ3XXPH.js.map +1 -0
- package/dist/linkchecker-JASSETVI.js +287 -0
- package/dist/linkchecker-JASSETVI.js.map +1 -0
- package/dist/markdown-OTLTCK26.js +136 -0
- package/dist/markdown-OTLTCK26.js.map +1 -0
- package/dist/markdown.cjs +94 -11
- package/dist/markdown.cjs.map +1 -1
- package/dist/markdown.d.cts +12 -10
- package/dist/markdown.d.ts +12 -10
- package/dist/markdown.js +4 -235
- package/dist/markdown.js.map +1 -1
- package/dist/math-ui-TY4VZF7Q.js +157 -0
- package/dist/math-ui-TY4VZF7Q.js.map +1 -0
- package/dist/media-ui-IXN4ENVF.js +123 -0
- package/dist/media-ui-IXN4ENVF.js.map +1 -0
- package/dist/mediaembed-ui-ODX5ECXC.js +207 -0
- package/dist/mediaembed-ui-ODX5ECXC.js.map +1 -0
- package/dist/mentions-ui-55GCKC6F.js +58 -0
- package/dist/mentions-ui-55GCKC6F.js.map +1 -0
- package/dist/mergetags-ui-6T7Z7MAZ.js +73 -0
- package/dist/mergetags-ui-6T7Z7MAZ.js.map +1 -0
- package/dist/{nonbreaking-66LFZV2W.js → nonbreaking-PONHSOMJ.js} +7 -7
- package/dist/nonbreaking-PONHSOMJ.js.map +1 -0
- package/dist/pagebreak-ui-AKAW7M5I.js +50 -0
- package/dist/pagebreak-ui-AKAW7M5I.js.map +1 -0
- package/dist/pageembed-ui-GUNPKMBR.js +172 -0
- package/dist/pageembed-ui-GUNPKMBR.js.map +1 -0
- package/dist/pagelayout-ui-JSFVEMHS.js +236 -0
- package/dist/pagelayout-ui-JSFVEMHS.js.map +1 -0
- package/dist/{paste-office-F3QW4WWO.js → paste-office-TORLAZ5L.js} +94 -4
- package/dist/paste-office-TORLAZ5L.js.map +1 -0
- package/dist/permanentpen-EACURV5U.js +206 -0
- package/dist/permanentpen-EACURV5U.js.map +1 -0
- package/dist/print-4XJCOANX.js +178 -0
- package/dist/print-4XJCOANX.js.map +1 -0
- package/dist/{quickbars-7E2QRS7J.js → quickbars-BT5PETRX.js} +20 -12
- package/dist/quickbars-BT5PETRX.js.map +1 -0
- package/dist/{revisionhistory-DXE7KU4R.js → revisionhistory-3FKLMJHJ.js} +42 -153
- package/dist/revisionhistory-3FKLMJHJ.js.map +1 -0
- package/dist/save-ZHFXH222.js +120 -0
- package/dist/save-ZHFXH222.js.map +1 -0
- package/dist/search-bar-6MVRMTK6.js +212 -0
- package/dist/search-bar-6MVRMTK6.js.map +1 -0
- package/dist/spellchecker-JJKA6B4R.js +474 -0
- package/dist/spellchecker-JJKA6B4R.js.map +1 -0
- package/dist/suggestions-panel-X37NFLXE.js +596 -0
- package/dist/suggestions-panel-X37NFLXE.js.map +1 -0
- package/dist/suggestions-ui-WN7QNYHB.js +395 -0
- package/dist/suggestions-ui-WN7QNYHB.js.map +1 -0
- package/dist/table-PEF56QG5.js +54 -0
- package/dist/table-PEF56QG5.js.map +1 -0
- package/dist/table-dialogs-QS3VFZD2.js +119 -0
- package/dist/table-dialogs-QS3VFZD2.js.map +1 -0
- package/dist/tableofcontents-ui-U7EV3UU7.js +167 -0
- package/dist/tableofcontents-ui-U7EV3UU7.js.map +1 -0
- package/dist/template-ZRTKIP2J.js +278 -0
- package/dist/template-ZRTKIP2J.js.map +1 -0
- package/dist/typography-S7RO54DB.js +399 -0
- package/dist/typography-S7RO54DB.js.map +1 -0
- package/dist/upload.cjs +160 -0
- package/dist/upload.cjs.map +1 -0
- package/dist/upload.d.cts +72 -0
- package/dist/upload.d.ts +72 -0
- package/dist/upload.js +132 -0
- package/dist/upload.js.map +1 -0
- package/dist/{visualblocks-6DLBXYOA.js → visualblocks-KJYRHF2L.js} +7 -7
- package/dist/visualblocks-KJYRHF2L.js.map +1 -0
- package/dist/visualchars-TDLZKFXD.js +134 -0
- package/dist/visualchars-TDLZKFXD.js.map +1 -0
- package/package.json +53 -3
- package/src/style.css +376 -550
- package/dist/advlist-5FNKPLUX.js.map +0 -1
- package/dist/autolink-45LTODWB.js.map +0 -1
- package/dist/autoresize-UB3GOA6D.js.map +0 -1
- package/dist/autosave-GMWJ5BPE.js.map +0 -1
- package/dist/charmap-2GC7LF7G.js.map +0 -1
- package/dist/chunk-5AW2HHG6.js.map +0 -1
- package/dist/chunk-DWZLSZDG.js +0 -5664
- package/dist/chunk-DWZLSZDG.js.map +0 -1
- package/dist/chunk-FCMZ7TUQ.js.map +0 -1
- package/dist/chunk-HPLT3XRZ.js.map +0 -1
- package/dist/chunk-JPJVTB45.js.map +0 -1
- package/dist/chunk-KPE3QRPB.js.map +0 -1
- package/dist/chunk-KWXFL4WS.js.map +0 -1
- package/dist/chunk-ND2CWNVG.js.map +0 -1
- package/dist/chunk-PVFKXRID.js.map +0 -1
- package/dist/chunk-R2UMUCVI.js.map +0 -1
- package/dist/chunk-T3GY6IVK.js.map +0 -1
- package/dist/chunk-Z3ELZ77W.js.map +0 -1
- package/dist/comments-panel-HXMWSRAW.js.map +0 -1
- package/dist/directionality-5JLWQGP2.js.map +0 -1
- package/dist/editor-CXkltf1R.d.ts +0 -1886
- package/dist/editor-CgSBFTke.d.cts +0 -1886
- package/dist/emoticons-ZD6ZRIWG.js.map +0 -1
- package/dist/form-dialog-QH6KAERD.js +0 -180
- package/dist/form-dialog-QH6KAERD.js.map +0 -1
- package/dist/html-rules-api-D3fKQi-R.d.cts +0 -40
- package/dist/html-rules-api-D3fKQi-R.d.ts +0 -40
- package/dist/insertdatetime-CRO7TJAQ.js.map +0 -1
- package/dist/nonbreaking-66LFZV2W.js.map +0 -1
- package/dist/paste-office-F3QW4WWO.js.map +0 -1
- package/dist/quickbars-7E2QRS7J.js.map +0 -1
- package/dist/revisionhistory-DXE7KU4R.js.map +0 -1
- package/dist/table-SSNABG5W.js.map +0 -1
- package/dist/visualblocks-6DLBXYOA.js.map +0 -1
|
@@ -0,0 +1,926 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HTMLSerializer
|
|
3
|
+
} from "./chunk-53AY5NAF.js";
|
|
4
|
+
import {
|
|
5
|
+
marksOf,
|
|
6
|
+
nodesOf
|
|
7
|
+
} from "./chunk-UHUOAQA6.js";
|
|
8
|
+
import {
|
|
9
|
+
ALIGNMENTS,
|
|
10
|
+
createSchema,
|
|
11
|
+
cssValue
|
|
12
|
+
} from "./chunk-6BJEOL5V.js";
|
|
13
|
+
import {
|
|
14
|
+
orderPlugins,
|
|
15
|
+
pageHandlerOf,
|
|
16
|
+
resolveEntries
|
|
17
|
+
} from "./chunk-V7WUHUHM.js";
|
|
18
|
+
import {
|
|
19
|
+
htmlRulesFor
|
|
20
|
+
} from "./chunk-OOVNE6MB.js";
|
|
21
|
+
|
|
22
|
+
// src/formats.ts
|
|
23
|
+
import { NodeSelection } from "prosemirror-state";
|
|
24
|
+
import { lift, wrapIn } from "prosemirror-commands";
|
|
25
|
+
var INLINE_MARKS = {
|
|
26
|
+
strong: "bold",
|
|
27
|
+
b: "bold",
|
|
28
|
+
em: "italic",
|
|
29
|
+
i: "italic",
|
|
30
|
+
u: "underline",
|
|
31
|
+
s: "strike",
|
|
32
|
+
strike: "strike",
|
|
33
|
+
del: "strike",
|
|
34
|
+
code: "code",
|
|
35
|
+
sub: "subscript",
|
|
36
|
+
sup: "superscript"
|
|
37
|
+
};
|
|
38
|
+
var INLINE_STYLES = {
|
|
39
|
+
color: { mark: "color", read: cssValue.color },
|
|
40
|
+
"background-color": { mark: "background", read: cssValue.color },
|
|
41
|
+
"font-family": { mark: "font_family", read: cssValue.fontFamily },
|
|
42
|
+
"font-size": { mark: "font_size", read: cssValue.length }
|
|
43
|
+
};
|
|
44
|
+
var BLOCK_TAGS = {
|
|
45
|
+
p: (n) => n.type.name === "paragraph",
|
|
46
|
+
h1: (n) => n.type.name === "heading" && n.attrs.level === 1,
|
|
47
|
+
h2: (n) => n.type.name === "heading" && n.attrs.level === 2,
|
|
48
|
+
h3: (n) => n.type.name === "heading" && n.attrs.level === 3,
|
|
49
|
+
h4: (n) => n.type.name === "heading" && n.attrs.level === 4,
|
|
50
|
+
h5: (n) => n.type.name === "heading" && n.attrs.level === 5,
|
|
51
|
+
h6: (n) => n.type.name === "heading" && n.attrs.level === 6,
|
|
52
|
+
blockquote: (n) => n.type.name === "blockquote",
|
|
53
|
+
pre: (n) => n.type.name === "code_block",
|
|
54
|
+
img: (n) => n.type.name === "image"
|
|
55
|
+
};
|
|
56
|
+
var warned = /* @__PURE__ */ new Set();
|
|
57
|
+
function warnOnce(message) {
|
|
58
|
+
if (warned.has(message)) return;
|
|
59
|
+
warned.add(message);
|
|
60
|
+
console.warn(`[nova] formats: ${message}`);
|
|
61
|
+
}
|
|
62
|
+
function classList(value) {
|
|
63
|
+
if (Array.isArray(value)) return value.flatMap(classList);
|
|
64
|
+
return typeof value === "string" ? value.split(/\s+/).filter(Boolean) : [];
|
|
65
|
+
}
|
|
66
|
+
function formatClasses(specs) {
|
|
67
|
+
const out = [];
|
|
68
|
+
for (const spec of specs) {
|
|
69
|
+
out.push(...classList(spec.classes));
|
|
70
|
+
if ("items" in spec && spec.items) out.push(...formatClasses(spec.items));
|
|
71
|
+
}
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
var hasClasses = (value, wanted) => {
|
|
75
|
+
const have = classList(value);
|
|
76
|
+
return wanted.every((c) => have.includes(c));
|
|
77
|
+
};
|
|
78
|
+
var withClasses = (value, add) => {
|
|
79
|
+
const merged = [.../* @__PURE__ */ new Set([...classList(value), ...add])];
|
|
80
|
+
return merged.length ? merged.join(" ") : null;
|
|
81
|
+
};
|
|
82
|
+
var withoutClasses = (value, drop) => {
|
|
83
|
+
const rest = classList(value).filter((c) => !drop.includes(c));
|
|
84
|
+
return rest.length ? rest.join(" ") : null;
|
|
85
|
+
};
|
|
86
|
+
function blockStyles(spec) {
|
|
87
|
+
const out = {};
|
|
88
|
+
for (const [prop, value] of Object.entries(spec.styles ?? {})) {
|
|
89
|
+
if (prop === "text-align" && ALIGNMENTS.includes(value))
|
|
90
|
+
out.align = value;
|
|
91
|
+
else if (prop === "line-height" && cssValue.lineHeight(value))
|
|
92
|
+
out.lineHeight = cssValue.lineHeight(value);
|
|
93
|
+
else warnOnce(`style "${prop}" is not supported on blocks`);
|
|
94
|
+
}
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
function inlineMarks(state, spec) {
|
|
98
|
+
const marks = marksOf(state);
|
|
99
|
+
const out = [];
|
|
100
|
+
if (spec.inline && spec.inline !== "span") {
|
|
101
|
+
const type = marks[INLINE_MARKS[spec.inline]];
|
|
102
|
+
if (type) out.push(type.create());
|
|
103
|
+
}
|
|
104
|
+
const classes = classList(spec.classes);
|
|
105
|
+
if (classes.length && marks.span_class)
|
|
106
|
+
out.push(marks.span_class.create({ class: classes.join(" ") }));
|
|
107
|
+
for (const [prop, raw] of Object.entries(spec.styles ?? {})) {
|
|
108
|
+
const style = INLINE_STYLES[prop];
|
|
109
|
+
const value = style?.read(raw);
|
|
110
|
+
const type = style ? marks[style.mark] : void 0;
|
|
111
|
+
if (type && value) out.push(type.create({ value }));
|
|
112
|
+
else warnOnce(`style "${prop}: ${raw}" is not supported on text`);
|
|
113
|
+
}
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
116
|
+
var selectorTags = (spec) => (spec.selector ?? "").split(",").map((s) => s.trim().toLowerCase()).filter((tag) => {
|
|
117
|
+
if (BLOCK_TAGS[tag]) return true;
|
|
118
|
+
warnOnce(`selector "${tag}" is not supported`);
|
|
119
|
+
return false;
|
|
120
|
+
});
|
|
121
|
+
function selectedNodes(state, tags) {
|
|
122
|
+
const out = [];
|
|
123
|
+
const matches = (node) => tags.some((tag) => BLOCK_TAGS[tag](node));
|
|
124
|
+
const { selection } = state;
|
|
125
|
+
if (selection instanceof NodeSelection && matches(selection.node)) {
|
|
126
|
+
return [{ node: selection.node, pos: selection.from }];
|
|
127
|
+
}
|
|
128
|
+
const { $from, from, to } = selection;
|
|
129
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
130
|
+
const node = $from.node(depth);
|
|
131
|
+
if (matches(node)) out.push({ node, pos: $from.before(depth) });
|
|
132
|
+
}
|
|
133
|
+
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
134
|
+
if (matches(node) && !out.some((o) => o.pos === pos)) out.push({ node, pos });
|
|
135
|
+
});
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
function textBlocks(state) {
|
|
139
|
+
const out = [];
|
|
140
|
+
const { from, to } = state.selection;
|
|
141
|
+
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
142
|
+
if (node.isTextblock) {
|
|
143
|
+
out.push({ node, pos });
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
return true;
|
|
147
|
+
});
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
function blockquoteAt(state) {
|
|
151
|
+
const { $from } = state.selection;
|
|
152
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
153
|
+
const node = $from.node(depth);
|
|
154
|
+
if (node.type.name === "blockquote") return { node, pos: $from.before(depth) };
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
function keepBlockStyle(attrs) {
|
|
159
|
+
return {
|
|
160
|
+
align: attrs.align ?? null,
|
|
161
|
+
lineHeight: attrs.lineHeight ?? null,
|
|
162
|
+
dir: attrs.dir ?? null
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
var Formatter = class {
|
|
166
|
+
constructor(editor, allowedClasses) {
|
|
167
|
+
this.editor = editor;
|
|
168
|
+
this.allowedClasses = allowedClasses;
|
|
169
|
+
}
|
|
170
|
+
editor;
|
|
171
|
+
allowedClasses;
|
|
172
|
+
registry = /* @__PURE__ */ new Map();
|
|
173
|
+
/** Register a named format (one description or several variants). */
|
|
174
|
+
register(name, spec) {
|
|
175
|
+
const specs = Array.isArray(spec) ? spec : [spec];
|
|
176
|
+
this.registry.set(name, specs);
|
|
177
|
+
formatClasses(specs).forEach((c) => this.allowedClasses.add(c));
|
|
178
|
+
}
|
|
179
|
+
unregister(name) {
|
|
180
|
+
this.registry.delete(name);
|
|
181
|
+
}
|
|
182
|
+
has(name) {
|
|
183
|
+
return this.registry.has(name);
|
|
184
|
+
}
|
|
185
|
+
get(name) {
|
|
186
|
+
return this.registry.get(name);
|
|
187
|
+
}
|
|
188
|
+
resolve(format) {
|
|
189
|
+
if (typeof format !== "string") return [format];
|
|
190
|
+
const specs = this.registry.get(format);
|
|
191
|
+
if (!specs) warnOnce(`unknown format "${format}"`);
|
|
192
|
+
return specs ?? [];
|
|
193
|
+
}
|
|
194
|
+
/** Whether the format can apply to the selection (for selector: whether there are matching elements). */
|
|
195
|
+
canApply(format) {
|
|
196
|
+
if (!this.editor.isEditable()) return false;
|
|
197
|
+
const state = this.editor.view.state;
|
|
198
|
+
return this.resolve(format).some((spec) => canApply(state, spec));
|
|
199
|
+
}
|
|
200
|
+
/** Whether the selection matches the format. */
|
|
201
|
+
match(format) {
|
|
202
|
+
const state = this.editor.view.state;
|
|
203
|
+
return this.resolve(format).some((spec) => matchSpec(state, spec));
|
|
204
|
+
}
|
|
205
|
+
apply(format) {
|
|
206
|
+
if (!this.editor.isEditable()) return false;
|
|
207
|
+
const specs = this.resolve(format);
|
|
208
|
+
if (!specs.length) return false;
|
|
209
|
+
const spec = specs.find((s) => canApply(this.editor.view.state, s)) ?? specs[0];
|
|
210
|
+
return this.run((state, tr) => applySpec(state, tr, spec));
|
|
211
|
+
}
|
|
212
|
+
remove(format) {
|
|
213
|
+
if (!this.editor.isEditable()) return false;
|
|
214
|
+
const specs = this.resolve(format);
|
|
215
|
+
if (!specs.length) return false;
|
|
216
|
+
return this.run((state, tr) => specs.forEach((spec) => removeSpec(state, tr, spec)));
|
|
217
|
+
}
|
|
218
|
+
toggle(format) {
|
|
219
|
+
return this.match(format) ? this.remove(format) : this.apply(format);
|
|
220
|
+
}
|
|
221
|
+
run(fn) {
|
|
222
|
+
const { view } = this.editor;
|
|
223
|
+
const tr = view.state.tr;
|
|
224
|
+
const result = fn(view.state, tr);
|
|
225
|
+
if (result === false) return false;
|
|
226
|
+
if (tr.docChanged || tr.storedMarksSet) view.dispatch(tr.scrollIntoView());
|
|
227
|
+
view.focus();
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
function canApply(state, spec) {
|
|
232
|
+
if (spec.selector) return selectedNodes(state, selectorTags(spec)).length > 0;
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
function hasBlockStyles(node, spec) {
|
|
236
|
+
if (node.type.name === "image") return true;
|
|
237
|
+
return Object.entries(blockStyles(spec)).every(([key2, value]) => node.attrs[key2] === value);
|
|
238
|
+
}
|
|
239
|
+
function matchSpec(state, spec) {
|
|
240
|
+
const classes = classList(spec.classes);
|
|
241
|
+
if (spec.block) {
|
|
242
|
+
if (spec.block === "blockquote") {
|
|
243
|
+
const quote = blockquoteAt(state);
|
|
244
|
+
return !!quote && hasClasses(quote.node.attrs.class, classes);
|
|
245
|
+
}
|
|
246
|
+
const node = state.selection.$from.parent;
|
|
247
|
+
return BLOCK_TAGS[spec.block](node) && hasClasses(node.attrs.class, classes) && hasBlockStyles(node, spec);
|
|
248
|
+
}
|
|
249
|
+
if (spec.selector) {
|
|
250
|
+
const nodes = selectedNodes(state, selectorTags(spec));
|
|
251
|
+
return nodes.length > 0 && nodes.some(({ node }) => hasClasses(node.attrs.class, classes) && hasBlockStyles(node, spec));
|
|
252
|
+
}
|
|
253
|
+
if (spec.inline) {
|
|
254
|
+
const wanted = inlineMarks(state, spec);
|
|
255
|
+
if (!wanted.length) return false;
|
|
256
|
+
const { $from, empty, from, to } = state.selection;
|
|
257
|
+
if (empty) {
|
|
258
|
+
const marks = state.storedMarks ?? $from.marks();
|
|
259
|
+
return wanted.every((mark) => marks.some((m) => markCovers(m, mark)));
|
|
260
|
+
}
|
|
261
|
+
let found = false;
|
|
262
|
+
let all = true;
|
|
263
|
+
state.doc.nodesBetween(from, to, (node) => {
|
|
264
|
+
if (!node.isText) return;
|
|
265
|
+
found = true;
|
|
266
|
+
if (!wanted.every((mark) => node.marks.some((m) => markCovers(m, mark)))) all = false;
|
|
267
|
+
});
|
|
268
|
+
return found && all;
|
|
269
|
+
}
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
function markCovers(m, mark) {
|
|
273
|
+
if (m.type !== mark.type) return false;
|
|
274
|
+
if (mark.type.name === "span_class")
|
|
275
|
+
return hasClasses(m.attrs.class, classList(mark.attrs.class));
|
|
276
|
+
return mark.attrs.value === void 0 || m.attrs.value === mark.attrs.value;
|
|
277
|
+
}
|
|
278
|
+
function applySpec(state, tr, spec) {
|
|
279
|
+
const classes = classList(spec.classes);
|
|
280
|
+
const nodes = nodesOf(state);
|
|
281
|
+
if (spec.block === "blockquote") {
|
|
282
|
+
const quote = blockquoteAt(state);
|
|
283
|
+
if (quote) {
|
|
284
|
+
tr.setNodeMarkup(quote.pos, void 0, {
|
|
285
|
+
...quote.node.attrs,
|
|
286
|
+
class: withClasses(quote.node.attrs.class, classes)
|
|
287
|
+
});
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
return wrapIn(nodes.blockquote, { class: withClasses(null, classes) })(
|
|
291
|
+
state,
|
|
292
|
+
(wrapped) => wrapped.steps.forEach((step) => tr.step(step))
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
if (spec.block === "pre") {
|
|
296
|
+
for (const { node, pos } of textBlocks(state)) {
|
|
297
|
+
if (node.type !== nodes.code_block)
|
|
298
|
+
tr.setNodeMarkup(pos, nodes.code_block, { language: null });
|
|
299
|
+
}
|
|
300
|
+
return true;
|
|
301
|
+
}
|
|
302
|
+
if (spec.block) {
|
|
303
|
+
const level = spec.block === "p" ? 0 : Number(spec.block.slice(1));
|
|
304
|
+
const type = level ? nodes.heading : nodes.paragraph;
|
|
305
|
+
const styles = blockStyles(spec);
|
|
306
|
+
for (const { node, pos } of textBlocks(state)) {
|
|
307
|
+
if (node.type === nodes.code_block && node.textContent.includes("\n")) continue;
|
|
308
|
+
const sameType = node.type === type && (!level || node.attrs.level === level);
|
|
309
|
+
tr.setNodeMarkup(pos, type, {
|
|
310
|
+
...keepBlockStyle(node.attrs),
|
|
311
|
+
...level ? { level } : {},
|
|
312
|
+
...styles,
|
|
313
|
+
class: withClasses(sameType ? node.attrs.class : null, classes)
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
if (spec.selector) {
|
|
319
|
+
const styles = blockStyles(spec);
|
|
320
|
+
const targets = selectedNodes(state, selectorTags(spec));
|
|
321
|
+
if (!targets.length) return false;
|
|
322
|
+
for (const { node, pos } of targets) {
|
|
323
|
+
const extra = node.type.name === "image" ? {} : styles;
|
|
324
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
325
|
+
...node.attrs,
|
|
326
|
+
...extra,
|
|
327
|
+
class: withClasses(node.attrs.class, classes)
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
if (state.selection instanceof NodeSelection)
|
|
331
|
+
tr.setSelection(NodeSelection.create(tr.doc, state.selection.from));
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
if (spec.inline) {
|
|
335
|
+
const marks = inlineMarks(state, spec);
|
|
336
|
+
if (!marks.length) return false;
|
|
337
|
+
const { empty, ranges } = state.selection;
|
|
338
|
+
if (empty) {
|
|
339
|
+
let stored = state.storedMarks ?? state.selection.$from.marks();
|
|
340
|
+
for (const mark of marks) stored = mark.addToSet(stored);
|
|
341
|
+
tr.setStoredMarks(stored);
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
for (const { $from, $to } of ranges) {
|
|
345
|
+
for (const mark of marks) tr.addMark($from.pos, $to.pos, mark);
|
|
346
|
+
}
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
return false;
|
|
350
|
+
}
|
|
351
|
+
function removeSpec(state, tr, spec) {
|
|
352
|
+
const classes = classList(spec.classes);
|
|
353
|
+
const nodes = nodesOf(state);
|
|
354
|
+
if (spec.block === "blockquote") {
|
|
355
|
+
const quote = blockquoteAt(state);
|
|
356
|
+
if (!quote) return;
|
|
357
|
+
const rest = withoutClasses(quote.node.attrs.class, classes);
|
|
358
|
+
if (classes.length && rest !== null) {
|
|
359
|
+
tr.setNodeMarkup(quote.pos, void 0, { ...quote.node.attrs, class: rest });
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
lift(state, (lifted) => lifted.steps.forEach((step) => tr.step(step)));
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (spec.block) {
|
|
366
|
+
for (const { node, pos } of textBlocks(state)) {
|
|
367
|
+
if (!BLOCK_TAGS[spec.block](node)) continue;
|
|
368
|
+
tr.setNodeMarkup(pos, nodes.paragraph, {
|
|
369
|
+
...keepBlockStyle(node.attrs),
|
|
370
|
+
class: spec.block === "p" ? withoutClasses(node.attrs.class, classes) : null
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
if (spec.selector) {
|
|
376
|
+
const styles = blockStyles(spec);
|
|
377
|
+
for (const { node, pos } of selectedNodes(state, selectorTags(spec))) {
|
|
378
|
+
const reset = {};
|
|
379
|
+
if (node.type.name !== "image") {
|
|
380
|
+
if ("align" in styles && node.attrs.align === styles.align) reset.align = null;
|
|
381
|
+
if ("lineHeight" in styles && node.attrs.lineHeight === styles.lineHeight)
|
|
382
|
+
reset.lineHeight = null;
|
|
383
|
+
}
|
|
384
|
+
tr.setNodeMarkup(pos, void 0, {
|
|
385
|
+
...node.attrs,
|
|
386
|
+
...reset,
|
|
387
|
+
class: withoutClasses(node.attrs.class, classes)
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
if (state.selection instanceof NodeSelection)
|
|
391
|
+
tr.setSelection(NodeSelection.create(tr.doc, state.selection.from));
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
if (spec.inline) {
|
|
395
|
+
const marks = inlineMarks(state, spec);
|
|
396
|
+
const { empty, from, to, $from } = state.selection;
|
|
397
|
+
if (empty) {
|
|
398
|
+
const stored = (state.storedMarks ?? $from.marks()).filter(
|
|
399
|
+
(m) => !marks.some((mark) => markCovers(m, mark))
|
|
400
|
+
);
|
|
401
|
+
tr.setStoredMarks(stored);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
for (const mark of marks) {
|
|
405
|
+
if (mark.type.name !== "span_class") {
|
|
406
|
+
tr.removeMark(from, to, mark.type);
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
410
|
+
if (!node.isText) return;
|
|
411
|
+
const current = node.marks.find((m) => m.type === mark.type);
|
|
412
|
+
if (!current) return;
|
|
413
|
+
const start = Math.max(pos, from);
|
|
414
|
+
const end = Math.min(pos + node.nodeSize, to);
|
|
415
|
+
tr.removeMark(start, end, mark.type);
|
|
416
|
+
const rest = withoutClasses(current.attrs.class, classList(mark.attrs.class));
|
|
417
|
+
if (rest) tr.addMark(start, end, mark.type.create({ class: rest }));
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// src/document.ts
|
|
424
|
+
import { Node as PMNode } from "prosemirror-model";
|
|
425
|
+
|
|
426
|
+
// src/content-rules.ts
|
|
427
|
+
import { Fragment } from "prosemirror-model";
|
|
428
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
429
|
+
var ALIASES = {
|
|
430
|
+
b: "strong",
|
|
431
|
+
i: "em",
|
|
432
|
+
strike: "s",
|
|
433
|
+
del: "s",
|
|
434
|
+
tbody: "table",
|
|
435
|
+
thead: "table",
|
|
436
|
+
tfoot: "table",
|
|
437
|
+
caption: "table",
|
|
438
|
+
colgroup: "table",
|
|
439
|
+
col: "table",
|
|
440
|
+
figcaption: "figure"
|
|
441
|
+
};
|
|
442
|
+
var KNOWN_TAGS = [
|
|
443
|
+
"p",
|
|
444
|
+
"h1",
|
|
445
|
+
"h2",
|
|
446
|
+
"h3",
|
|
447
|
+
"h4",
|
|
448
|
+
"h5",
|
|
449
|
+
"h6",
|
|
450
|
+
"blockquote",
|
|
451
|
+
"pre",
|
|
452
|
+
"hr",
|
|
453
|
+
"ul",
|
|
454
|
+
"ol",
|
|
455
|
+
"li",
|
|
456
|
+
"img",
|
|
457
|
+
"figure",
|
|
458
|
+
"br",
|
|
459
|
+
"table",
|
|
460
|
+
"tr",
|
|
461
|
+
"td",
|
|
462
|
+
"th",
|
|
463
|
+
"strong",
|
|
464
|
+
"em",
|
|
465
|
+
"u",
|
|
466
|
+
"s",
|
|
467
|
+
"code",
|
|
468
|
+
"a",
|
|
469
|
+
"sub",
|
|
470
|
+
"sup",
|
|
471
|
+
"span"
|
|
472
|
+
];
|
|
473
|
+
var REQUIREMENTS = {
|
|
474
|
+
bold: ["strong"],
|
|
475
|
+
italic: ["em"],
|
|
476
|
+
underline: ["u"],
|
|
477
|
+
strikethrough: ["s"],
|
|
478
|
+
strike: ["s"],
|
|
479
|
+
inlinecode: ["code"],
|
|
480
|
+
code: ["code"],
|
|
481
|
+
subscript: ["sub"],
|
|
482
|
+
superscript: ["sup"],
|
|
483
|
+
language: ["span"],
|
|
484
|
+
link: ["a"],
|
|
485
|
+
unlink: ["a"],
|
|
486
|
+
quicklink: ["a"],
|
|
487
|
+
image: ["img"],
|
|
488
|
+
quickimage: ["img"],
|
|
489
|
+
table: ["table"],
|
|
490
|
+
quicktable: ["table"],
|
|
491
|
+
inserttable: ["table"],
|
|
492
|
+
tableinsertrowbefore: ["table"],
|
|
493
|
+
tableinsertrowafter: ["table"],
|
|
494
|
+
tabledeleterow: ["table"],
|
|
495
|
+
tableinsertcolbefore: ["table"],
|
|
496
|
+
tableinsertcolafter: ["table"],
|
|
497
|
+
tabledeletecol: ["table"],
|
|
498
|
+
tablemergecells: ["table"],
|
|
499
|
+
tablesplitcells: ["table"],
|
|
500
|
+
tabledelete: ["table"],
|
|
501
|
+
tablerowheader: ["th"],
|
|
502
|
+
tablecolheader: ["th"],
|
|
503
|
+
tablecellbackground: ["style:background-color"],
|
|
504
|
+
bullist: ["ul"],
|
|
505
|
+
checklist: ["ul"],
|
|
506
|
+
accordion: ["details"],
|
|
507
|
+
bulletlist: ["ul"],
|
|
508
|
+
numlist: ["ol"],
|
|
509
|
+
orderedlist: ["ol"],
|
|
510
|
+
blockquote: ["blockquote"],
|
|
511
|
+
codeblock: ["pre"],
|
|
512
|
+
hr: ["hr"],
|
|
513
|
+
horizontalrule: ["hr"],
|
|
514
|
+
h1: ["h1"],
|
|
515
|
+
h2: ["h2"],
|
|
516
|
+
h3: ["h3"],
|
|
517
|
+
h4: ["h4"],
|
|
518
|
+
h5: ["h5"],
|
|
519
|
+
h6: ["h6"],
|
|
520
|
+
forecolor: ["span", "style:color"],
|
|
521
|
+
backcolor: ["span", "style:background-color"],
|
|
522
|
+
fontfamily: ["span", "style:font-family"],
|
|
523
|
+
fontsize: ["span", "style:font-size"],
|
|
524
|
+
lineheight: ["style:line-height"],
|
|
525
|
+
align: ["style:text-align"],
|
|
526
|
+
alignleft: ["style:text-align"],
|
|
527
|
+
aligncenter: ["style:text-align"],
|
|
528
|
+
alignright: ["style:text-align"],
|
|
529
|
+
alignjustify: ["style:text-align"],
|
|
530
|
+
imagealignleft: ["style:float"],
|
|
531
|
+
imagealigncenter: ["style:float"],
|
|
532
|
+
imagealignright: ["style:float"]
|
|
533
|
+
};
|
|
534
|
+
function parseList(value) {
|
|
535
|
+
if (value === void 0) return null;
|
|
536
|
+
const set = /* @__PURE__ */ new Set();
|
|
537
|
+
for (const raw of value.split(",")) {
|
|
538
|
+
const item = raw.trim().replace(/^[-#+!]+/, "").replace(/\[.*$/, "").toLowerCase();
|
|
539
|
+
for (const name of item.split("/")) {
|
|
540
|
+
const tag = name.trim();
|
|
541
|
+
if (tag) set.add(ALIASES[tag] ?? tag);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return set;
|
|
545
|
+
}
|
|
546
|
+
function parseStyles(value) {
|
|
547
|
+
if (value === void 0) return null;
|
|
548
|
+
const text = typeof value === "string" ? value : Object.values(value).join(",");
|
|
549
|
+
return new Set(
|
|
550
|
+
text.split(",").map((s) => s.trim().toLowerCase()).filter(Boolean)
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
var ContentRules = class {
|
|
554
|
+
tags;
|
|
555
|
+
styles;
|
|
556
|
+
constructor(options) {
|
|
557
|
+
const valid = parseList(options.validElements);
|
|
558
|
+
const invalid = parseList(options.invalidElements) ?? /* @__PURE__ */ new Set();
|
|
559
|
+
const tags = new Set(valid ?? KNOWN_TAGS);
|
|
560
|
+
if (valid) for (const tag of parseList(options.extendedValidElements) ?? []) tags.add(tag);
|
|
561
|
+
if (tags.has("ul") || tags.has("ol")) tags.add("li");
|
|
562
|
+
if (tags.has("table")) {
|
|
563
|
+
tags.add("tr");
|
|
564
|
+
tags.add("td");
|
|
565
|
+
}
|
|
566
|
+
for (const tag of invalid) tags.delete(tag);
|
|
567
|
+
tags.add("p");
|
|
568
|
+
this.tags = tags;
|
|
569
|
+
this.styles = parseStyles(options.validStyles);
|
|
570
|
+
}
|
|
571
|
+
isTagAllowed(tag) {
|
|
572
|
+
const t = tag.toLowerCase();
|
|
573
|
+
return this.tags.has(ALIASES[t] ?? t);
|
|
574
|
+
}
|
|
575
|
+
isStyleAllowed(property) {
|
|
576
|
+
return !this.styles || this.styles.has(property.toLowerCase());
|
|
577
|
+
}
|
|
578
|
+
/** Whether a control, menu item or slash command is available (by name). Unknown names are allowed. */
|
|
579
|
+
isAllowed(name) {
|
|
580
|
+
const req = REQUIREMENTS[name.toLowerCase()];
|
|
581
|
+
if (!req) return true;
|
|
582
|
+
return req.every(
|
|
583
|
+
(r) => r.startsWith("style:") ? this.isStyleAllowed(r.slice(6)) : this.isTagAllowed(r)
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
markAllowed(mark) {
|
|
587
|
+
switch (mark.type.name) {
|
|
588
|
+
case "bold":
|
|
589
|
+
return this.isTagAllowed("strong");
|
|
590
|
+
case "italic":
|
|
591
|
+
return this.isTagAllowed("em");
|
|
592
|
+
case "underline":
|
|
593
|
+
return this.isTagAllowed("u");
|
|
594
|
+
case "strike":
|
|
595
|
+
return this.isTagAllowed("s");
|
|
596
|
+
case "code":
|
|
597
|
+
return this.isTagAllowed("code");
|
|
598
|
+
case "link":
|
|
599
|
+
return this.isTagAllowed("a");
|
|
600
|
+
case "subscript":
|
|
601
|
+
return this.isTagAllowed("sub");
|
|
602
|
+
case "superscript":
|
|
603
|
+
return this.isTagAllowed("sup");
|
|
604
|
+
case "color":
|
|
605
|
+
return this.isTagAllowed("span") && this.isStyleAllowed("color");
|
|
606
|
+
case "background":
|
|
607
|
+
return this.isTagAllowed("span") && this.isStyleAllowed("background-color");
|
|
608
|
+
case "font_family":
|
|
609
|
+
return this.isTagAllowed("span") && this.isStyleAllowed("font-family");
|
|
610
|
+
case "font_size":
|
|
611
|
+
return this.isTagAllowed("span") && this.isStyleAllowed("font-size");
|
|
612
|
+
case "language":
|
|
613
|
+
return this.isTagAllowed("span");
|
|
614
|
+
default:
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
/** Block attributes without disallowed styles. */
|
|
619
|
+
blockAttrs(attrs) {
|
|
620
|
+
return {
|
|
621
|
+
...attrs,
|
|
622
|
+
...this.isStyleAllowed("text-align") ? {} : { align: null },
|
|
623
|
+
...this.isStyleAllowed("line-height") ? {} : { lineHeight: null },
|
|
624
|
+
...this.isStyleAllowed("margin-left") ? {} : { indent: 0 }
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
/** Bring a node in line with the rules. Returns 0…n nodes (a disallowed block can dissolve). */
|
|
628
|
+
normalize(node) {
|
|
629
|
+
const schema = node.type.schema;
|
|
630
|
+
const { nodes } = schema;
|
|
631
|
+
if (node.isText) {
|
|
632
|
+
const marks2 = node.marks.filter((m) => this.markAllowed(m));
|
|
633
|
+
return [marks2.length === node.marks.length ? node : node.mark(marks2)];
|
|
634
|
+
}
|
|
635
|
+
const marks = node.marks.filter((m) => this.markAllowed(m));
|
|
636
|
+
switch (node.type) {
|
|
637
|
+
case nodes.image:
|
|
638
|
+
if (!this.isTagAllowed("img")) return [];
|
|
639
|
+
return [
|
|
640
|
+
nodes.image.create(
|
|
641
|
+
{ ...node.attrs, ...this.isStyleAllowed("float") ? {} : { align: null } },
|
|
642
|
+
null,
|
|
643
|
+
marks
|
|
644
|
+
)
|
|
645
|
+
];
|
|
646
|
+
case nodes.figure: {
|
|
647
|
+
const caption = node.childCount > 1 ? node.child(1).content : null;
|
|
648
|
+
const captionBlocks = caption?.size ? [nodes.paragraph.create(null, this.normalizeChildren(caption))] : [];
|
|
649
|
+
const image = node.firstChild;
|
|
650
|
+
if (!this.isTagAllowed("img") || !image) return captionBlocks;
|
|
651
|
+
const align = this.isStyleAllowed("float") ? node.attrs.align : null;
|
|
652
|
+
if (!this.isTagAllowed("figure")) {
|
|
653
|
+
const inline = nodes.image.create({ ...image.attrs, align });
|
|
654
|
+
return [nodes.paragraph.create(null, inline), ...captionBlocks];
|
|
655
|
+
}
|
|
656
|
+
return [nodes.figure.create({ ...node.attrs, align }, node.content)];
|
|
657
|
+
}
|
|
658
|
+
case nodes.hard_break:
|
|
659
|
+
return this.isTagAllowed("br") ? [node.mark(marks)] : [schema.text(" ", marks)];
|
|
660
|
+
case nodes.horizontal_rule:
|
|
661
|
+
return this.isTagAllowed("hr") ? [node] : [];
|
|
662
|
+
}
|
|
663
|
+
const children = this.normalizeChildren(node.content);
|
|
664
|
+
const make = (type = node.type, attrs = node.attrs) => {
|
|
665
|
+
try {
|
|
666
|
+
return [type.createChecked(attrs, children, node.marks)];
|
|
667
|
+
} catch {
|
|
668
|
+
const filled = type.createAndFill(attrs, children, node.marks);
|
|
669
|
+
return filled ? [filled] : children.content.length ? asBlocks(children) : [];
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
if (node.type.name === "details" && !this.isTagAllowed("details")) {
|
|
673
|
+
const out = [];
|
|
674
|
+
children.forEach((child) => {
|
|
675
|
+
if (child.type.name !== "details_summary") out.push(child);
|
|
676
|
+
else if (child.content.size) out.push(nodes.paragraph.create(null, child.content));
|
|
677
|
+
});
|
|
678
|
+
return out;
|
|
679
|
+
}
|
|
680
|
+
switch (node.type) {
|
|
681
|
+
case nodes.paragraph:
|
|
682
|
+
return make(nodes.paragraph, this.blockAttrs(node.attrs));
|
|
683
|
+
case nodes.heading:
|
|
684
|
+
return this.isTagAllowed(`h${node.attrs.level}`) ? make(nodes.heading, this.blockAttrs(node.attrs)) : make(
|
|
685
|
+
nodes.paragraph,
|
|
686
|
+
this.blockAttrs({ align: node.attrs.align, lineHeight: node.attrs.lineHeight })
|
|
687
|
+
);
|
|
688
|
+
case nodes.blockquote:
|
|
689
|
+
return this.isTagAllowed("blockquote") ? make() : asBlocks(children);
|
|
690
|
+
case nodes.code_block:
|
|
691
|
+
if (this.isTagAllowed("pre")) return make();
|
|
692
|
+
return node.textContent.split("\n").map((line) => nodes.paragraph.create(null, line ? schema.text(line) : null));
|
|
693
|
+
case nodes.bullet_list:
|
|
694
|
+
case nodes.ordered_list:
|
|
695
|
+
if (!this.isTagAllowed(node.type === nodes.bullet_list ? "ul" : "ol"))
|
|
696
|
+
return flattenItems(children);
|
|
697
|
+
return make(node.type, {
|
|
698
|
+
...node.attrs,
|
|
699
|
+
...this.isStyleAllowed("list-style-type") ? {} : { listStyle: null }
|
|
700
|
+
});
|
|
701
|
+
case nodes.table:
|
|
702
|
+
return this.isTagAllowed("table") ? make() : flattenTable(children);
|
|
703
|
+
case nodes.table_header:
|
|
704
|
+
return this.isTagAllowed("th") ? make() : make(nodes.table_cell, node.attrs);
|
|
705
|
+
case nodes.table_cell:
|
|
706
|
+
return make(nodes.table_cell, {
|
|
707
|
+
...node.attrs,
|
|
708
|
+
...this.isStyleAllowed("background-color") ? {} : { background: null }
|
|
709
|
+
});
|
|
710
|
+
default:
|
|
711
|
+
return make();
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
normalizeChildren(fragment) {
|
|
715
|
+
const out = [];
|
|
716
|
+
fragment.forEach((child) => out.push(...this.normalize(child)));
|
|
717
|
+
return Fragment.from(out);
|
|
718
|
+
}
|
|
719
|
+
/** Normalize the whole document (the initial content). */
|
|
720
|
+
normalizeDoc(doc) {
|
|
721
|
+
const content = this.normalizeChildren(doc.content);
|
|
722
|
+
const schema = doc.type.schema;
|
|
723
|
+
return doc.type.createAndFill(
|
|
724
|
+
doc.attrs,
|
|
725
|
+
content.size ? content : schema.nodes.paragraph.create()
|
|
726
|
+
);
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
function asBlocks(fragment) {
|
|
730
|
+
const out = [];
|
|
731
|
+
let inline = [];
|
|
732
|
+
const flush = () => {
|
|
733
|
+
if (inline.length)
|
|
734
|
+
out.push(inline[0].type.schema.nodes.paragraph.create(null, inline));
|
|
735
|
+
inline = [];
|
|
736
|
+
};
|
|
737
|
+
fragment.forEach((child) => {
|
|
738
|
+
if (child.isInline) inline.push(child);
|
|
739
|
+
else {
|
|
740
|
+
flush();
|
|
741
|
+
out.push(child);
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
flush();
|
|
745
|
+
return out;
|
|
746
|
+
}
|
|
747
|
+
function flattenItems(fragment) {
|
|
748
|
+
const out = [];
|
|
749
|
+
fragment.forEach((item) => {
|
|
750
|
+
if (item.type === item.type.schema.nodes.list_item)
|
|
751
|
+
item.content.forEach((block) => out.push(block));
|
|
752
|
+
else out.push(...asBlocks(Fragment.from(item)));
|
|
753
|
+
});
|
|
754
|
+
return out;
|
|
755
|
+
}
|
|
756
|
+
function flattenTable(fragment) {
|
|
757
|
+
const out = [];
|
|
758
|
+
fragment.forEach((row) => row.forEach((cell) => cell.forEach((block) => out.push(block))));
|
|
759
|
+
return out;
|
|
760
|
+
}
|
|
761
|
+
var key = new PluginKey("nova-content-rules");
|
|
762
|
+
function contentRulesPlugin(rules) {
|
|
763
|
+
return new Plugin({
|
|
764
|
+
key,
|
|
765
|
+
appendTransaction(transactions, oldState, newState) {
|
|
766
|
+
if (!transactions.some((tr2) => tr2.docChanged)) return null;
|
|
767
|
+
const start = oldState.doc.content.findDiffStart(newState.doc.content);
|
|
768
|
+
if (start === null) return null;
|
|
769
|
+
const end = oldState.doc.content.findDiffEnd(newState.doc.content)?.b ?? newState.doc.content.size;
|
|
770
|
+
const doc = newState.doc;
|
|
771
|
+
const replacements = [];
|
|
772
|
+
doc.forEach((child, offset) => {
|
|
773
|
+
const from = offset;
|
|
774
|
+
const to = offset + child.nodeSize;
|
|
775
|
+
if (to < start || from > Math.max(start, end)) return;
|
|
776
|
+
const normalized = rules.normalize(child);
|
|
777
|
+
if (normalized.length === 1 && normalized[0].eq(child)) return;
|
|
778
|
+
replacements.push({ from, to, nodes: normalized });
|
|
779
|
+
});
|
|
780
|
+
if (!replacements.length) return null;
|
|
781
|
+
const tr = newState.tr;
|
|
782
|
+
for (const { from, to, nodes } of replacements.reverse()) {
|
|
783
|
+
if (nodes.length) tr.replaceWith(from, to, nodes);
|
|
784
|
+
else if (tr.doc.childCount > 1) tr.delete(from, to);
|
|
785
|
+
else tr.replaceWith(from, to, newState.schema.nodes.paragraph.create());
|
|
786
|
+
}
|
|
787
|
+
return tr.setMeta(
|
|
788
|
+
"addToHistory",
|
|
789
|
+
transactions.every((t) => t.getMeta("addToHistory") !== false)
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// src/document.ts
|
|
796
|
+
var htmlSerializer = new HTMLSerializer();
|
|
797
|
+
var RTL_LANGUAGES = /* @__PURE__ */ new Set(["ar", "he", "iw", "fa", "ur", "ps", "sd", "ug", "yi", "dv", "ckb"]);
|
|
798
|
+
function isRtlLanguage(language) {
|
|
799
|
+
return !!language && RTL_LANGUAGES.has(language.toLowerCase().split(/[-_]/)[0]);
|
|
800
|
+
}
|
|
801
|
+
function report(message, error) {
|
|
802
|
+
console.error(`[nova] ${message}`, ...error === void 0 ? [] : [error]);
|
|
803
|
+
}
|
|
804
|
+
function schemaFromOptions(options, plugins, direction, context) {
|
|
805
|
+
const allowedClasses = /* @__PURE__ */ new Set([
|
|
806
|
+
...formatClasses(Object.values(options.formats ?? {}).flat()),
|
|
807
|
+
...formatClasses(options.styleFormats ?? []),
|
|
808
|
+
...Array.isArray(options.validClasses) ? options.validClasses : [],
|
|
809
|
+
...[...options.tableClassList ?? [], ...options.tableCellClassList ?? []].flatMap(
|
|
810
|
+
(o) => o.value.split(/\s+/).filter(Boolean)
|
|
811
|
+
)
|
|
812
|
+
]);
|
|
813
|
+
const htmlRules = htmlRulesFor(options);
|
|
814
|
+
const allClasses = options.validClasses === true || options.validClasses === void 0 && !!htmlRules?.classOnBuiltIn;
|
|
815
|
+
const classFilter = allClasses ? () => true : (name) => allowedClasses.has(name);
|
|
816
|
+
const nodes = {};
|
|
817
|
+
const marks = {};
|
|
818
|
+
const attributes = {};
|
|
819
|
+
for (const plugin of plugins) {
|
|
820
|
+
Object.assign(attributes, plugin.nodeAttributes);
|
|
821
|
+
let pluginNodes;
|
|
822
|
+
try {
|
|
823
|
+
pluginNodes = typeof plugin.nodes === "function" ? plugin.nodes(context) : plugin.nodes;
|
|
824
|
+
} catch (error) {
|
|
825
|
+
report(`Plugin "${plugin.name}" failed to define its nodes`, error);
|
|
826
|
+
}
|
|
827
|
+
for (const [name, spec] of Object.entries(pluginNodes ?? {})) {
|
|
828
|
+
if (name in nodes) report(`Node "${name}" is defined by several plugins`);
|
|
829
|
+
else nodes[name] = spec;
|
|
830
|
+
}
|
|
831
|
+
for (const [name, spec] of Object.entries(plugin.marks ?? {})) {
|
|
832
|
+
if (name in marks) report(`Mark "${name}" is defined by several plugins`);
|
|
833
|
+
else marks[name] = spec;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
try {
|
|
837
|
+
return {
|
|
838
|
+
schema: createSchema({ nodes, marks, attributes }, classFilter, htmlRules, direction),
|
|
839
|
+
allowedClasses
|
|
840
|
+
};
|
|
841
|
+
} catch (error) {
|
|
842
|
+
report("Failed to build the document schema from plugins", error);
|
|
843
|
+
return { schema: createSchema({}, classFilter, htmlRules, direction), allowedClasses };
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
function attrValid(spec, value) {
|
|
847
|
+
const validate = spec?.validate;
|
|
848
|
+
if (!validate) return true;
|
|
849
|
+
if (typeof validate === "function") {
|
|
850
|
+
try {
|
|
851
|
+
validate(value);
|
|
852
|
+
return true;
|
|
853
|
+
} catch {
|
|
854
|
+
return false;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
const type = value === null ? "null" : typeof value;
|
|
858
|
+
return validate.split("|").includes(type);
|
|
859
|
+
}
|
|
860
|
+
function sanitizeAttrs(specs, attrs) {
|
|
861
|
+
if (!attrs || typeof attrs !== "object" || !specs) return attrs;
|
|
862
|
+
return Object.fromEntries(
|
|
863
|
+
Object.entries(attrs).filter(([name, value]) => attrValid(specs[name], value))
|
|
864
|
+
);
|
|
865
|
+
}
|
|
866
|
+
function sanitizeJSON(schema, json) {
|
|
867
|
+
const type = schema.nodes[json.type];
|
|
868
|
+
const out = { ...json };
|
|
869
|
+
if (type) out.attrs = sanitizeAttrs(type.spec.attrs, json.attrs);
|
|
870
|
+
if (Array.isArray(json.marks)) {
|
|
871
|
+
out.marks = json.marks.map((mark) => {
|
|
872
|
+
const markType = mark && schema.marks[mark.type];
|
|
873
|
+
return markType ? { ...mark, attrs: sanitizeAttrs(markType.spec.attrs, mark.attrs) } : mark;
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
if (Array.isArray(json.content)) {
|
|
877
|
+
out.content = json.content.map(
|
|
878
|
+
(child) => child && typeof child === "object" ? sanitizeJSON(schema, child) : child
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
return out;
|
|
882
|
+
}
|
|
883
|
+
function createRenderer(options = {}) {
|
|
884
|
+
const resolved = resolveEntries(options.plugins ?? []);
|
|
885
|
+
resolved.errors.forEach((message) => report(message));
|
|
886
|
+
const { ordered, errors } = orderPlugins(resolved.plugins);
|
|
887
|
+
errors.forEach((message) => report(message));
|
|
888
|
+
const direction = options.direction ?? (isRtlLanguage(options.language) ? "rtl" : "ltr");
|
|
889
|
+
const { schema } = schemaFromOptions(options, ordered, direction, { options });
|
|
890
|
+
const hasRules = options.validElements !== void 0 || options.invalidElements !== void 0 || options.validStyles !== void 0;
|
|
891
|
+
const rules = hasRules ? new ContentRules(options) : null;
|
|
892
|
+
const doc = (json) => {
|
|
893
|
+
const node = PMNode.fromJSON(schema, sanitizeJSON(schema, json));
|
|
894
|
+
return rules ? rules.normalizeDoc(node) : node;
|
|
895
|
+
};
|
|
896
|
+
const page = pageHandlerOf(ordered, { options });
|
|
897
|
+
return {
|
|
898
|
+
schema,
|
|
899
|
+
doc,
|
|
900
|
+
html: (json, { fullPage = true } = {}) => {
|
|
901
|
+
const node = doc(json);
|
|
902
|
+
const content = htmlSerializer.serializeFragment(node.content);
|
|
903
|
+
return page && fullPage ? page.write(content, node.attrs) : content;
|
|
904
|
+
},
|
|
905
|
+
text: (json) => {
|
|
906
|
+
const node = doc(json);
|
|
907
|
+
return node.textBetween(0, node.content.size, "\n\n");
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
function renderHTML(json, options = {}) {
|
|
912
|
+
return createRenderer(options).html(json);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
export {
|
|
916
|
+
Formatter,
|
|
917
|
+
ContentRules,
|
|
918
|
+
contentRulesPlugin,
|
|
919
|
+
htmlSerializer,
|
|
920
|
+
isRtlLanguage,
|
|
921
|
+
schemaFromOptions,
|
|
922
|
+
sanitizeJSON,
|
|
923
|
+
createRenderer,
|
|
924
|
+
renderHTML
|
|
925
|
+
};
|
|
926
|
+
//# sourceMappingURL=chunk-3KBQEAX2.js.map
|