@novaprose/core 0.6.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 +20 -4
- 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-K2U3VPH2.js → advlist-CEHE6YXS.js} +14 -20
- 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-XWDTLY37.js → autolink-N427KVQO.js} +13 -7
- 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-MWNRUNU3.js → autosave-L7OZ3KLK.js} +9 -13
- 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-ADLYOIB3.js → charmap-5CBBDWOP.js} +9 -14
- 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-3BOK3S3T.js +26 -0
- 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-4VPDY3LF.js +27 -0
- 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-GHEFKKRC.js → chunk-AC3YCAX4.js} +108 -29
- package/dist/chunk-AC3YCAX4.js.map +1 -0
- package/dist/{chunk-NPKAIW34.js → chunk-ADRPQLZ2.js} +50 -1
- 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-DEYYVZ7O.js +393 -0
- 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-GHVB6SV4.js +177 -0
- 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-J6W2CDRF.js +425 -0
- 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-HZRIBOPW.js → chunk-QU3KXMYT.js} +45 -3
- 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-7ON7PR5R.js → chunk-TAM2FHKG.js} +374 -52
- 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/chunk-VK6YF2AA.js +359 -0
- 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-FYJE3U64.js → comments-panel-SOLBZ46Q.js} +12 -6
- package/dist/comments-panel-SOLBZ46Q.js.map +1 -0
- package/dist/{directionality-XOHJFSL6.js → directionality-EGQKGDZA.js} +16 -11
- 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-TP4N4ZGY.js → emoticons-EGHNZKSA.js} +9 -14
- 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 +482 -0
- package/dist/html-rules.cjs.map +1 -0
- package/dist/html-rules.d.cts +89 -0
- package/dist/html-rules.d.ts +89 -0
- package/dist/html-rules.js +417 -0
- package/dist/html-rules.js.map +1 -0
- package/dist/i18n/de.cjs +670 -0
- package/dist/i18n/de.cjs.map +1 -0
- package/dist/i18n/de.d.cts +9 -0
- package/dist/i18n/de.d.ts +9 -0
- package/dist/i18n/de.js +649 -0
- package/dist/i18n/de.js.map +1 -0
- package/dist/i18n/es.cjs +670 -0
- package/dist/i18n/es.cjs.map +1 -0
- package/dist/i18n/es.d.cts +9 -0
- package/dist/i18n/es.d.ts +9 -0
- package/dist/i18n/es.js +649 -0
- package/dist/i18n/es.js.map +1 -0
- package/dist/i18n/fr.cjs +670 -0
- package/dist/i18n/fr.cjs.map +1 -0
- package/dist/i18n/fr.d.cts +9 -0
- package/dist/i18n/fr.d.ts +9 -0
- package/dist/i18n/fr.js +649 -0
- package/dist/i18n/fr.js.map +1 -0
- package/dist/i18n/it.cjs +670 -0
- package/dist/i18n/it.cjs.map +1 -0
- package/dist/i18n/it.d.cts +9 -0
- package/dist/i18n/it.d.ts +9 -0
- package/dist/i18n/it.js +649 -0
- package/dist/i18n/it.js.map +1 -0
- package/dist/i18n/pt-BR.cjs +670 -0
- package/dist/i18n/pt-BR.cjs.map +1 -0
- package/dist/i18n/pt-BR.d.cts +9 -0
- package/dist/i18n/pt-BR.d.ts +9 -0
- package/dist/i18n/pt-BR.js +649 -0
- package/dist/i18n/pt-BR.js.map +1 -0
- package/dist/i18n/ru.cjs +670 -0
- package/dist/i18n/ru.cjs.map +1 -0
- package/dist/i18n/ru.d.cts +10 -0
- package/dist/i18n/ru.d.ts +10 -0
- package/dist/i18n/ru.js +649 -0
- package/dist/i18n/ru.js.map +1 -0
- 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-CZ9yDvmQ.d.cts +235 -0
- package/dist/index-CZ9yDvmQ.d.ts +235 -0
- package/dist/index.cjs +29531 -10134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +160 -1828
- package/dist/index.d.ts +160 -1828
- package/dist/index.js +212 -1480
- package/dist/index.js.map +1 -1
- package/dist/{insertdatetime-T4SEMQWP.js → insertdatetime-YW2VHYZH.js} +10 -16
- 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 +356 -0
- package/dist/markdown.cjs.map +1 -0
- package/dist/markdown.d.cts +25 -0
- package/dist/markdown.d.ts +25 -0
- package/dist/markdown.js +10 -0
- package/dist/markdown.js.map +1 -0
- 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-HG5HV6AL.js → nonbreaking-GYRUH4UO.js} +10 -9
- 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-3A6KWKCV.js +520 -0
- 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-4NU4SIPL.js → quickbars-UZ2Q67TX.js} +24 -12
- package/dist/quickbars-UZ2Q67TX.js.map +1 -0
- package/dist/{revisionhistory-3YQPLPLM.js → revisionhistory-ACRB23HL.js} +48 -173
- 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-RTAYJOGR.js → visualblocks-O5QW7ZDT.js} +10 -9
- 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 +96 -6
- package/src/style.css +440 -508
- package/dist/advlist-K2U3VPH2.js.map +0 -1
- package/dist/autolink-XWDTLY37.js.map +0 -1
- package/dist/autoresize-UB3GOA6D.js.map +0 -1
- package/dist/autosave-MWNRUNU3.js.map +0 -1
- package/dist/charmap-ADLYOIB3.js.map +0 -1
- package/dist/chunk-435CRWKA.js +0 -983
- package/dist/chunk-435CRWKA.js.map +0 -1
- package/dist/chunk-46RIM5KP.js +0 -5949
- package/dist/chunk-46RIM5KP.js.map +0 -1
- package/dist/chunk-6RJENZXT.js +0 -104
- package/dist/chunk-6RJENZXT.js.map +0 -1
- package/dist/chunk-7ON7PR5R.js.map +0 -1
- package/dist/chunk-GHEFKKRC.js.map +0 -1
- package/dist/chunk-HPLT3XRZ.js.map +0 -1
- package/dist/chunk-HZRIBOPW.js.map +0 -1
- package/dist/chunk-NPKAIW34.js.map +0 -1
- package/dist/chunk-Z3ELZ77W.js.map +0 -1
- package/dist/comments-panel-FYJE3U64.js.map +0 -1
- package/dist/directionality-XOHJFSL6.js.map +0 -1
- package/dist/emoticons-TP4N4ZGY.js.map +0 -1
- package/dist/insertdatetime-T4SEMQWP.js.map +0 -1
- package/dist/nonbreaking-HG5HV6AL.js.map +0 -1
- package/dist/quickbars-4NU4SIPL.js.map +0 -1
- package/dist/revisionhistory-3YQPLPLM.js.map +0 -1
- package/dist/visualblocks-RTAYJOGR.js.map +0 -1
|
@@ -1,23 +1,49 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./chunk-46RIM5KP.js";
|
|
5
|
-
import "./chunk-435CRWKA.js";
|
|
6
|
-
import "./chunk-7ON7PR5R.js";
|
|
2
|
+
diffDocs
|
|
3
|
+
} from "./chunk-SCIRO4XK.js";
|
|
7
4
|
import {
|
|
8
|
-
|
|
9
|
-
} from "./chunk-
|
|
5
|
+
parseContent
|
|
6
|
+
} from "./chunk-EXX2S352.js";
|
|
7
|
+
import "./chunk-4I4AYH2K.js";
|
|
8
|
+
import "./chunk-YVSUR7E5.js";
|
|
9
|
+
import "./chunk-66INZHZ2.js";
|
|
10
|
+
import "./chunk-GTLE2HEW.js";
|
|
11
|
+
import "./chunk-6LQM7G4V.js";
|
|
12
|
+
import "./chunk-6YSQGFV7.js";
|
|
13
|
+
import "./chunk-IG2BL4ON.js";
|
|
14
|
+
import "./chunk-J6W2CDRF.js";
|
|
15
|
+
import "./chunk-GHVB6SV4.js";
|
|
16
|
+
import "./chunk-ANE5ASXG.js";
|
|
17
|
+
import "./chunk-23ZLVT5D.js";
|
|
18
|
+
import "./chunk-FTEA6L2Q.js";
|
|
19
|
+
import "./chunk-MZGNOHSY.js";
|
|
20
|
+
import "./chunk-YDPZCVXS.js";
|
|
10
21
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
HTMLSerializer
|
|
23
|
+
} from "./chunk-53AY5NAF.js";
|
|
24
|
+
import "./chunk-OQMMHWMZ.js";
|
|
25
|
+
import "./chunk-AC3YCAX4.js";
|
|
26
|
+
import "./chunk-HNEAVVBC.js";
|
|
27
|
+
import "./chunk-TAM2FHKG.js";
|
|
28
|
+
import "./chunk-XR7CY4NI.js";
|
|
14
29
|
import {
|
|
15
30
|
icons
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import
|
|
31
|
+
} from "./chunk-ADRPQLZ2.js";
|
|
32
|
+
import {
|
|
33
|
+
pickLabels
|
|
34
|
+
} from "./chunk-DEYYVZ7O.js";
|
|
18
35
|
import {
|
|
19
36
|
definePlugin
|
|
20
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-V7WUHUHM.js";
|
|
38
|
+
import {
|
|
39
|
+
h,
|
|
40
|
+
uniqueId
|
|
41
|
+
} from "./chunk-QU3KXMYT.js";
|
|
42
|
+
import "./chunk-G74HNSB6.js";
|
|
43
|
+
import "./chunk-OOVNE6MB.js";
|
|
44
|
+
import "./chunk-3BOK3S3T.js";
|
|
45
|
+
import "./chunk-YDF55N6Z.js";
|
|
46
|
+
import "./chunk-4VPDY3LF.js";
|
|
21
47
|
|
|
22
48
|
// src/plugins/revisionhistory.ts
|
|
23
49
|
import { Node as PMNode } from "prosemirror-model";
|
|
@@ -25,143 +51,8 @@ import { closeHistory } from "prosemirror-history";
|
|
|
25
51
|
import { EditorState } from "prosemirror-state";
|
|
26
52
|
import { Decoration, DecorationSet, EditorView } from "prosemirror-view";
|
|
27
53
|
|
|
28
|
-
// src/plugins/
|
|
29
|
-
var
|
|
30
|
-
function textblocks(doc) {
|
|
31
|
-
const blocks = [];
|
|
32
|
-
doc.descendants((node, pos) => {
|
|
33
|
-
if (!node.isTextblock) return true;
|
|
34
|
-
let text = "";
|
|
35
|
-
const chars = [];
|
|
36
|
-
node.forEach((child, offset) => {
|
|
37
|
-
const start = pos + 1 + offset;
|
|
38
|
-
if (child.isText) {
|
|
39
|
-
for (let k = 0; k < child.text.length; k += 1) chars.push(start + k);
|
|
40
|
-
text += child.text;
|
|
41
|
-
} else {
|
|
42
|
-
const leaf = child.type.spec.leafText?.(child) ?? " ";
|
|
43
|
-
for (let k = 0; k < leaf.length; k += 1) chars.push(start);
|
|
44
|
-
text += leaf;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
blocks.push({
|
|
48
|
-
pos,
|
|
49
|
-
end: pos + node.nodeSize - 1,
|
|
50
|
-
depth: doc.resolve(pos).depth,
|
|
51
|
-
type: node.type.name,
|
|
52
|
-
text,
|
|
53
|
-
chars
|
|
54
|
-
});
|
|
55
|
-
return false;
|
|
56
|
-
});
|
|
57
|
-
return blocks;
|
|
58
|
-
}
|
|
59
|
-
function lcs(a, b, eq) {
|
|
60
|
-
const n = a.length;
|
|
61
|
-
const m = b.length;
|
|
62
|
-
if ((n + 1) * (m + 1) > MAX_CELLS) return null;
|
|
63
|
-
const table = new Uint32Array((n + 1) * (m + 1));
|
|
64
|
-
const at = (i2, j2) => i2 * (m + 1) + j2;
|
|
65
|
-
for (let i2 = n - 1; i2 >= 0; i2 -= 1) {
|
|
66
|
-
for (let j2 = m - 1; j2 >= 0; j2 -= 1) {
|
|
67
|
-
table[at(i2, j2)] = eq(a[i2], b[j2]) ? table[at(i2 + 1, j2 + 1)] + 1 : Math.max(table[at(i2 + 1, j2)], table[at(i2, j2 + 1)]);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const pairs = [];
|
|
71
|
-
let i = 0;
|
|
72
|
-
let j = 0;
|
|
73
|
-
while (i < n && j < m) {
|
|
74
|
-
if (eq(a[i], b[j])) {
|
|
75
|
-
pairs.push([i, j]);
|
|
76
|
-
i += 1;
|
|
77
|
-
j += 1;
|
|
78
|
-
} else if (table[at(i + 1, j)] >= table[at(i, j + 1)]) i += 1;
|
|
79
|
-
else j += 1;
|
|
80
|
-
}
|
|
81
|
-
return pairs;
|
|
82
|
-
}
|
|
83
|
-
var tokenize = (text) => text.split(/(\s+)/).filter(Boolean);
|
|
84
|
-
function addRange(result, from, to) {
|
|
85
|
-
if (from >= to) return;
|
|
86
|
-
const last = result.added[result.added.length - 1];
|
|
87
|
-
if (last && last.to >= from) last.to = Math.max(last.to, to);
|
|
88
|
-
else result.added.push({ from, to });
|
|
89
|
-
}
|
|
90
|
-
function diffBlock(result, rev, cur) {
|
|
91
|
-
if (rev.text === cur.text) {
|
|
92
|
-
if (rev.text) addRange(result, rev.chars[0], rev.end);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const a = tokenize(rev.text);
|
|
96
|
-
const b = tokenize(cur.text);
|
|
97
|
-
const pairs = lcs(a, b, (x, y) => x === y);
|
|
98
|
-
if (!pairs) {
|
|
99
|
-
if (rev.text) addRange(result, rev.chars[0], rev.end);
|
|
100
|
-
if (cur.text) result.removed.push({ pos: rev.end, text: cur.text, block: false });
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const offsets = [];
|
|
104
|
-
let offset = 0;
|
|
105
|
-
for (const token of a) {
|
|
106
|
-
offsets.push(offset);
|
|
107
|
-
offset += token.length;
|
|
108
|
-
}
|
|
109
|
-
const charPos = (index) => index < rev.chars.length ? rev.chars[index] : rev.end;
|
|
110
|
-
let i = 0;
|
|
111
|
-
let j = 0;
|
|
112
|
-
const flushRemoved = (until, atToken) => {
|
|
113
|
-
const text = b.slice(j, until).join("");
|
|
114
|
-
if (text.trim()) {
|
|
115
|
-
const pos = atToken < a.length ? charPos(offsets[atToken]) : rev.end;
|
|
116
|
-
result.removed.push({ pos, text, block: false });
|
|
117
|
-
}
|
|
118
|
-
j = until;
|
|
119
|
-
};
|
|
120
|
-
for (const [pi, pj] of [...pairs, [a.length, b.length]]) {
|
|
121
|
-
for (; i < pi; i += 1) {
|
|
122
|
-
if (!a[i].trim()) continue;
|
|
123
|
-
const start = offsets[i];
|
|
124
|
-
addRange(result, charPos(start), charPos(start + a[i].length - 1) + 1);
|
|
125
|
-
}
|
|
126
|
-
flushRemoved(pj, pi);
|
|
127
|
-
i = pi + 1;
|
|
128
|
-
j = pj + 1;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function blockAnchor(revision, next, depth) {
|
|
132
|
-
if (!next) return revision.content.size;
|
|
133
|
-
if (depth >= next.depth) return next.pos;
|
|
134
|
-
return revision.resolve(next.pos).before(depth + 1);
|
|
135
|
-
}
|
|
136
|
-
function diffDocs(revision, current) {
|
|
137
|
-
const result = { added: [], removed: [] };
|
|
138
|
-
const rev = textblocks(revision);
|
|
139
|
-
const cur = textblocks(current);
|
|
140
|
-
const same = (x, y) => x.type === y.type && x.text === y.text;
|
|
141
|
-
const pairs = lcs(rev, cur, same) ?? [];
|
|
142
|
-
let i = 0;
|
|
143
|
-
let j = 0;
|
|
144
|
-
for (const [pi, pj] of [...pairs, [rev.length, cur.length]]) {
|
|
145
|
-
const revGap = rev.slice(i, pi);
|
|
146
|
-
const curGap = cur.slice(j, pj);
|
|
147
|
-
const common = Math.min(revGap.length, curGap.length);
|
|
148
|
-
for (let k = 0; k < common; k += 1) diffBlock(result, revGap[k], curGap[k]);
|
|
149
|
-
for (const block of revGap.slice(common)) {
|
|
150
|
-
if (block.text) addRange(result, block.chars[0], block.end);
|
|
151
|
-
}
|
|
152
|
-
for (const block of curGap.slice(common)) {
|
|
153
|
-
if (!block.text.trim()) continue;
|
|
154
|
-
result.removed.push({
|
|
155
|
-
pos: blockAnchor(revision, rev[pi], block.depth),
|
|
156
|
-
text: block.text,
|
|
157
|
-
block: true
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
i = pi + 1;
|
|
161
|
-
j = pj + 1;
|
|
162
|
-
}
|
|
163
|
-
return result;
|
|
164
|
-
}
|
|
54
|
+
// nova-raw-css:/home/runner/work/novaprose/novaprose/packages/core/src/plugins/revisionhistory.css?raw
|
|
55
|
+
var revisionhistory_default = '.nova-editor.nova-history-open{min-height:460px}.nova-history{position:absolute;inset:0;z-index:5;display:flex;flex-direction:column;border-radius:inherit;background:var(--nova-bg);container-type:inline-size}.nova-history-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;padding:8px 10px;border-bottom:1px solid var(--nova-border);background:var(--nova-toolbar-bg)}.nova-history-title{margin:0;font-size:15px;font-weight:600}.nova-history-spacer{flex:1}.nova-history-legend{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;color:var(--nova-muted);font-size:12px}.nova-history-toggle{display:inline-flex;align-items:center;gap:5px}.nova-history-toggle input{accent-color:var(--nova-accent)}.nova-history-swatch:before{content:"";display:inline-block;width:10px;height:10px;margin-inline-end:5px;border-radius:2px;vertical-align:-1px}.nova-history-swatch.is-added:before{background:var(--nova-diff-added-bg)}.nova-history-swatch.is-removed:before{background:var(--nova-diff-removed-bg)}.nova-history-body{display:flex;flex:1;min-height:0}.nova-history-preview{flex:1;min-width:0;overflow:auto}.nova-history-side{width:260px;flex:none;overflow:auto;padding:8px;border-inline-start:1px solid var(--nova-border);background:var(--nova-toolbar-bg)}.nova-history-status:empty{display:none}.nova-history-status{margin:4px 4px 8px;color:var(--nova-muted);font-size:13px}.nova-history-list{display:flex;flex-direction:column;gap:2px;margin:0;padding:0;list-style:none}.nova-history-item{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:7px 9px;border:1px solid transparent;border-radius:var(--nova-radius-sm);background:none;color:inherit;font:inherit;font-size:13px;text-align:start;cursor:pointer}.nova-history-item:hover{background:var(--nova-hover)}.nova-history-item[aria-current=true]{border-color:var(--nova-accent);background:var(--nova-active)}.nova-history-item:focus-visible{outline:2px solid var(--nova-focus);outline-offset:1px}.nova-history-time{font-weight:600}.nova-history-label{padding:0 6px;border-radius:999px;background:var(--nova-hover);font-size:12px}.nova-history-authors{color:var(--nova-muted);font-size:12px}.nova-diff-added{background:var(--nova-diff-added-bg);text-decoration:underline 2px var(--nova-success);text-underline-offset:3px}.nova-diff-removed{background:var(--nova-diff-removed-bg);color:var(--nova-danger);text-decoration:line-through}div.nova-diff-removed{margin:.5em 0;padding:2px 6px;border-radius:var(--nova-radius-sm)}@container (max-width: 600px){.nova-history-body{flex-direction:column-reverse}.nova-history-side{width:auto;max-height:150px;border-inline-start:0;border-bottom:1px solid var(--nova-border)}}.nova-history-legend{order:1;flex-basis:100%}';
|
|
165
56
|
|
|
166
57
|
// src/plugins/revisionhistory.ts
|
|
167
58
|
var LABELS = {
|
|
@@ -182,24 +73,6 @@ var LABELS = {
|
|
|
182
73
|
empty: "No saved versions yet.",
|
|
183
74
|
restored: "Restored the version from {date}. Undo with Ctrl+Z.",
|
|
184
75
|
versions: "Versions"
|
|
185
|
-
},
|
|
186
|
-
ru: {
|
|
187
|
-
button: "\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u0432\u0435\u0440\u0441\u0438\u0439",
|
|
188
|
-
title: "\u0418\u0441\u0442\u043E\u0440\u0438\u044F \u0432\u0435\u0440\u0441\u0438\u0439",
|
|
189
|
-
current: "\u0422\u0435\u043A\u0443\u0449\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F",
|
|
190
|
-
restore: "\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u044D\u0442\u0443 \u0432\u0435\u0440\u0441\u0438\u044E",
|
|
191
|
-
close: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C",
|
|
192
|
-
save: "\u0421\u043E\u0445\u0440\u0430\u043D\u0438\u0442\u044C \u0432\u0435\u0440\u0441\u0438\u044E",
|
|
193
|
-
saved: "\u0412\u0435\u0440\u0441\u0438\u044F \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0430",
|
|
194
|
-
highlight: "\u041F\u043E\u043A\u0430\u0437\u044B\u0432\u0430\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F",
|
|
195
|
-
onlyHere: "\u0422\u043E\u043B\u044C\u043A\u043E \u0432 \u044D\u0442\u043E\u0439 \u0432\u0435\u0440\u0441\u0438\u0438",
|
|
196
|
-
onlyNow: "\u0422\u043E\u043B\u044C\u043A\u043E \u0432 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u0442\u0435\u043A\u0441\u0442\u0435",
|
|
197
|
-
loading: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",
|
|
198
|
-
failed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0438\u0441\u0442\u043E\u0440\u0438\u044E \u0432\u0435\u0440\u0441\u0438\u0439.",
|
|
199
|
-
retry: "\u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",
|
|
200
|
-
empty: "\u0421\u043E\u0445\u0440\u0430\u043D\u0451\u043D\u043D\u044B\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \u043F\u043E\u043A\u0430 \u043D\u0435\u0442.",
|
|
201
|
-
restored: "\u0412\u043E\u0441\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430 \u0432\u0435\u0440\u0441\u0438\u044F \u043E\u0442 {date}. \u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C \u2014 Ctrl+Z.",
|
|
202
|
-
versions: "\u0412\u0435\u0440\u0441\u0438\u0438"
|
|
203
76
|
}
|
|
204
77
|
};
|
|
205
78
|
var ICON = icons.history;
|
|
@@ -209,7 +82,7 @@ function toDoc(editor, content) {
|
|
|
209
82
|
return parseContent(editor.schema, html);
|
|
210
83
|
}
|
|
211
84
|
function openHistory(editor, options) {
|
|
212
|
-
const labels = pickLabels(editor, LABELS);
|
|
85
|
+
const labels = pickLabels(editor, "revisionhistory", LABELS);
|
|
213
86
|
const lang = editor.options.language ?? "en";
|
|
214
87
|
const dateFormat = new Intl.DateTimeFormat(lang, { dateStyle: "medium", timeStyle: "short" });
|
|
215
88
|
const titleId = uniqueId("nova-history-title");
|
|
@@ -426,16 +299,17 @@ function openHistory(editor, options) {
|
|
|
426
299
|
});
|
|
427
300
|
return { close, element: view };
|
|
428
301
|
}
|
|
429
|
-
var
|
|
302
|
+
var revisionhistory_default2 = definePlugin({
|
|
430
303
|
name: "revisionhistory",
|
|
431
304
|
toolbar: "revisionhistory",
|
|
432
305
|
setup(editor) {
|
|
306
|
+
editor.ui.addStyles("nova-revisionhistory", revisionhistory_default);
|
|
433
307
|
const options = editor.options.pluginOptions?.revisionhistory;
|
|
434
308
|
if (!options?.list || !options.load) {
|
|
435
309
|
console.warn("[nova] revisionhistory: set pluginOptions.revisionhistory.list and .load");
|
|
436
310
|
return;
|
|
437
311
|
}
|
|
438
|
-
const labels = pickLabels(editor, LABELS);
|
|
312
|
+
const labels = pickLabels(editor, "revisionhistory", LABELS);
|
|
439
313
|
let current = null;
|
|
440
314
|
const open = () => {
|
|
441
315
|
if (current?.element.isConnected) return;
|
|
@@ -455,6 +329,7 @@ var revisionhistory_default = definePlugin({
|
|
|
455
329
|
}
|
|
456
330
|
});
|
|
457
331
|
export {
|
|
458
|
-
|
|
332
|
+
LABELS,
|
|
333
|
+
revisionhistory_default2 as default
|
|
459
334
|
};
|
|
460
|
-
//# sourceMappingURL=revisionhistory-
|
|
335
|
+
//# sourceMappingURL=revisionhistory-ACRB23HL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/revisionhistory.ts","nova-raw-css:/home/runner/work/novaprose/novaprose/packages/core/src/plugins/revisionhistory.css?raw"],"sourcesContent":["import { icons } from '../ui/icons';\nimport { Node as PMNode } from 'prosemirror-model';\nimport { closeHistory } from 'prosemirror-history';\nimport { EditorState } from 'prosemirror-state';\nimport { Decoration, DecorationSet, EditorView } from 'prosemirror-view';\nimport { parseContent, type Editor } from '../editor';\nimport { definePlugin } from '../plugins';\nimport { HTMLSerializer } from '../serializer';\nimport { h, uniqueId } from '../ui/dom';\nimport { diffDocs } from './history-diff';\nimport { pickLabels } from './shared';\nimport css from './revisionhistory.css?raw';\n\n/**\n * The revisionhistory plugin (named as in TinyMCE): the document's version history. A list of\n * versions, viewing a version with the differences from the current text highlighted, and\n * restoring (an ordinary edit — Ctrl+Z undoes it). Your app decides where versions come from:\n * `pluginOptions.revisionhistory` ({@link RevisionHistoryOptions}); with collaboration, `sync.versions()` from @novaprose/collab.\n */\n\nexport interface Revision {\n id: string;\n /** Time of the version, ms since 1970. */\n createdAt: number;\n /** Who changed the document in this version. */\n authors?: string[];\n /** Name of the version (\"Sent to legal\") if it was saved by hand. */\n label?: string | null;\n}\n\nexport interface RevisionHistoryOptions {\n /** The list of versions (order doesn't matter: newest are shown first). */\n list: () => Promise<Revision[]>;\n /** A version's content: HTML or a JSON document. */\n load: (revision: Revision, editor: Editor) => Promise<string | Record<string, unknown>>;\n /** \"Save version\" (the button appears when this is set). */\n save?: (label?: string) => Promise<void>;\n /** A version was restored (after the content was already replaced). */\n onRestore?: (revision: Revision) => void;\n}\n\nexport const LABELS = {\n en: {\n button: 'Version history',\n title: 'Version history',\n current: 'Current version',\n restore: 'Restore this version',\n close: 'Close',\n save: 'Save version',\n saved: 'Version saved',\n highlight: 'Highlight changes',\n onlyHere: 'Only in this version',\n onlyNow: 'Only in the current text',\n loading: 'Loading…',\n failed: 'Could not load the version history.',\n retry: 'Try again',\n empty: 'No saved versions yet.',\n restored: 'Restored the version from {date}. Undo with Ctrl+Z.',\n versions: 'Versions',\n },\n};\n\nconst ICON = icons.history;\n\nconst serializer = new HTMLSerializer();\n\n/** A version's content → a document through HTML: the same checks of links, styles and markup as everywhere. */\nfunction toDoc(editor: Editor, content: string | Record<string, unknown>): PMNode {\n const html =\n typeof content === 'string'\n ? content\n : serializer.serializeFragment(PMNode.fromJSON(editor.schema, content).content);\n return parseContent(editor.schema, html);\n}\n\nfunction openHistory(editor: Editor, options: RevisionHistoryOptions) {\n const labels = pickLabels(editor, 'revisionhistory', LABELS);\n const lang = editor.options.language ?? 'en';\n const dateFormat = new Intl.DateTimeFormat(lang, { dateStyle: 'medium', timeStyle: 'short' });\n const titleId = uniqueId('nova-history-title');\n\n let revisions: Revision[] = [];\n let selected: Revision | null = null;\n let selectedDoc: PMNode | null = null;\n let highlight = true;\n let preview: EditorView | null = null;\n let loadToken = 0;\n\n const list = h('ol', { className: 'nova-history-list', 'aria-label': labels.versions });\n const previewHost = h('div', { className: 'nova-history-preview' });\n const status = h('p', { className: 'nova-history-status', role: 'status' });\n const restoreBtn = h(\n 'button',\n { type: 'button', className: 'nova-button nova-button-primary', disabled: true },\n labels.restore,\n );\n const highlightBox = h('input', { type: 'checkbox', checked: true });\n const legend = h(\n 'div',\n { className: 'nova-history-legend' },\n h('label', { className: 'nova-history-toggle' }, highlightBox, labels.highlight),\n h('span', { className: 'nova-history-swatch is-added' }, labels.onlyHere),\n h('span', { className: 'nova-history-swatch is-removed' }, labels.onlyNow),\n );\n const saveBtn = options.save\n ? h('button', { type: 'button', className: 'nova-button' }, labels.save)\n : null;\n const closeBtn = h('button', { type: 'button', className: 'nova-button' }, labels.close);\n\n const view = h(\n 'section',\n { className: 'nova-history', role: 'region', 'aria-labelledby': titleId },\n h(\n 'header',\n { className: 'nova-history-head' },\n h('h2', { id: titleId, className: 'nova-history-title' }, labels.title),\n legend,\n h('span', { className: 'nova-history-spacer' }),\n saveBtn,\n restoreBtn,\n closeBtn,\n ),\n h(\n 'div',\n { className: 'nova-history-body' },\n previewHost,\n h('aside', { className: 'nova-history-side' }, status, list),\n ),\n );\n\n const decorationsFor = (doc: PMNode) => {\n if (!highlight || !selected) return DecorationSet.empty;\n const { added, removed } = diffDocs(doc, editor.view.state.doc);\n const decorations = [\n ...added.map((r) => Decoration.inline(r.from, r.to, { class: 'nova-diff-added' })),\n ...removed.map((r) =>\n Decoration.widget(\n r.pos,\n () => h(r.block ? 'div' : 'span', { className: 'nova-diff-removed' }, r.text),\n { side: -1, ignoreSelection: true },\n ),\n ),\n ];\n return DecorationSet.create(doc, decorations);\n };\n\n const showDoc = (doc: PMNode) => {\n selectedDoc = doc;\n const state = EditorState.create({ doc });\n const decorations = decorationsFor(doc);\n if (preview) {\n preview.setProps({ state, decorations: () => decorations });\n return;\n }\n preview = new EditorView(previewHost, {\n state,\n editable: () => false,\n decorations: () => decorations,\n attributes: {\n class: 'nova-prosemirror nova-history-doc',\n 'aria-label': labels.title,\n 'aria-readonly': 'true',\n },\n });\n };\n\n const renderList = () => {\n const items: { revision: Revision | null; title: string; detail: string; label?: string }[] = [\n { revision: null, title: labels.current, detail: '' },\n ...[...revisions]\n .sort((a, b) => b.createdAt - a.createdAt)\n .map((revision) => ({\n revision,\n title: dateFormat.format(revision.createdAt),\n detail: (revision.authors ?? []).join(', '),\n ...(revision.label ? { label: revision.label } : {}),\n })),\n ];\n list.replaceChildren(\n ...items.map((item) => {\n const isSelected = item.revision?.id === selected?.id && !!item.revision === !!selected;\n const button = h(\n 'button',\n {\n type: 'button',\n className: 'nova-history-item',\n 'aria-current': isSelected ? 'true' : null,\n tabindex: isSelected ? '0' : '-1',\n 'data-revision': item.revision?.id ?? 'current',\n },\n h('span', { className: 'nova-history-time' }, item.title),\n item.label ? h('span', { className: 'nova-history-label' }, item.label) : null,\n item.detail ? h('span', { className: 'nova-history-authors' }, item.detail) : null,\n );\n button.addEventListener('click', () => {\n void select(item.revision);\n // Safari doesn't focus a button on click: without this, Esc and the arrows would miss the history.\n focusSelected();\n });\n return h('li', {}, button);\n }),\n );\n };\n\n function focusSelected() {\n list.querySelector<HTMLButtonElement>('.nova-history-item[aria-current=\"true\"]')?.focus();\n }\n\n async function select(revision: Revision | null) {\n selected = revision;\n renderList();\n restoreBtn.disabled = true;\n const token = ++loadToken;\n if (!revision) {\n showDoc(editor.view.state.doc);\n return;\n }\n status.textContent = labels.loading;\n try {\n const content = await options.load(revision, editor);\n if (token !== loadToken) return;\n showDoc(toDoc(editor, content));\n status.textContent = '';\n restoreBtn.disabled = !editor.isEditable();\n } catch {\n if (token === loadToken) status.textContent = labels.failed;\n }\n }\n\n async function loadList() {\n status.textContent = labels.loading;\n try {\n revisions = (await options.list()).filter((r) => r && typeof r.id === 'string');\n status.textContent = revisions.length ? '' : labels.empty;\n renderList();\n } catch {\n status.replaceChildren(\n labels.failed,\n ' ',\n h(\n 'button',\n { type: 'button', className: 'nova-link-btn', onClick: () => void loadList() },\n labels.retry,\n ),\n );\n }\n }\n\n function close() {\n preview?.destroy();\n view.remove();\n editor.root.classList.remove('nova-history-open');\n editor.focus();\n }\n\n restoreBtn.addEventListener('click', () => {\n if (!selected || !selectedDoc) return;\n const revision = selected;\n const { state } = editor.view;\n // A separate undo step: it doesn't merge with an edit made a second before the restore.\n editor.view.dispatch(\n closeHistory(state.tr.replaceWith(0, state.doc.content.size, selectedDoc.content)),\n );\n options.onRestore?.(revision);\n editor.ui.notify({\n text: labels.restored.replace('{date}', dateFormat.format(revision.createdAt)),\n type: 'success',\n });\n close();\n });\n saveBtn?.addEventListener('click', async () => {\n saveBtn.disabled = true;\n try {\n await options.save!();\n editor.ui.notify({ text: labels.saved, type: 'success' });\n await loadList();\n focusSelected();\n } finally {\n saveBtn.disabled = false;\n }\n });\n closeBtn.addEventListener('click', close);\n highlightBox.addEventListener('change', () => {\n highlight = highlightBox.checked;\n if (selectedDoc) showDoc(selectedDoc);\n });\n view.addEventListener('keydown', (event) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n close();\n return;\n }\n // Arrows across the version list (one element in the Tab order, a \"roving tabindex\").\n const target = event.target as HTMLElement;\n if (!target.classList.contains('nova-history-item')) return;\n if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp') return;\n event.preventDefault();\n const buttons = [...list.querySelectorAll<HTMLButtonElement>('.nova-history-item')];\n const next =\n buttons[buttons.indexOf(target as HTMLButtonElement) + (event.key === 'ArrowDown' ? 1 : -1)];\n next?.click();\n list.querySelector<HTMLButtonElement>(`[data-revision=\"${next?.dataset.revision}\"]`)?.focus();\n });\n\n editor.ui.closeOverlays();\n editor.root.classList.add('nova-history-open');\n editor.root.append(view);\n void select(null);\n void loadList().then(() => {\n list.querySelector<HTMLButtonElement>('.nova-history-item')?.focus();\n });\n return { close, element: view };\n}\n\nexport default definePlugin({\n name: 'revisionhistory',\n toolbar: 'revisionhistory',\n setup(editor) {\n editor.ui.addStyles('nova-revisionhistory', css);\n const options = editor.options.pluginOptions?.revisionhistory as\n RevisionHistoryOptions | undefined;\n if (!options?.list || !options.load) {\n console.warn('[nova] revisionhistory: set pluginOptions.revisionhistory.list and .load');\n return;\n }\n const labels = pickLabels(editor, 'revisionhistory', LABELS);\n let current: ReturnType<typeof openHistory> | null = null;\n const open = () => {\n if (current?.element.isConnected) return;\n current = openHistory(editor, options);\n };\n editor.ui.registry.addButton('revisionhistory', {\n icon: ICON,\n tooltip: labels.button,\n onAction: open,\n });\n editor.ui.registry.addMenuItem('revisionhistory', {\n text: labels.button,\n icon: ICON,\n onAction: open,\n });\n return () => current?.close();\n },\n});\n",".nova-editor.nova-history-open{min-height:460px}.nova-history{position:absolute;inset:0;z-index:5;display:flex;flex-direction:column;border-radius:inherit;background:var(--nova-bg);container-type:inline-size}.nova-history-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px;padding:8px 10px;border-bottom:1px solid var(--nova-border);background:var(--nova-toolbar-bg)}.nova-history-title{margin:0;font-size:15px;font-weight:600}.nova-history-spacer{flex:1}.nova-history-legend{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;color:var(--nova-muted);font-size:12px}.nova-history-toggle{display:inline-flex;align-items:center;gap:5px}.nova-history-toggle input{accent-color:var(--nova-accent)}.nova-history-swatch:before{content:\"\";display:inline-block;width:10px;height:10px;margin-inline-end:5px;border-radius:2px;vertical-align:-1px}.nova-history-swatch.is-added:before{background:var(--nova-diff-added-bg)}.nova-history-swatch.is-removed:before{background:var(--nova-diff-removed-bg)}.nova-history-body{display:flex;flex:1;min-height:0}.nova-history-preview{flex:1;min-width:0;overflow:auto}.nova-history-side{width:260px;flex:none;overflow:auto;padding:8px;border-inline-start:1px solid var(--nova-border);background:var(--nova-toolbar-bg)}.nova-history-status:empty{display:none}.nova-history-status{margin:4px 4px 8px;color:var(--nova-muted);font-size:13px}.nova-history-list{display:flex;flex-direction:column;gap:2px;margin:0;padding:0;list-style:none}.nova-history-item{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:7px 9px;border:1px solid transparent;border-radius:var(--nova-radius-sm);background:none;color:inherit;font:inherit;font-size:13px;text-align:start;cursor:pointer}.nova-history-item:hover{background:var(--nova-hover)}.nova-history-item[aria-current=true]{border-color:var(--nova-accent);background:var(--nova-active)}.nova-history-item:focus-visible{outline:2px solid var(--nova-focus);outline-offset:1px}.nova-history-time{font-weight:600}.nova-history-label{padding:0 6px;border-radius:999px;background:var(--nova-hover);font-size:12px}.nova-history-authors{color:var(--nova-muted);font-size:12px}.nova-diff-added{background:var(--nova-diff-added-bg);text-decoration:underline 2px var(--nova-success);text-underline-offset:3px}.nova-diff-removed{background:var(--nova-diff-removed-bg);color:var(--nova-danger);text-decoration:line-through}div.nova-diff-removed{margin:.5em 0;padding:2px 6px;border-radius:var(--nova-radius-sm)}@container (max-width: 600px){.nova-history-body{flex-direction:column-reverse}.nova-history-side{width:auto;max-height:150px;border-inline-start:0;border-bottom:1px solid var(--nova-border)}}.nova-history-legend{order:1;flex-basis:100%}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,QAAQ,cAAc;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B,SAAS,YAAY,eAAe,kBAAkB;;;ACJtD;;;ADyCO,IAAM,SAAS;AAAA,EACpB,IAAI;AAAA,IACF,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,WAAW;AAAA,IACX,UAAU;AAAA,IACV,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,OAAO;AAAA,IACP,UAAU;AAAA,IACV,UAAU;AAAA,EACZ;AACF;AAEA,IAAM,OAAO,MAAM;AAEnB,IAAM,aAAa,IAAI,eAAe;AAGtC,SAAS,MAAM,QAAgB,SAAmD;AAChF,QAAM,OACJ,OAAO,YAAY,WACf,UACA,WAAW,kBAAkB,OAAO,SAAS,OAAO,QAAQ,OAAO,EAAE,OAAO;AAClF,SAAO,aAAa,OAAO,QAAQ,IAAI;AACzC;AAEA,SAAS,YAAY,QAAgB,SAAiC;AACpE,QAAM,SAAS,WAAW,QAAQ,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;AACxB,SAAO,KAAK,UAAU,IAAI,mBAAmB;AAC7C,SAAO,KAAK,OAAO,IAAI;AACvB,OAAK,OAAO,IAAI;AAChB,OAAK,SAAS,EAAE,KAAK,MAAM;AACzB,SAAK,cAAiC,oBAAoB,GAAG,MAAM;AAAA,EACrE,CAAC;AACD,SAAO,EAAE,OAAO,SAAS,KAAK;AAChC;AAEA,IAAOA,2BAAQ,aAAa;AAAA,EAC1B,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM,QAAQ;AACZ,WAAO,GAAG,UAAU,wBAAwB,uBAAG;AAC/C,UAAM,UAAU,OAAO,QAAQ,eAAe;AAE9C,QAAI,CAAC,SAAS,QAAQ,CAAC,QAAQ,MAAM;AACnC,cAAQ,KAAK,0EAA0E;AACvF;AAAA,IACF;AACA,UAAM,SAAS,WAAW,QAAQ,mBAAmB,MAAM;AAC3D,QAAI,UAAiD;AACrD,UAAM,OAAO,MAAM;AACjB,UAAI,SAAS,QAAQ,YAAa;AAClC,gBAAU,YAAY,QAAQ,OAAO;AAAA,IACvC;AACA,WAAO,GAAG,SAAS,UAAU,mBAAmB;AAAA,MAC9C,MAAM;AAAA,MACN,SAAS,OAAO;AAAA,MAChB,UAAU;AAAA,IACZ,CAAC;AACD,WAAO,GAAG,SAAS,YAAY,mBAAmB;AAAA,MAChD,MAAM,OAAO;AAAA,MACb,MAAM;AAAA,MACN,UAAU;AAAA,IACZ,CAAC;AACD,WAAO,MAAM,SAAS,MAAM;AAAA,EAC9B;AACF,CAAC;","names":["revisionhistory_default"]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {
|
|
2
|
+
icons
|
|
3
|
+
} from "./chunk-ADRPQLZ2.js";
|
|
4
|
+
import {
|
|
5
|
+
pickLabels
|
|
6
|
+
} from "./chunk-DEYYVZ7O.js";
|
|
7
|
+
import {
|
|
8
|
+
definePlugin
|
|
9
|
+
} from "./chunk-V7WUHUHM.js";
|
|
10
|
+
import "./chunk-QU3KXMYT.js";
|
|
11
|
+
|
|
12
|
+
// src/plugins/save.ts
|
|
13
|
+
import { keymap } from "prosemirror-keymap";
|
|
14
|
+
var LABELS = {
|
|
15
|
+
en: {
|
|
16
|
+
save: "Save",
|
|
17
|
+
cancel: "Cancel changes",
|
|
18
|
+
saved: "Saved",
|
|
19
|
+
canceled: "Changes canceled",
|
|
20
|
+
failed: "Could not save"
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var states = /* @__PURE__ */ new WeakMap();
|
|
24
|
+
function stateOf(editor) {
|
|
25
|
+
let state = states.get(editor);
|
|
26
|
+
if (!state) {
|
|
27
|
+
state = { saved: editor.getHTML(), dirty: false, saving: false };
|
|
28
|
+
states.set(editor, state);
|
|
29
|
+
}
|
|
30
|
+
return state;
|
|
31
|
+
}
|
|
32
|
+
var optionsOf = (editor) => editor.options.pluginOptions?.save ?? {};
|
|
33
|
+
async function save(editor) {
|
|
34
|
+
const state = stateOf(editor);
|
|
35
|
+
const options = optionsOf(editor);
|
|
36
|
+
const labels = pickLabels(editor, "save", LABELS);
|
|
37
|
+
const form = editor.root.closest("form");
|
|
38
|
+
if (state.saving || !options.onSave && !form) return false;
|
|
39
|
+
state.saving = true;
|
|
40
|
+
editor.updateUI();
|
|
41
|
+
const html = editor.getHTML();
|
|
42
|
+
try {
|
|
43
|
+
if (options.onSave) await options.onSave(editor);
|
|
44
|
+
else if (form) {
|
|
45
|
+
if (typeof form.requestSubmit === "function") form.requestSubmit();
|
|
46
|
+
else form.submit();
|
|
47
|
+
}
|
|
48
|
+
state.saved = html;
|
|
49
|
+
state.dirty = editor.getHTML() !== html;
|
|
50
|
+
editor.ui.announce(labels.saved);
|
|
51
|
+
return true;
|
|
52
|
+
} catch (error) {
|
|
53
|
+
editor.ui.notify({ type: "error", text: labels.failed });
|
|
54
|
+
console.error("[nova] save:", error);
|
|
55
|
+
return false;
|
|
56
|
+
} finally {
|
|
57
|
+
state.saving = false;
|
|
58
|
+
editor.updateUI();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function cancel(editor) {
|
|
62
|
+
const state = stateOf(editor);
|
|
63
|
+
editor.setContent(state.saved);
|
|
64
|
+
state.dirty = false;
|
|
65
|
+
editor.updateUI();
|
|
66
|
+
optionsOf(editor).onCancel?.(editor);
|
|
67
|
+
editor.ui.announce(pickLabels(editor, "save", LABELS).canceled);
|
|
68
|
+
}
|
|
69
|
+
var save_default = definePlugin({
|
|
70
|
+
name: "save",
|
|
71
|
+
toolbar: "save cancel",
|
|
72
|
+
prosemirrorPlugins: (editor) => [
|
|
73
|
+
keymap({
|
|
74
|
+
// Ctrl/Cmd+S saves; the browser's "Save page" is never what is meant inside the editor.
|
|
75
|
+
"Mod-s": () => {
|
|
76
|
+
void save(editor);
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
],
|
|
81
|
+
setup(editor) {
|
|
82
|
+
const labels = pickLabels(editor, "save", LABELS);
|
|
83
|
+
const state = stateOf(editor);
|
|
84
|
+
const enableWhenDirty = optionsOf(editor).enableWhenDirty !== false;
|
|
85
|
+
const offChange = editor.on("change", () => {
|
|
86
|
+
if (state.dirty) return;
|
|
87
|
+
state.dirty = true;
|
|
88
|
+
editor.updateUI();
|
|
89
|
+
});
|
|
90
|
+
const offSet = editor.on("setContent", () => {
|
|
91
|
+
state.saved = editor.getHTML();
|
|
92
|
+
state.dirty = false;
|
|
93
|
+
editor.updateUI();
|
|
94
|
+
});
|
|
95
|
+
const canSave = (e) => e.isEditable() && !state.saving && (!enableWhenDirty || state.dirty);
|
|
96
|
+
editor.ui.registry.addButton("save", {
|
|
97
|
+
icon: icons.save,
|
|
98
|
+
tooltip: labels.save,
|
|
99
|
+
shortcut: "Mod-s",
|
|
100
|
+
isEnabled: canSave,
|
|
101
|
+
onAction: (e) => void save(e)
|
|
102
|
+
});
|
|
103
|
+
editor.ui.registry.addButton("cancel", {
|
|
104
|
+
icon: icons.cancelChanges,
|
|
105
|
+
tooltip: labels.cancel,
|
|
106
|
+
isEnabled: (e) => e.isEditable() && state.dirty && !state.saving,
|
|
107
|
+
onAction: cancel
|
|
108
|
+
});
|
|
109
|
+
return () => {
|
|
110
|
+
offChange();
|
|
111
|
+
offSet();
|
|
112
|
+
states.delete(editor);
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
export {
|
|
117
|
+
LABELS,
|
|
118
|
+
save_default as default
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=save-72ZLF6AO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugins/save.ts"],"sourcesContent":["import { keymap } from 'prosemirror-keymap';\nimport type { Editor } from '../editor';\nimport { definePlugin } from '../plugins';\nimport { icons } from '../ui/icons';\nimport { pickLabels } from './shared';\n\n/**\n * The save plugin (named as in TinyMCE): the `save` button (and Ctrl/Cmd+S) saves, `cancel` brings\n * back the text as it was at the last save (or at the start). Saving calls\n * `pluginOptions.save.onSave(editor)`; without it, the form around the editor is submitted (the\n * <novaprose-editor> element and tinymce.init put the text into the form themselves). By default the\n * button is enabled only when there are unsaved changes (`enableWhenDirty: false` — always).\n */\n\nexport const LABELS = {\n en: {\n save: 'Save',\n cancel: 'Cancel changes',\n saved: 'Saved',\n canceled: 'Changes canceled',\n failed: 'Could not save',\n },\n};\n\nexport interface SaveOptions {\n /** Saves the document (for example, sends getHTML() to your server). May return a promise. */\n onSave?: (editor: Editor) => void | Promise<void>;\n /** Called after Cancel brought back the saved text. */\n onCancel?: (editor: Editor) => void;\n /** The Save button only when there are unsaved changes (true by default). */\n enableWhenDirty?: boolean;\n}\n\ninterface SaveState {\n /** The text at the last save (or at the start). */\n saved: string;\n dirty: boolean;\n saving: boolean;\n}\n\nconst states = new WeakMap<Editor, SaveState>();\n\nfunction stateOf(editor: Editor): SaveState {\n let state = states.get(editor);\n if (!state) {\n state = { saved: editor.getHTML(), dirty: false, saving: false };\n states.set(editor, state);\n }\n return state;\n}\n\nconst optionsOf = (editor: Editor) => (editor.options.pluginOptions?.save ?? {}) as SaveOptions;\n\n/** Saves: your onSave, or the form around the editor. False when there is nothing to do. */\nasync function save(editor: Editor): Promise<boolean> {\n const state = stateOf(editor);\n const options = optionsOf(editor);\n const labels = pickLabels(editor, 'save', LABELS);\n const form = editor.root.closest('form');\n if (state.saving || (!options.onSave && !form)) return false;\n state.saving = true;\n editor.updateUI();\n const html = editor.getHTML();\n try {\n if (options.onSave) await options.onSave(editor);\n else if (form) {\n if (typeof form.requestSubmit === 'function') form.requestSubmit();\n else form.submit();\n }\n state.saved = html;\n state.dirty = editor.getHTML() !== html;\n editor.ui.announce(labels.saved);\n return true;\n } catch (error) {\n editor.ui.notify({ type: 'error', text: labels.failed });\n console.error('[nova] save:', error);\n return false;\n } finally {\n state.saving = false;\n editor.updateUI();\n }\n}\n\n/** Brings back the text of the last save. */\nfunction cancel(editor: Editor): void {\n const state = stateOf(editor);\n editor.setContent(state.saved);\n state.dirty = false;\n editor.updateUI();\n optionsOf(editor).onCancel?.(editor);\n editor.ui.announce(pickLabels(editor, 'save', LABELS).canceled);\n}\n\nexport default definePlugin({\n name: 'save',\n toolbar: 'save cancel',\n prosemirrorPlugins: (editor) => [\n keymap({\n // Ctrl/Cmd+S saves; the browser's \"Save page\" is never what is meant inside the editor.\n 'Mod-s': () => {\n void save(editor);\n return true;\n },\n }),\n ],\n setup(editor) {\n const labels = pickLabels(editor, 'save', LABELS);\n const state = stateOf(editor);\n const enableWhenDirty = optionsOf(editor).enableWhenDirty !== false;\n const offChange = editor.on('change', () => {\n if (state.dirty) return;\n state.dirty = true;\n editor.updateUI();\n });\n // setContent from your code is a new starting point, not an unsaved change.\n const offSet = editor.on('setContent', () => {\n state.saved = editor.getHTML();\n state.dirty = false;\n editor.updateUI();\n });\n const canSave = (e: Editor) =>\n e.isEditable() && !state.saving && (!enableWhenDirty || state.dirty);\n editor.ui.registry.addButton('save', {\n icon: icons.save,\n tooltip: labels.save,\n shortcut: 'Mod-s',\n isEnabled: canSave,\n onAction: (e) => void save(e),\n });\n editor.ui.registry.addButton('cancel', {\n icon: icons.cancelChanges,\n tooltip: labels.cancel,\n isEnabled: (e) => e.isEditable() && state.dirty && !state.saving,\n onAction: cancel,\n });\n return () => {\n offChange();\n offSet();\n states.delete(editor);\n };\n },\n});\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,cAAc;AAchB,IAAM,SAAS;AAAA,EACpB,IAAI;AAAA,IACF,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,UAAU;AAAA,IACV,QAAQ;AAAA,EACV;AACF;AAkBA,IAAM,SAAS,oBAAI,QAA2B;AAE9C,SAAS,QAAQ,QAA2B;AAC1C,MAAI,QAAQ,OAAO,IAAI,MAAM;AAC7B,MAAI,CAAC,OAAO;AACV,YAAQ,EAAE,OAAO,OAAO,QAAQ,GAAG,OAAO,OAAO,QAAQ,MAAM;AAC/D,WAAO,IAAI,QAAQ,KAAK;AAAA,EAC1B;AACA,SAAO;AACT;AAEA,IAAM,YAAY,CAAC,WAAoB,OAAO,QAAQ,eAAe,QAAQ,CAAC;AAG9E,eAAe,KAAK,QAAkC;AACpD,QAAM,QAAQ,QAAQ,MAAM;AAC5B,QAAM,UAAU,UAAU,MAAM;AAChC,QAAM,SAAS,WAAW,QAAQ,QAAQ,MAAM;AAChD,QAAM,OAAO,OAAO,KAAK,QAAQ,MAAM;AACvC,MAAI,MAAM,UAAW,CAAC,QAAQ,UAAU,CAAC,KAAO,QAAO;AACvD,QAAM,SAAS;AACf,SAAO,SAAS;AAChB,QAAM,OAAO,OAAO,QAAQ;AAC5B,MAAI;AACF,QAAI,QAAQ,OAAQ,OAAM,QAAQ,OAAO,MAAM;AAAA,aACtC,MAAM;AACb,UAAI,OAAO,KAAK,kBAAkB,WAAY,MAAK,cAAc;AAAA,UAC5D,MAAK,OAAO;AAAA,IACnB;AACA,UAAM,QAAQ;AACd,UAAM,QAAQ,OAAO,QAAQ,MAAM;AACnC,WAAO,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;AAAA,MACZ,SAAS,OAAO;AAAA,MAChB,UAAU;AAAA,MACV,WAAW;AAAA,MACX,UAAU,CAAC,MAAM,KAAK,KAAK,CAAC;AAAA,IAC9B,CAAC;AACD,WAAO,GAAG,SAAS,UAAU,UAAU;AAAA,MACrC,MAAM,MAAM;AAAA,MACZ,SAAS,OAAO;AAAA,MAChB,WAAW,CAAC,MAAM,EAAE,WAAW,KAAK,MAAM,SAAS,CAAC,MAAM;AAAA,MAC1D,UAAU;AAAA,IACZ,CAAC;AACD,WAAO,MAAM;AACX,gBAAU;AACV,aAAO;AACP,aAAO,OAAO,MAAM;AAAA,IACtB;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MAX_MATCHES,
|
|
3
|
+
clearSearch,
|
|
4
|
+
findNext,
|
|
5
|
+
getSearchState,
|
|
6
|
+
replaceAll,
|
|
7
|
+
replaceCurrent,
|
|
8
|
+
setSearch
|
|
9
|
+
} from "./chunk-6LQM7G4V.js";
|
|
10
|
+
import {
|
|
11
|
+
icons
|
|
12
|
+
} from "./chunk-ADRPQLZ2.js";
|
|
13
|
+
import {
|
|
14
|
+
h,
|
|
15
|
+
icon,
|
|
16
|
+
uniqueId
|
|
17
|
+
} from "./chunk-QU3KXMYT.js";
|
|
18
|
+
|
|
19
|
+
// src/ui/search-bar.ts
|
|
20
|
+
function createSearchBar(editor, before) {
|
|
21
|
+
const { t } = editor.ui;
|
|
22
|
+
const findId = uniqueId("nova-find");
|
|
23
|
+
const replaceId = uniqueId("nova-replace");
|
|
24
|
+
const findInput = h("input", {
|
|
25
|
+
id: findId,
|
|
26
|
+
type: "search",
|
|
27
|
+
className: "nova-input",
|
|
28
|
+
placeholder: t("search.find"),
|
|
29
|
+
"aria-label": t("search.find"),
|
|
30
|
+
autocomplete: "off",
|
|
31
|
+
spellcheck: "false"
|
|
32
|
+
});
|
|
33
|
+
const replaceInput = h("input", {
|
|
34
|
+
id: replaceId,
|
|
35
|
+
type: "text",
|
|
36
|
+
className: "nova-input",
|
|
37
|
+
placeholder: t("search.replace"),
|
|
38
|
+
"aria-label": t("search.replace"),
|
|
39
|
+
autocomplete: "off",
|
|
40
|
+
spellcheck: "false"
|
|
41
|
+
});
|
|
42
|
+
const counter = h("span", { className: "nova-search-count", "aria-live": "polite" });
|
|
43
|
+
const toggle = (label, text) => {
|
|
44
|
+
const b = h(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
className: "nova-btn nova-search-toggle",
|
|
49
|
+
"aria-pressed": "false",
|
|
50
|
+
"aria-label": label,
|
|
51
|
+
"data-tooltip": label
|
|
52
|
+
},
|
|
53
|
+
text
|
|
54
|
+
);
|
|
55
|
+
editor.ui.tooltip.attach(b);
|
|
56
|
+
b.addEventListener("click", () => {
|
|
57
|
+
b.setAttribute("aria-pressed", String(b.getAttribute("aria-pressed") !== "true"));
|
|
58
|
+
run();
|
|
59
|
+
findInput.focus();
|
|
60
|
+
});
|
|
61
|
+
return b;
|
|
62
|
+
};
|
|
63
|
+
const caseToggle = toggle(t("search.matchCase"), "Aa");
|
|
64
|
+
const wordToggle = toggle(t("search.wholeWord"), "ab|");
|
|
65
|
+
const iconButton = (svg, label, onClick) => {
|
|
66
|
+
const b = h(
|
|
67
|
+
"button",
|
|
68
|
+
{ type: "button", className: "nova-btn", "aria-label": label, "data-tooltip": label },
|
|
69
|
+
icon(svg)
|
|
70
|
+
);
|
|
71
|
+
editor.ui.tooltip.attach(b);
|
|
72
|
+
b.addEventListener("click", onClick);
|
|
73
|
+
return b;
|
|
74
|
+
};
|
|
75
|
+
const prev = iconButton(icons.chevronUp, t("search.prev"), () => {
|
|
76
|
+
editor.exec(findNext(-1));
|
|
77
|
+
findInput.focus();
|
|
78
|
+
});
|
|
79
|
+
const next = iconButton(icons.chevronDown, t("search.next"), () => {
|
|
80
|
+
editor.exec(findNext(1));
|
|
81
|
+
findInput.focus();
|
|
82
|
+
});
|
|
83
|
+
const close = iconButton(icons.close, t("dialog.close"), () => handle.close());
|
|
84
|
+
const replaceOne = h(
|
|
85
|
+
"button",
|
|
86
|
+
{ type: "button", className: "nova-button" },
|
|
87
|
+
t("search.replaceOne")
|
|
88
|
+
);
|
|
89
|
+
const replaceAllBtn = h(
|
|
90
|
+
"button",
|
|
91
|
+
{ type: "button", className: "nova-button" },
|
|
92
|
+
t("search.replaceAll")
|
|
93
|
+
);
|
|
94
|
+
replaceOne.addEventListener("click", () => {
|
|
95
|
+
sync();
|
|
96
|
+
editor.exec(replaceCurrent(replaceInput.value));
|
|
97
|
+
editor.exec(findNext(1));
|
|
98
|
+
replaceInput.focus();
|
|
99
|
+
});
|
|
100
|
+
replaceAllBtn.addEventListener("click", () => {
|
|
101
|
+
sync();
|
|
102
|
+
editor.exec(replaceAll(replaceInput.value));
|
|
103
|
+
replaceInput.focus();
|
|
104
|
+
});
|
|
105
|
+
const bar = h(
|
|
106
|
+
"div",
|
|
107
|
+
{ className: "nova-search", role: "search", "aria-label": t("search.title"), hidden: true },
|
|
108
|
+
h(
|
|
109
|
+
"div",
|
|
110
|
+
{ className: "nova-search-row" },
|
|
111
|
+
findInput,
|
|
112
|
+
counter,
|
|
113
|
+
caseToggle,
|
|
114
|
+
wordToggle,
|
|
115
|
+
prev,
|
|
116
|
+
next,
|
|
117
|
+
close
|
|
118
|
+
),
|
|
119
|
+
h("div", { className: "nova-search-row" }, replaceInput, replaceOne, replaceAllBtn)
|
|
120
|
+
);
|
|
121
|
+
before.parentElement.insertBefore(bar, before);
|
|
122
|
+
let timer = null;
|
|
123
|
+
const run = () => {
|
|
124
|
+
if (timer) clearTimeout(timer);
|
|
125
|
+
timer = null;
|
|
126
|
+
setSearch({
|
|
127
|
+
query: findInput.value,
|
|
128
|
+
caseSensitive: caseToggle.getAttribute("aria-pressed") === "true",
|
|
129
|
+
wholeWord: wordToggle.getAttribute("aria-pressed") === "true"
|
|
130
|
+
})(editor.view.state, editor.view.dispatch);
|
|
131
|
+
};
|
|
132
|
+
const sync = () => {
|
|
133
|
+
if (timer || getSearchState(editor.view.state).query !== findInput.value) run();
|
|
134
|
+
};
|
|
135
|
+
findInput.addEventListener("input", () => {
|
|
136
|
+
if (timer) clearTimeout(timer);
|
|
137
|
+
timer = setTimeout(run, 120);
|
|
138
|
+
});
|
|
139
|
+
findInput.addEventListener("keydown", (event) => {
|
|
140
|
+
if (event.key === "Enter") {
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
sync();
|
|
143
|
+
editor.exec(findNext(event.shiftKey ? -1 : 1));
|
|
144
|
+
findInput.focus();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
replaceInput.addEventListener("keydown", (event) => {
|
|
148
|
+
if (event.key === "Enter") {
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
replaceOne.click();
|
|
151
|
+
replaceInput.focus();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
bar.addEventListener("keydown", (event) => {
|
|
155
|
+
if (event.key === "Escape") {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
event.stopPropagation();
|
|
158
|
+
handle.close();
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
bar.addEventListener("mousedown", (event) => {
|
|
162
|
+
if (event.target.closest("button")) event.preventDefault();
|
|
163
|
+
});
|
|
164
|
+
const update = () => {
|
|
165
|
+
if (bar.hidden) return;
|
|
166
|
+
const { matches, current, query } = getSearchState(editor.view.state);
|
|
167
|
+
const total = matches.length;
|
|
168
|
+
if (!query) counter.textContent = "";
|
|
169
|
+
else if (!total) counter.textContent = t("search.none");
|
|
170
|
+
else
|
|
171
|
+
counter.textContent = t("search.count", {
|
|
172
|
+
current: current + 1,
|
|
173
|
+
total: total >= MAX_MATCHES ? `${MAX_MATCHES}+` : total
|
|
174
|
+
});
|
|
175
|
+
bar.classList.toggle("is-empty", !!query && !total);
|
|
176
|
+
for (const b of [prev, next, replaceOne, replaceAllBtn]) b.disabled = !total;
|
|
177
|
+
replaceOne.disabled = !total || !editor.isEditable();
|
|
178
|
+
replaceAllBtn.disabled = !total || !editor.isEditable();
|
|
179
|
+
};
|
|
180
|
+
const handle = {
|
|
181
|
+
open() {
|
|
182
|
+
const wasHidden = bar.hidden;
|
|
183
|
+
bar.hidden = false;
|
|
184
|
+
const { from, to, empty } = editor.view.state.selection;
|
|
185
|
+
const selected = empty ? "" : editor.view.state.doc.textBetween(from, to, " ");
|
|
186
|
+
if (selected && !selected.includes("\n") && selected.length <= 100)
|
|
187
|
+
findInput.value = selected;
|
|
188
|
+
if (wasHidden || selected) run();
|
|
189
|
+
findInput.focus();
|
|
190
|
+
findInput.select();
|
|
191
|
+
update();
|
|
192
|
+
},
|
|
193
|
+
close() {
|
|
194
|
+
if (bar.hidden) return;
|
|
195
|
+
bar.hidden = true;
|
|
196
|
+
if (timer) clearTimeout(timer);
|
|
197
|
+
clearSearch(editor.view.state, editor.view.dispatch);
|
|
198
|
+
editor.focus();
|
|
199
|
+
},
|
|
200
|
+
isOpen: () => !bar.hidden,
|
|
201
|
+
update,
|
|
202
|
+
destroy() {
|
|
203
|
+
if (timer) clearTimeout(timer);
|
|
204
|
+
bar.remove();
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
return handle;
|
|
208
|
+
}
|
|
209
|
+
export {
|
|
210
|
+
createSearchBar
|
|
211
|
+
};
|
|
212
|
+
//# sourceMappingURL=search-bar-HTZQNPD3.js.map
|