@fiduswriter/document 0.1.0-alpha.4 → 0.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bibliography/common.d.ts +9 -91
- package/dist/bibliography/common.d.ts.map +1 -1
- package/dist/bibliography/common.js +3 -2
- package/dist/bibliography/common.js.map +1 -1
- package/dist/bibliography/csl_bib.d.ts +1 -1
- package/dist/bibliography/csl_bib.d.ts.map +1 -1
- package/dist/bibliography/csl_bib.js +7 -7
- package/dist/bibliography/csl_bib.js.map +1 -1
- package/dist/citations/citeproc_sys.d.ts +9 -10
- package/dist/citations/citeproc_sys.d.ts.map +1 -1
- package/dist/citations/citeproc_sys.js +6 -1
- package/dist/citations/citeproc_sys.js.map +1 -1
- package/dist/citations/format.d.ts +33 -16
- package/dist/citations/format.d.ts.map +1 -1
- package/dist/citations/format.js +29 -4
- package/dist/citations/format.js.map +1 -1
- package/dist/editor/e2ee/encryptor.d.ts +35 -35
- package/dist/editor/e2ee/encryptor.d.ts.map +1 -1
- package/dist/editor/e2ee/encryptor.js +31 -31
- package/dist/editor/e2ee/encryptor.js.map +1 -1
- package/dist/exporter/docx/citations.d.ts +27 -17
- package/dist/exporter/docx/citations.d.ts.map +1 -1
- package/dist/exporter/docx/citations.js +24 -7
- package/dist/exporter/docx/citations.js.map +1 -1
- package/dist/exporter/docx/comments.d.ts +15 -11
- package/dist/exporter/docx/comments.d.ts.map +1 -1
- package/dist/exporter/docx/comments.js +47 -14
- package/dist/exporter/docx/comments.js.map +1 -1
- package/dist/exporter/docx/footnotes.d.ts +36 -31
- package/dist/exporter/docx/footnotes.d.ts.map +1 -1
- package/dist/exporter/docx/footnotes.js +46 -12
- package/dist/exporter/docx/footnotes.js.map +1 -1
- package/dist/exporter/docx/images.d.ts +23 -12
- package/dist/exporter/docx/images.d.ts.map +1 -1
- package/dist/exporter/docx/images.js +35 -20
- package/dist/exporter/docx/images.js.map +1 -1
- package/dist/exporter/docx/index.d.ts +11 -17
- package/dist/exporter/docx/index.d.ts.map +1 -1
- package/dist/exporter/docx/index.js +15 -7
- package/dist/exporter/docx/index.js.map +1 -1
- package/dist/exporter/docx/lists.d.ts +27 -22
- package/dist/exporter/docx/lists.d.ts.map +1 -1
- package/dist/exporter/docx/lists.js +77 -30
- package/dist/exporter/docx/lists.js.map +1 -1
- package/dist/exporter/docx/math.d.ts +9 -9
- package/dist/exporter/docx/math.d.ts.map +1 -1
- package/dist/exporter/docx/math.js +22 -5
- package/dist/exporter/docx/math.js.map +1 -1
- package/dist/exporter/docx/metadata.d.ts +12 -9
- package/dist/exporter/docx/metadata.d.ts.map +1 -1
- package/dist/exporter/docx/metadata.js +59 -26
- package/dist/exporter/docx/metadata.js.map +1 -1
- package/dist/exporter/docx/rels.d.ts +14 -12
- package/dist/exporter/docx/rels.d.ts.map +1 -1
- package/dist/exporter/docx/rels.js +37 -22
- package/dist/exporter/docx/rels.js.map +1 -1
- package/dist/exporter/docx/render.d.ts +17 -15
- package/dist/exporter/docx/render.d.ts.map +1 -1
- package/dist/exporter/docx/render.js +37 -31
- package/dist/exporter/docx/render.js.map +1 -1
- package/dist/exporter/docx/richtext.d.ts +8 -8
- package/dist/exporter/docx/richtext.d.ts.map +1 -1
- package/dist/exporter/docx/richtext.js +61 -43
- package/dist/exporter/docx/richtext.js.map +1 -1
- package/dist/exporter/docx/tables.d.ts +11 -9
- package/dist/exporter/docx/tables.d.ts.map +1 -1
- package/dist/exporter/docx/tables.js +16 -10
- package/dist/exporter/docx/tables.js.map +1 -1
- package/dist/exporter/docx/tools.d.ts +3 -2
- package/dist/exporter/docx/tools.d.ts.map +1 -1
- package/dist/exporter/docx/tools.js +3 -3
- package/dist/exporter/docx/tools.js.map +1 -1
- package/dist/exporter/epub/index.d.ts +11 -3
- package/dist/exporter/epub/index.d.ts.map +1 -1
- package/dist/exporter/epub/index.js +10 -3
- package/dist/exporter/epub/index.js.map +1 -1
- package/dist/exporter/epub/templates.d.ts +62 -31
- package/dist/exporter/epub/templates.d.ts.map +1 -1
- package/dist/exporter/epub/templates.js +1 -1
- package/dist/exporter/epub/templates.js.map +1 -1
- package/dist/exporter/epub/tools.d.ts +12 -4
- package/dist/exporter/epub/tools.d.ts.map +1 -1
- package/dist/exporter/epub/tools.js +14 -13
- package/dist/exporter/epub/tools.js.map +1 -1
- package/dist/exporter/html/citations.d.ts +17 -15
- package/dist/exporter/html/citations.d.ts.map +1 -1
- package/dist/exporter/html/citations.js +37 -18
- package/dist/exporter/html/citations.js.map +1 -1
- package/dist/exporter/html/convert.d.ts +20 -70
- package/dist/exporter/html/convert.d.ts.map +1 -1
- package/dist/exporter/html/convert.js +74 -42
- package/dist/exporter/html/convert.js.map +1 -1
- package/dist/exporter/html/index.d.ts +55 -52
- package/dist/exporter/html/index.d.ts.map +1 -1
- package/dist/exporter/html/index.js +23 -3
- package/dist/exporter/html/index.js.map +1 -1
- package/dist/exporter/html/templates.d.ts +23 -9
- package/dist/exporter/html/templates.d.ts.map +1 -1
- package/dist/exporter/html/templates.js +1 -1
- package/dist/exporter/html/templates.js.map +1 -1
- package/dist/exporter/html/tools.d.ts +1 -1
- package/dist/exporter/html/tools.d.ts.map +1 -1
- package/dist/exporter/html/tools.js +2 -2
- package/dist/exporter/html/tools.js.map +1 -1
- package/dist/exporter/jats/bibliography.d.ts +2 -1
- package/dist/exporter/jats/bibliography.d.ts.map +1 -1
- package/dist/exporter/jats/bibliography.js +57 -52
- package/dist/exporter/jats/bibliography.js.map +1 -1
- package/dist/exporter/jats/citations.d.ts +13 -11
- package/dist/exporter/jats/citations.d.ts.map +1 -1
- package/dist/exporter/jats/citations.js +28 -6
- package/dist/exporter/jats/citations.js.map +1 -1
- package/dist/exporter/jats/convert.d.ts +24 -28
- package/dist/exporter/jats/convert.d.ts.map +1 -1
- package/dist/exporter/jats/convert.js +53 -36
- package/dist/exporter/jats/convert.js.map +1 -1
- package/dist/exporter/jats/index.d.ts +21 -15
- package/dist/exporter/jats/index.d.ts.map +1 -1
- package/dist/exporter/jats/index.js +21 -5
- package/dist/exporter/jats/index.js.map +1 -1
- package/dist/exporter/jats/templates.d.ts +17 -15
- package/dist/exporter/jats/templates.d.ts.map +1 -1
- package/dist/exporter/jats/templates.js.map +1 -1
- package/dist/exporter/jats/text.d.ts +3 -2
- package/dist/exporter/jats/text.d.ts.map +1 -1
- package/dist/exporter/jats/text.js +4 -4
- package/dist/exporter/jats/text.js.map +1 -1
- package/dist/exporter/latex/convert.d.ts +12 -15
- package/dist/exporter/latex/convert.d.ts.map +1 -1
- package/dist/exporter/latex/convert.js +70 -54
- package/dist/exporter/latex/convert.js.map +1 -1
- package/dist/exporter/latex/escape_latex.d.ts +1 -1
- package/dist/exporter/latex/escape_latex.d.ts.map +1 -1
- package/dist/exporter/latex/escape_latex.js +1 -1
- package/dist/exporter/latex/escape_latex.js.map +1 -1
- package/dist/exporter/latex/index.d.ts +20 -19
- package/dist/exporter/latex/index.d.ts.map +1 -1
- package/dist/exporter/latex/index.js +15 -5
- package/dist/exporter/latex/index.js.map +1 -1
- package/dist/exporter/latex/readme.d.ts +1 -1
- package/dist/exporter/latex/readme.d.ts.map +1 -1
- package/dist/exporter/latex/readme.js +2 -2
- package/dist/exporter/latex/readme.js.map +1 -1
- 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 +29 -14
- package/dist/exporter/native/shrink.d.ts.map +1 -1
- package/dist/exporter/native/shrink.js +27 -18
- package/dist/exporter/native/shrink.js.map +1 -1
- 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 +18 -15
- package/dist/exporter/odt/citations.d.ts.map +1 -1
- package/dist/exporter/odt/citations.js +21 -4
- package/dist/exporter/odt/citations.js.map +1 -1
- package/dist/exporter/odt/footnotes.d.ts +25 -19
- package/dist/exporter/odt/footnotes.d.ts.map +1 -1
- package/dist/exporter/odt/footnotes.js +23 -6
- package/dist/exporter/odt/footnotes.js.map +1 -1
- package/dist/exporter/odt/images.d.ts +23 -11
- package/dist/exporter/odt/images.d.ts.map +1 -1
- package/dist/exporter/odt/images.js +34 -26
- package/dist/exporter/odt/images.js.map +1 -1
- package/dist/exporter/odt/index.d.ts +12 -18
- package/dist/exporter/odt/index.d.ts.map +1 -1
- package/dist/exporter/odt/index.js +16 -7
- package/dist/exporter/odt/index.js.map +1 -1
- package/dist/exporter/odt/math.d.ts +10 -8
- package/dist/exporter/odt/math.d.ts.map +1 -1
- package/dist/exporter/odt/math.js +27 -4
- package/dist/exporter/odt/math.js.map +1 -1
- package/dist/exporter/odt/metadata.d.ts +13 -9
- package/dist/exporter/odt/metadata.d.ts.map +1 -1
- package/dist/exporter/odt/metadata.js +36 -15
- package/dist/exporter/odt/metadata.js.map +1 -1
- package/dist/exporter/odt/render.d.ts +17 -15
- package/dist/exporter/odt/render.d.ts.map +1 -1
- package/dist/exporter/odt/render.js +25 -18
- package/dist/exporter/odt/render.js.map +1 -1
- package/dist/exporter/odt/richtext.d.ts +9 -9
- package/dist/exporter/odt/richtext.d.ts.map +1 -1
- package/dist/exporter/odt/richtext.js +55 -40
- package/dist/exporter/odt/richtext.js.map +1 -1
- package/dist/exporter/odt/styles.d.ts +29 -21
- package/dist/exporter/odt/styles.d.ts.map +1 -1
- package/dist/exporter/odt/styles.js +44 -22
- package/dist/exporter/odt/styles.js.map +1 -1
- package/dist/exporter/odt/track.d.ts +14 -7
- package/dist/exporter/odt/track.d.ts.map +1 -1
- package/dist/exporter/odt/track.js +7 -0
- package/dist/exporter/odt/track.js.map +1 -1
- package/dist/exporter/pandoc/citations.d.ts +20 -14
- package/dist/exporter/pandoc/citations.d.ts.map +1 -1
- package/dist/exporter/pandoc/citations.js +18 -4
- package/dist/exporter/pandoc/citations.js.map +1 -1
- package/dist/exporter/pandoc/convert.d.ts +10 -29
- package/dist/exporter/pandoc/convert.d.ts.map +1 -1
- package/dist/exporter/pandoc/convert.js +45 -40
- package/dist/exporter/pandoc/convert.js.map +1 -1
- package/dist/exporter/pandoc/index.d.ts +20 -33
- package/dist/exporter/pandoc/index.d.ts.map +1 -1
- package/dist/exporter/pandoc/index.js +20 -8
- package/dist/exporter/pandoc/index.js.map +1 -1
- package/dist/exporter/pandoc/readme.d.ts +1 -1
- package/dist/exporter/pandoc/readme.d.ts.map +1 -1
- package/dist/exporter/pandoc/readme.js +0 -1
- package/dist/exporter/pandoc/readme.js.map +1 -1
- package/dist/exporter/pandoc/tools.d.ts +21 -5
- package/dist/exporter/pandoc/tools.d.ts.map +1 -1
- package/dist/exporter/pandoc/tools.js +2 -2
- package/dist/exporter/pandoc/tools.js.map +1 -1
- package/dist/exporter/print/index.d.ts +18 -7
- package/dist/exporter/print/index.d.ts.map +1 -1
- package/dist/exporter/print/index.js +12 -10
- package/dist/exporter/print/index.js.map +1 -1
- package/dist/exporter/tools/doc_content.d.ts +5 -6
- package/dist/exporter/tools/doc_content.d.ts.map +1 -1
- package/dist/exporter/tools/doc_content.js +17 -16
- package/dist/exporter/tools/doc_content.js.map +1 -1
- package/dist/exporter/tools/svg.d.ts +7 -1
- package/dist/exporter/tools/svg.d.ts.map +1 -1
- package/dist/exporter/tools/svg.js.map +1 -1
- package/dist/exporter/tools/xml.d.ts +39 -38
- package/dist/exporter/tools/xml.d.ts.map +1 -1
- package/dist/exporter/tools/xml.js +82 -55
- package/dist/exporter/tools/xml.js.map +1 -1
- package/dist/exporter/tools/xml_zip.d.ts +15 -14
- package/dist/exporter/tools/xml_zip.d.ts.map +1 -1
- package/dist/exporter/tools/xml_zip.js +8 -2
- package/dist/exporter/tools/xml_zip.js.map +1 -1
- package/dist/exporter/tools/zip.d.ts +28 -14
- package/dist/exporter/tools/zip.d.ts.map +1 -1
- package/dist/exporter/tools/zip.js +13 -6
- package/dist/exporter/tools/zip.js.map +1 -1
- package/dist/exporter/tools/zotero_csl.d.ts +19 -6
- package/dist/exporter/tools/zotero_csl.d.ts.map +1 -1
- package/dist/exporter/tools/zotero_csl.js +9 -9
- package/dist/exporter/tools/zotero_csl.js.map +1 -1
- package/dist/importer/citations.d.ts +25 -22
- package/dist/importer/citations.d.ts.map +1 -1
- package/dist/importer/citations.js +1 -49
- package/dist/importer/citations.js.map +1 -1
- package/dist/importer/docx/citations.d.ts +8 -30
- package/dist/importer/docx/citations.d.ts.map +1 -1
- package/dist/importer/docx/citations.js +1 -26
- package/dist/importer/docx/citations.js.map +1 -1
- package/dist/importer/docx/convert.d.ts +38 -116
- package/dist/importer/docx/convert.d.ts.map +1 -1
- package/dist/importer/docx/convert.js +99 -82
- package/dist/importer/docx/convert.js.map +1 -1
- package/dist/importer/docx/helpers.d.ts +1 -1
- package/dist/importer/docx/helpers.d.ts.map +1 -1
- package/dist/importer/docx/helpers.js +1 -1
- package/dist/importer/docx/helpers.js.map +1 -1
- 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 +2 -3
- package/dist/importer/docx/omml2mathml.d.ts.map +1 -1
- package/dist/importer/docx/omml2mathml.js +23 -116
- package/dist/importer/docx/omml2mathml.js.map +1 -1
- package/dist/importer/docx/parse.d.ts +22 -131
- package/dist/importer/docx/parse.d.ts.map +1 -1
- package/dist/importer/docx/parse.js +73 -55
- package/dist/importer/docx/parse.js.map +1 -1
- 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 +18 -8
- package/dist/importer/native/get_images.d.ts.map +1 -1
- package/dist/importer/native/get_images.js +39 -45
- package/dist/importer/native/get_images.js.map +1 -1
- 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 +5 -4
- package/dist/importer/native/update.d.ts.map +1 -1
- package/dist/importer/native/update.js +4 -3
- package/dist/importer/native/update.js.map +1 -1
- 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 +7 -27
- package/dist/importer/odt/citations.d.ts.map +1 -1
- package/dist/importer/odt/citations.js +0 -22
- package/dist/importer/odt/citations.js.map +1 -1
- package/dist/importer/odt/convert.d.ts +53 -237
- package/dist/importer/odt/convert.d.ts.map +1 -1
- package/dist/importer/odt/convert.js +162 -138
- package/dist/importer/odt/convert.js.map +1 -1
- 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 +25 -77
- package/dist/importer/pandoc/convert.d.ts.map +1 -1
- package/dist/importer/pandoc/convert.js +65 -52
- package/dist/importer/pandoc/convert.js.map +1 -1
- package/dist/importer/pandoc/helpers.d.ts +4 -3
- package/dist/importer/pandoc/helpers.d.ts.map +1 -1
- package/dist/importer/pandoc/helpers.js +24 -26
- package/dist/importer/pandoc/helpers.js.map +1 -1
- 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 +27 -21
- package/dist/importer/zip_analyzer.d.ts.map +1 -1
- package/dist/importer/zip_analyzer.js +10 -5
- package/dist/importer/zip_analyzer.js.map +1 -1
- package/dist/mathlive/opf_includes.d.ts +1 -1
- package/dist/mathlive/opf_includes.d.ts.map +1 -1
- package/dist/mathlive/opf_includes.js.map +1 -1
- package/dist/schema/common/annotate.d.ts +37 -49
- package/dist/schema/common/annotate.d.ts.map +1 -1
- package/dist/schema/common/annotate.js +2 -2
- package/dist/schema/common/annotate.js.map +1 -1
- package/dist/schema/common/base.d.ts +63 -81
- package/dist/schema/common/base.d.ts.map +1 -1
- package/dist/schema/common/base.js.map +1 -1
- package/dist/schema/common/citation.d.ts +23 -22
- package/dist/schema/common/citation.d.ts.map +1 -1
- package/dist/schema/common/citation.js +4 -5
- package/dist/schema/common/citation.js.map +1 -1
- package/dist/schema/common/equation.d.ts +13 -14
- package/dist/schema/common/equation.d.ts.map +1 -1
- package/dist/schema/common/equation.js +1 -1
- package/dist/schema/common/equation.js.map +1 -1
- package/dist/schema/common/figure.d.ts +72 -93
- package/dist/schema/common/figure.d.ts.map +1 -1
- package/dist/schema/common/figure.js +11 -9
- package/dist/schema/common/figure.js.map +1 -1
- package/dist/schema/common/heading.d.ts +8 -32
- package/dist/schema/common/heading.d.ts.map +1 -1
- package/dist/schema/common/heading.js +2 -2
- package/dist/schema/common/heading.js.map +1 -1
- package/dist/schema/common/index.d.ts +2 -2
- package/dist/schema/common/index.d.ts.map +1 -1
- package/dist/schema/common/index.js.map +1 -1
- package/dist/schema/common/list.d.ts +52 -72
- package/dist/schema/common/list.d.ts.map +1 -1
- package/dist/schema/common/list.js +3 -3
- package/dist/schema/common/list.js.map +1 -1
- package/dist/schema/common/reference.d.ts +51 -59
- package/dist/schema/common/reference.d.ts.map +1 -1
- package/dist/schema/common/reference.js +5 -5
- package/dist/schema/common/reference.js.map +1 -1
- package/dist/schema/common/table.d.ts +59 -75
- package/dist/schema/common/table.d.ts.map +1 -1
- package/dist/schema/common/table.js +3 -2
- package/dist/schema/common/table.js.map +1 -1
- package/dist/schema/common/track.d.ts +83 -97
- package/dist/schema/common/track.d.ts.map +1 -1
- package/dist/schema/common/track.js +18 -17
- package/dist/schema/common/track.js.map +1 -1
- package/dist/schema/convert.d.ts +2 -2
- package/dist/schema/convert.d.ts.map +1 -1
- package/dist/schema/convert.js +2 -2
- package/dist/schema/convert.js.map +1 -1
- package/dist/schema/document/content.d.ts +95 -122
- package/dist/schema/document/content.d.ts.map +1 -1
- package/dist/schema/document/content.js +9 -9
- package/dist/schema/document/content.js.map +1 -1
- package/dist/schema/document/index.d.ts +173 -257
- package/dist/schema/document/index.d.ts.map +1 -1
- package/dist/schema/document/index.js.map +1 -1
- package/dist/schema/document/structure.d.ts +149 -258
- package/dist/schema/document/structure.d.ts.map +1 -1
- package/dist/schema/document/structure.js +2 -2
- package/dist/schema/document/structure.js.map +1 -1
- package/dist/schema/export.d.ts +4 -877
- package/dist/schema/export.d.ts.map +1 -1
- package/dist/schema/export.js +1 -0
- package/dist/schema/export.js.map +1 -1
- package/dist/schema/footnotes.d.ts +110 -155
- package/dist/schema/footnotes.d.ts.map +1 -1
- package/dist/schema/footnotes.js +4 -2
- package/dist/schema/footnotes.js.map +1 -1
- package/dist/schema/footnotes_convert.d.ts +3 -3
- package/dist/schema/footnotes_convert.d.ts.map +1 -1
- package/dist/schema/footnotes_convert.js +10 -6
- package/dist/schema/footnotes_convert.js.map +1 -1
- package/dist/schema/i18n.d.ts +3 -534
- package/dist/schema/i18n.d.ts.map +1 -1
- package/dist/schema/i18n.js +1 -0
- package/dist/schema/i18n.js.map +1 -1
- package/dist/schema/index.d.ts +1 -1
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/mini_json.d.ts +3 -4
- package/dist/schema/mini_json.d.ts.map +1 -1
- package/dist/schema/mini_json.js +2 -0
- package/dist/schema/mini_json.js.map +1 -1
- package/dist/schema/text.d.ts +2 -1
- package/dist/schema/text.d.ts.map +1 -1
- package/dist/schema/text.js +1 -1
- package/dist/schema/text.js.map +1 -1
- package/dist/types.d.ts +167 -8
- package/dist/types.d.ts.map +1 -1
- package/package.json +24 -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.js → tools.ts} +31 -25
- 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/{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 +2 -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.js → track.ts} +42 -31
- 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.js → i18n.ts} +7 -1
- package/src/schema/{mini_json.js → mini_json.ts} +11 -12
- package/src/schema/{text.js → text.ts} +6 -2
- package/src/types.ts +185 -7
- 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/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,162 @@
|
|
|
1
|
+
import { escapeText, gettext } from "fwtoolkit";
|
|
2
|
+
import { FW_DOCUMENT_VERSION } from "../../schema/index.js";
|
|
3
|
+
import { updateFile } from "./update.js";
|
|
4
|
+
import { updateTemplateFile } from "./update_template.js";
|
|
5
|
+
import { NativeImporter } from "./importer.js";
|
|
6
|
+
export const MIN_FW_DOCUMENT_VERSION = 1.6;
|
|
7
|
+
export const MAX_FW_DOCUMENT_VERSION = Number.parseFloat(FW_DOCUMENT_VERSION);
|
|
8
|
+
const TEXT_FILENAMES = [
|
|
9
|
+
"mimetype",
|
|
10
|
+
"filetype-version",
|
|
11
|
+
"document.json",
|
|
12
|
+
"images.json",
|
|
13
|
+
"bibliography.json"
|
|
14
|
+
];
|
|
15
|
+
export class FidusFileImporter {
|
|
16
|
+
file;
|
|
17
|
+
user;
|
|
18
|
+
path;
|
|
19
|
+
check;
|
|
20
|
+
contacts;
|
|
21
|
+
e2eeOptions;
|
|
22
|
+
checkDocUsers;
|
|
23
|
+
textFiles = [];
|
|
24
|
+
otherFiles = [];
|
|
25
|
+
ok = false;
|
|
26
|
+
statusText = "";
|
|
27
|
+
doc = null;
|
|
28
|
+
docInfo = null;
|
|
29
|
+
template = null;
|
|
30
|
+
backend;
|
|
31
|
+
constructor(file, user, path, backend, options = {}) {
|
|
32
|
+
this.file = file;
|
|
33
|
+
this.user = user;
|
|
34
|
+
this.path = path;
|
|
35
|
+
this.check = options.check ?? false;
|
|
36
|
+
this.contacts = options.contacts || [];
|
|
37
|
+
this.e2eeOptions = options.e2eeOptions ?? null;
|
|
38
|
+
this.checkDocUsers = options.checkDocUsers;
|
|
39
|
+
this.backend = backend;
|
|
40
|
+
}
|
|
41
|
+
init() {
|
|
42
|
+
if (!this.check) {
|
|
43
|
+
return this.initZipFileRead();
|
|
44
|
+
}
|
|
45
|
+
return new Promise(resolve => {
|
|
46
|
+
const reader = new FileReader();
|
|
47
|
+
reader.onloadend = () => {
|
|
48
|
+
const result = reader.result;
|
|
49
|
+
if (result.length > 60 &&
|
|
50
|
+
result.substring(0, 2) === "PK") {
|
|
51
|
+
this.initZipFileRead().then(() => resolve(this));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.statusText = gettext("The uploaded file does not appear to be a Fidus Writer file.");
|
|
55
|
+
resolve(this);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
reader.readAsText(this.file);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
initZipFileRead() {
|
|
62
|
+
return import("jszip")
|
|
63
|
+
.then(({ default: JSZip }) => new JSZip())
|
|
64
|
+
.then(zipfs => zipfs.loadAsync(this.file))
|
|
65
|
+
.then(zipfs => {
|
|
66
|
+
const filenames = [];
|
|
67
|
+
const p = [];
|
|
68
|
+
let validFile = true;
|
|
69
|
+
zipfs.forEach(filename => filenames.push(filename));
|
|
70
|
+
TEXT_FILENAMES.forEach(filename => {
|
|
71
|
+
if (filenames.indexOf(filename) === -1) {
|
|
72
|
+
validFile = false;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
if (!validFile) {
|
|
76
|
+
this.statusText = gettext("The uploaded file does not appear to be a Fidus Writer file.");
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
filenames
|
|
80
|
+
.filter(filename => !filename.endsWith("/"))
|
|
81
|
+
.forEach(filename => {
|
|
82
|
+
p.push(new Promise(resolve => {
|
|
83
|
+
const isText = ["mimetype", "filetype-version"].includes(filename) || filename.endsWith(".json");
|
|
84
|
+
zipfs.files[filename]
|
|
85
|
+
.async(isText ? "string" : "blob")
|
|
86
|
+
.then(content => {
|
|
87
|
+
if (isText) {
|
|
88
|
+
this.textFiles.push({
|
|
89
|
+
filename,
|
|
90
|
+
content: content
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this.otherFiles.push({
|
|
95
|
+
filename,
|
|
96
|
+
content: content
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
resolve();
|
|
100
|
+
});
|
|
101
|
+
}));
|
|
102
|
+
});
|
|
103
|
+
return Promise.all(p).then(() => this.processFidusFile());
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
processFidusFile() {
|
|
107
|
+
const filetypeVersionFile = this.textFiles.find(file => file.filename === "filetype-version"), mimeTypeFile = this.textFiles.find(file => file.filename === "mimetype");
|
|
108
|
+
if (!filetypeVersionFile || !mimeTypeFile) {
|
|
109
|
+
this.statusText = gettext("The uploaded file does not appear to be a Fidus Writer file.");
|
|
110
|
+
return Promise.resolve(this);
|
|
111
|
+
}
|
|
112
|
+
const filetypeVersion = Number.parseFloat(filetypeVersionFile.content), mimeType = mimeTypeFile.content;
|
|
113
|
+
if (mimeType === "application/fidus+zip" &&
|
|
114
|
+
filetypeVersion >= MIN_FW_DOCUMENT_VERSION &&
|
|
115
|
+
filetypeVersion <= MAX_FW_DOCUMENT_VERSION) {
|
|
116
|
+
const documentFile = this.textFiles.find(file => file.filename === "document.json"), bibliographyFile = this.textFiles.find(file => file.filename === "bibliography.json"), imagesFile = this.textFiles.find(file => file.filename === "images.json");
|
|
117
|
+
if (!documentFile || !bibliographyFile || !imagesFile) {
|
|
118
|
+
this.statusText = gettext("The uploaded file does not appear to be a Fidus Writer file.");
|
|
119
|
+
return Promise.resolve(this);
|
|
120
|
+
}
|
|
121
|
+
const updatedFile = updateFile(JSON.parse(documentFile.content), filetypeVersion, JSON.parse(bibliographyFile.content), JSON.parse(imagesFile.content)), bibliography = updatedFile.bibliography, images = updatedFile.images;
|
|
122
|
+
let doc = updatedFile.doc;
|
|
123
|
+
if (this.check && this.checkDocUsers) {
|
|
124
|
+
doc = this.checkDocUsers(doc, this.user, this.contacts);
|
|
125
|
+
}
|
|
126
|
+
const templateFiles = this.otherFiles.filter(file => file.filename.startsWith("exporttemplates/") ||
|
|
127
|
+
file.filename.startsWith("documentstyles/"));
|
|
128
|
+
this.otherFiles = this.otherFiles.filter(file => !file.filename.startsWith("exporttemplates/") &&
|
|
129
|
+
!file.filename.startsWith("documentstyles/"));
|
|
130
|
+
const templateFile = this.textFiles.find(file => file.filename === "template.json");
|
|
131
|
+
if (templateFile) {
|
|
132
|
+
const exporttemplatesFile = this.textFiles.find(file => file.filename === "exporttemplates.json"), documentstylesFile = this.textFiles.find(file => file.filename === "documentstyles.json");
|
|
133
|
+
if (!exporttemplatesFile || !documentstylesFile) {
|
|
134
|
+
this.statusText = gettext("The uploaded file does not appear to be a Fidus Writer file.");
|
|
135
|
+
return Promise.resolve(this);
|
|
136
|
+
}
|
|
137
|
+
const templateDef = JSON.parse(templateFile.content);
|
|
138
|
+
this.template = updateTemplateFile(templateDef.attrs.template, templateDef, JSON.parse(exporttemplatesFile.content), JSON.parse(documentstylesFile.content), filetypeVersion);
|
|
139
|
+
this.template.files = templateFiles;
|
|
140
|
+
}
|
|
141
|
+
const importer = new NativeImporter(doc, bibliography, { db: images }, this.otherFiles, this.user, this.backend, {
|
|
142
|
+
importId: null,
|
|
143
|
+
requestedPath: this.path.endsWith("/")
|
|
144
|
+
? this.path + doc.title
|
|
145
|
+
: this.path,
|
|
146
|
+
template: this.template,
|
|
147
|
+
e2eeOptions: this.e2eeOptions
|
|
148
|
+
});
|
|
149
|
+
return importer.init().then(({ doc: importedDoc, docInfo }) => {
|
|
150
|
+
this.ok = true;
|
|
151
|
+
this.doc = importedDoc;
|
|
152
|
+
this.docInfo = docInfo;
|
|
153
|
+
this.statusText = `${escapeText(importedDoc.title)} ${gettext("successfully imported.")}`;
|
|
154
|
+
return this;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
this.statusText =
|
|
158
|
+
gettext("The uploaded file does not appear to be of the version used on this server: ") + FW_DOCUMENT_VERSION;
|
|
159
|
+
return Promise.resolve(this);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/importer/native/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,OAAO,EAAC,MAAM,WAAW,CAAA;AAE7C,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAA;AAY5C,MAAM,CAAC,MAAM,uBAAuB,GAAG,G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AAI,EAAE,CAAC,IAAI,CAAC,CAAC,EAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAC,EAAE,EAAE;gBACxD,IAAI,CAAC,EAAE,GAAG,IAAI,CAAA;gBACd,IAAI,CAAC,GAAG,GAAG,WAAW,CAAA;gBACtB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;gBACtB,IAAI,CAAC,UAAU,GAAG,GAAG,UAAU,CAC3B,WAAW,CAAC,KAAe,CAC9B,IAAI,OAAO,CAAC,wBAAwB,CAAC,EAAE,CAAA;gBACxC,OAAO,IAAI,CAAA;YACf,CAAC,CAAC,CAAA;QACN,CAAC;QACD,IAAI,CAAC,UAAU;YACX,OAAO,CACH,8EAA8E,CACjF,GAAG,mBAAmB,CAAA;QAC3B,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACJ"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { ImageDB, ImageDBEntry } from "../../types.js";
|
|
2
|
+
interface ZipEntry {
|
|
3
|
+
filename: string;
|
|
4
|
+
content: Blob | ArrayBuffer | string;
|
|
5
|
+
}
|
|
6
|
+
interface UrlEntry {
|
|
7
|
+
filename: string;
|
|
8
|
+
url: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class GetImages {
|
|
11
|
+
images: ImageDB;
|
|
12
|
+
imageEntries: ImageDBEntry[];
|
|
13
|
+
entries: Array<ZipEntry | UrlEntry>;
|
|
6
14
|
counter: number;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
constructor(images: ImageDB, entries: Array<ZipEntry | UrlEntry>);
|
|
16
|
+
init(): Promise<void>;
|
|
17
|
+
getImageZipEntry(): Promise<void>;
|
|
18
|
+
getImageUrlEntry(): Promise<void>;
|
|
10
19
|
}
|
|
20
|
+
export {};
|
|
11
21
|
//# sourceMappingURL=get_images.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_images.d.ts","sourceRoot":"","sources":["../../../src/importer/native/get_images.
|
|
1
|
+
{"version":3,"file":"get_images.d.ts","sourceRoot":"","sources":["../../../src/importer/native/get_images.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAEzD,UAAU,QAAQ;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,IAAI,GAAG,WAAW,GAAG,MAAM,CAAA;CACvC;AAED,UAAU,QAAQ;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;CACd;AAED,qBAAa,SAAS;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,YAAY,EAAE,YAAY,EAAE,CAAA;IAC5B,OAAO,EAAE,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAA;IACnC,OAAO,EAAE,MAAM,CAAA;gBAEH,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAO1D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAWrB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAyBjC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;CAkB1C"}
|
|
@@ -1,64 +1,58 @@
|
|
|
1
1
|
import { get } from "fwtoolkit";
|
|
2
2
|
export class GetImages {
|
|
3
|
+
images;
|
|
4
|
+
imageEntries;
|
|
5
|
+
entries;
|
|
6
|
+
counter;
|
|
3
7
|
constructor(images, entries) {
|
|
4
8
|
this.images = images;
|
|
5
|
-
this.imageEntries = Object.values(this.images);
|
|
9
|
+
this.imageEntries = Object.values(this.images.db);
|
|
6
10
|
this.entries = entries;
|
|
7
11
|
this.counter = 0;
|
|
8
12
|
}
|
|
9
|
-
init() {
|
|
10
|
-
if (this.entries.length
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return this.getImageZipEntry();
|
|
16
|
-
}
|
|
13
|
+
async init() {
|
|
14
|
+
if (this.entries.length === 0) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (this.entries[0].hasOwnProperty("url")) {
|
|
18
|
+
await this.getImageUrlEntry();
|
|
17
19
|
}
|
|
18
20
|
else {
|
|
19
|
-
|
|
21
|
+
await this.getImageZipEntry();
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
|
-
getImageZipEntry() {
|
|
23
|
-
if (this.counter
|
|
24
|
-
return
|
|
25
|
-
const f = this.entries.find(entry => entry.filename === this.imageEntries[this.counter].image);
|
|
26
|
-
if (!f) {
|
|
27
|
-
console.warn(`Image ${this.imageEntries[this.counter].image} not found`, this.imageEntries, this.entries);
|
|
28
|
-
this.counter++;
|
|
29
|
-
return this.getImageZipEntry().then(() => {
|
|
30
|
-
resolve();
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
const fc = f.content;
|
|
34
|
-
this.imageEntries[this.counter]["file"] = new window.Blob([fc], {
|
|
35
|
-
type: this.imageEntries[this.counter].file_type
|
|
36
|
-
});
|
|
37
|
-
this.counter++;
|
|
38
|
-
this.getImageZipEntry().then(() => {
|
|
39
|
-
resolve();
|
|
40
|
-
});
|
|
41
|
-
});
|
|
24
|
+
async getImageZipEntry() {
|
|
25
|
+
if (this.counter >= this.imageEntries.length) {
|
|
26
|
+
return;
|
|
42
27
|
}
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
const imageEntry = this.imageEntries[this.counter];
|
|
29
|
+
const f = this.entries.find(e => e.filename === imageEntry.image);
|
|
30
|
+
if (!f) {
|
|
31
|
+
console.warn(`Image ${imageEntry.image} not found`, this.imageEntries, this.entries);
|
|
32
|
+
this.counter++;
|
|
33
|
+
await this.getImageZipEntry();
|
|
34
|
+
return;
|
|
45
35
|
}
|
|
36
|
+
this.imageEntries[this.counter]["file"] = new window.Blob([f.content], {
|
|
37
|
+
type: imageEntry.file_type
|
|
38
|
+
});
|
|
39
|
+
this.counter++;
|
|
40
|
+
await this.getImageZipEntry();
|
|
46
41
|
}
|
|
47
|
-
getImageUrlEntry() {
|
|
48
|
-
if (this.counter
|
|
49
|
-
|
|
50
|
-
`images/${this.imageEntries[this.counter].image.split("/").pop()}`).url;
|
|
51
|
-
return get(getUrl)
|
|
52
|
-
.then(response => response.blob())
|
|
53
|
-
.then(blob => {
|
|
54
|
-
this.imageEntries[this.counter]["file"] = blob;
|
|
55
|
-
this.counter++;
|
|
56
|
-
return this.getImageUrlEntry();
|
|
57
|
-
});
|
|
42
|
+
async getImageUrlEntry() {
|
|
43
|
+
if (this.counter >= this.imageEntries.length) {
|
|
44
|
+
return;
|
|
58
45
|
}
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
const imageEntry = this.imageEntries[this.counter];
|
|
47
|
+
const entry = this.entries.find(e => e.filename ===
|
|
48
|
+
`images/${String(imageEntry.image).split("/").pop()}`);
|
|
49
|
+
if (!entry) {
|
|
50
|
+
return;
|
|
61
51
|
}
|
|
52
|
+
const response = await get(entry.url);
|
|
53
|
+
this.imageEntries[this.counter]["file"] = await response.blob();
|
|
54
|
+
this.counter++;
|
|
55
|
+
await this.getImageUrlEntry();
|
|
62
56
|
}
|
|
63
57
|
}
|
|
64
58
|
//# sourceMappingURL=get_images.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_images.js","sourceRoot":"","sources":["../../../src/importer/native/get_images.
|
|
1
|
+
{"version":3,"file":"get_images.js","sourceRoot":"","sources":["../../../src/importer/native/get_images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,WAAW,CAAA;AAc7B,MAAM,OAAO,SAAS;IAClB,MAAM,CAAS;IACf,YAAY,CAAgB;IAC5B,OAAO,CAA4B;IACnC,OAAO,CAAQ;IAEf,YAAY,MAAe,EAAE,OAAmC;QAC5D,IAAI,CAAC,MAAM,GAAG,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AC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE;YACnE,IAAI,EAAE,UAAU,CAAC,SAAS;SAC7B,CAAC,CAAA;QACF,IAAI,CAAC,OAAO,EAAE,CAAA;QACd,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAA;IACjC,CAAC;IAED,KAAK,CAAC,gBAAgB;QAClB,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;YAC3C,OAAM;QACV,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAClD,MAAM,KAAK,GAAI,IAAI,CAAC,OAAsB,CAAC,IAAI,CAC3C,CAAC,CAAC,EAAE,CACA,CAAC,CAAC,QAAQ;YACV,UAAU,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC5D,CAAA;QACD,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAM;QACV,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACrC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAC/D,IAAI,CAAC,OAAO,EAAE,CAAA;QACd,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAA;IACjC,CAAC;CACJ"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { E2EEOptions, ImageDB, NativeImporterBackend, Template, User } from "../../types.js";
|
|
2
|
+
interface NativeImporterOptions {
|
|
3
|
+
importId?: string | number | null;
|
|
4
|
+
requestedPath?: string;
|
|
5
|
+
template?: Template | null;
|
|
6
|
+
e2eeOptions?: E2EEOptions | null;
|
|
7
|
+
}
|
|
8
|
+
export declare class NativeImporter {
|
|
9
|
+
doc: Record<string, unknown>;
|
|
10
|
+
docId: number;
|
|
11
|
+
path: string;
|
|
12
|
+
bibliography: Record<string, unknown>;
|
|
13
|
+
images: ImageDB;
|
|
14
|
+
otherFiles: Array<{
|
|
15
|
+
filename: string;
|
|
16
|
+
content: Blob | ArrayBuffer | string;
|
|
17
|
+
}>;
|
|
18
|
+
user: User;
|
|
19
|
+
importId: string | number | null;
|
|
20
|
+
requestedPath: string;
|
|
21
|
+
template: Template | null;
|
|
22
|
+
e2eeOptions: E2EEOptions | null;
|
|
23
|
+
backend: NativeImporterBackend;
|
|
24
|
+
constructor(doc: Record<string, unknown>, bibliography: Record<string, unknown>, images: ImageDB, otherFiles: Array<{
|
|
25
|
+
filename: string;
|
|
26
|
+
content: Blob | ArrayBuffer | string;
|
|
27
|
+
}>, user: User, backend: NativeImporterBackend, options?: NativeImporterOptions);
|
|
28
|
+
init(): Promise<{
|
|
29
|
+
doc: Record<string, unknown>;
|
|
30
|
+
docInfo: Record<string, unknown>;
|
|
31
|
+
}>;
|
|
32
|
+
createDoc(): Promise<void>;
|
|
33
|
+
saveImages(): Promise<Record<number | string, number>>;
|
|
34
|
+
translateReferenceIds(imageTranslationTable: Record<number | string, number>): void;
|
|
35
|
+
saveDocument(): Promise<{
|
|
36
|
+
doc: Record<string, unknown>;
|
|
37
|
+
docInfo: Record<string, unknown>;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=importer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../../../src/importer/native/importer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAER,WAAW,EAEX,OAAO,EACP,qBAAqB,EACrB,QAAQ,EACR,IAAI,EACP,MAAM,gBAAgB,CAAA;AAEvB,UAAU,qBAAqB;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IACj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AC,CAAC;IA6BjF,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAmD1B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;IAQtD,qBAAqB,CAAC,qBAAqB,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAwB7E,YAAY,IAAI,OAAO,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAC,CAAC;CAqElG"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { GetImages } from "./get_images.js";
|
|
2
|
+
import { extractTemplate } from "./extract_template.js";
|
|
3
|
+
export class NativeImporter {
|
|
4
|
+
doc;
|
|
5
|
+
docId;
|
|
6
|
+
path;
|
|
7
|
+
bibliography;
|
|
8
|
+
images;
|
|
9
|
+
otherFiles;
|
|
10
|
+
user;
|
|
11
|
+
importId;
|
|
12
|
+
requestedPath;
|
|
13
|
+
template;
|
|
14
|
+
e2eeOptions;
|
|
15
|
+
backend;
|
|
16
|
+
constructor(doc, bibliography, images, otherFiles, user, backend, options = {}) {
|
|
17
|
+
this.doc = doc;
|
|
18
|
+
this.docId = 0;
|
|
19
|
+
this.path = "";
|
|
20
|
+
this.bibliography = bibliography;
|
|
21
|
+
this.images = images;
|
|
22
|
+
this.otherFiles = otherFiles;
|
|
23
|
+
this.user = user;
|
|
24
|
+
this.importId = options.importId ?? null;
|
|
25
|
+
this.requestedPath = options.requestedPath || "";
|
|
26
|
+
this.template = options.template ?? null;
|
|
27
|
+
this.e2eeOptions = options.e2eeOptions ?? null;
|
|
28
|
+
this.backend = backend;
|
|
29
|
+
}
|
|
30
|
+
init() {
|
|
31
|
+
const imageGetter = new GetImages(this.images, this.otherFiles);
|
|
32
|
+
return imageGetter
|
|
33
|
+
.init()
|
|
34
|
+
.then(() => {
|
|
35
|
+
const missingImage = Object.values(this.images.db).find(imageEntry => !imageEntry.file);
|
|
36
|
+
if (missingImage) {
|
|
37
|
+
throw new Error(`Could not create document. Missing image file: ${String(missingImage.image)}`);
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
.then(() => this.createDoc())
|
|
41
|
+
.then(() => {
|
|
42
|
+
if (!this.docId) {
|
|
43
|
+
return Promise.reject(new Error("document not created"));
|
|
44
|
+
}
|
|
45
|
+
return this.saveImages();
|
|
46
|
+
})
|
|
47
|
+
.then((imageTranslationTable) => {
|
|
48
|
+
this.translateReferenceIds(imageTranslationTable);
|
|
49
|
+
return this.saveDocument();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
createDoc() {
|
|
53
|
+
const template = this.template
|
|
54
|
+
? this.template
|
|
55
|
+
: (this.backend.extractTemplate || extractTemplate)(this.doc.content);
|
|
56
|
+
const jsonData = {
|
|
57
|
+
template: template.content,
|
|
58
|
+
export_templates: template.exportTemplates,
|
|
59
|
+
document_styles: template.documentStyles,
|
|
60
|
+
import_id: this.importId
|
|
61
|
+
? this.importId
|
|
62
|
+
: template.content.attrs?.import_id,
|
|
63
|
+
template_title: template.content.attrs
|
|
64
|
+
?.template,
|
|
65
|
+
path: this.requestedPath
|
|
66
|
+
};
|
|
67
|
+
if (this.e2eeOptions?.enabled) {
|
|
68
|
+
jsonData.e2ee = true;
|
|
69
|
+
if (this.e2eeOptions.salt) {
|
|
70
|
+
jsonData.e2ee_salt = this.e2eeOptions.salt;
|
|
71
|
+
}
|
|
72
|
+
if (this.e2eeOptions.iterations) {
|
|
73
|
+
jsonData.e2ee_iterations = this.e2eeOptions.iterations;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const files = {};
|
|
77
|
+
if (template.files?.length) {
|
|
78
|
+
files.files = template.files.map(({ filename, content }) => new File([content], filename));
|
|
79
|
+
}
|
|
80
|
+
return this.backend
|
|
81
|
+
.createDoc(template, this.importId, this.requestedPath, this.e2eeOptions, files)
|
|
82
|
+
.then(({ id, path, e2ee }) => {
|
|
83
|
+
this.docId = id;
|
|
84
|
+
this.path = path;
|
|
85
|
+
this.doc.e2ee = e2ee || false;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
saveImages() {
|
|
89
|
+
return this.backend.saveImages(this.images, this.docId, this.e2eeOptions);
|
|
90
|
+
}
|
|
91
|
+
translateReferenceIds(imageTranslationTable) {
|
|
92
|
+
const walkTree = (node) => {
|
|
93
|
+
switch (node.type) {
|
|
94
|
+
case "image":
|
|
95
|
+
if (node.attrs && node.attrs.image !== false) {
|
|
96
|
+
node.attrs.image =
|
|
97
|
+
imageTranslationTable[node.attrs.image];
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case "footnote":
|
|
101
|
+
if (node.attrs?.footnote) {
|
|
102
|
+
;
|
|
103
|
+
node.attrs.footnote.forEach(childNode => walkTree(childNode));
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
if (node.content) {
|
|
108
|
+
node.content.forEach(childNode => walkTree(childNode));
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
walkTree(this.doc.content);
|
|
112
|
+
}
|
|
113
|
+
async saveDocument() {
|
|
114
|
+
let saveData;
|
|
115
|
+
if (this.e2eeOptions?.enabled && this.e2eeOptions.key) {
|
|
116
|
+
const encryptedContent = await this.backend.encryptObject(this.doc.content, this.e2eeOptions.key);
|
|
117
|
+
const encryptedComments = await this.backend.encryptObject(this.doc.comments || {}, this.e2eeOptions.key);
|
|
118
|
+
const encryptedBibliography = await this.backend.encryptObject(this.bibliography, this.e2eeOptions.key);
|
|
119
|
+
const encryptedTitle = await this.backend.encrypt(this.doc.title, this.e2eeOptions.key);
|
|
120
|
+
saveData = {
|
|
121
|
+
id: this.docId,
|
|
122
|
+
title: encryptedTitle,
|
|
123
|
+
content: encryptedContent,
|
|
124
|
+
comments: encryptedComments,
|
|
125
|
+
bibliography: encryptedBibliography
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
saveData = {
|
|
130
|
+
id: this.docId,
|
|
131
|
+
title: this.doc.title,
|
|
132
|
+
content: this.doc.content,
|
|
133
|
+
comments: this.doc.comments,
|
|
134
|
+
bibliography: this.bibliography
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return this.backend
|
|
138
|
+
.saveDocument(saveData, this.e2eeOptions)
|
|
139
|
+
.then(({ added, updated }) => {
|
|
140
|
+
const docInfo = {
|
|
141
|
+
is_owner: true,
|
|
142
|
+
access_rights: "write",
|
|
143
|
+
id: this.docId
|
|
144
|
+
};
|
|
145
|
+
this.doc.owner = {
|
|
146
|
+
id: this.user.id,
|
|
147
|
+
name: this.user.name,
|
|
148
|
+
avatar: this.user.avatar
|
|
149
|
+
};
|
|
150
|
+
this.doc.is_owner = true;
|
|
151
|
+
this.doc.version = 0;
|
|
152
|
+
this.doc.comment_version = 0;
|
|
153
|
+
this.doc.id = this.docId;
|
|
154
|
+
this.doc.added = added;
|
|
155
|
+
this.doc.updated = updated;
|
|
156
|
+
this.doc.revisions = [];
|
|
157
|
+
this.doc.rights = "write";
|
|
158
|
+
this.doc.path = this.path;
|
|
159
|
+
this.doc.e2ee = this.doc.e2ee || false;
|
|
160
|
+
if (this.e2eeOptions?.enabled &&
|
|
161
|
+
this.e2eeOptions.key &&
|
|
162
|
+
this.docId &&
|
|
163
|
+
this.backend.storeKeyInSession) {
|
|
164
|
+
this.backend.storeKeyInSession(this.docId, this.e2eeOptions.key);
|
|
165
|
+
}
|
|
166
|
+
return { doc: this.doc, docInfo };
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=importer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importer.js","sourceRoot":"","sources":["../../../src/importer/native/importer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAA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} from "./get_images.js";
|
|
2
|
+
export { updateFile } from "./update.js";
|
|
3
|
+
export { updateTemplateFile } from "./update_template.js";
|
|
4
|
+
export { extractTemplate } from "./extract_template.js";
|
|
5
|
+
export { NativeImporter } from "./importer.js";
|
|
6
|
+
export { FidusFileImporter } from "./file.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/importer/native/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { GetImages } from "./get_images.js";
|
|
2
|
+
export { updateFile } from "./update.js";
|
|
3
|
+
export { updateTemplateFile } from "./update_template.js";
|
|
4
|
+
export { extractTemplate } from "./extract_template.js";
|
|
5
|
+
export { NativeImporter } from "./importer.js";
|
|
6
|
+
export { FidusFileImporter } from "./file.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/importer/native/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAA;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AACtC,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,WAAW,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { FidusDoc, ImageDBEntries } from "../../types.js";
|
|
2
|
+
export declare function updateFile(doc: FidusDoc, filetypeVersion: number, bibliography: Record<string, unknown>, images: ImageDBEntries): {
|
|
3
|
+
doc: FidusDoc;
|
|
4
|
+
bibliography: Record<string, unknown>;
|
|
5
|
+
images: ImageDBEntries;
|
|
5
6
|
};
|
|
6
7
|
//# sourceMappingURL=update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/importer/native/update.
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/importer/native/update.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,QAAQ,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAE5D,wBAAgB,UAAU,CACtB,GAAG,EAAE,QAAQ,EACb,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,MAAM,EAAE,cAAc,GACvB;IAAC,GAAG,EAAE,QAAQ,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAC,CA2BhF"}
|
|
@@ -10,13 +10,14 @@ export function updateFile(doc, filetypeVersion, bibliography, images) {
|
|
|
10
10
|
licenses: []
|
|
11
11
|
}));
|
|
12
12
|
}
|
|
13
|
+
const docRecord = doc;
|
|
13
14
|
if (filetypeVersion < 3.3) {
|
|
14
|
-
|
|
15
|
-
delete
|
|
15
|
+
docRecord.content = docRecord.contents;
|
|
16
|
+
delete docRecord.contents;
|
|
16
17
|
}
|
|
17
18
|
if (filetypeVersion < 2.0) {
|
|
18
19
|
// Before 2.0, version numbers of the doc and of the file differed.
|
|
19
|
-
doc = updateDoc(doc,
|
|
20
|
+
doc = updateDoc(doc, docRecord.settings["doc_version"], bibliography);
|
|
20
21
|
}
|
|
21
22
|
else {
|
|
22
23
|
doc = updateDoc(doc, filetypeVersion, bibliography);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/importer/native/update.
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/importer/native/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAA;AAIjD,MAAM,UAAU,UAAU,CACtB,GAAa,EACb,eAAuB,EACvB,YAAqC,EACrC,MAAsB;IAEtB,8CAA8C;IAC9C,yCAAyC;IACzC,IAAI,eAAe,GAAG,GAAG,EAAE,CAAC;QACxB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CACzB,KAAK,CAAC,EAAE,CACJ,CAAC,KAAK,CAAC,SAAS,GAAG;YACf,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,KAAK;YACX,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,EAAE;SACf,CAAC,CACT,CAAA;IACL,CAAC;IACD,MAAM,SAAS,GAAG,GAAyC,CAAA;IAC3D,IAAI,eAAe,GAAG,GAAG,EAAE,CAAC;QACxB,SAAS,CAAC,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAA;QACtC,OAAO,SAAS,CAAC,QAAQ,CAAA;IAC7B,CAAC;IACD,IAAI,eAAe,GAAG,GAAG,EAAE,CAAC;QACxB,mEAAmE;QACnE,GAAG,GAAG,SAAS,CAAC,GAAG,EAAG,SAAS,CAAC,QAAoC,CAAC,aAAa,CAAW,EAAE,YAAmB,CAAa,CAAA;IACnI,CAAC;SAAM,CAAC;QACJ,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,eAAe,EAAE,YAAmB,CAAa,CAAA;IAC1E,CAAC;IAED,OAAO,EAAC,GAAG,EAAE,YAAY,EAAE,MAAM,EAAC,CAAA;AACtC,CAAC"}
|