@fiduswriter/document 0.1.0-alpha.3 → 0.1.0-alpha.5
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 +22 -1
- package/dist/bibliography/common.d.ts +10 -0
- package/dist/bibliography/common.d.ts.map +1 -0
- package/dist/bibliography/common.js +86 -0
- package/dist/bibliography/common.js.map +1 -0
- package/dist/bibliography/csl_bib.d.ts +3 -0
- package/dist/bibliography/csl_bib.d.ts.map +1 -0
- package/dist/bibliography/csl_bib.js +131 -0
- package/dist/bibliography/csl_bib.js.map +1 -0
- package/dist/citations/citeproc_sys.d.ts +12 -0
- package/dist/citations/citeproc_sys.d.ts.map +1 -0
- package/dist/citations/citeproc_sys.js +48 -0
- package/dist/citations/citeproc_sys.js.map +1 -0
- package/dist/citations/format.d.ts +40 -0
- package/dist/citations/format.d.ts.map +1 -0
- package/dist/citations/format.js +186 -0
- package/dist/citations/format.js.map +1 -0
- package/dist/editor/e2ee/encryptor.d.ts +123 -0
- package/dist/editor/e2ee/encryptor.d.ts.map +1 -0
- package/dist/editor/e2ee/encryptor.js +201 -0
- package/dist/editor/e2ee/encryptor.js.map +1 -0
- package/dist/exporter/docx/citations.d.ts +31 -0
- package/dist/exporter/docx/citations.d.ts.map +1 -0
- package/dist/exporter/docx/citations.js +171 -0
- package/dist/exporter/docx/citations.js.map +1 -0
- package/dist/exporter/docx/comments.d.ts +22 -0
- package/dist/exporter/docx/comments.d.ts.map +1 -0
- package/dist/exporter/docx/comments.js +170 -0
- package/dist/exporter/docx/comments.js.map +1 -0
- package/dist/exporter/docx/footnotes.d.ts +47 -0
- package/dist/exporter/docx/footnotes.d.ts.map +1 -0
- package/dist/exporter/docx/footnotes.js +216 -0
- package/dist/exporter/docx/footnotes.js.map +1 -0
- package/dist/exporter/docx/images.d.ts +25 -0
- package/dist/exporter/docx/images.d.ts.map +1 -0
- package/dist/exporter/docx/images.js +101 -0
- package/dist/exporter/docx/images.js.map +1 -0
- package/dist/exporter/docx/index.d.ts +16 -0
- package/dist/exporter/docx/index.d.ts.map +1 -0
- package/dist/exporter/docx/index.js +115 -0
- package/dist/exporter/docx/index.js.map +1 -0
- package/dist/exporter/docx/lists.d.ts +38 -0
- package/dist/exporter/docx/lists.d.ts.map +1 -0
- package/dist/exporter/docx/lists.js +276 -0
- package/dist/exporter/docx/lists.js.map +1 -0
- package/dist/exporter/docx/math.d.ts +13 -0
- package/dist/exporter/docx/math.d.ts.map +1 -0
- package/dist/exporter/docx/math.js +59 -0
- package/dist/exporter/docx/math.js.map +1 -0
- package/dist/exporter/docx/metadata.d.ts +17 -0
- package/dist/exporter/docx/metadata.d.ts.map +1 -0
- package/dist/exporter/docx/metadata.js +272 -0
- package/dist/exporter/docx/metadata.js.map +1 -0
- package/dist/exporter/docx/rels.d.ts +27 -0
- package/dist/exporter/docx/rels.d.ts.map +1 -0
- package/dist/exporter/docx/rels.js +183 -0
- package/dist/exporter/docx/rels.js.map +1 -0
- package/dist/exporter/docx/render.d.ts +22 -0
- package/dist/exporter/docx/render.d.ts.map +1 -0
- package/dist/exporter/docx/render.js +780 -0
- package/dist/exporter/docx/render.js.map +1 -0
- package/dist/exporter/docx/richtext.d.ts +25 -0
- package/dist/exporter/docx/richtext.d.ts.map +1 -0
- package/dist/exporter/docx/richtext.js +1070 -0
- package/dist/exporter/docx/richtext.js.map +1 -0
- package/dist/exporter/docx/tables.d.ts +16 -0
- package/dist/exporter/docx/tables.d.ts.map +1 -0
- package/dist/exporter/docx/tables.js +115 -0
- package/dist/exporter/docx/tables.js.map +1 -0
- package/dist/exporter/docx/tools.d.ts +4 -0
- package/dist/exporter/docx/tools.d.ts.map +1 -0
- package/dist/exporter/docx/tools.js +48 -0
- package/dist/exporter/docx/tools.js.map +1 -0
- package/dist/exporter/epub/index.d.ts +19 -0
- package/dist/exporter/epub/index.d.ts.map +1 -0
- package/dist/exporter/epub/index.js +109 -0
- package/dist/exporter/epub/index.js.map +1 -0
- package/dist/exporter/epub/templates.d.ts +63 -0
- package/dist/exporter/epub/templates.d.ts.map +1 -0
- package/dist/exporter/epub/templates.js +95 -0
- package/dist/exporter/epub/templates.js.map +1 -0
- package/dist/exporter/epub/tools.d.ts +13 -0
- package/dist/exporter/epub/tools.d.ts.map +1 -0
- package/{src → dist}/exporter/epub/tools.js +32 -46
- package/dist/exporter/epub/tools.js.map +1 -0
- package/dist/exporter/html/citations.d.ts +29 -0
- package/dist/exporter/html/citations.d.ts.map +1 -0
- package/dist/exporter/html/citations.js +110 -0
- package/dist/exporter/html/citations.js.map +1 -0
- package/dist/exporter/html/convert.d.ts +50 -0
- package/dist/exporter/html/convert.d.ts.map +1 -0
- package/dist/exporter/html/convert.js +750 -0
- package/dist/exporter/html/convert.js.map +1 -0
- package/dist/exporter/html/index.d.ts +64 -0
- package/dist/exporter/html/index.d.ts.map +1 -0
- package/dist/exporter/html/index.js +154 -0
- package/dist/exporter/html/index.js.map +1 -0
- package/dist/exporter/html/templates.d.ts +24 -0
- package/dist/exporter/html/templates.d.ts.map +1 -0
- package/dist/exporter/html/templates.js +21 -0
- package/dist/exporter/html/templates.js.map +1 -0
- package/dist/exporter/html/tools.d.ts +2 -0
- package/dist/exporter/html/tools.d.ts.map +1 -0
- package/dist/exporter/html/tools.js +49 -0
- package/dist/exporter/html/tools.js.map +1 -0
- package/dist/exporter/jats/bibliography.d.ts +3 -0
- package/dist/exporter/jats/bibliography.d.ts.map +1 -0
- package/dist/exporter/jats/bibliography.js +158 -0
- package/dist/exporter/jats/bibliography.js.map +1 -0
- package/dist/exporter/jats/citations.d.ts +16 -0
- package/dist/exporter/jats/citations.d.ts.map +1 -0
- package/dist/exporter/jats/citations.js +105 -0
- package/dist/exporter/jats/citations.js.map +1 -0
- package/dist/exporter/jats/convert.d.ts +41 -0
- package/dist/exporter/jats/convert.d.ts.map +1 -0
- package/dist/exporter/jats/convert.js +816 -0
- package/dist/exporter/jats/convert.js.map +1 -0
- package/dist/exporter/jats/index.d.ts +25 -0
- package/dist/exporter/jats/index.d.ts.map +1 -0
- package/dist/exporter/jats/index.js +82 -0
- package/dist/exporter/jats/index.js.map +1 -0
- package/dist/exporter/jats/templates.d.ts +18 -0
- package/dist/exporter/jats/templates.d.ts.map +1 -0
- package/dist/exporter/jats/templates.js +25 -0
- package/dist/exporter/jats/templates.js.map +1 -0
- package/dist/exporter/jats/text.d.ts +4 -0
- package/dist/exporter/jats/text.d.ts.map +1 -0
- package/dist/exporter/jats/text.js +72 -0
- package/dist/exporter/jats/text.js.map +1 -0
- package/dist/exporter/latex/convert.d.ts +24 -0
- package/dist/exporter/latex/convert.d.ts.map +1 -0
- package/dist/exporter/latex/convert.js +881 -0
- package/dist/exporter/latex/convert.js.map +1 -0
- package/dist/exporter/latex/escape_latex.d.ts +2 -0
- package/dist/exporter/latex/escape_latex.d.ts.map +1 -0
- package/dist/exporter/latex/escape_latex.js +20 -0
- package/dist/exporter/latex/escape_latex.js.map +1 -0
- package/dist/exporter/latex/index.d.ts +24 -0
- package/dist/exporter/latex/index.d.ts.map +1 -0
- package/dist/exporter/latex/index.js +67 -0
- package/dist/exporter/latex/index.js.map +1 -0
- package/dist/exporter/latex/readme.d.ts +2 -0
- package/dist/exporter/latex/readme.d.ts.map +1 -0
- package/dist/exporter/latex/readme.js +23 -0
- package/dist/exporter/latex/readme.js.map +1 -0
- package/dist/exporter/native/copy.d.ts +30 -0
- package/dist/exporter/native/copy.d.ts.map +1 -0
- package/dist/exporter/native/copy.js +151 -0
- package/dist/exporter/native/copy.js.map +1 -0
- package/dist/exporter/native/file.d.ts +12 -0
- package/dist/exporter/native/file.d.ts.map +1 -0
- package/dist/exporter/native/file.js +38 -0
- package/dist/exporter/native/file.js.map +1 -0
- package/dist/exporter/native/index.d.ts +5 -0
- package/dist/exporter/native/index.d.ts.map +1 -0
- package/dist/exporter/native/index.js +5 -0
- package/dist/exporter/native/index.js.map +1 -0
- package/dist/exporter/native/revision.d.ts +18 -0
- package/dist/exporter/native/revision.d.ts.map +1 -0
- package/dist/exporter/native/revision.js +39 -0
- package/dist/exporter/native/revision.js.map +1 -0
- package/dist/exporter/native/shrink.d.ts +36 -0
- package/dist/exporter/native/shrink.d.ts.map +1 -0
- package/dist/exporter/native/shrink.js +124 -0
- package/dist/exporter/native/shrink.js.map +1 -0
- package/dist/exporter/native/zip.d.ts +25 -0
- package/dist/exporter/native/zip.d.ts.map +1 -0
- package/dist/exporter/native/zip.js +56 -0
- package/dist/exporter/native/zip.js.map +1 -0
- package/dist/exporter/odt/citations.d.ts +21 -0
- package/dist/exporter/odt/citations.d.ts.map +1 -0
- package/dist/exporter/odt/citations.js +104 -0
- package/dist/exporter/odt/citations.js.map +1 -0
- package/dist/exporter/odt/footnotes.d.ts +31 -0
- package/dist/exporter/odt/footnotes.d.ts.map +1 -0
- package/dist/exporter/odt/footnotes.js +129 -0
- package/dist/exporter/odt/footnotes.js.map +1 -0
- package/dist/exporter/odt/images.d.ts +25 -0
- package/dist/exporter/odt/images.d.ts.map +1 -0
- package/dist/exporter/odt/images.js +106 -0
- package/dist/exporter/odt/images.js.map +1 -0
- package/dist/exporter/odt/index.d.ts +17 -0
- package/dist/exporter/odt/index.d.ts.map +1 -0
- package/dist/exporter/odt/index.js +108 -0
- package/dist/exporter/odt/index.js.map +1 -0
- package/dist/exporter/odt/math.d.ts +15 -0
- package/dist/exporter/odt/math.d.ts.map +1 -0
- package/dist/exporter/odt/math.js +71 -0
- package/dist/exporter/odt/math.js.map +1 -0
- package/dist/exporter/odt/metadata.d.ts +18 -0
- package/dist/exporter/odt/metadata.d.ts.map +1 -0
- package/dist/exporter/odt/metadata.js +224 -0
- package/dist/exporter/odt/metadata.js.map +1 -0
- package/dist/exporter/odt/render.d.ts +26 -0
- package/dist/exporter/odt/render.d.ts.map +1 -0
- package/dist/exporter/odt/render.js +651 -0
- package/dist/exporter/odt/render.js.map +1 -0
- package/dist/exporter/odt/richtext.d.ts +22 -0
- package/dist/exporter/odt/richtext.d.ts.map +1 -0
- package/dist/exporter/odt/richtext.js +743 -0
- package/dist/exporter/odt/richtext.js.map +1 -0
- package/dist/exporter/odt/styles.d.ts +41 -0
- package/dist/exporter/odt/styles.d.ts.map +1 -0
- package/dist/exporter/odt/styles.js +370 -0
- package/dist/exporter/odt/styles.js.map +1 -0
- package/dist/exporter/odt/track.d.ts +18 -0
- package/dist/exporter/odt/track.d.ts.map +1 -0
- package/dist/exporter/odt/track.js +66 -0
- package/dist/exporter/odt/track.js.map +1 -0
- package/dist/exporter/pandoc/citations.d.ts +23 -0
- package/dist/exporter/pandoc/citations.d.ts.map +1 -0
- package/dist/exporter/pandoc/citations.js +99 -0
- package/dist/exporter/pandoc/citations.js.map +1 -0
- package/dist/exporter/pandoc/convert.d.ts +19 -0
- package/dist/exporter/pandoc/convert.d.ts.map +1 -0
- package/dist/exporter/pandoc/convert.js +886 -0
- package/dist/exporter/pandoc/convert.js.map +1 -0
- package/dist/exporter/pandoc/index.d.ts +25 -0
- package/dist/exporter/pandoc/index.d.ts.map +1 -0
- package/dist/exporter/pandoc/index.js +79 -0
- package/dist/exporter/pandoc/index.js.map +1 -0
- package/dist/exporter/pandoc/readme.d.ts +2 -0
- package/dist/exporter/pandoc/readme.d.ts.map +1 -0
- package/dist/exporter/pandoc/readme.js +8 -0
- package/dist/exporter/pandoc/readme.js.map +1 -0
- package/dist/exporter/pandoc/tools.d.ts +22 -0
- package/dist/exporter/pandoc/tools.d.ts.map +1 -0
- package/dist/exporter/pandoc/tools.js +52 -0
- package/dist/exporter/pandoc/tools.js.map +1 -0
- package/dist/exporter/print/index.d.ts +20 -0
- package/dist/exporter/print/index.d.ts.map +1 -0
- package/dist/exporter/print/index.js +142 -0
- package/dist/exporter/print/index.js.map +1 -0
- package/dist/exporter/tools/doc_content.d.ts +6 -0
- package/dist/exporter/tools/doc_content.d.ts.map +1 -0
- package/dist/exporter/tools/doc_content.js +130 -0
- package/dist/exporter/tools/doc_content.js.map +1 -0
- package/dist/exporter/tools/file.d.ts +2 -0
- package/dist/exporter/tools/file.d.ts.map +1 -0
- package/dist/exporter/tools/file.js +10 -0
- package/dist/exporter/tools/file.js.map +1 -0
- package/dist/exporter/tools/json.d.ts +7 -0
- package/dist/exporter/tools/json.d.ts.map +1 -0
- package/dist/exporter/tools/json.js +82 -0
- package/dist/exporter/tools/json.js.map +1 -0
- package/dist/exporter/tools/svg.d.ts +8 -0
- package/dist/exporter/tools/svg.d.ts.map +1 -0
- package/dist/exporter/tools/svg.js +26 -0
- package/dist/exporter/tools/svg.js.map +1 -0
- package/dist/exporter/tools/xml.d.ts +42 -0
- package/dist/exporter/tools/xml.d.ts.map +1 -0
- package/dist/exporter/tools/xml.js +467 -0
- package/dist/exporter/tools/xml.js.map +1 -0
- package/dist/exporter/tools/xml_zip.d.ts +21 -0
- package/dist/exporter/tools/xml_zip.d.ts.map +1 -0
- package/dist/exporter/tools/xml_zip.js +92 -0
- package/dist/exporter/tools/xml_zip.js.map +1 -0
- package/dist/exporter/tools/zip.d.ts +35 -0
- package/dist/exporter/tools/zip.d.ts.map +1 -0
- package/dist/exporter/tools/zip.js +78 -0
- package/dist/exporter/tools/zip.js.map +1 -0
- package/dist/exporter/tools/zotero_csl.d.ts +23 -0
- package/dist/exporter/tools/zotero_csl.d.ts.map +1 -0
- package/dist/exporter/tools/zotero_csl.js +78 -0
- package/dist/exporter/tools/zotero_csl.js.map +1 -0
- package/dist/importer/citations.d.ts +28 -0
- package/dist/importer/citations.d.ts.map +1 -0
- package/dist/importer/citations.js +68 -0
- package/dist/importer/citations.js.map +1 -0
- package/dist/importer/docx/citations.d.ts +43 -0
- package/dist/importer/docx/citations.d.ts.map +1 -0
- package/dist/importer/docx/citations.js +81 -0
- package/dist/importer/docx/citations.js.map +1 -0
- package/dist/importer/docx/convert.d.ts +150 -0
- package/dist/importer/docx/convert.d.ts.map +1 -0
- package/dist/importer/docx/convert.js +1243 -0
- package/dist/importer/docx/convert.js.map +1 -0
- package/dist/importer/docx/helpers.d.ts +2 -0
- package/dist/importer/docx/helpers.d.ts.map +1 -0
- package/dist/importer/docx/helpers.js +10 -0
- package/dist/importer/docx/helpers.js.map +1 -0
- package/dist/importer/docx/index.d.ts +27 -0
- package/dist/importer/docx/index.d.ts.map +1 -0
- package/dist/importer/docx/index.js +77 -0
- package/dist/importer/docx/index.js.map +1 -0
- package/dist/importer/docx/omml2mathml.d.ts +6 -0
- package/dist/importer/docx/omml2mathml.d.ts.map +1 -0
- package/dist/importer/docx/omml2mathml.js +1146 -0
- package/dist/importer/docx/omml2mathml.js.map +1 -0
- package/dist/importer/docx/parse.d.ts +96 -0
- package/dist/importer/docx/parse.d.ts.map +1 -0
- package/dist/importer/docx/parse.js +681 -0
- package/dist/importer/docx/parse.js.map +1 -0
- package/dist/importer/native/extract_template.d.ts +6 -0
- package/dist/importer/native/extract_template.d.ts.map +1 -0
- package/dist/importer/native/extract_template.js +80 -0
- package/dist/importer/native/extract_template.js.map +1 -0
- package/dist/importer/native/file.d.ts +37 -0
- package/dist/importer/native/file.d.ts.map +1 -0
- package/dist/importer/native/file.js +162 -0
- package/dist/importer/native/file.js.map +1 -0
- package/dist/importer/native/get_images.d.ts +21 -0
- package/dist/importer/native/get_images.d.ts.map +1 -0
- package/dist/importer/native/get_images.js +58 -0
- package/dist/importer/native/get_images.js.map +1 -0
- package/dist/importer/native/importer.d.ts +41 -0
- package/dist/importer/native/importer.d.ts.map +1 -0
- package/dist/importer/native/importer.js +170 -0
- package/dist/importer/native/importer.js.map +1 -0
- package/dist/importer/native/index.d.ts +7 -0
- package/dist/importer/native/index.d.ts.map +1 -0
- package/dist/importer/native/index.js +7 -0
- package/dist/importer/native/index.js.map +1 -0
- package/dist/importer/native/update.d.ts +7 -0
- package/dist/importer/native/update.d.ts.map +1 -0
- package/dist/importer/native/update.js +27 -0
- package/dist/importer/native/update.js.map +1 -0
- package/dist/importer/native/update_template.d.ts +12 -0
- package/dist/importer/native/update_template.d.ts.map +1 -0
- package/dist/importer/native/update_template.js +19 -0
- package/dist/importer/native/update_template.js.map +1 -0
- package/dist/importer/odt/citations.d.ts +27 -0
- package/dist/importer/odt/citations.d.ts.map +1 -0
- package/dist/importer/odt/citations.js +57 -0
- package/dist/importer/odt/citations.js.map +1 -0
- package/dist/importer/odt/convert.d.ts +146 -0
- package/dist/importer/odt/convert.d.ts.map +1 -0
- package/dist/importer/odt/convert.js +1530 -0
- package/dist/importer/odt/convert.js.map +1 -0
- package/dist/importer/odt/index.d.ts +30 -0
- package/dist/importer/odt/index.d.ts.map +1 -0
- package/dist/importer/odt/index.js +124 -0
- package/dist/importer/odt/index.js.map +1 -0
- package/dist/importer/pandoc/convert.d.ts +32 -0
- package/dist/importer/pandoc/convert.d.ts.map +1 -0
- package/dist/importer/pandoc/convert.js +790 -0
- package/dist/importer/pandoc/convert.js.map +1 -0
- package/dist/importer/pandoc/helpers.d.ts +5 -0
- package/dist/importer/pandoc/helpers.d.ts.map +1 -0
- package/dist/importer/pandoc/helpers.js +73 -0
- package/dist/importer/pandoc/helpers.js.map +1 -0
- package/dist/importer/pandoc/index.d.ts +31 -0
- package/dist/importer/pandoc/index.d.ts.map +1 -0
- package/dist/importer/pandoc/index.js +114 -0
- package/dist/importer/pandoc/index.js.map +1 -0
- package/dist/importer/registry.d.ts +21 -0
- package/dist/importer/registry.d.ts.map +1 -0
- package/dist/importer/registry.js +41 -0
- package/dist/importer/registry.js.map +1 -0
- package/dist/importer/zip_analyzer.d.ts +31 -0
- package/dist/importer/zip_analyzer.d.ts.map +1 -0
- package/dist/importer/zip_analyzer.js +89 -0
- package/dist/importer/zip_analyzer.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/mathlive/opf_includes.d.ts +2 -0
- package/dist/mathlive/opf_includes.d.ts.map +1 -0
- package/dist/mathlive/opf_includes.js +25 -0
- package/dist/mathlive/opf_includes.js.map +1 -0
- package/dist/schema/common/annotate.d.ts +47 -0
- package/dist/schema/common/annotate.d.ts.map +1 -0
- package/dist/schema/common/annotate.js +75 -0
- package/dist/schema/common/annotate.js.map +1 -0
- package/dist/schema/common/base.d.ts +91 -0
- package/dist/schema/common/base.d.ts.map +1 -0
- package/dist/schema/common/base.js +109 -0
- package/dist/schema/common/base.js.map +1 -0
- package/dist/schema/common/citation.d.ts +30 -0
- package/dist/schema/common/citation.d.ts.map +1 -0
- package/dist/schema/common/citation.js +61 -0
- package/dist/schema/common/citation.js.map +1 -0
- package/dist/schema/common/equation.d.ts +17 -0
- package/dist/schema/common/equation.d.ts.map +1 -0
- package/dist/schema/common/equation.js +32 -0
- package/dist/schema/common/equation.js.map +1 -0
- package/dist/schema/common/figure.d.ts +87 -0
- package/dist/schema/common/figure.d.ts.map +1 -0
- package/dist/schema/common/figure.js +178 -0
- package/dist/schema/common/figure.js.map +1 -0
- package/dist/schema/common/heading.d.ts +9 -0
- package/dist/schema/common/heading.d.ts.map +1 -0
- package/dist/schema/common/heading.js +41 -0
- package/dist/schema/common/heading.js.map +1 -0
- package/dist/schema/common/index.d.ts +11 -0
- package/dist/schema/common/index.d.ts.map +1 -0
- package/dist/schema/common/index.js +11 -0
- package/dist/schema/common/index.js.map +1 -0
- package/dist/schema/common/list.d.ts +63 -0
- package/dist/schema/common/list.d.ts.map +1 -0
- package/dist/schema/common/list.js +92 -0
- package/dist/schema/common/list.js.map +1 -0
- package/dist/schema/common/reference.d.ts +70 -0
- package/dist/schema/common/reference.d.ts.map +1 -0
- package/dist/schema/common/reference.js +97 -0
- package/dist/schema/common/reference.js.map +1 -0
- package/dist/schema/common/table.d.ts +76 -0
- package/dist/schema/common/table.d.ts.map +1 -0
- package/dist/schema/common/table.js +86 -0
- package/dist/schema/common/table.js.map +1 -0
- package/dist/schema/common/track.d.ts +117 -0
- package/dist/schema/common/track.d.ts.map +1 -0
- package/{src → dist}/schema/common/track.js +44 -49
- package/dist/schema/common/track.js.map +1 -0
- package/dist/schema/const.d.ts +3 -0
- package/dist/schema/const.d.ts.map +1 -0
- package/{src → dist}/schema/const.js +3 -3
- package/dist/schema/const.js.map +1 -0
- package/dist/schema/convert.d.ts +3 -0
- package/dist/schema/convert.d.ts.map +1 -0
- package/dist/schema/convert.js +1215 -0
- package/dist/schema/convert.js.map +1 -0
- package/dist/schema/document/content.d.ts +110 -0
- package/dist/schema/document/content.d.ts.map +1 -0
- package/dist/schema/document/content.js +177 -0
- package/dist/schema/document/content.js.map +1 -0
- package/dist/schema/document/index.d.ts +795 -0
- package/dist/schema/document/index.d.ts.map +1 -0
- package/dist/schema/document/index.js +68 -0
- package/dist/schema/document/index.js.map +1 -0
- package/dist/schema/document/structure.d.ts +164 -0
- package/dist/schema/document/structure.d.ts.map +1 -0
- package/dist/schema/document/structure.js +445 -0
- package/dist/schema/document/structure.js.map +1 -0
- package/dist/schema/export.d.ts +7 -0
- package/dist/schema/export.d.ts.map +1 -0
- package/dist/schema/export.js +17 -0
- package/dist/schema/export.js.map +1 -0
- package/dist/schema/footnotes.d.ts +454 -0
- package/dist/schema/footnotes.d.ts.map +1 -0
- package/dist/schema/footnotes.js +90 -0
- package/dist/schema/footnotes.js.map +1 -0
- package/dist/schema/footnotes_convert.d.ts +5 -0
- package/dist/schema/footnotes_convert.d.ts.map +1 -0
- package/dist/schema/footnotes_convert.js +30 -0
- package/dist/schema/footnotes_convert.js.map +1 -0
- package/dist/schema/i18n.d.ts +55 -0
- package/dist/schema/i18n.d.ts.map +1 -0
- package/{src → dist}/schema/i18n.js +14 -23
- package/dist/schema/i18n.js.map +1 -0
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +6 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/mini_json.d.ts +4 -0
- package/dist/schema/mini_json.d.ts.map +1 -0
- package/{src → dist}/schema/mini_json.js +19 -28
- package/dist/schema/mini_json.js.map +1 -0
- package/dist/schema/text.d.ts +3 -0
- package/dist/schema/text.d.ts.map +1 -0
- package/dist/schema/text.js +23 -0
- package/dist/schema/text.js.map +1 -0
- package/dist/types.d.ts +281 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +51 -16
- package/scripts/export-schema.js +1 -1
- package/src/bibliography/{common.js → common.ts} +15 -12
- package/src/bibliography/{csl_bib.js → csl_bib.ts} +16 -15
- package/src/citations/{citeproc_sys.js → citeproc_sys.ts} +26 -6
- package/src/citations/{format.js → format.ts} +80 -24
- package/src/editor/e2ee/{encryptor.js → encryptor.ts} +76 -44
- package/src/exporter/docx/{citations.js → citations.ts} +51 -23
- package/src/exporter/docx/{comments.js → comments.ts} +69 -26
- package/src/exporter/docx/{footnotes.js → footnotes.ts} +81 -42
- package/src/exporter/docx/images.ts +128 -0
- package/src/exporter/docx/{index.js → index.ts} +48 -25
- package/src/exporter/docx/{lists.js → lists.ts} +89 -46
- package/src/exporter/docx/{math.js → math.ts} +29 -9
- package/src/exporter/docx/{metadata.js → metadata.ts} +78 -42
- package/src/exporter/docx/{rels.js → rels.ts} +71 -50
- package/src/exporter/docx/{render.js → render.ts} +124 -87
- package/src/exporter/docx/{richtext.js → richtext.ts} +107 -84
- package/src/exporter/docx/{tables.js → tables.ts} +33 -23
- package/src/exporter/docx/{tools.js → tools.ts} +4 -3
- package/src/exporter/epub/{index.js → index.ts} +44 -15
- package/src/exporter/epub/{templates.js → templates.ts} +71 -7
- package/src/exporter/epub/tools.ts +102 -0
- package/src/exporter/html/{citations.js → citations.ts} +79 -31
- package/src/exporter/html/{convert.js → convert.ts} +118 -71
- package/src/exporter/html/{index.js → index.ts} +63 -29
- package/src/exporter/html/{templates.js → templates.ts} +22 -2
- package/src/exporter/html/{tools.js → tools.ts} +9 -6
- package/src/exporter/jats/bibliography.ts +199 -0
- package/src/exporter/jats/{citations.js → citations.ts} +56 -20
- package/src/exporter/jats/{convert.js → convert.ts} +72 -53
- package/src/exporter/jats/index.ts +132 -0
- package/src/exporter/jats/{templates.js → templates.ts} +19 -3
- package/src/exporter/jats/{text.js → text.ts} +8 -6
- package/src/exporter/latex/{convert.js → convert.ts} +160 -125
- package/src/exporter/latex/{escape_latex.js → escape_latex.ts} +1 -1
- package/src/exporter/latex/{index.js → index.ts} +27 -12
- package/src/exporter/latex/{readme.js → readme.ts} +2 -2
- package/src/exporter/native/copy.ts +231 -0
- package/src/exporter/native/file.ts +65 -0
- package/src/exporter/native/index.ts +4 -0
- package/src/exporter/native/revision.ts +76 -0
- package/src/exporter/native/{shrink.js → shrink.ts} +64 -29
- package/src/exporter/native/zip.ts +85 -0
- package/src/exporter/odt/{citations.js → citations.ts} +35 -15
- package/src/exporter/odt/{footnotes.js → footnotes.ts} +53 -30
- package/src/exporter/odt/images.ts +135 -0
- package/src/exporter/odt/{index.js → index.ts} +49 -27
- package/src/exporter/odt/{math.js → math.ts} +38 -9
- package/src/exporter/odt/{metadata.js → metadata.ts} +54 -29
- package/src/exporter/odt/{render.js → render.ts} +89 -60
- package/src/exporter/odt/{richtext.js → richtext.ts} +102 -72
- package/src/exporter/odt/{styles.js → styles.ts} +98 -66
- package/src/exporter/odt/{track.js → track.ts} +22 -6
- package/src/exporter/pandoc/{citations.js → citations.ts} +31 -15
- package/src/exporter/pandoc/{convert.js → convert.ts} +98 -79
- package/src/exporter/pandoc/{index.js → index.ts} +36 -13
- package/src/exporter/pandoc/{readme.js → readme.ts} +0 -1
- package/src/exporter/pandoc/{tools.js → tools.ts} +28 -5
- package/src/exporter/print/{index.js → index.ts} +38 -19
- package/src/exporter/tools/{doc_content.js → doc_content.ts} +34 -24
- package/src/exporter/tools/{file.js → file.ts} +1 -1
- package/src/exporter/tools/{json.js → json.ts} +30 -19
- package/src/exporter/tools/{svg.js → svg.ts} +9 -3
- package/src/exporter/tools/{xml.js → xml.ts} +187 -138
- package/src/exporter/tools/{xml_zip.js → xml_zip.ts} +19 -11
- package/src/exporter/tools/{zip.js → zip.ts} +35 -11
- package/src/exporter/tools/{zotero_csl.js → zotero_csl.ts} +35 -18
- package/src/global.d.ts +13 -0
- package/src/importer/citations.ts +116 -0
- package/src/importer/docx/{citations.js → citations.ts} +22 -37
- package/src/importer/docx/{convert.js → convert.ts} +176 -141
- package/src/importer/docx/{helpers.js → helpers.ts} +1 -1
- package/src/importer/docx/index.ts +124 -0
- package/src/importer/docx/{omml2mathml.js → omml2mathml.ts} +154 -176
- package/src/importer/docx/{parse.js → parse.ts} +103 -81
- package/src/importer/native/extract_template.ts +83 -0
- package/src/importer/native/file.ts +282 -0
- package/src/importer/native/get_images.ts +82 -0
- package/src/importer/native/importer.ts +244 -0
- package/src/importer/native/index.ts +6 -0
- package/src/importer/native/{update.js → update.ts} +13 -5
- package/src/importer/native/update_template.ts +32 -0
- package/src/importer/odt/{citations.js → citations.ts} +17 -29
- package/src/importer/odt/{convert.js → convert.ts} +261 -237
- package/src/importer/odt/index.ts +202 -0
- package/src/importer/pandoc/{convert.js → convert.ts} +116 -94
- package/src/importer/pandoc/{helpers.js → helpers.ts} +24 -12
- package/src/importer/pandoc/index.ts +171 -0
- package/src/importer/registry.ts +69 -0
- package/src/importer/{zip_analyzer.js → zip_analyzer.ts} +44 -18
- package/src/mathlive/{opf_includes.js → opf_includes.ts} +1 -1
- package/src/modules.d.ts +40 -0
- package/src/schema/common/{annotate.js → annotate.ts} +10 -8
- package/src/schema/common/{base.js → base.ts} +12 -10
- package/src/schema/common/{citation.js → citation.ts} +17 -8
- package/src/schema/common/{equation.js → equation.ts} +6 -4
- package/src/schema/common/{figure.js → figure.ts} +43 -23
- package/src/schema/common/{heading.js → heading.ts} +7 -5
- package/src/schema/common/{list.js → list.ts} +15 -13
- package/src/schema/common/{reference.js → reference.ts} +14 -12
- package/src/schema/common/{table.js → table.ts} +16 -14
- package/src/schema/common/track.ts +201 -0
- package/src/schema/const.ts +58 -0
- package/src/schema/{convert.js → convert.ts} +6 -2
- package/src/schema/document/{content.js → content.ts} +22 -20
- package/src/schema/document/{structure.js → structure.ts} +15 -9
- package/src/schema/{export.js → export.ts} +4 -2
- package/src/schema/{footnotes.js → footnotes.ts} +11 -8
- package/src/schema/{footnotes_convert.js → footnotes_convert.ts} +11 -8
- package/src/schema/i18n.ts +601 -0
- package/src/schema/mini_json.ts +60 -0
- package/src/schema/{text.js → text.ts} +6 -2
- package/src/types.ts +314 -0
- package/jest.config.js +0 -24
- package/src/exporter/docx/images.js +0 -101
- package/src/exporter/jats/bibliography.js +0 -183
- package/src/exporter/jats/index.js +0 -92
- package/src/exporter/odt/images.js +0 -115
- package/src/importer/citations.js +0 -129
- package/src/importer/native/get_images.js +0 -76
- /package/src/{index.js → index.ts} +0 -0
- /package/src/schema/common/{index.js → index.ts} +0 -0
- /package/src/schema/document/{index.js → index.ts} +0 -0
- /package/src/schema/{index.js → index.ts} +0 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {escapeText} from "fwtoolkit"
|
|
2
|
+
|
|
3
|
+
import {PandocConvert} from "./convert.js"
|
|
4
|
+
import {NativeImporter} from "../native/importer.js"
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
BibDBEntry,
|
|
8
|
+
E2EEOptions,
|
|
9
|
+
FidusNode,
|
|
10
|
+
NativeImporterBackend,
|
|
11
|
+
User
|
|
12
|
+
} from "../../types.js"
|
|
13
|
+
|
|
14
|
+
interface PandocImporterOptions {
|
|
15
|
+
getTemplate: (importId: string | number | null) => Promise<Record<string, unknown>>
|
|
16
|
+
importBibliography: (bibString: string) => Promise<Record<string, BibDBEntry>>
|
|
17
|
+
nativeBackend: NativeImporterBackend
|
|
18
|
+
e2eeOptions?: E2EEOptions | null
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class PandocImporter {
|
|
22
|
+
file: Blob
|
|
23
|
+
user: User
|
|
24
|
+
path: string
|
|
25
|
+
importId: string | number | null
|
|
26
|
+
additionalFiles: Record<string, any>
|
|
27
|
+
e2eeOptions: E2EEOptions | null
|
|
28
|
+
getTemplate: (importId: string | number | null) => Promise<Record<string, unknown>>
|
|
29
|
+
importBibliography: (bibString: string) => Promise<Record<string, BibDBEntry>>
|
|
30
|
+
nativeBackend: NativeImporterBackend
|
|
31
|
+
|
|
32
|
+
template: Record<string, unknown> | null = null
|
|
33
|
+
output: {
|
|
34
|
+
ok: boolean
|
|
35
|
+
statusText: string
|
|
36
|
+
doc: Record<string, unknown> | null
|
|
37
|
+
docInfo: Record<string, unknown> | null
|
|
38
|
+
} = {
|
|
39
|
+
ok: false,
|
|
40
|
+
statusText: "",
|
|
41
|
+
doc: null,
|
|
42
|
+
docInfo: null
|
|
43
|
+
}
|
|
44
|
+
title = "Untitled"
|
|
45
|
+
|
|
46
|
+
constructor(
|
|
47
|
+
file: Blob,
|
|
48
|
+
user: User,
|
|
49
|
+
path: string,
|
|
50
|
+
importId: string | number | null,
|
|
51
|
+
options: PandocImporterOptions
|
|
52
|
+
) {
|
|
53
|
+
this.file = file
|
|
54
|
+
this.user = user
|
|
55
|
+
this.path = path
|
|
56
|
+
this.importId = importId
|
|
57
|
+
this.additionalFiles = (options as PandocImporterOptions & {files?: Record<string, any>}).files || {}
|
|
58
|
+
this.e2eeOptions = options.e2eeOptions ?? null
|
|
59
|
+
this.getTemplate = options.getTemplate
|
|
60
|
+
this.importBibliography = options.importBibliography
|
|
61
|
+
this.nativeBackend = options.nativeBackend
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async init(): Promise<typeof this.output> {
|
|
65
|
+
await this.getTemplate(this.importId)
|
|
66
|
+
.then(template => {
|
|
67
|
+
this.template = template
|
|
68
|
+
})
|
|
69
|
+
.catch(error => {
|
|
70
|
+
this.output.statusText = error.message
|
|
71
|
+
})
|
|
72
|
+
if (this.output.statusText) {
|
|
73
|
+
return this.output
|
|
74
|
+
}
|
|
75
|
+
const text = await this.file.text()
|
|
76
|
+
return this.handlePandocJson(
|
|
77
|
+
text,
|
|
78
|
+
this.additionalFiles?.images,
|
|
79
|
+
this.additionalFiles?.bibliography
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
handlePandocJson(
|
|
84
|
+
jsonString: string,
|
|
85
|
+
images: Record<string, Blob> = {},
|
|
86
|
+
bibString = ""
|
|
87
|
+
): Promise<typeof this.output> {
|
|
88
|
+
let pandocJson
|
|
89
|
+
try {
|
|
90
|
+
pandocJson = JSON.parse(jsonString)
|
|
91
|
+
} catch (error: any) {
|
|
92
|
+
this.output.statusText = error.message
|
|
93
|
+
return Promise.resolve(this.output)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return this.importBibliography(bibString)
|
|
97
|
+
.then(bibliography => {
|
|
98
|
+
const converter = new PandocConvert(
|
|
99
|
+
pandocJson,
|
|
100
|
+
this.importId as string,
|
|
101
|
+
this.template as {content: any},
|
|
102
|
+
bibliography
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
let convertedDoc
|
|
106
|
+
try {
|
|
107
|
+
convertedDoc = converter.init()
|
|
108
|
+
} catch (error: any) {
|
|
109
|
+
this.output.statusText = error.message
|
|
110
|
+
console.error(error)
|
|
111
|
+
return this.output
|
|
112
|
+
}
|
|
113
|
+
const firstText =
|
|
114
|
+
(convertedDoc.content as FidusNode).content?.[0].content?.[0]
|
|
115
|
+
.text
|
|
116
|
+
if (["", "Untitled"].includes(firstText || "")) {
|
|
117
|
+
;(
|
|
118
|
+
(convertedDoc.content as FidusNode).content![0]
|
|
119
|
+
.content![0] as any
|
|
120
|
+
).text = this.title
|
|
121
|
+
} else {
|
|
122
|
+
this.title = firstText || this.title
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const nativeImporter = new NativeImporter(
|
|
126
|
+
{
|
|
127
|
+
content: convertedDoc.content,
|
|
128
|
+
title: this.title,
|
|
129
|
+
comments: {},
|
|
130
|
+
settings: convertedDoc.settings
|
|
131
|
+
},
|
|
132
|
+
bibliography,
|
|
133
|
+
converter.images as any,
|
|
134
|
+
Object.entries(images).map(([filename, blob]) => ({
|
|
135
|
+
filename,
|
|
136
|
+
content: blob
|
|
137
|
+
})),
|
|
138
|
+
this.user,
|
|
139
|
+
this.nativeBackend,
|
|
140
|
+
{
|
|
141
|
+
importId: null,
|
|
142
|
+
requestedPath: this.path + this.title,
|
|
143
|
+
template: null,
|
|
144
|
+
e2eeOptions: this.e2eeOptions
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
return nativeImporter
|
|
149
|
+
.init()
|
|
150
|
+
.then(({doc, docInfo}) => {
|
|
151
|
+
this.output.ok = true
|
|
152
|
+
this.output.doc = doc
|
|
153
|
+
this.output.docInfo = docInfo
|
|
154
|
+
this.output.statusText = `${escapeText(
|
|
155
|
+
doc.title as string
|
|
156
|
+
)} successfully imported.`
|
|
157
|
+
return this.output
|
|
158
|
+
})
|
|
159
|
+
.catch(error => {
|
|
160
|
+
this.output.statusText = error.message
|
|
161
|
+
console.error(error)
|
|
162
|
+
return this.output
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
.catch(error => {
|
|
166
|
+
this.output.statusText = error.message
|
|
167
|
+
console.error(error)
|
|
168
|
+
return this.output
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {ZipAnalyzer} from "./zip_analyzer.js"
|
|
2
|
+
|
|
3
|
+
interface ImporterEntry {
|
|
4
|
+
importer: any
|
|
5
|
+
description: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class ImporterRegistry {
|
|
9
|
+
importers: Map<string, ImporterEntry>
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
this.importers = new Map()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
register(
|
|
16
|
+
fileTypes: Array<[string, Array<string>]>,
|
|
17
|
+
importer: any
|
|
18
|
+
): void {
|
|
19
|
+
fileTypes.forEach(([description, types]) => {
|
|
20
|
+
types.forEach(extension =>
|
|
21
|
+
this.importers.set(extension, {importer, description})
|
|
22
|
+
)
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getZipImporter(zip: any): {
|
|
27
|
+
importer: any
|
|
28
|
+
getContents: () => ReturnType<ZipAnalyzer["getContents"]>
|
|
29
|
+
} | null {
|
|
30
|
+
const analyzer = new ZipAnalyzer(zip, this.getAllFormats())
|
|
31
|
+
const analysis = analyzer.analyze()
|
|
32
|
+
|
|
33
|
+
if (analysis.hasConvertible && analysis.format) {
|
|
34
|
+
return {
|
|
35
|
+
importer: this.getImporter(analysis.format)["importer"],
|
|
36
|
+
getContents: () => analyzer.getContents()
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
getImporter(format: string): ImporterEntry {
|
|
44
|
+
return this.importers.get(format) as ImporterEntry
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getAllFormats(): string[] {
|
|
48
|
+
return Array.from(this.importers.keys())
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getAllDescriptions(): Record<string, string[]> {
|
|
52
|
+
return Array.from(this.importers).reduce(
|
|
53
|
+
(acc, [extension, {description}]) => {
|
|
54
|
+
;(acc[description] = acc[description] || []).push(extension)
|
|
55
|
+
return acc
|
|
56
|
+
},
|
|
57
|
+
{} as Record<string, string[]>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const importerRegistry = new ImporterRegistry()
|
|
63
|
+
|
|
64
|
+
export function registerImporter(
|
|
65
|
+
fileTypes: Array<[string, Array<string>]>,
|
|
66
|
+
importer: any
|
|
67
|
+
): void {
|
|
68
|
+
importerRegistry.register(fileTypes, importer)
|
|
69
|
+
}
|
|
@@ -1,25 +1,49 @@
|
|
|
1
|
+
import type JSZip from "jszip"
|
|
2
|
+
|
|
3
|
+
interface ZipAnalysis {
|
|
4
|
+
hasConvertible: boolean
|
|
5
|
+
format: string | null
|
|
6
|
+
convertibleFile: {
|
|
7
|
+
path: string
|
|
8
|
+
entry: JSZip.JSZipObject
|
|
9
|
+
fileName: string
|
|
10
|
+
format: string
|
|
11
|
+
} | null
|
|
12
|
+
imageFiles: Array<{path: string; entry: JSZip.JSZipObject}>
|
|
13
|
+
bibFile: JSZip.JSZipObject | null
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ZipContents {
|
|
17
|
+
images: Record<string, Blob>
|
|
18
|
+
bibliography: string | null
|
|
19
|
+
mainContent: File | null
|
|
20
|
+
}
|
|
21
|
+
|
|
1
22
|
export class ZipAnalyzer {
|
|
2
|
-
|
|
23
|
+
zip: JSZip
|
|
24
|
+
formats: string[]
|
|
25
|
+
analysis: ZipAnalysis | null
|
|
26
|
+
|
|
27
|
+
constructor(zip: JSZip, formats: string[] = []) {
|
|
3
28
|
this.zip = zip
|
|
4
29
|
this.formats = formats
|
|
5
|
-
|
|
6
30
|
this.analysis = null
|
|
7
31
|
}
|
|
8
32
|
|
|
9
|
-
analyze() {
|
|
33
|
+
analyze(): ZipAnalysis {
|
|
10
34
|
if (this.analysis) {
|
|
11
35
|
return this.analysis
|
|
12
36
|
}
|
|
13
37
|
|
|
14
|
-
let convertibleFile = null
|
|
15
|
-
const imageFiles = []
|
|
16
|
-
let bibFile = null
|
|
38
|
+
let convertibleFile: ZipAnalysis["convertibleFile"] = null
|
|
39
|
+
const imageFiles: ZipAnalysis["imageFiles"] = []
|
|
40
|
+
let bibFile: JSZip.JSZipObject | null = null
|
|
17
41
|
|
|
18
42
|
// Analyze all files in the ZIP
|
|
19
43
|
this.zip.forEach((relativePath, zipEntry) => {
|
|
20
44
|
if (!zipEntry.dir) {
|
|
21
|
-
const fileName = relativePath.split("/").pop()
|
|
22
|
-
const extension = fileName.split(".").pop()
|
|
45
|
+
const fileName = relativePath.split("/").pop() || ""
|
|
46
|
+
const extension = fileName.split(".").pop()?.toLowerCase() || ""
|
|
23
47
|
|
|
24
48
|
if (extension === "bib") {
|
|
25
49
|
bibFile = zipEntry
|
|
@@ -52,7 +76,9 @@ export class ZipAnalyzer {
|
|
|
52
76
|
|
|
53
77
|
this.analysis = {
|
|
54
78
|
hasConvertible: Boolean(convertibleFile),
|
|
55
|
-
format: convertibleFile
|
|
79
|
+
format: convertibleFile
|
|
80
|
+
? (convertibleFile as Exclude<ZipAnalysis["convertibleFile"], null>).format
|
|
81
|
+
: null,
|
|
56
82
|
convertibleFile,
|
|
57
83
|
imageFiles,
|
|
58
84
|
bibFile
|
|
@@ -61,29 +87,29 @@ export class ZipAnalyzer {
|
|
|
61
87
|
return this.analysis
|
|
62
88
|
}
|
|
63
89
|
|
|
64
|
-
async getContents() {
|
|
90
|
+
async getContents(): Promise<ZipContents> {
|
|
65
91
|
if (!this.analysis) {
|
|
66
|
-
|
|
92
|
+
this.analyze()
|
|
67
93
|
}
|
|
68
94
|
|
|
69
|
-
const contents = {
|
|
95
|
+
const contents: ZipContents = {
|
|
70
96
|
images: {},
|
|
71
97
|
bibliography: null,
|
|
72
98
|
mainContent: null
|
|
73
99
|
}
|
|
74
100
|
|
|
75
101
|
// Load main content file
|
|
76
|
-
if (this.analysis.
|
|
102
|
+
if (this.analysis!.hasConvertible && this.analysis!.convertibleFile) {
|
|
77
103
|
const mainBlob =
|
|
78
|
-
await this.analysis
|
|
104
|
+
await this.analysis!.convertibleFile.entry.async("blob")
|
|
79
105
|
contents.mainContent = new File(
|
|
80
106
|
[mainBlob],
|
|
81
|
-
this.analysis
|
|
107
|
+
this.analysis!.convertibleFile.fileName
|
|
82
108
|
)
|
|
83
109
|
}
|
|
84
110
|
|
|
85
111
|
// Load images
|
|
86
|
-
const imagePromises = this.analysis
|
|
112
|
+
const imagePromises = this.analysis!.imageFiles.map(
|
|
87
113
|
async ({path, entry}) => {
|
|
88
114
|
const blob = await entry.async("blob")
|
|
89
115
|
contents.images[path] = blob
|
|
@@ -93,8 +119,8 @@ export class ZipAnalyzer {
|
|
|
93
119
|
await Promise.all(imagePromises)
|
|
94
120
|
|
|
95
121
|
// Load bibliography if present
|
|
96
|
-
if (this.analysis
|
|
97
|
-
contents.bibliography = await this.analysis
|
|
122
|
+
if (this.analysis!.bibFile) {
|
|
123
|
+
contents.bibliography = await this.analysis!.bibFile.async("text")
|
|
98
124
|
}
|
|
99
125
|
|
|
100
126
|
return contents
|
|
@@ -21,4 +21,4 @@ export const mathliveOpfIncludes = `
|
|
|
21
21
|
<item id="mathlive-18" href="css/media/KaTeX_Main-Regular.woff2" media-type="font/woff2" />
|
|
22
22
|
<item id="mathlive-19" href="css/media/KaTeX_Math-Italic.woff2" media-type="font/woff2" />
|
|
23
23
|
<item id="mathlive-20" href="css/media/KaTeX_Typewriter-Regular.woff2" media-type="font/woff2" />
|
|
24
|
-
`
|
|
24
|
+
`
|
package/src/modules.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ambient type declarations for dependencies that do not ship their own types.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
declare module "downloadjs" {
|
|
6
|
+
/**
|
|
7
|
+
* Trigger a browser download of the given data.
|
|
8
|
+
* @param data - File content (Blob or string).
|
|
9
|
+
* @param filename - Suggested filename for the download.
|
|
10
|
+
* @param mimeType - MIME type of the data.
|
|
11
|
+
*/
|
|
12
|
+
function download(
|
|
13
|
+
data: Blob | string,
|
|
14
|
+
filename?: string,
|
|
15
|
+
mimeType?: string
|
|
16
|
+
): void
|
|
17
|
+
export default download
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare module "pretty" {
|
|
21
|
+
/**
|
|
22
|
+
* Pretty-print HTML/XML markup.
|
|
23
|
+
* @param input - Markup string to format.
|
|
24
|
+
* @param options - Formatting options.
|
|
25
|
+
*/
|
|
26
|
+
function pretty(input: string, options?: {ocd?: boolean}): string
|
|
27
|
+
export default pretty
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare module "@vivliostyle/print" {
|
|
31
|
+
/**
|
|
32
|
+
* Render the given HTML with Vivliostyle for printing.
|
|
33
|
+
* @param html - HTML content to print.
|
|
34
|
+
* @param config - Optional print configuration.
|
|
35
|
+
*/
|
|
36
|
+
export function printHTML(
|
|
37
|
+
html: string,
|
|
38
|
+
config?: Record<string, unknown>
|
|
39
|
+
): Promise<unknown>
|
|
40
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type {MarkSpec} from "prosemirror-model"
|
|
2
|
+
|
|
1
3
|
// Annotation tag is not used by the core Fidus Writer editor, but can be used by plugins that need to add annotation capability.
|
|
2
4
|
export const annotation_tag = {
|
|
3
5
|
attrs: {
|
|
@@ -17,9 +19,9 @@ export const annotation_tag = {
|
|
|
17
19
|
parseDOM: [
|
|
18
20
|
{
|
|
19
21
|
tag: "span.annotation-tag[data-type]",
|
|
20
|
-
getAttrs(dom) {
|
|
22
|
+
getAttrs(dom: HTMLElement) {
|
|
21
23
|
return {
|
|
22
|
-
type: dom.dataset.type,
|
|
24
|
+
type: dom.dataset.type || "",
|
|
23
25
|
key: dom.dataset.key ? dom.dataset.key : "",
|
|
24
26
|
value: dom.dataset.value ? dom.dataset.value : ""
|
|
25
27
|
}
|
|
@@ -27,7 +29,7 @@ export const annotation_tag = {
|
|
|
27
29
|
}
|
|
28
30
|
],
|
|
29
31
|
toDOM(node) {
|
|
30
|
-
const attrs = {
|
|
32
|
+
const attrs: Record<string, unknown> = {
|
|
31
33
|
class: "annotation-tag",
|
|
32
34
|
"data-type": node.attrs.type
|
|
33
35
|
}
|
|
@@ -39,7 +41,7 @@ export const annotation_tag = {
|
|
|
39
41
|
}
|
|
40
42
|
return ["span", attrs]
|
|
41
43
|
}
|
|
42
|
-
}
|
|
44
|
+
} satisfies MarkSpec
|
|
43
45
|
|
|
44
46
|
export const comment = {
|
|
45
47
|
attrs: {
|
|
@@ -53,9 +55,9 @@ export const comment = {
|
|
|
53
55
|
parseDOM: [
|
|
54
56
|
{
|
|
55
57
|
tag: "span.comment[data-id]",
|
|
56
|
-
getAttrs(dom) {
|
|
58
|
+
getAttrs(dom: HTMLElement) {
|
|
57
59
|
return {
|
|
58
|
-
id: Number.parseInt(dom.dataset.id)
|
|
60
|
+
id: Number.parseInt(dom.dataset.id || "0")
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -69,8 +71,8 @@ export const comment = {
|
|
|
69
71
|
}
|
|
70
72
|
]
|
|
71
73
|
}
|
|
72
|
-
}
|
|
74
|
+
} satisfies MarkSpec
|
|
73
75
|
|
|
74
|
-
export function randomCommentId() {
|
|
76
|
+
export function randomCommentId(): string {
|
|
75
77
|
return String(Math.floor(Math.random() * 0xffffffff))
|
|
76
78
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type {MarkSpec, NodeSpec} from "prosemirror-model"
|
|
2
|
+
|
|
1
3
|
import {parseTracks} from "./track.js"
|
|
2
4
|
|
|
3
5
|
// :: NodeSpec A plain paragraph textblock. Represented in the DOM
|
|
@@ -13,7 +15,7 @@ export const paragraph = {
|
|
|
13
15
|
parseDOM: [
|
|
14
16
|
{
|
|
15
17
|
tag: "p",
|
|
16
|
-
getAttrs(dom) {
|
|
18
|
+
getAttrs(dom: HTMLElement) {
|
|
17
19
|
return {
|
|
18
20
|
track: parseTracks(dom.dataset.track)
|
|
19
21
|
}
|
|
@@ -27,7 +29,7 @@ export const paragraph = {
|
|
|
27
29
|
: {}
|
|
28
30
|
return ["p", attrs, 0]
|
|
29
31
|
}
|
|
30
|
-
}
|
|
32
|
+
} satisfies NodeSpec
|
|
31
33
|
|
|
32
34
|
// :: NodeSpec A blockquote (`<blockquote>`) wrapping one or more blocks.
|
|
33
35
|
export const blockquote = {
|
|
@@ -43,7 +45,7 @@ export const blockquote = {
|
|
|
43
45
|
parseDOM: [
|
|
44
46
|
{
|
|
45
47
|
tag: "blockquote",
|
|
46
|
-
getAttrs(dom) {
|
|
48
|
+
getAttrs(dom: HTMLElement) {
|
|
47
49
|
return {
|
|
48
50
|
track: parseTracks(dom.dataset.track)
|
|
49
51
|
}
|
|
@@ -57,7 +59,7 @@ export const blockquote = {
|
|
|
57
59
|
: {}
|
|
58
60
|
return ["blockquote", attrs, 0]
|
|
59
61
|
}
|
|
60
|
-
}
|
|
62
|
+
} satisfies NodeSpec
|
|
61
63
|
|
|
62
64
|
// :: NodeSpec A horizontal rule (`<hr>`).
|
|
63
65
|
export const horizontal_rule = {
|
|
@@ -70,7 +72,7 @@ export const horizontal_rule = {
|
|
|
70
72
|
parseDOM: [
|
|
71
73
|
{
|
|
72
74
|
tag: "hr",
|
|
73
|
-
getAttrs(dom) {
|
|
75
|
+
getAttrs(dom: HTMLElement) {
|
|
74
76
|
return {
|
|
75
77
|
track: parseTracks(dom.dataset.track)
|
|
76
78
|
}
|
|
@@ -84,14 +86,14 @@ export const horizontal_rule = {
|
|
|
84
86
|
: {}
|
|
85
87
|
return ["hr", attrs]
|
|
86
88
|
}
|
|
87
|
-
}
|
|
89
|
+
} satisfies NodeSpec
|
|
88
90
|
|
|
89
91
|
export const underline = {
|
|
90
92
|
parseDOM: [{tag: "span.underline"}],
|
|
91
93
|
toDOM() {
|
|
92
94
|
return ["span", {class: "underline"}, 0]
|
|
93
95
|
}
|
|
94
|
-
}
|
|
96
|
+
} satisfies MarkSpec
|
|
95
97
|
|
|
96
98
|
export const sup = {
|
|
97
99
|
parseDOM: [{tag: "sup"}],
|
|
@@ -99,7 +101,7 @@ export const sup = {
|
|
|
99
101
|
return ["sup", 0]
|
|
100
102
|
},
|
|
101
103
|
excludes: "sub"
|
|
102
|
-
}
|
|
104
|
+
} satisfies MarkSpec
|
|
103
105
|
|
|
104
106
|
export const sub = {
|
|
105
107
|
parseDOM: [{tag: "sub"}],
|
|
@@ -107,7 +109,7 @@ export const sub = {
|
|
|
107
109
|
return ["sub", 0]
|
|
108
110
|
},
|
|
109
111
|
excludes: "sup"
|
|
110
|
-
}
|
|
112
|
+
} satisfies MarkSpec
|
|
111
113
|
|
|
112
114
|
export const code = {
|
|
113
115
|
parseDOM: [{tag: "code"}],
|
|
@@ -115,4 +117,4 @@ export const code = {
|
|
|
115
117
|
return ["code", 0]
|
|
116
118
|
},
|
|
117
119
|
excludes: "strong em underline link sup sub"
|
|
118
|
-
}
|
|
120
|
+
} satisfies MarkSpec
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import type {NodeSpec} from "prosemirror-model"
|
|
2
|
+
|
|
3
|
+
export interface CitationReference {
|
|
4
|
+
id: number
|
|
5
|
+
locator?: string
|
|
6
|
+
prefix?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function parseReferences(str: string | undefined): CitationReference[] {
|
|
2
10
|
if (!str) {
|
|
3
11
|
return []
|
|
4
12
|
}
|
|
5
|
-
let references
|
|
13
|
+
let references: unknown
|
|
6
14
|
try {
|
|
7
15
|
references = JSON.parse(str)
|
|
8
16
|
} catch (_error) {
|
|
@@ -13,15 +21,16 @@ function parseReferences(str) {
|
|
|
13
21
|
}
|
|
14
22
|
return references
|
|
15
23
|
.filter(
|
|
16
|
-
ref
|
|
24
|
+
(ref): ref is Record<string, unknown> =>
|
|
25
|
+
typeof ref === "object" && ref !== null && Object.prototype.hasOwnProperty.call(ref, "id")
|
|
17
26
|
)
|
|
18
27
|
.map(ref => {
|
|
19
|
-
const mRef = {id: ref.id}
|
|
28
|
+
const mRef: CitationReference = {id: Number(ref.id)}
|
|
20
29
|
if (ref.locator) {
|
|
21
|
-
mRef.locator = ref.locator
|
|
30
|
+
mRef.locator = String(ref.locator)
|
|
22
31
|
}
|
|
23
32
|
if (ref.prefix) {
|
|
24
|
-
mRef.prefix = ref.prefix
|
|
33
|
+
mRef.prefix = String(ref.prefix)
|
|
25
34
|
}
|
|
26
35
|
return mRef
|
|
27
36
|
})
|
|
@@ -41,7 +50,7 @@ export const citation = {
|
|
|
41
50
|
parseDOM: [
|
|
42
51
|
{
|
|
43
52
|
tag: "span.citation",
|
|
44
|
-
getAttrs(dom) {
|
|
53
|
+
getAttrs(dom: HTMLElement) {
|
|
45
54
|
return {
|
|
46
55
|
format: dom.dataset.format || "",
|
|
47
56
|
references: parseReferences(dom.dataset.references)
|
|
@@ -59,4 +68,4 @@ export const citation = {
|
|
|
59
68
|
}
|
|
60
69
|
]
|
|
61
70
|
}
|
|
62
|
-
}
|
|
71
|
+
} satisfies NodeSpec
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type {NodeSpec} from "prosemirror-model"
|
|
2
|
+
|
|
1
3
|
export const equation = {
|
|
2
4
|
inline: true,
|
|
3
5
|
group: "inline",
|
|
@@ -9,9 +11,9 @@ export const equation = {
|
|
|
9
11
|
parseDOM: [
|
|
10
12
|
{
|
|
11
13
|
tag: "span.equation",
|
|
12
|
-
getAttrs(dom) {
|
|
14
|
+
getAttrs(dom: HTMLElement) {
|
|
13
15
|
return {
|
|
14
|
-
equation: dom.dataset.equation
|
|
16
|
+
equation: dom.dataset.equation || ""
|
|
15
17
|
}
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -23,9 +25,9 @@ export const equation = {
|
|
|
23
25
|
import("mathlive").then(MathLive => {
|
|
24
26
|
dom.innerHTML = MathLive.convertLatexToMarkup(node.attrs.equation, {
|
|
25
27
|
mathstyle: "textstyle"
|
|
26
|
-
})
|
|
28
|
+
} as unknown as Record<string, unknown>)
|
|
27
29
|
})
|
|
28
30
|
dom.setAttribute("contenteditable", "false")
|
|
29
31
|
return dom
|
|
30
32
|
}
|
|
31
|
-
}
|
|
33
|
+
} satisfies NodeSpec
|