@novaprose/core 0.7.0 → 0.8.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-7KQU7DD3.js +449 -0
- package/dist/a11ychecker-7KQU7DD3.js.map +1 -0
- package/dist/accordion-ui-FGN3I5UF.js +201 -0
- package/dist/accordion-ui-FGN3I5UF.js.map +1 -0
- package/dist/advcode-65Z2ELUB.js +51 -0
- package/dist/advcode-65Z2ELUB.js.map +1 -0
- package/dist/advcode-editor-WIOCY552.js +257 -0
- package/dist/advcode-editor-WIOCY552.js.map +1 -0
- package/dist/{advlist-5FNKPLUX.js → advlist-CEHE6YXS.js} +10 -7
- package/dist/advlist-CEHE6YXS.js.map +1 -0
- package/dist/advtable-ui-5CBOPTHW.js +364 -0
- package/dist/advtable-ui-5CBOPTHW.js.map +1 -0
- package/dist/ai-IRQYZHRK.js +1485 -0
- package/dist/ai-IRQYZHRK.js.map +1 -0
- package/dist/anchor-ui-NWIIRKGY.js +81 -0
- package/dist/anchor-ui-NWIIRKGY.js.map +1 -0
- package/dist/autocorrect-6GFLVDPC.js +851 -0
- package/dist/autocorrect-6GFLVDPC.js.map +1 -0
- package/dist/{autolink-45LTODWB.js → autolink-N427KVQO.js} +11 -8
- package/dist/autolink-N427KVQO.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-L7OZ3KLK.js} +7 -7
- package/dist/autosave-L7OZ3KLK.js.map +1 -0
- package/dist/casechange-5G6RAJ7K.js +201 -0
- package/dist/casechange-5G6RAJ7K.js.map +1 -0
- package/dist/{charmap-2GC7LF7G.js → charmap-5CBBDWOP.js} +7 -7
- package/dist/charmap-5CBBDWOP.js.map +1 -0
- package/dist/checklist-HM4VXZKY.js +189 -0
- package/dist/checklist-HM4VXZKY.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-4I4AYH2K.js +101 -0
- package/dist/chunk-4I4AYH2K.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-5VCESSQB.js +137 -0
- package/dist/chunk-5VCESSQB.js.map +1 -0
- package/dist/chunk-66INZHZ2.js +79 -0
- package/dist/chunk-66INZHZ2.js.map +1 -0
- package/dist/chunk-6LQM7G4V.js +159 -0
- package/dist/chunk-6LQM7G4V.js.map +1 -0
- package/dist/chunk-6YSQGFV7.js +893 -0
- package/dist/chunk-6YSQGFV7.js.map +1 -0
- package/dist/{chunk-T3GY6IVK.js → chunk-AC3YCAX4.js} +71 -9
- package/dist/chunk-AC3YCAX4.js.map +1 -0
- package/dist/{chunk-5AW2HHG6.js → chunk-ADRPQLZ2.js} +47 -3
- package/dist/chunk-ADRPQLZ2.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-AQV6FIKK.js +259 -0
- package/dist/chunk-AQV6FIKK.js.map +1 -0
- package/dist/chunk-AUQSATWL.js +322 -0
- package/dist/chunk-AUQSATWL.js.map +1 -0
- package/dist/chunk-C326LHHU.js +143 -0
- package/dist/chunk-C326LHHU.js.map +1 -0
- package/dist/{chunk-R2UMUCVI.js → chunk-DEYYVZ7O.js} +50 -8
- package/dist/chunk-DEYYVZ7O.js.map +1 -0
- package/dist/chunk-EOJ5XHKA.js +160 -0
- package/dist/chunk-EOJ5XHKA.js.map +1 -0
- package/dist/chunk-EXX2S352.js +3642 -0
- package/dist/chunk-EXX2S352.js.map +1 -0
- package/dist/chunk-FTEA6L2Q.js +47 -0
- package/dist/chunk-FTEA6L2Q.js.map +1 -0
- package/dist/chunk-G74HNSB6.js +9 -0
- package/dist/chunk-G74HNSB6.js.map +1 -0
- package/dist/{chunk-KWXFL4WS.js → chunk-GHVB6SV4.js} +8 -5
- package/dist/chunk-GHVB6SV4.js.map +1 -0
- package/dist/chunk-GTLE2HEW.js +108 -0
- package/dist/chunk-GTLE2HEW.js.map +1 -0
- package/dist/chunk-GXXXLPDQ.js +67 -0
- package/dist/chunk-GXXXLPDQ.js.map +1 -0
- package/dist/chunk-HC6RMBAD.js +163 -0
- package/dist/chunk-HC6RMBAD.js.map +1 -0
- package/dist/chunk-HNEAVVBC.js +98 -0
- package/dist/chunk-HNEAVVBC.js.map +1 -0
- package/dist/chunk-I7Y4KSM2.js +165 -0
- package/dist/chunk-I7Y4KSM2.js.map +1 -0
- package/dist/chunk-IG2BL4ON.js +127 -0
- package/dist/chunk-IG2BL4ON.js.map +1 -0
- package/dist/{chunk-KPE3QRPB.js → chunk-J6W2CDRF.js} +16 -315
- package/dist/chunk-J6W2CDRF.js.map +1 -0
- package/dist/chunk-LVEQBNLX.js +207 -0
- package/dist/chunk-LVEQBNLX.js.map +1 -0
- package/dist/chunk-MZGNOHSY.js +176 -0
- package/dist/chunk-MZGNOHSY.js.map +1 -0
- package/dist/chunk-N32H37AJ.js +373 -0
- package/dist/chunk-N32H37AJ.js.map +1 -0
- package/dist/chunk-NTGEKGXU.js +263 -0
- package/dist/chunk-NTGEKGXU.js.map +1 -0
- package/dist/chunk-OFHGXYG3.js +140 -0
- package/dist/chunk-OFHGXYG3.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-P2UU2NLT.js +1149 -0
- package/dist/chunk-P2UU2NLT.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-S2XZRKHA.js +29 -0
- package/dist/chunk-S2XZRKHA.js.map +1 -0
- package/dist/chunk-SCIRO4XK.js +144 -0
- package/dist/chunk-SCIRO4XK.js.map +1 -0
- package/dist/chunk-T3IRLTKK.js +158 -0
- package/dist/chunk-T3IRLTKK.js.map +1 -0
- package/dist/chunk-TABIUD2L.js +66 -0
- package/dist/chunk-TABIUD2L.js.map +1 -0
- package/dist/{chunk-FCMZ7TUQ.js → chunk-TAM2FHKG.js} +172 -43
- package/dist/chunk-TAM2FHKG.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/{table-SSNABG5W.js → chunk-VK6YF2AA.js} +119 -61
- package/dist/chunk-VK6YF2AA.js.map +1 -0
- package/dist/chunk-WAOU5NGN.js +430 -0
- package/dist/chunk-WAOU5NGN.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-YDF55N6Z.js +164 -0
- package/dist/chunk-YDF55N6Z.js.map +1 -0
- package/dist/chunk-YDPZCVXS.js +923 -0
- package/dist/chunk-YDPZCVXS.js.map +1 -0
- package/dist/chunk-YG5V7POU.js +137 -0
- package/dist/chunk-YG5V7POU.js.map +1 -0
- package/dist/chunk-YVSUR7E5.js +151 -0
- package/dist/chunk-YVSUR7E5.js.map +1 -0
- package/dist/codesample-GHWIC7PT.js +546 -0
- package/dist/codesample-GHWIC7PT.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-EGQKGDZA.js} +13 -10
- package/dist/directionality-EGQKGDZA.js.map +1 -0
- package/dist/document-0ft41E6d.d.ts +39 -0
- package/dist/document-IQqDDT4v.d.cts +39 -0
- package/dist/docx.cjs +23518 -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 +1821 -0
- package/dist/docx.js.map +1 -0
- package/dist/draghandle-U6CYZHPA.js +389 -0
- package/dist/draghandle-U6CYZHPA.js.map +1 -0
- package/dist/editimage-5EWPSM22.js +683 -0
- package/dist/editimage-5EWPSM22.js.map +1 -0
- package/dist/editor-BCMxe1M4.d.cts +2888 -0
- package/dist/editor-Dmtwjw2u.d.ts +2888 -0
- package/dist/email-ELNMEQ6E.js +177 -0
- package/dist/email-ELNMEQ6E.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-EGHNZKSA.js} +7 -7
- package/dist/emoticons-EGHNZKSA.js.map +1 -0
- package/dist/exportpdf-4P7X3NY2.js +91 -0
- package/dist/exportpdf-4P7X3NY2.js.map +1 -0
- package/dist/exportword-JFJ3KTYZ.js +16 -0
- package/dist/exportword-JFJ3KTYZ.js.map +1 -0
- package/dist/footnotes-ui-FV6QRGDA.js +449 -0
- package/dist/footnotes-ui-FV6QRGDA.js.map +1 -0
- package/dist/form-dialog-SNWFPM2K.js +379 -0
- package/dist/form-dialog-SNWFPM2K.js.map +1 -0
- package/dist/formatpainter-IEXX27OJ.js +209 -0
- package/dist/formatpainter-IEXX27OJ.js.map +1 -0
- package/dist/fullpagehtml-ui-RE4C2NO5.js +220 -0
- package/dist/fullpagehtml-ui-RE4C2NO5.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 +19 -17
- 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 +24 -20
- package/dist/html-rules.js.map +1 -1
- package/dist/i18n/de.cjs +346 -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 +346 -0
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/es.cjs +346 -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 +346 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.cjs +346 -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 +346 -0
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/it.cjs +346 -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 +346 -0
- package/dist/i18n/it.js.map +1 -1
- package/dist/i18n/pt-BR.cjs +346 -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 +346 -0
- package/dist/i18n/pt-BR.js.map +1 -1
- package/dist/i18n/ru.cjs +346 -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 +346 -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-D7Z6RXGQ.js +73 -0
- package/dist/importword-D7Z6RXGQ.js.map +1 -0
- package/dist/{index-C603bU6r.d.ts → index-CZ9yDvmQ.d.cts} +36 -17
- package/dist/{index-C603bU6r.d.cts → index-CZ9yDvmQ.d.ts} +36 -17
- package/dist/index.cjs +28858 -10442
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +138 -64
- package/dist/index.d.ts +138 -64
- package/dist/index.js +199 -1411
- package/dist/index.js.map +1 -1
- package/dist/{insertdatetime-CRO7TJAQ.js → insertdatetime-YW2VHYZH.js} +7 -7
- package/dist/insertdatetime-YW2VHYZH.js.map +1 -0
- package/dist/linkchecker-3S3MCPOS.js +287 -0
- package/dist/linkchecker-3S3MCPOS.js.map +1 -0
- package/dist/markdown-26O3N3T2.js +136 -0
- package/dist/markdown-26O3N3T2.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-RUTCHTRY.js +157 -0
- package/dist/math-ui-RUTCHTRY.js.map +1 -0
- package/dist/media-ui-36TE3CJD.js +123 -0
- package/dist/media-ui-36TE3CJD.js.map +1 -0
- package/dist/mediaembed-ui-ZNTGZ2SQ.js +207 -0
- package/dist/mediaembed-ui-ZNTGZ2SQ.js.map +1 -0
- package/dist/mentions-ui-O4IPWQT4.js +58 -0
- package/dist/mentions-ui-O4IPWQT4.js.map +1 -0
- package/dist/mergetags-ui-HS3Q2R36.js +73 -0
- package/dist/mergetags-ui-HS3Q2R36.js.map +1 -0
- package/dist/{nonbreaking-66LFZV2W.js → nonbreaking-GYRUH4UO.js} +7 -7
- package/dist/nonbreaking-GYRUH4UO.js.map +1 -0
- package/dist/pagebreak-ui-I4ZPYK3U.js +50 -0
- package/dist/pagebreak-ui-I4ZPYK3U.js.map +1 -0
- package/dist/pageembed-ui-WOY6VWRJ.js +172 -0
- package/dist/pageembed-ui-WOY6VWRJ.js.map +1 -0
- package/dist/pagelayout-ui-Y2IM7FJQ.js +236 -0
- package/dist/pagelayout-ui-Y2IM7FJQ.js.map +1 -0
- package/dist/{paste-office-F3QW4WWO.js → paste-office-3A6KWKCV.js} +82 -2
- package/dist/paste-office-3A6KWKCV.js.map +1 -0
- package/dist/permanentpen-6D5LLKFX.js +206 -0
- package/dist/permanentpen-6D5LLKFX.js.map +1 -0
- package/dist/print-MZMLQIQX.js +178 -0
- package/dist/print-MZMLQIQX.js.map +1 -0
- package/dist/{quickbars-7E2QRS7J.js → quickbars-UZ2Q67TX.js} +20 -12
- package/dist/quickbars-UZ2Q67TX.js.map +1 -0
- package/dist/{revisionhistory-DXE7KU4R.js → revisionhistory-ACRB23HL.js} +42 -153
- package/dist/revisionhistory-ACRB23HL.js.map +1 -0
- package/dist/save-72ZLF6AO.js +120 -0
- package/dist/save-72ZLF6AO.js.map +1 -0
- package/dist/search-bar-HTZQNPD3.js +212 -0
- package/dist/search-bar-HTZQNPD3.js.map +1 -0
- package/dist/spellchecker-DJ7SP5JY.js +474 -0
- package/dist/spellchecker-DJ7SP5JY.js.map +1 -0
- package/dist/suggestions-panel-RJXC4LCM.js +596 -0
- package/dist/suggestions-panel-RJXC4LCM.js.map +1 -0
- package/dist/suggestions-ui-PODMNH7D.js +395 -0
- package/dist/suggestions-ui-PODMNH7D.js.map +1 -0
- package/dist/table-OBHE465Y.js +54 -0
- package/dist/table-OBHE465Y.js.map +1 -0
- package/dist/table-dialogs-UMIIZQYE.js +119 -0
- package/dist/table-dialogs-UMIIZQYE.js.map +1 -0
- package/dist/tableofcontents-ui-U2PYNPX6.js +167 -0
- package/dist/tableofcontents-ui-U2PYNPX6.js.map +1 -0
- package/dist/template-YYC2MGVH.js +278 -0
- package/dist/template-YYC2MGVH.js.map +1 -0
- package/dist/typography-EQUXUXIN.js +399 -0
- package/dist/typography-EQUXUXIN.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-O5QW7ZDT.js} +7 -7
- package/dist/visualblocks-O5QW7ZDT.js.map +1 -0
- package/dist/visualchars-UQFRWQPE.js +134 -0
- package/dist/visualchars-UQFRWQPE.js.map +1 -0
- package/package.json +53 -3
- package/src/style.css +320 -544
- 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 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/pageembed-ui.ts"],"sourcesContent":["import { NodeSelection } from 'prosemirror-state';\nimport { replaceSelectionWithBlock } from '../commands';\nimport { definePlugin } from '../plugins';\nimport { imageSize } from '../schema';\nimport { embeddableUrl, FIXED, pageEmbedOptions, ratioOf } from './pageembed';\nimport { pickLabels } from './shared';\n\n/** The lazy part of the pageembed plugin: the \"Embedded page\" dialog, the button and the menu item. */\n\nconst ICON =\n '<svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"M3 8h18\"/><path d=\"m10 12-2 2 2 2\"/><path d=\"m14 12 2 2-2 2\"/></svg>';\n\nexport const LABELS = {\n en: {\n title: 'Embedded page',\n url: 'Page address',\n hint: 'Some sites don’t allow their pages to be shown on others.',\n name: 'Title (for screen readers)',\n nameHint: 'When empty, the site’s name is used.',\n size: 'Size',\n fixed: 'Fixed size',\n responsive: 'Full width, {ratio}',\n width: 'Width, px',\n height: 'Height, px',\n border: 'Show a border',\n scrolling: 'Show scroll bars',\n invalid: 'Enter the full address, starting with https://',\n notAllowed: 'Pages from this site can’t be embedded here.',\n insert: 'Insert',\n save: 'Save',\n },\n};\n\nexport default definePlugin({\n name: 'pageembed-ui',\n requires: ['pageembed'],\n setup(editor) {\n const labels = pickLabels(editor, 'pageembed', LABELS);\n const settings = pageEmbedOptions(editor);\n const selected = () => {\n const { selection } = editor.view.state;\n return selection instanceof NodeSelection && selection.node.type.name === 'pageembed'\n ? selection\n : null;\n };\n const sizeLabel = (value: string, text?: string) => {\n if (text) return text;\n const ratio = ratioOf(value);\n return ratio ? labels.responsive.replace('{ratio}', `${ratio[0]}:${ratio[1]}`) : value;\n };\n\n const open = async () => {\n const current = selected()?.node.attrs;\n const preferred =\n settings.sizes.find((size) => ratioOf(size.value)?.join(':') === '16:9') ??\n settings.sizes[0];\n const size = current\n ? settings.sizes.some((s) => s.value === current.size)\n ? (current.size as string)\n : ''\n : (preferred?.value ?? '');\n const data = await editor.ui.dialog({\n title: labels.title,\n submitLabel: current ? labels.save : labels.insert,\n initialData: {\n src: typeof current?.src === 'string' ? current.src : '',\n title: typeof current?.title === 'string' ? current.title : '',\n size,\n width: imageSize(current?.width) ?? FIXED.width,\n height: imageSize(current?.height) ?? FIXED.height,\n border: current?.border === true,\n scrolling: current?.scrolling !== false,\n },\n fields: [\n {\n type: 'url',\n name: 'src',\n label: labels.url,\n required: true,\n hint: labels.hint,\n validate: (value) =>\n !embeddableUrl(value)\n ? labels.invalid\n : embeddableUrl(value, settings.allowUrl)\n ? null\n : labels.notAllowed,\n },\n { type: 'text', name: 'title', label: labels.name, hint: labels.nameHint },\n ...(settings.sizes.length\n ? [\n {\n type: 'select' as const,\n name: 'size',\n label: labels.size,\n options: [\n { value: '', label: labels.fixed },\n ...settings.sizes.map((s) => ({\n value: s.value,\n label: sizeLabel(s.value, s.text),\n })),\n ],\n },\n ]\n : []),\n {\n type: 'number',\n name: 'width',\n label: labels.width,\n min: 1,\n max: 10000,\n disabled: !!size,\n },\n {\n type: 'number',\n name: 'height',\n label: labels.height,\n min: 1,\n max: 10000,\n disabled: !!size,\n },\n { type: 'checkbox', name: 'border', label: labels.border },\n { type: 'checkbox', name: 'scrolling', label: labels.scrolling },\n ],\n // Width and height are for a fixed size only.\n onChange: (values, { name }, api) => {\n if (name !== 'size') return;\n api.setEnabled('width', !values.size);\n api.setEnabled('height', !values.size);\n },\n });\n if (!data) return;\n const src = embeddableUrl(data.src, settings.allowUrl);\n if (!src) return;\n const attrs = {\n src,\n size: typeof data.size === 'string' ? data.size : '',\n width: imageSize(String(data.width ?? '')) ?? FIXED.width,\n height: imageSize(String(data.height ?? '')) ?? FIXED.height,\n title: typeof data.title === 'string' ? data.title.trim().slice(0, 300) : '',\n border: data.border === true,\n scrolling: data.scrolling !== false,\n };\n const { state, dispatch } = editor.view;\n const sel = selected();\n if (sel)\n dispatch(state.tr.setNodeMarkup(sel.from, undefined, { ...sel.node.attrs, ...attrs }));\n else\n dispatch(\n replaceSelectionWithBlock(\n state.tr,\n editor.schema.nodes.pageembed!.create(attrs),\n ).scrollIntoView(),\n );\n editor.focus();\n };\n\n editor.ui.registry.addToggleButton('pageembed', {\n icon: ICON,\n tooltip: labels.title,\n isActive: () => selected() !== null,\n isEnabled: (e) => e.isEditable(),\n onAction: () => void open(),\n });\n editor.ui.registry.addMenuItem('pageembed', {\n text: labels.title,\n icon: ICON,\n onAction: () => void open(),\n });\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAS9B,IAAM,OACJ;AAEK,IAAM,SAAS;AAAA,EACpB,IAAI;AAAA,IACF,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,OA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AAC;AACD,WAAO,GAAG,SAAS,YAAY,aAAa;AAAA,MAC1C,MAAM,OAAO;AAAA,MACb,MAAM;AAAA,MACN,UAAU,MAAM,KAAK,KAAK;AAAA,IAC5B,CAAC;AAAA,EACH;AACF,CAAC;","names":["size"]}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fillBand,
|
|
3
|
+
pageLayout,
|
|
4
|
+
setPageCount
|
|
5
|
+
} from "./chunk-OFHGXYG3.js";
|
|
6
|
+
import {
|
|
7
|
+
pickLabels
|
|
8
|
+
} from "./chunk-DEYYVZ7O.js";
|
|
9
|
+
import {
|
|
10
|
+
definePlugin
|
|
11
|
+
} from "./chunk-V7WUHUHM.js";
|
|
12
|
+
import {
|
|
13
|
+
h
|
|
14
|
+
} from "./chunk-QU3KXMYT.js";
|
|
15
|
+
|
|
16
|
+
// src/plugins/pagelayout-ui.ts
|
|
17
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
18
|
+
|
|
19
|
+
// nova-raw-css:/home/runner/work/novaprose/novaprose/packages/core/src/plugins/pagelayout-ui.css?raw
|
|
20
|
+
var pagelayout_ui_default = ".nova-page-breaks{position:absolute;z-index:1;pointer-events:none}.nova-page-break{position:absolute;inset-inline:0;border-top:1px dashed #8c959f}.nova-page-band{position:absolute;inset-inline:0;display:flex;gap:12px;direction:ltr;transform:translateY(-50%);color:#59636e;font:11px/1.4 system-ui,sans-serif;white-space:nowrap}.nova-page-band>span{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;unicode-bidi:plaintext}.nova-page-band>span:nth-child(2){text-align:center}.nova-page-band>span:last-child{text-align:right}.nova-page-break>span{position:absolute;inset-inline-end:6px;top:0;transform:translateY(-50%);padding:0 6px;border-radius:8px;background:#fff;color:#59636e;font:11px/1.6 system-ui,sans-serif;white-space:nowrap}";
|
|
21
|
+
|
|
22
|
+
// src/plugins/pagelayout-ui.ts
|
|
23
|
+
var LABELS = { en: { page: "Page {page}" } };
|
|
24
|
+
var PX_PER_MM = 96 / 25.4;
|
|
25
|
+
var ATOMIC = /* @__PURE__ */ new Set([
|
|
26
|
+
"IMG",
|
|
27
|
+
"VIDEO",
|
|
28
|
+
"IFRAME",
|
|
29
|
+
"CANVAS",
|
|
30
|
+
"HR",
|
|
31
|
+
"TR",
|
|
32
|
+
"INPUT",
|
|
33
|
+
"SELECT",
|
|
34
|
+
"TEXTAREA",
|
|
35
|
+
"BUTTON"
|
|
36
|
+
]);
|
|
37
|
+
function collectLines(root) {
|
|
38
|
+
const top = root.getBoundingClientRect().top;
|
|
39
|
+
const lines = [];
|
|
40
|
+
const range = root.ownerDocument.createRange();
|
|
41
|
+
const push = (rect) => {
|
|
42
|
+
if (rect.height > 0) lines.push({ top: rect.top - top, bottom: rect.bottom - top });
|
|
43
|
+
};
|
|
44
|
+
const walk = (node) => {
|
|
45
|
+
for (let child = node.firstChild; child; child = child.nextSibling) {
|
|
46
|
+
if (child.nodeType === 3) {
|
|
47
|
+
range.selectNodeContents(child);
|
|
48
|
+
for (const rect of range.getClientRects()) push(rect);
|
|
49
|
+
} else if (child instanceof Element) {
|
|
50
|
+
if (child.classList.contains("nova-pagebreak")) {
|
|
51
|
+
const next = child.nextElementSibling;
|
|
52
|
+
const margin = next ? parseFloat(getComputedStyle(next).marginTop) || 0 : 0;
|
|
53
|
+
const bottom = child.getBoundingClientRect().bottom - top;
|
|
54
|
+
lines.push({ top: bottom, bottom, forced: true, offset: margin });
|
|
55
|
+
} else if (ATOMIC.has(child.tagName) || child.localName === "svg") {
|
|
56
|
+
push(child.getBoundingClientRect());
|
|
57
|
+
} else if (child.childNodes.length === 1 && child.firstChild?.nodeName === "BR") {
|
|
58
|
+
push(child.getBoundingClientRect());
|
|
59
|
+
} else {
|
|
60
|
+
walk(child);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
walk(root);
|
|
66
|
+
return lines;
|
|
67
|
+
}
|
|
68
|
+
function mergeLines(lines) {
|
|
69
|
+
const merged = [];
|
|
70
|
+
for (const line of [...lines].sort((a, b) => a.top - b.top || a.bottom - b.bottom)) {
|
|
71
|
+
const last = merged[merged.length - 1];
|
|
72
|
+
if (last && !last.forced && !line.forced && line.top < last.bottom - 1)
|
|
73
|
+
last.bottom = Math.max(last.bottom, line.bottom);
|
|
74
|
+
else merged.push({ ...line });
|
|
75
|
+
}
|
|
76
|
+
return merged;
|
|
77
|
+
}
|
|
78
|
+
function paginate(lines, start, height) {
|
|
79
|
+
const breaks = [];
|
|
80
|
+
let pageTop = start;
|
|
81
|
+
let previous = start;
|
|
82
|
+
let forced = null;
|
|
83
|
+
for (const line of mergeLines(lines)) {
|
|
84
|
+
if (line.forced) {
|
|
85
|
+
forced = line;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (forced) {
|
|
89
|
+
const at = line.top - (forced.offset ?? 0);
|
|
90
|
+
const mark = forced.top;
|
|
91
|
+
forced = null;
|
|
92
|
+
if (at > pageTop + 0.5) {
|
|
93
|
+
breaks.push({ at, mark });
|
|
94
|
+
pageTop = at;
|
|
95
|
+
previous = line.bottom;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (line.bottom - pageTop > height + 0.5 && line.top > pageTop + 0.5) {
|
|
100
|
+
breaks.push({ at: line.top, mark: (previous + line.top) / 2 });
|
|
101
|
+
pageTop = line.top;
|
|
102
|
+
}
|
|
103
|
+
previous = line.bottom;
|
|
104
|
+
}
|
|
105
|
+
return breaks;
|
|
106
|
+
}
|
|
107
|
+
var PageBreaks = class {
|
|
108
|
+
constructor(editor, view) {
|
|
109
|
+
this.editor = editor;
|
|
110
|
+
this.view = view;
|
|
111
|
+
this.overlay = h("div", { className: "nova-page-breaks", "aria-hidden": "true" });
|
|
112
|
+
view.dom.after(this.overlay);
|
|
113
|
+
this.observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => this.schedule());
|
|
114
|
+
this.observer?.observe(view.dom);
|
|
115
|
+
if (view.dom.parentElement) this.observer?.observe(view.dom.parentElement);
|
|
116
|
+
view.dom.addEventListener("load", this.schedule, true);
|
|
117
|
+
view.dom.ownerDocument.fonts?.ready.then(this.schedule, () => {
|
|
118
|
+
});
|
|
119
|
+
this.schedule();
|
|
120
|
+
}
|
|
121
|
+
editor;
|
|
122
|
+
view;
|
|
123
|
+
overlay;
|
|
124
|
+
observer;
|
|
125
|
+
timer = null;
|
|
126
|
+
frame = 0;
|
|
127
|
+
destroyed = false;
|
|
128
|
+
signature = "";
|
|
129
|
+
update(view, prev) {
|
|
130
|
+
if (view.state.doc !== prev.doc) this.schedule();
|
|
131
|
+
}
|
|
132
|
+
schedule = () => {
|
|
133
|
+
if (this.timer || this.destroyed) return;
|
|
134
|
+
this.timer = setTimeout(() => {
|
|
135
|
+
this.timer = null;
|
|
136
|
+
this.frame = requestAnimationFrame(() => this.measure());
|
|
137
|
+
}, 60);
|
|
138
|
+
};
|
|
139
|
+
measure() {
|
|
140
|
+
const layout = pageLayout(this.editor)?.layout;
|
|
141
|
+
const dom = this.view.dom;
|
|
142
|
+
if (!layout || this.destroyed) return;
|
|
143
|
+
const width = dom.getBoundingClientRect().width;
|
|
144
|
+
if (!width || Math.abs(width - layout.width * PX_PER_MM) > 1.5)
|
|
145
|
+
return this.render(null, layout);
|
|
146
|
+
const start = parseFloat(getComputedStyle(dom).paddingTop) || 0;
|
|
147
|
+
const height = (layout.height - layout.margins.top - layout.margins.bottom) * PX_PER_MM;
|
|
148
|
+
this.render(paginate(collectLines(dom), start, height), layout);
|
|
149
|
+
}
|
|
150
|
+
render(breaks, layout) {
|
|
151
|
+
const dom = this.view.dom;
|
|
152
|
+
const { root } = this.editor;
|
|
153
|
+
const signature = breaks ? `${breaks.map((b) => b.mark.toFixed(1)).join(",")}|${JSON.stringify([layout.header, layout.footer, layout.differentFirstPage, layout.margins])}` : "none";
|
|
154
|
+
this.overlay.style.cssText = `top:${dom.offsetTop}px;left:${dom.offsetLeft}px;width:${dom.offsetWidth}px`;
|
|
155
|
+
if (signature !== this.signature) {
|
|
156
|
+
this.signature = signature;
|
|
157
|
+
const last = breaks?.[breaks.length - 1]?.at;
|
|
158
|
+
if (last !== void 0) {
|
|
159
|
+
const rest = (layout.height - layout.margins.top) * PX_PER_MM;
|
|
160
|
+
root.style.setProperty("--nova-pages-height", `${last + rest}px`);
|
|
161
|
+
} else root.style.removeProperty("--nova-pages-height");
|
|
162
|
+
this.overlay.replaceChildren(
|
|
163
|
+
...(breaks ?? []).map(
|
|
164
|
+
(pageBreak, index) => h(
|
|
165
|
+
"div",
|
|
166
|
+
{ className: "nova-page-break", style: `top:${pageBreak.mark}px` },
|
|
167
|
+
h("span", {}, this.editor.ui.t("pagelayout.page", { page: index + 2 }))
|
|
168
|
+
)
|
|
169
|
+
),
|
|
170
|
+
...breaks ? this.bands(layout, breaks.length + 1, dom.offsetHeight) : []
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
setPageCount(this.editor, breaks ? breaks.length + 1 : null);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The header in the top margin of the first page and the footer in the bottom margin of the last one, with
|
|
177
|
+
* their page numbers: a preview of what prints on every page. The sheet here is one long page, so there is
|
|
178
|
+
* no margin between pages to draw them in.
|
|
179
|
+
*/
|
|
180
|
+
bands(layout, pages, sheetHeight) {
|
|
181
|
+
const { margins } = layout;
|
|
182
|
+
const band = (parts, page, top, className) => h(
|
|
183
|
+
"div",
|
|
184
|
+
{
|
|
185
|
+
className: `nova-page-band ${className}`,
|
|
186
|
+
style: `top:${top}px;padding:0 ${margins.right}mm 0 ${margins.left}mm`
|
|
187
|
+
},
|
|
188
|
+
...["left", "center", "right"].map(
|
|
189
|
+
(side) => h("span", {}, fillBand(parts[side], page, pages))
|
|
190
|
+
)
|
|
191
|
+
);
|
|
192
|
+
const result = [];
|
|
193
|
+
if (layout.header && !layout.differentFirstPage)
|
|
194
|
+
result.push(band(layout.header, 1, margins.top * PX_PER_MM / 2, "nova-page-header"));
|
|
195
|
+
if (layout.footer && !(layout.differentFirstPage && pages === 1))
|
|
196
|
+
result.push(
|
|
197
|
+
band(
|
|
198
|
+
layout.footer,
|
|
199
|
+
pages,
|
|
200
|
+
sheetHeight - margins.bottom * PX_PER_MM / 2,
|
|
201
|
+
"nova-page-footer"
|
|
202
|
+
)
|
|
203
|
+
);
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
destroy() {
|
|
207
|
+
this.destroyed = true;
|
|
208
|
+
if (this.timer) clearTimeout(this.timer);
|
|
209
|
+
cancelAnimationFrame(this.frame);
|
|
210
|
+
this.observer?.disconnect();
|
|
211
|
+
this.view.dom.removeEventListener("load", this.schedule, true);
|
|
212
|
+
this.overlay.remove();
|
|
213
|
+
this.editor.root.style.removeProperty("--nova-pages-height");
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
var pagelayout_ui_default2 = definePlugin({
|
|
217
|
+
name: "pagelayout-ui",
|
|
218
|
+
prosemirrorPlugins: (editor) => [
|
|
219
|
+
new Plugin({
|
|
220
|
+
key: new PluginKey("nova-pagelayout"),
|
|
221
|
+
view: (view) => new PageBreaks(editor, view)
|
|
222
|
+
})
|
|
223
|
+
],
|
|
224
|
+
setup(editor) {
|
|
225
|
+
editor.ui.addStyles("nova-pagelayout-ui", pagelayout_ui_default);
|
|
226
|
+
pickLabels(editor, "pagelayout", LABELS);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
export {
|
|
230
|
+
LABELS,
|
|
231
|
+
PX_PER_MM,
|
|
232
|
+
collectLines,
|
|
233
|
+
pagelayout_ui_default2 as default,
|
|
234
|
+
paginate
|
|
235
|
+
};
|
|
236
|
+
//# sourceMappingURL=pagelayout-ui-Y2IM7FJQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/pagelayout-ui.ts","nova-raw-css:/home/runner/work/novaprose/novaprose/packages/core/src/plugins/pagelayout-ui.css?raw"],"sourcesContent":["import { Plugin, PluginKey } from 'prosemirror-state';\nimport type { EditorView } from 'prosemirror-view';\nimport type { Editor } from '../editor';\nimport { definePlugin } from '../plugins';\nimport { h } from '../ui/dom';\nimport {\n fillBand,\n pageLayout,\n setPageCount,\n type PageBandParts,\n type PageLayout,\n} from './pagelayout';\nimport css from './pagelayout-ui.css?raw';\nimport { pickLabels } from './shared';\n\n/**\n * The lazy part of page mode: where each page ends. Text lines, images and table rows\n * are measured in the editor itself (the sheet has the same width as the printed page), then\n * laid out into pages the way printing will do it (orphans/widows: 1, table rows and\n * images aren't split, a page break starts a new page). The lines are drawn on top of the sheet,\n * outside ProseMirror's DOM, so they don't interfere with typing.\n */\n\nexport const LABELS = { en: { page: 'Page {page}' } };\n\n/** CSS pixels per millimetre (96 dpi: both the screen and browser printing count this way). */\nexport const PX_PER_MM = 96 / 25.4;\n\nexport interface Line {\n top: number;\n bottom: number;\n /** A page break: the next line starts a new page. */\n forced?: boolean;\n /** At a break: the top margin of the next block (it is kept after a forced break). */\n offset?: number;\n}\n\n/** Kept whole on one page: images, table rows, input fields of node views. */\nconst ATOMIC = new Set([\n 'IMG',\n 'VIDEO',\n 'IFRAME',\n 'CANVAS',\n 'HR',\n 'TR',\n 'INPUT',\n 'SELECT',\n 'TEXTAREA',\n 'BUTTON',\n]);\n\n/** Rectangles of content lines in sheet coordinates (from its top edge). */\nexport function collectLines(root: HTMLElement): Line[] {\n const top = root.getBoundingClientRect().top;\n const lines: Line[] = [];\n const range = root.ownerDocument.createRange();\n const push = (rect: DOMRect) => {\n if (rect.height > 0) lines.push({ top: rect.top - top, bottom: rect.bottom - top });\n };\n const walk = (node: Node) => {\n for (let child = node.firstChild; child; child = child.nextSibling) {\n if (child.nodeType === 3) {\n range.selectNodeContents(child);\n for (const rect of range.getClientRects()) push(rect);\n } else if (child instanceof Element) {\n if (child.classList.contains('nova-pagebreak')) {\n const next = child.nextElementSibling;\n const margin = next ? parseFloat(getComputedStyle(next).marginTop) || 0 : 0;\n const bottom = child.getBoundingClientRect().bottom - top;\n lines.push({ top: bottom, bottom, forced: true, offset: margin });\n } else if (ATOMIC.has(child.tagName) || child.localName === 'svg') {\n push(child.getBoundingClientRect());\n } else if (child.childNodes.length === 1 && child.firstChild?.nodeName === 'BR') {\n // An empty paragraph: no text line, but it takes up space.\n push(child.getBoundingClientRect());\n } else {\n walk(child);\n }\n }\n }\n };\n walk(root);\n return lines;\n}\n\n/** Lines that share one line (text in different fonts, an inline image) count as one line. */\nfunction mergeLines(lines: Line[]): Line[] {\n const merged: Line[] = [];\n for (const line of [...lines].sort((a, b) => a.top - b.top || a.bottom - b.bottom)) {\n const last = merged[merged.length - 1];\n if (last && !last.forced && !line.forced && line.top < last.bottom - 1)\n last.bottom = Math.max(last.bottom, line.bottom);\n else merged.push({ ...line });\n }\n return merged;\n}\n\nexport interface PageBreak {\n /** Where the text of the new page starts (for the layout). */\n at: number;\n /** Where to draw the border: between lines or at the page break itself. */\n mark: number;\n}\n\n/**\n * Where pages start from the second one on (in sheet coordinates). `start` is the top of the text area of the first\n * page, `height` is the height of a page's text area.\n */\nexport function paginate(lines: Line[], start: number, height: number): PageBreak[] {\n const breaks: PageBreak[] = [];\n let pageTop = start;\n let previous = start;\n let forced: Line | null = null;\n for (const line of mergeLines(lines)) {\n if (line.forced) {\n forced = line;\n continue;\n }\n if (forced) {\n const at = line.top - (forced.offset ?? 0);\n const mark = forced.top;\n forced = null;\n if (at > pageTop + 0.5) {\n breaks.push({ at, mark });\n pageTop = at;\n previous = line.bottom;\n continue;\n }\n }\n if (line.bottom - pageTop > height + 0.5 && line.top > pageTop + 0.5) {\n breaks.push({ at: line.top, mark: (previous + line.top) / 2 });\n pageTop = line.top;\n }\n previous = line.bottom;\n }\n return breaks;\n}\n\nclass PageBreaks {\n private readonly overlay: HTMLElement;\n private readonly observer: ResizeObserver | null;\n private timer: ReturnType<typeof setTimeout> | null = null;\n private frame = 0;\n private destroyed = false;\n private signature = '';\n\n constructor(\n private readonly editor: Editor,\n private readonly view: EditorView,\n ) {\n this.overlay = h('div', { className: 'nova-page-breaks', 'aria-hidden': 'true' });\n view.dom.after(this.overlay);\n this.observer =\n typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => this.schedule());\n this.observer?.observe(view.dom);\n if (view.dom.parentElement) this.observer?.observe(view.dom.parentElement);\n // Images finish loading, fonts get swapped: lines shift.\n view.dom.addEventListener('load', this.schedule, true);\n view.dom.ownerDocument.fonts?.ready.then(this.schedule, () => {});\n this.schedule();\n }\n\n update(view: EditorView, prev: { doc: unknown }): void {\n if (view.state.doc !== prev.doc) this.schedule();\n }\n\n readonly schedule = (): void => {\n if (this.timer || this.destroyed) return;\n this.timer = setTimeout(() => {\n this.timer = null;\n this.frame = requestAnimationFrame(() => this.measure());\n }, 60);\n };\n\n private measure(): void {\n const layout = pageLayout(this.editor)?.layout;\n const dom = this.view.dom;\n if (!layout || this.destroyed) return;\n const width = dom.getBoundingClientRect().width;\n // The sheet is narrower than the page (a narrow screen): lines wrap differently from print.\n if (!width || Math.abs(width - layout.width * PX_PER_MM) > 1.5)\n return this.render(null, layout);\n const start = parseFloat(getComputedStyle(dom).paddingTop) || 0;\n const height = (layout.height - layout.margins.top - layout.margins.bottom) * PX_PER_MM;\n this.render(paginate(collectLines(dom), start, height), layout);\n }\n\n private render(breaks: PageBreak[] | null, layout: PageLayout): void {\n const dom = this.view.dom;\n const { root } = this.editor;\n const signature = breaks\n ? `${breaks.map((b) => b.mark.toFixed(1)).join(',')}|${JSON.stringify([layout.header, layout.footer, layout.differentFirstPage, layout.margins])}`\n : 'none';\n this.overlay.style.cssText = `top:${dom.offsetTop}px;left:${dom.offsetLeft}px;width:${dom.offsetWidth}px`;\n if (signature !== this.signature) {\n this.signature = signature;\n // The last page runs to the end, like a sheet of paper: from its start, the text and the bottom margin.\n const last = breaks?.[breaks.length - 1]?.at;\n if (last !== undefined) {\n const rest = (layout.height - layout.margins.top) * PX_PER_MM;\n root.style.setProperty('--nova-pages-height', `${last + rest}px`);\n } else root.style.removeProperty('--nova-pages-height');\n this.overlay.replaceChildren(\n ...(breaks ?? []).map((pageBreak, index) =>\n h(\n 'div',\n { className: 'nova-page-break', style: `top:${pageBreak.mark}px` },\n h('span', {}, this.editor.ui.t('pagelayout.page', { page: index + 2 })),\n ),\n ),\n ...(breaks ? this.bands(layout, breaks.length + 1, dom.offsetHeight) : []),\n );\n }\n setPageCount(this.editor, breaks ? breaks.length + 1 : null);\n }\n\n /**\n * The header in the top margin of the first page and the footer in the bottom margin of the last one, with\n * their page numbers: a preview of what prints on every page. The sheet here is one long page, so there is\n * no margin between pages to draw them in.\n */\n private bands(layout: PageLayout, pages: number, sheetHeight: number): HTMLElement[] {\n const { margins } = layout;\n const band = (parts: PageBandParts, page: number, top: number, className: string) =>\n h(\n 'div',\n {\n className: `nova-page-band ${className}`,\n style: `top:${top}px;padding:0 ${margins.right}mm 0 ${margins.left}mm`,\n },\n ...(['left', 'center', 'right'] as const).map((side) =>\n h('span', {}, fillBand(parts[side], page, pages)),\n ),\n );\n const result: HTMLElement[] = [];\n if (layout.header && !layout.differentFirstPage)\n result.push(band(layout.header, 1, (margins.top * PX_PER_MM) / 2, 'nova-page-header'));\n if (layout.footer && !(layout.differentFirstPage && pages === 1))\n result.push(\n band(\n layout.footer,\n pages,\n sheetHeight - (margins.bottom * PX_PER_MM) / 2,\n 'nova-page-footer',\n ),\n );\n return result;\n }\n\n destroy(): void {\n this.destroyed = true;\n if (this.timer) clearTimeout(this.timer);\n cancelAnimationFrame(this.frame);\n this.observer?.disconnect();\n this.view.dom.removeEventListener('load', this.schedule, true);\n this.overlay.remove();\n this.editor.root.style.removeProperty('--nova-pages-height');\n }\n}\n\nexport default definePlugin({\n name: 'pagelayout-ui',\n prosemirrorPlugins: (editor) => [\n new Plugin({\n key: new PluginKey('nova-pagelayout'),\n view: (view) => new PageBreaks(editor, view),\n }),\n ],\n setup(editor) {\n editor.ui.addStyles('nova-pagelayout-ui', css);\n pickLabels(editor, 'pagelayout', LABELS);\n },\n});\n",".nova-page-breaks{position:absolute;z-index:1;pointer-events:none}.nova-page-break{position:absolute;inset-inline:0;border-top:1px dashed #8c959f}.nova-page-band{position:absolute;inset-inline:0;display:flex;gap:12px;direction:ltr;transform:translateY(-50%);color:#59636e;font:11px/1.4 system-ui,sans-serif;white-space:nowrap}.nova-page-band>span{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;unicode-bidi:plaintext}.nova-page-band>span:nth-child(2){text-align:center}.nova-page-band>span:last-child{text-align:right}.nova-page-break>span{position:absolute;inset-inline-end:6px;top:0;transform:translateY(-50%);padding:0 6px;border-radius:8px;background:#fff;color:#59636e;font:11px/1.6 system-ui,sans-serif;white-space:nowrap}"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,QAAQ,iBAAiB;;;ACAlC;;;ADuBO,IAAM,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,EAAE;AAG7C,IAAM,YAAY,KAAK;AAY9B,IAAM,SAAS,oBAAI,IAAI;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,SAAS,aAAa,MAA2B;AACtD,QAAM,MAAM,KAAK,sBAAsB,EAAE;AACzC,QAAM,QAAgB,CAAC;AACvB,QAAM,QAAQ,KAAK,cAAc,YAAY;AAC7C,QAAM,OAAO,CAAC,SAAkB;AAC9B,QAAI,KAAK,SAAS,EAAG,OAAM,KAAK,EAAE,KAAK,KAAK,MAAM,KAAK,QAAQ,KAAK,SAAS,IAAI,CAAC;AAAA,EACpF;AACA,QAAM,OAAO,CAAC,SAAe;AAC3B,aAAS,QAAQ,KAAK,YAAY,OAAO,QAAQ,MAAM,aAAa;AAClE,UAAI,MAAM,aAAa,GAAG;AACxB,cAAM,mBAAmB,KAAK;AAC9B,mBAAW,QAAQ,MAAM,eAAe,EAAG,MAAK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OAAO;AAAA,UACP;AAAA,UACA,cAAe,QAAQ,SAAS,YAAa;AAAA,UAC7C;AAAA,QACF;AAAA,MACF;AACF,WAAO;AAAA,EACT;AAAA,EAEA,UAAgB;AACd,SAAK,YAAY;AACjB,QAAI,KAAK,MAAO,cAAa,KAAK,KAAK;AACvC,yBAAqB,KAAK,KAAK;AAC/B,SAAK,UAAU,WAAW;AAC1B,SAAK,KAAK,IAAI,oBAAoB,QAAQ,KAAK,UAAU,IAAI;AAC7D,SAAK,QAAQ,OAAO;AACpB,SAAK,OAAO,KAAK,MAAM,eAAe,qBAAqB;AAAA,EAC7D;AACF;AAEA,IAAOA,yBAAQ,aAAa;AAAA,EAC1B,MAAM;AAAA,EACN,oBAAoB,CAAC,WAAW;AAAA,IAC9B,IAAI,OAAO;AAAA,MACT,KAAK,IAAI,UAAU,iBAAiB;AAAA,MACpC,MAAM,CAAC,SAAS,IAAI,WAAW,QAAQ,IAAI;AAAA,IAC7C,CAAC;AAAA,EACH;AAAA,EACA,MAAM,QAAQ;AACZ,WAAO,GAAG,UAAU,sBAAsB,qBAAG;AAC7C,eAAW,QAAQ,cAAc,MAAM;AAAA,EACzC;AACF,CAAC;","names":["pagelayout_ui_default"]}
|
|
@@ -1,3 +1,81 @@
|
|
|
1
|
+
// src/paste-rtf.ts
|
|
2
|
+
function groupEnd(rtf, start) {
|
|
3
|
+
let depth = 0;
|
|
4
|
+
for (let i = start; i < rtf.length; i++) {
|
|
5
|
+
const ch = rtf[i];
|
|
6
|
+
if (ch === "\\") {
|
|
7
|
+
i++;
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
if (ch === "{") depth++;
|
|
11
|
+
else if (ch === "}") {
|
|
12
|
+
depth--;
|
|
13
|
+
if (depth === 0) return i;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return -1;
|
|
17
|
+
}
|
|
18
|
+
function withoutNestedGroups(body) {
|
|
19
|
+
let out = "";
|
|
20
|
+
let depth = 0;
|
|
21
|
+
for (let i = 0; i < body.length; i++) {
|
|
22
|
+
const ch = body[i];
|
|
23
|
+
if (ch === "\\") {
|
|
24
|
+
if (depth === 0) out += ch + (body[i + 1] ?? "");
|
|
25
|
+
i++;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (ch === "{") depth++;
|
|
29
|
+
else if (ch === "}") depth--;
|
|
30
|
+
else if (depth === 0) out += ch;
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
var MAX_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
35
|
+
function hexToBase64(hex) {
|
|
36
|
+
if (hex.length % 2 !== 0 || hex.length / 2 > MAX_IMAGE_BYTES || !/^[0-9a-f]+$/i.test(hex))
|
|
37
|
+
return null;
|
|
38
|
+
let binary = "";
|
|
39
|
+
for (let i = 0; i < hex.length; i += 2)
|
|
40
|
+
binary += String.fromCharCode(parseInt(hex.slice(i, i + 2), 16));
|
|
41
|
+
return btoa(binary);
|
|
42
|
+
}
|
|
43
|
+
function extractRtfImages(rtf) {
|
|
44
|
+
const images = [];
|
|
45
|
+
let from = 0;
|
|
46
|
+
for (; ; ) {
|
|
47
|
+
const start = rtf.indexOf("{\\pict", from);
|
|
48
|
+
if (start < 0) break;
|
|
49
|
+
const end = groupEnd(rtf, start);
|
|
50
|
+
if (end < 0) break;
|
|
51
|
+
from = end + 1;
|
|
52
|
+
if (/\\nonshppict\s*$/.test(rtf.slice(Math.max(0, start - 16), start))) continue;
|
|
53
|
+
const body = withoutNestedGroups(rtf.slice(start + 1, end));
|
|
54
|
+
const type = /\\pngblip(?![a-z])/.test(body) ? "image/png" : /\\jpegblip(?![a-z])/.test(body) ? "image/jpeg" : null;
|
|
55
|
+
if (!type) continue;
|
|
56
|
+
const hex = body.replace(/\\[a-z]+-?\d* ?/gi, "").replace(/\s+/g, "");
|
|
57
|
+
const base64 = hexToBase64(hex);
|
|
58
|
+
if (!base64) continue;
|
|
59
|
+
const head = atob(base64.slice(0, 12));
|
|
60
|
+
const valid = type === "image/png" ? head.startsWith(String.fromCharCode(137) + "PNG") : head.charCodeAt(0) === 255 && head.charCodeAt(1) === 216;
|
|
61
|
+
if (valid) images.push({ type, base64 });
|
|
62
|
+
}
|
|
63
|
+
return images;
|
|
64
|
+
}
|
|
65
|
+
function replaceLocalImages(html, images) {
|
|
66
|
+
const template = document.createElement("template");
|
|
67
|
+
template.innerHTML = html;
|
|
68
|
+
const targets = [...template.content.querySelectorAll("img")].filter(
|
|
69
|
+
(img) => /^file:/i.test(img.getAttribute("src") ?? "")
|
|
70
|
+
);
|
|
71
|
+
if (!targets.length || targets.length !== images.length) return html;
|
|
72
|
+
targets.forEach((img, i) => {
|
|
73
|
+
const image = images[i];
|
|
74
|
+
img.setAttribute("src", `data:${image.type};base64,${image.base64}`);
|
|
75
|
+
});
|
|
76
|
+
return template.innerHTML;
|
|
77
|
+
}
|
|
78
|
+
|
|
1
79
|
// src/paste-office.ts
|
|
2
80
|
function detectPasteSource(html) {
|
|
3
81
|
if (/data-pm-slice=/.test(html)) return "nova";
|
|
@@ -435,6 +513,8 @@ function renameElement(el, tag) {
|
|
|
435
513
|
}
|
|
436
514
|
export {
|
|
437
515
|
cleanPastedHTML,
|
|
438
|
-
detectPasteSource
|
|
516
|
+
detectPasteSource,
|
|
517
|
+
extractRtfImages,
|
|
518
|
+
replaceLocalImages
|
|
439
519
|
};
|
|
440
|
-
//# sourceMappingURL=paste-office-
|
|
520
|
+
//# sourceMappingURL=paste-office-3A6KWKCV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/paste-rtf.ts","../src/paste-office.ts"],"sourcesContent":["/**\n * Images from the desktop Word clipboard.\n *\n * In HTML, Word refers to images by local paths (`<img src=\"file:///C:/…/clip_image001.png\">`)\n * that a browser won't open. The images themselves are in the RTF flavor of the same clipboard: `{\\pict …}` groups\n * with hexadecimal data. PNG and JPEG are extracted and put in place of the file: links, in order.\n *\n * Built from the public RTF specification (\\pict, \\pngblip, \\jpegblip, \\shppict/\\nonshppict groups), without anyone else's code.\n */\n\nexport interface RtfImage {\n type: 'image/png' | 'image/jpeg';\n /** The data in base64 (for a data: URL). */\n base64: string;\n}\n\n/** Finds the end of a group starting with '{' at position start (minding nesting and escaping). */\nfunction groupEnd(rtf: string, start: number): number {\n let depth = 0;\n for (let i = start; i < rtf.length; i++) {\n const ch = rtf[i];\n if (ch === '\\\\') {\n i++; // an escaped character (\\{, \\}, \\\\) or the start of a control word: skip the next one\n continue;\n }\n if (ch === '{') depth++;\n else if (ch === '}') {\n depth--;\n if (depth === 0) return i;\n }\n }\n return -1;\n}\n\n/** The group's content without nested groups ({\\*\\picprop…}, {\\*\\blipuid…}). */\nfunction withoutNestedGroups(body: string): string {\n let out = '';\n let depth = 0;\n for (let i = 0; i < body.length; i++) {\n const ch = body[i]!;\n if (ch === '\\\\') {\n if (depth === 0) out += ch + (body[i + 1] ?? '');\n i++;\n continue;\n }\n if (ch === '{') depth++;\n else if (ch === '}') depth--;\n else if (depth === 0) out += ch;\n }\n return out;\n}\n\nconst MAX_IMAGE_BYTES = 20 * 1024 * 1024;\n\nfunction hexToBase64(hex: string): string | null {\n if (hex.length % 2 !== 0 || hex.length / 2 > MAX_IMAGE_BYTES || !/^[0-9a-f]+$/i.test(hex))\n return null;\n let binary = '';\n for (let i = 0; i < hex.length; i += 2)\n binary += String.fromCharCode(parseInt(hex.slice(i, i + 2), 16));\n return btoa(binary);\n}\n\n/** PNG and JPEG from the RTF, in order. Vector WMF/EMF and fallback copies (\\nonshppict) are skipped. */\nexport function extractRtfImages(rtf: string): RtfImage[] {\n const images: RtfImage[] = [];\n let from = 0;\n for (;;) {\n const start = rtf.indexOf('{\\\\pict', from);\n if (start < 0) break;\n const end = groupEnd(rtf, start);\n if (end < 0) break;\n from = end + 1;\n // A fallback copy of the image for old RTF readers: a duplicate, skipped.\n if (/\\\\nonshppict\\s*$/.test(rtf.slice(Math.max(0, start - 16), start))) continue;\n const body = withoutNestedGroups(rtf.slice(start + 1, end));\n const type = /\\\\pngblip(?![a-z])/.test(body)\n ? 'image/png'\n : /\\\\jpegblip(?![a-z])/.test(body)\n ? 'image/jpeg'\n : null;\n if (!type) continue;\n const hex = body.replace(/\\\\[a-z]+-?\\d* ?/gi, '').replace(/\\s+/g, '');\n const base64 = hexToBase64(hex);\n if (!base64) continue;\n // A signature check: the keyword isn't trusted if the data doesn't match the format.\n const head = atob(base64.slice(0, 12));\n const valid =\n type === 'image/png'\n ? head.startsWith(String.fromCharCode(0x89) + 'PNG')\n : head.charCodeAt(0) === 0xff && head.charCodeAt(1) === 0xd8;\n if (valid) images.push({ type, base64 });\n }\n return images;\n}\n\n/**\n * Puts images from the RTF in place of file: links. Only when the counts match: otherwise\n * the matching is unreliable, and such images just aren't pasted (as before).\n */\nexport function replaceLocalImages(html: string, images: RtfImage[]): string {\n const template = document.createElement('template');\n template.innerHTML = html;\n const targets = [...template.content.querySelectorAll('img')].filter((img) =>\n /^file:/i.test(img.getAttribute('src') ?? ''),\n );\n if (!targets.length || targets.length !== images.length) return html;\n targets.forEach((img, i) => {\n const image = images[i]!;\n img.setAttribute('src', `data:${image.type};base64,${image.base64}`);\n });\n return template.innerHTML;\n}\n","/**\n * Cleans up HTML pasted from Word, Word Online, Google Docs, Excel, Google Sheets, LibreOffice\n * and regular web pages. Runs before the schema parses it: turns \"office\" markup into clean HTML\n * that the schema understands correctly (real lists instead of paragraphs with markers, styles from\n * classes moved into style, no service tags or styles).\n *\n * Built from the public description of the Office clipboard format and the observed behavior of\n * the applications, without anyone else's code (clean room, see CLAUDE.md).\n */\n\n// Images of desktop Word come in the RTF: read there, at paste time, with this chunk.\nexport { extractRtfImages, replaceLocalImages } from './paste-rtf';\n\nexport type PasteSource =\n | 'nova'\n | 'word'\n | 'word-online'\n | 'google-docs'\n | 'excel'\n | 'google-sheets'\n | 'libreoffice'\n | 'web';\n\n/** 'clean' (default) — without fonts, sizes, spacing and \"default\" colors; 'keep' — as it is. */\nexport type PasteStyles = 'clean' | 'keep';\n\n/** Where the HTML was copied from (by telltale signs in the markup). */\nexport function detectPasteSource(html: string): PasteSource {\n if (/data-pm-slice=/.test(html)) return 'nova';\n if (/<google-sheets-html-origin|data-sheets-(root|value)/i.test(html)) return 'google-sheets';\n if (/id=\"docs-internal-guid-/.test(html)) return 'google-docs';\n if (/urn:schemas-microsoft-com:office:excel|ProgId\"?\\s+content=\"?Excel\\.Sheet/i.test(html))\n return 'excel';\n if (\n /urn:schemas-microsoft-com:office:word|class=\"?Mso|mso-list:|content=\"?Microsoft Word/i.test(\n html,\n )\n )\n return 'word';\n if (\n /class=\"[^\"]*\\b(TextRun|OutlineElement|EOP|SCXW\\d+|BCX\\d+)\\b|data-ccp-props|paraid=/.test(html)\n )\n return 'word-online';\n if (/content=\"?LibreOffice|content=\"?OpenOffice/i.test(html)) return 'libreoffice';\n return 'web';\n}\n\n/** Cleans up pasted HTML. NovaProse's own internal copy is left alone. */\nexport function cleanPastedHTML(html: string, styles: PasteStyles = 'clean'): string {\n const source = detectPasteSource(html);\n if (source === 'nova') return html;\n\n const template = document.createElement('template');\n template.innerHTML = html;\n const root = document.createElement('div');\n root.append(template.content);\n\n inlineClassStyles(root);\n removeJunk(root);\n if (source === 'word') convertWordLists(root);\n if (source === 'google-docs') unwrapGoogleDocsWrapper(root);\n normalizeLists(root);\n convertWordParagraphStyles(root);\n root.querySelectorAll<HTMLElement>('[style]').forEach((el) => cleanStyle(el, styles));\n if (styles === 'clean') stripLayoutAttributes(root);\n unwrapMeaningless(root);\n removeBreaksBetweenBlocks(root);\n normalizeEmptyParagraphs(root);\n wrapCellContent(root);\n // Office classes (MsoNormal, xl65, TextRun…) mean nothing outside Office: their styles are already in style.\n if (source !== 'web')\n root.querySelectorAll('[class]').forEach((el) => el.removeAttribute('class'));\n return root.innerHTML;\n}\n\n// ---------- styles from <style> (Word, Excel and LibreOffice keep formatting in classes) ----------\n\ntype Declarations = Map<string, string>;\n\nfunction parseDeclarations(css: string): Declarations {\n const out: Declarations = new Map();\n for (const part of css.split(';')) {\n const colon = part.indexOf(':');\n if (colon < 0) continue;\n const name = part.slice(0, colon).trim().toLowerCase();\n const value = part\n .slice(colon + 1)\n .trim()\n .replace(/\\s*!important$/i, '');\n if (name && value) out.set(name, value);\n }\n return out;\n}\n\nfunction serializeDeclarations(decls: Declarations): string {\n return [...decls].map(([name, value]) => `${name}: ${value}`).join('; ');\n}\n\n/** Moves rules like `.xl65 {…}` and `p.MsoTitle {…}` into the elements' style. The element's own style wins. */\nfunction inlineClassStyles(root: HTMLElement): void {\n const sheets = [...root.querySelectorAll('style')].map((s) => s.textContent ?? '');\n if (!sheets.length) return;\n const rules: { tag: string; cls: string; decls: Declarations }[] = [];\n const css = sheets\n .join('\\n')\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')\n .replace(/<!--|-->/g, '');\n for (const match of css.matchAll(/([^{}@]+)\\{([^{}]*)\\}/g)) {\n const decls = parseDeclarations(match[2]!);\n for (const selector of match[1]!.split(',')) {\n const m = selector.trim().match(/^([a-z][a-z0-9]*)?\\.([\\w-]+)$/i);\n if (m) rules.push({ tag: (m[1] ?? '').toLowerCase(), cls: m[2]!, decls });\n }\n }\n if (!rules.length) return;\n root.querySelectorAll<HTMLElement>('[class]').forEach((el) => {\n const classes = el.className.split(/\\s+/).filter(Boolean);\n const merged: Declarations = new Map();\n for (const rule of rules) {\n if (!classes.includes(rule.cls)) continue;\n if (rule.tag && rule.tag !== el.tagName.toLowerCase()) continue;\n rule.decls.forEach((value, name) => merged.set(name, value));\n }\n if (!merged.size) return;\n parseDeclarations(el.getAttribute('style') ?? '').forEach((value, name) =>\n merged.set(name, value),\n );\n el.setAttribute('style', serializeDeclarations(merged));\n });\n}\n\n// ---------- service elements ----------\n\nconst DROP_TAGS = /^(STYLE|SCRIPT|META|LINK|TITLE|XML|HEAD|NOSCRIPT|TEMPLATE)$/;\n\nfunction removeJunk(root: HTMLElement): void {\n // Comments (including Word's conditional <!--[if …]-->).\n const walker = document.createTreeWalker(root, NodeFilter.SHOW_COMMENT);\n const comments: Node[] = [];\n while (walker.nextNode()) comments.push(walker.currentNode);\n comments.forEach((c) => c.parentNode?.removeChild(c));\n\n for (const el of [...root.querySelectorAll('*')]) {\n if (!root.contains(el)) continue;\n const tag = el.tagName.toUpperCase();\n if (DROP_TAGS.test(tag)) {\n el.remove();\n continue;\n }\n if (tag.includes(':')) {\n // <o:p> is Word's \"end of paragraph\", <v:…> is vector graphics (VML): removed.\n // Other namespaced tags (smart tags <st1:…>, <w:sdt>) are unwrapped.\n const prefix = tag.split(':')[0];\n if (prefix === 'O' || prefix === 'V') el.remove();\n else unwrap(el);\n }\n }\n\n // Word Online: the end of paragraph marker <span class=\"EOP\"> </span>.\n root.querySelectorAll<HTMLElement>('span.EOP').forEach((span) => {\n if (/^\\s*$/.test(span.textContent ?? '')) span.remove();\n });\n\n root.querySelectorAll<HTMLElement>('a').forEach((a) => {\n const href = a.getAttribute('href') ?? '';\n // Google Docs wraps external links in a google.com/url?q=… redirect: restore the address.\n const redirect = href.match(/^https?:\\/\\/(www\\.)?google\\.[a-z.]+\\/url\\?(.*)$/i);\n if (redirect) {\n const target = new URLSearchParams(redirect[2]).get('q');\n if (target) a.setAttribute('href', target);\n }\n // Word bookmarks and table of contents (<a name=\"_Toc…\">), links to footnotes and comments.\n if (!href || /^#_(ftn|edn|msocom|Toc|Ref)/i.test(href)) unwrap(a);\n });\n\n // Word page breaks: <br clear=all style='page-break-before:always'>.\n root.querySelectorAll<HTMLElement>('br[style*=\"page-break\"]').forEach((br) => br.remove());\n // Word's footnote and comment blocks at the end of the document.\n root\n .querySelectorAll<HTMLElement>(\n '[style*=\"mso-element:footnote-list\"], [style*=\"mso-element:comment-list\"], [style*=\"mso-element:endnote-list\"]',\n )\n .forEach((el) => el.remove());\n}\n\n// ---------- desktop Word lists: paragraphs with mso-list → <ul>/<ol> ----------\n\ninterface WordListItem {\n el: HTMLElement;\n level: number;\n ordered: boolean;\n start: number;\n /** list-style-type when it differs from the default (disc / decimal). */\n style?: string | null;\n}\n\n/**\n * A numbered list marker: \"1.\", \"1.1.\", \"1\", \"a)\", \"iv.\", \"(2)\". A letter without a dot or a parenthesis\n * is not a number: \"o\" is Word's standard marker for the second level of a bulleted list.\n */\nconst ORDERED_MARKER = /^[([]?(\\d+(\\.\\d+)*[.)\\]]?|[a-z]{1,4}[.)\\]])$/i;\n\nfunction readWordListItem(el: HTMLElement): WordListItem | null {\n const css = el.getAttribute('style') ?? '';\n const match = css.match(/mso-list:\\s*(l\\d+)\\s+level(\\d+)/i);\n if (!match) return null;\n // Word puts the marker into <span style=\"mso-list:Ignore\">1.<span> </span></span>.\n const markerEl = [...el.querySelectorAll<HTMLElement>('[style]')].find((s) =>\n /mso-list:\\s*Ignore/i.test(s.getAttribute('style') ?? ''),\n );\n const marker = (markerEl?.textContent ?? '').replace(/\\s+/g, '');\n markerEl?.remove();\n const ordered = ORDERED_MARKER.test(marker);\n const { style, start } = ordered ? numbering(marker) : { style: bulletStyle(marker), start: 1 };\n return {\n el,\n level: Math.max(1, Math.min(9, Number(match[2]))),\n ordered,\n start,\n style,\n };\n}\n\nconst ROMAN = /^(i|ii|iii|iv|v|vi|vii|viii|ix|x|xi|xii)$/i;\nconst ROMAN_VALUES: Record<string, number> = { i: 1, v: 5, x: 10 };\n\nfunction romanToNumber(roman: string): number {\n let total = 0;\n const chars = roman.toLowerCase();\n for (let i = 0; i < chars.length; i++) {\n const value = ROMAN_VALUES[chars[i]!]!;\n const next = ROMAN_VALUES[chars[i + 1] ?? ''] ?? 0;\n total += value < next ? -value : value;\n }\n return total;\n}\n\n/** Style and start of the numbering from the marker: \"3.\" → decimal from 3, \"c)\" → lower-alpha from 3, \"iv.\" → lower-roman from 4. */\nfunction numbering(marker: string): { style: string | null; start: number } {\n const digits = marker.match(/\\d+/);\n if (digits) return { style: null, start: Number(digits[0]) };\n const letters = marker.replace(/[^a-z]/gi, '');\n if (ROMAN.test(letters)) {\n return {\n style: letters === letters.toLowerCase() ? 'lower-roman' : 'upper-roman',\n start: romanToNumber(letters),\n };\n }\n const lower = letters === letters.toLowerCase();\n return {\n style: lower ? 'lower-alpha' : 'upper-alpha',\n start: letters.toLowerCase().charCodeAt(0) - 96,\n };\n}\n\n/** Word's second-level marker \"o\" is a circle, \"§\" and \"▪\" (Wingdings) a square, anything else a disc. */\nfunction bulletStyle(marker: string): string | null {\n if (marker === 'o') return 'circle';\n if (/^[§▪■]$/.test(marker)) return 'square';\n return null;\n}\n\nfunction convertWordLists(root: HTMLElement): void {\n const candidates = [\n ...root.querySelectorAll<HTMLElement>('p, div, h1, h2, h3, h4, h5, h6'),\n ].filter((el) => /mso-list:\\s*l\\d+\\s+level\\d+/i.test(el.getAttribute('style') ?? ''));\n // Numbered headings (\"1. Introduction\") are not a list: the marker stays as text.\n for (const heading of candidates.filter((el) => /^H[1-6]$/.test(el.tagName))) {\n heading.querySelectorAll<HTMLElement>('[style]').forEach((s) => {\n if (!/mso-list:\\s*Ignore/i.test(s.getAttribute('style') ?? '')) return;\n // The \"1.\" marker + an indent of non-breaking spaces → \"1. \".\n const marker = (s.textContent ?? '').replace(/\\s+/g, '');\n s.replaceWith(s.ownerDocument.createTextNode(`${marker} `));\n });\n }\n const paragraphs = candidates.filter((el) => !/^H[1-6]$/.test(el.tagName));\n const done = new Set<HTMLElement>();\n for (const first of paragraphs) {\n if (done.has(first)) continue;\n // A run: consecutive siblings that are list items.\n const run: WordListItem[] = [];\n let node: Element | null = first;\n while (node instanceof HTMLElement && paragraphs.includes(node)) {\n const item = readWordListItem(node);\n if (!item) break;\n run.push(item);\n done.add(node);\n node = nextElement(node);\n }\n if (run.length) buildNestedList(run);\n }\n}\n\nfunction nextElement(el: Element): Element | null {\n let next = el.nextSibling;\n // Skip empty text between paragraphs.\n while (next && next.nodeType === Node.TEXT_NODE && !next.textContent?.trim())\n next = next.nextSibling;\n return next instanceof Element ? next : null;\n}\n\n/** Builds nested lists from a flat run of items with levels and puts them in place of the first item. */\nfunction buildNestedList(run: WordListItem[]): void {\n const doc = run[0]!.el.ownerDocument;\n const anchor = run[0]!.el;\n const stack: { list: HTMLElement; level: number }[] = [];\n let top: HTMLElement | null = null;\n for (const item of run) {\n while (stack.length && stack[stack.length - 1]!.level > item.level) stack.pop();\n let current = stack[stack.length - 1];\n if (!current || current.level < item.level) {\n const list = doc.createElement(item.ordered ? 'ol' : 'ul');\n if (item.ordered && item.start !== 1) list.setAttribute('start', String(item.start));\n if (item.style) list.style.listStyleType = item.style;\n if (current) {\n // A nested list goes inside the parent's last item.\n const parentItem =\n current.list.lastElementChild ?? current.list.appendChild(doc.createElement('li'));\n parentItem.appendChild(list);\n } else top = list;\n current = { list, level: item.level };\n stack.push(current);\n }\n const li = doc.createElement('li');\n const p = doc.createElement('p');\n while (item.el.firstChild) p.appendChild(item.el.firstChild);\n li.appendChild(p);\n current.list.appendChild(li);\n }\n anchor.replaceWith(top!);\n run.slice(1).forEach((item) => item.el.remove());\n}\n\n// ---------- Google Docs and Word Online lists: aria-level, split <ul> ----------\n\nfunction levelOf(li: Element): number | null {\n const raw = li.getAttribute('aria-level') ?? li.getAttribute('data-aria-level');\n const n = raw ? Number(raw) : NaN;\n return Number.isFinite(n) && n >= 1 ? Math.min(9, n) : null;\n}\n\nfunction normalizeLists(root: HTMLElement): void {\n // Word Online wraps each item in <div class=\"ListContainerWrapper\"><ul>…</ul></div>.\n root.querySelectorAll<HTMLElement>('div').forEach((div) => {\n const only = div.children.length === 1 ? div.firstElementChild : null;\n if (\n only &&\n /^(UL|OL)$/.test(only.tagName) &&\n !div.textContent?.replace(only.textContent ?? '', '').trim()\n )\n unwrap(div);\n });\n\n // A list directly inside a list (<ul><li/><ul>…</ul></ul>, happens in Google Docs) goes into a nested item.\n root.querySelectorAll<HTMLElement>('ul > ul, ul > ol, ol > ul, ol > ol').forEach((list) => {\n const prev = list.previousElementSibling;\n if (prev?.tagName === 'LI') prev.appendChild(list);\n });\n\n // Runs of adjacent lists with aria-level are rebuilt with the right nesting.\n const lists = [...root.querySelectorAll<HTMLElement>('ul, ol')].filter(\n (l) =>\n !l.parentElement?.closest('ul, ol') && l.querySelector('li[aria-level], li[data-aria-level]'),\n );\n const done = new Set<Element>();\n for (const first of lists) {\n if (done.has(first) || !root.contains(first)) continue;\n const run: WordListItem[] = [];\n let node: Element | null = first;\n while (node && /^(UL|OL)$/.test(node.tagName)) {\n done.add(node);\n collectListItems(node, 1, run);\n const next = nextElement(node);\n if (node !== first) node.remove();\n node = next;\n }\n if (!run.length) continue;\n const placeholder = first.ownerDocument.createElement('div');\n first.replaceWith(placeholder);\n buildNestedListFromBlocks(run, placeholder);\n }\n}\n\n/** List items in document order: nested lists come out one level deeper (when there is no aria-level). */\nfunction collectListItems(list: Element, depth: number, run: WordListItem[]): void {\n for (const li of [...list.children]) {\n if (li.tagName !== 'LI') continue;\n const level = levelOf(li) ?? depth;\n const nested = [...li.children].filter((c) => /^(UL|OL)$/.test(c.tagName));\n nested.forEach((n) => n.remove());\n const holder = li.ownerDocument.createElement('div');\n while (li.firstChild) holder.appendChild(li.firstChild);\n run.push({\n el: holder,\n level,\n ordered: list.tagName === 'OL',\n start: Number(list.getAttribute('start') ?? 1) || 1,\n });\n nested.forEach((n) => collectListItems(n, level + 1, run));\n }\n}\n\n/** Like buildNestedList, but an item's content may already be blocks (<p>). */\nfunction buildNestedListFromBlocks(run: WordListItem[], placeholder: HTMLElement): void {\n const doc = placeholder.ownerDocument;\n const stack: { list: HTMLElement; level: number }[] = [];\n let top: HTMLElement | null = null;\n for (const item of run) {\n while (stack.length && stack[stack.length - 1]!.level > item.level) stack.pop();\n let current = stack[stack.length - 1];\n if (!current || current.level < item.level) {\n const list = doc.createElement(item.ordered ? 'ol' : 'ul');\n if (item.ordered && item.start !== 1 && !current)\n list.setAttribute('start', String(item.start));\n if (current) {\n const parentItem =\n current.list.lastElementChild ?? current.list.appendChild(doc.createElement('li'));\n parentItem.appendChild(list);\n } else top = list;\n current = { list, level: item.level };\n stack.push(current);\n }\n const li = doc.createElement('li');\n while (item.el.firstChild) li.appendChild(item.el.firstChild);\n current.list.appendChild(li);\n }\n placeholder.replaceWith(top!);\n}\n\n// ---------- Google Docs ----------\n\nfunction unwrapGoogleDocsWrapper(root: HTMLElement): void {\n // All Google Docs content is wrapped in <b style=\"font-weight:normal\" id=\"docs-internal-guid-…\">.\n root.querySelectorAll<HTMLElement>('[id^=\"docs-internal-guid-\"]').forEach(unwrap);\n // Checkbox items become regular items.\n root.querySelectorAll<HTMLElement>('li[role=\"checkbox\"]').forEach((li) => {\n li.removeAttribute('role');\n li.removeAttribute('aria-checked');\n });\n}\n\n// ---------- Word paragraph styles ----------\n\nfunction convertWordParagraphStyles(root: HTMLElement): void {\n root.querySelectorAll<HTMLElement>('p.MsoTitle, p[class*=\"Title\"]').forEach((p) => {\n if (!/\\bMsoTitle\\b|^Title$/.test(p.className)) return;\n renameElement(p, 'h1');\n });\n // Word section wrappers.\n root\n .querySelectorAll<HTMLElement>('div.WordSection1, div[class^=\"WordSection\"], div.Section1')\n .forEach(unwrap);\n}\n\n// ---------- styles ----------\n\nconst DEFAULT_TEXT_COLORS =\n /^(black|windowtext|auto|#000|#000000|rgb\\(0,\\s*0,\\s*0\\)|initial|inherit)$/i;\nconst DEFAULT_BACKGROUNDS =\n /^(transparent|white|window|auto|none|#fff|#ffffff|rgba?\\(255,\\s*255,\\s*255(,\\s*1)?\\)|rgba\\(\\d+,\\s*\\d+,\\s*\\d+,\\s*0\\)|initial|inherit)$/i;\n/** Properties that describe the look of the source document, not the meaning of the text. */\nconst CLEAN_DROP =\n /^(font|font-family|font-size|line-height|margin|margin-.+|padding|padding-.+|text-indent|letter-spacing|word-spacing|white-space|height|width|min-height|border|border-.+|tab-stops|layout-grid-mode|page-break-.+|break-.+|orphans|widows|direction|unicode-bidi|font-variant.*|text-transform)$/i;\n\nfunction cleanStyle(el: HTMLElement, mode: PasteStyles): void {\n const decls = parseDeclarations(el.getAttribute('style') ?? '');\n const out: Declarations = new Map();\n decls.forEach((value, name) => {\n if (name.startsWith('mso-')) {\n // Text highlighting in Word: mso-highlight:yellow → background color.\n if (\n name === 'mso-highlight' &&\n !DEFAULT_BACKGROUNDS.test(value) &&\n !decls.has('background-color')\n )\n out.set('background-color', value);\n return;\n }\n if (name.startsWith('-webkit-') || name.startsWith('-moz-')) return;\n if (name === 'background') {\n // Word and Excel write the background in shorthand: background:yellow. Only a plain color is taken.\n const color = value.split(/\\s+/)[0]!;\n if (/^(#[0-9a-f]{3,8}|rgba?\\([^)]*\\)|[a-z]+)$/i.test(color) && !out.has('background-color'))\n out.set('background-color', color);\n return;\n }\n if (name === 'text-decoration' || name === 'text-decoration-line') {\n // \"underline line-through\" and \"underline\" with extra parts → what the schema understands.\n if (/underline/.test(value)) out.set('text-decoration', 'underline');\n else if (/line-through/.test(value)) out.set('text-decoration', 'line-through');\n return;\n }\n if (mode === 'clean' && CLEAN_DROP.test(name)) return;\n // Vertical alignment of table cells (Sheets and Excel put \"bottom\" in every cell) is the source's look.\n if (mode === 'clean' && name === 'vertical-align' && /^(TD|TH)$/.test(el.tagName)) return;\n out.set(name, value);\n });\n\n // \"Default\" colors (black text, white/transparent background) are not formatting.\n const color = out.get('color');\n if (color && DEFAULT_TEXT_COLORS.test(color.trim()) && mode === 'clean') out.delete('color');\n const background = out.get('background-color');\n if (background && DEFAULT_BACKGROUNDS.test(background.trim())) out.delete('background-color');\n if (out.get('font-weight') === 'normal' && el.tagName !== 'B') out.delete('font-weight');\n if (out.get('font-style') === 'normal') out.delete('font-style');\n if (out.get('text-decoration') === 'none') out.delete('text-decoration');\n if (out.get('vertical-align') === 'baseline') out.delete('vertical-align');\n // Left alignment is the default, not formatting.\n if (/^(left|start)$/i.test(out.get('text-align') ?? '')) out.delete('text-align');\n\n // The blue color and underline of links are the source's look; on the site its CSS styles the links.\n if (mode === 'clean' && el.closest('a')) {\n out.delete('color');\n if (out.get('text-decoration') === 'underline') out.delete('text-decoration');\n }\n\n if (out.size) el.setAttribute('style', serializeDeclarations(out));\n else el.removeAttribute('style');\n}\n\n/** Table and cell sizes from attributes (width=\"256\", height, valign) are the source document's layout. */\nfunction stripLayoutAttributes(root: HTMLElement): void {\n root.querySelectorAll('table, tr, td, th, col, colgroup').forEach((el) => {\n el.removeAttribute('width');\n el.removeAttribute('height');\n el.removeAttribute('valign');\n });\n}\n\n// ---------- unwrapping empty wrappers, empty paragraphs, extra <br> ----------\n\nfunction unwrapMeaningless(root: HTMLElement): void {\n for (const el of [...root.querySelectorAll<HTMLElement>('span, font')].reverse()) {\n if (!root.contains(el)) continue;\n const hasFormatting =\n el.hasAttribute('style') || (el.tagName === 'FONT' && el.hasAttribute('color'));\n if (!hasFormatting) unwrap(el);\n }\n root.querySelectorAll('[class]').forEach((el) => el.removeAttribute('class'));\n root.querySelectorAll('[lang]').forEach((el) => el.removeAttribute('lang'));\n // Google Docs puts dir=\"ltr\" on every paragraph: that is the default; rtl is kept.\n root.querySelectorAll('[dir]').forEach((el) => {\n if (!/^rtl$/i.test(el.getAttribute('dir') ?? '')) el.removeAttribute('dir');\n });\n}\n\nconst BLOCK = /^(P|DIV|H[1-6]|UL|OL|TABLE|BLOCKQUOTE|PRE|HR)$/;\n\n/** <br> between top-level blocks (Google Docs puts them between paragraphs) are extra empty lines. */\nfunction removeBreaksBetweenBlocks(root: HTMLElement): void {\n root.querySelectorAll('br').forEach((br) => {\n const parent = br.parentElement;\n if (\n !parent ||\n !(\n parent === root ||\n parent.tagName === 'DIV' ||\n parent.tagName === 'TD' ||\n parent.tagName === 'LI'\n )\n )\n return;\n const prev = siblingElement(br, -1);\n const next = siblingElement(br, 1);\n if (\n (prev && BLOCK.test(prev.tagName)) ||\n (next && BLOCK.test(next.tagName)) ||\n (!prev && !next && parent === root)\n )\n br.remove();\n });\n}\n\nfunction siblingElement(node: Node, dir: -1 | 1): Element | null {\n let s = dir < 0 ? node.previousSibling : node.nextSibling;\n while (s && s.nodeType === Node.TEXT_NODE && !s.textContent?.trim())\n s = dir < 0 ? s.previousSibling : s.nextSibling;\n return s instanceof Element ? s : null;\n}\n\n/** A paragraph of a single non-breaking space (the way Word writes an empty line) is an empty paragraph. */\nfunction normalizeEmptyParagraphs(root: HTMLElement): void {\n root.querySelectorAll<HTMLElement>('p').forEach((p) => {\n if (p.children.length === 0 && /^\\s*$/.test(p.textContent ?? '')) p.textContent = '';\n });\n}\n\n/**\n * Excel and Google Sheets cells hold text without a paragraph, with the alignment set on the cell itself.\n * The inline content is wrapped in a paragraph that takes the text-align, otherwise the alignment is lost.\n */\nfunction wrapCellContent(root: HTMLElement): void {\n root.querySelectorAll<HTMLElement>('td, th').forEach((cell) => {\n // Word formulas come as MathML: a \"td\" there without style is not a table cell.\n if (!cell.style) return;\n const align = cell.style.textAlign;\n const hasBlock = [...cell.children].some((c) => BLOCK.test(c.tagName));\n if (!align || hasBlock || !cell.textContent?.trim()) return;\n const p = cell.ownerDocument.createElement('p');\n p.style.textAlign = align;\n while (cell.firstChild) p.appendChild(cell.firstChild);\n cell.appendChild(p);\n cell.style.removeProperty('text-align');\n if (!cell.getAttribute('style')) cell.removeAttribute('style');\n });\n}\n\n// ---------- utilities ----------\n\nfunction unwrap(el: Element): void {\n const parent = el.parentNode;\n if (!parent) return;\n while (el.firstChild) parent.insertBefore(el.firstChild, el);\n parent.removeChild(el);\n}\n\nfunction renameElement(el: HTMLElement, tag: string): HTMLElement {\n const next = el.ownerDocument.createElement(tag);\n for (const attr of [...el.attributes]) next.setAttribute(attr.name, attr.value);\n while (el.firstChild) next.appendChild(el.firstChild);\n el.replaceWith(next);\n return next;\n}\n"],"mappings":";AAiBA,SAAS,SAAS,KAAa,OAAuB;AACpD,MAAI,QAAQ;AACZ,WAAS,IAAI,OAAO,IAAI,IAAI,QAAQ,KAAK;AACvC,UAAM,KAAK,IAAI,CAAC;AAChB,QAAI,OAAO,MAAM;AACf;AACA;AAAA,IACF;AACA,QAAI,OAAO,IAAK;AAAA,aACP,OAAO,KAAK;AACnB;A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