@fiduswriter/editor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +22 -0
- package/dist/bibliography/tools.js +53 -0
- package/dist/bibliography/tools.js.map +1 -0
- package/dist/citations/index.js +339 -0
- package/dist/citations/index.js.map +1 -0
- package/dist/citations/render.js +47 -0
- package/dist/citations/render.js.map +1 -0
- package/dist/clipboard/copy/index.js +2 -0
- package/dist/clipboard/copy/index.js.map +1 -0
- package/dist/clipboard/copy/schema.js +54 -0
- package/dist/clipboard/copy/schema.js.map +1 -0
- package/dist/clipboard/copy/serializers.js +132 -0
- package/dist/clipboard/copy/serializers.js.map +1 -0
- package/dist/clipboard/paste/fidus_writer.js +45 -0
- package/dist/clipboard/paste/fidus_writer.js.map +1 -0
- package/dist/clipboard/paste/general.js +76 -0
- package/dist/clipboard/paste/general.js.map +1 -0
- package/dist/clipboard/paste/google_docs.js +24 -0
- package/dist/clipboard/paste/google_docs.js.map +1 -0
- package/dist/clipboard/paste/html.js +68 -0
- package/dist/clipboard/paste/html.js.map +1 -0
- package/dist/clipboard/paste/index.js +3 -0
- package/dist/clipboard/paste/index.js.map +1 -0
- package/dist/clipboard/paste/libreoffice_writer.js +27 -0
- package/dist/clipboard/paste/libreoffice_writer.js.map +1 -0
- package/dist/clipboard/paste/microsoft_word.js +79 -0
- package/dist/clipboard/paste/microsoft_word.js.map +1 -0
- package/dist/clipboard/paste/text.js +41 -0
- package/dist/clipboard/paste/text.js.map +1 -0
- package/dist/collab/chat.js +154 -0
- package/dist/collab/chat.js.map +1 -0
- package/dist/collab/colors.js +62 -0
- package/dist/collab/colors.js.map +1 -0
- package/dist/collab/doc.js +1090 -0
- package/dist/collab/doc.js.map +1 -0
- package/dist/collab/index.js +75 -0
- package/dist/collab/index.js.map +1 -0
- package/dist/collab/merge/changeset.js +90 -0
- package/dist/collab/merge/changeset.js.map +1 -0
- package/dist/collab/merge/editor.js +708 -0
- package/dist/collab/merge/editor.js.map +1 -0
- package/dist/collab/merge/footnotes.js +149 -0
- package/dist/collab/merge/footnotes.js.map +1 -0
- package/dist/collab/merge/index.js +270 -0
- package/dist/collab/merge/index.js.map +1 -0
- package/dist/collab/merge/recreate_transform.js +259 -0
- package/dist/collab/merge/recreate_transform.js.map +1 -0
- package/dist/collab/merge/schema.js +117 -0
- package/dist/collab/merge/schema.js.map +1 -0
- package/dist/collab/merge/state_plugins/action.js +138 -0
- package/dist/collab/merge/state_plugins/action.js.map +1 -0
- package/dist/collab/merge/state_plugins/clipboard.js +32 -0
- package/dist/collab/merge/state_plugins/clipboard.js.map +1 -0
- package/dist/collab/merge/state_plugins/diff.js +541 -0
- package/dist/collab/merge/state_plugins/diff.js.map +1 -0
- package/dist/collab/merge/state_plugins/index.js +3 -0
- package/dist/collab/merge/state_plugins/index.js.map +1 -0
- package/dist/collab/merge/tools.js +175 -0
- package/dist/collab/merge/tools.js.map +1 -0
- package/dist/collab/templates.js +10 -0
- package/dist/collab/templates.js.map +1 -0
- package/dist/comments/comment.js +17 -0
- package/dist/comments/comment.js.map +1 -0
- package/dist/comments/editors/answer.js +43 -0
- package/dist/comments/editors/answer.js.map +1 -0
- package/dist/comments/editors/comment.js +278 -0
- package/dist/comments/editors/comment.js.map +1 -0
- package/dist/comments/editors/index.js +4 -0
- package/dist/comments/editors/index.js.map +1 -0
- package/dist/comments/editors/notify.js +13 -0
- package/dist/comments/editors/notify.js.map +1 -0
- package/dist/comments/editors/schema.js +60 -0
- package/dist/comments/editors/schema.js.map +1 -0
- package/dist/comments/index.js +11 -0
- package/dist/comments/index.js.map +1 -0
- package/dist/comments/interactions.js +379 -0
- package/dist/comments/interactions.js.map +1 -0
- package/dist/comments/store.js +438 -0
- package/dist/comments/store.js.map +1 -0
- package/dist/contacts/add_dialog.js +88 -0
- package/dist/contacts/add_dialog.js.map +1 -0
- package/dist/contacts/templates.js +23 -0
- package/dist/contacts/templates.js.map +1 -0
- package/dist/copyright_dialog/index.js +148 -0
- package/dist/copyright_dialog/index.js.map +1 -0
- package/dist/copyright_dialog/templates.js +48 -0
- package/dist/copyright_dialog/templates.js.map +1 -0
- package/dist/databases/bibliography.js +162 -0
- package/dist/databases/bibliography.js.map +1 -0
- package/dist/databases/images.js +260 -0
- package/dist/databases/images.js.map +1 -0
- package/dist/databases/index.js +55 -0
- package/dist/databases/index.js.map +1 -0
- package/dist/dialogs/citation.js +321 -0
- package/dist/dialogs/citation.js.map +1 -0
- package/dist/dialogs/code_block.js +192 -0
- package/dist/dialogs/code_block.js.map +1 -0
- package/dist/dialogs/contributor.js +132 -0
- package/dist/dialogs/contributor.js.map +1 -0
- package/dist/dialogs/figure.js +378 -0
- package/dist/dialogs/figure.js.map +1 -0
- package/dist/dialogs/index.js +11 -0
- package/dist/dialogs/index.js.map +1 -0
- package/dist/dialogs/language.js +47 -0
- package/dist/dialogs/language.js.map +1 -0
- package/dist/dialogs/link.js +243 -0
- package/dist/dialogs/link.js.map +1 -0
- package/dist/dialogs/math.js +121 -0
- package/dist/dialogs/math.js.map +1 -0
- package/dist/dialogs/ordered_list.js +67 -0
- package/dist/dialogs/ordered_list.js.map +1 -0
- package/dist/dialogs/revision.js +36 -0
- package/dist/dialogs/revision.js.map +1 -0
- package/dist/dialogs/subsup.js +109 -0
- package/dist/dialogs/subsup.js.map +1 -0
- package/dist/dialogs/table.js +217 -0
- package/dist/dialogs/table.js.map +1 -0
- package/dist/dialogs/templates.js +366 -0
- package/dist/dialogs/templates.js.map +1 -0
- package/dist/document_template/exporter.js +83 -0
- package/dist/document_template/exporter.js.map +1 -0
- package/dist/document_template/index.js +327 -0
- package/dist/document_template/index.js.map +1 -0
- package/dist/documents/access_rights/index.js +532 -0
- package/dist/documents/access_rights/index.js.map +1 -0
- package/dist/documents/access_rights/templates.js +150 -0
- package/dist/documents/access_rights/templates.js.map +1 -0
- package/dist/e2ee/encryptor.js +201 -0
- package/dist/e2ee/encryptor.js.map +1 -0
- package/dist/e2ee/key-manager.js +171 -0
- package/dist/e2ee/key-manager.js.map +1 -0
- package/dist/e2ee/passphrase-crypto.js +365 -0
- package/dist/e2ee/passphrase-crypto.js.map +1 -0
- package/dist/e2ee/passphrase-dialog.js +548 -0
- package/dist/e2ee/passphrase-dialog.js.map +1 -0
- package/dist/e2ee/passphrase-manager.js +350 -0
- package/dist/e2ee/passphrase-manager.js.map +1 -0
- package/dist/e2ee/password-dialog.js +552 -0
- package/dist/e2ee/password-dialog.js.map +1 -0
- package/dist/e2ee/snapshot-manager.js +238 -0
- package/dist/e2ee/snapshot-manager.js.map +1 -0
- package/dist/exporter/native/copy.js +29 -0
- package/dist/exporter/native/copy.js.map +1 -0
- package/dist/exporter/native/file.js +19 -0
- package/dist/exporter/native/file.js.map +1 -0
- package/dist/exporter/native/index.js +4 -0
- package/dist/exporter/native/index.js.map +1 -0
- package/dist/exporter/native/revision.js +54 -0
- package/dist/exporter/native/revision.js.map +1 -0
- package/dist/exporter/native/zip.js +2 -0
- package/dist/exporter/native/zip.js.map +1 -0
- package/dist/footnotes/editor.js +180 -0
- package/dist/footnotes/editor.js.map +1 -0
- package/dist/footnotes/index.js +15 -0
- package/dist/footnotes/index.js.map +1 -0
- package/dist/footnotes/layout.js +125 -0
- package/dist/footnotes/layout.js.map +1 -0
- package/dist/footnotes/state_plugins/access_rights.js +25 -0
- package/dist/footnotes/state_plugins/access_rights.js.map +1 -0
- package/dist/footnotes/state_plugins/index.js +2 -0
- package/dist/footnotes/state_plugins/index.js.map +1 -0
- package/dist/images/edit_dialog/edit_dialog/index.js +186 -0
- package/dist/images/edit_dialog/edit_dialog/index.js.map +1 -0
- package/dist/images/edit_dialog/edit_dialog/model.js +152 -0
- package/dist/images/edit_dialog/edit_dialog/model.js.map +1 -0
- package/dist/images/edit_dialog/edit_dialog/templates.js +33 -0
- package/dist/images/edit_dialog/edit_dialog/templates.js.map +1 -0
- package/dist/images/edit_dialog/model.js +6 -0
- package/dist/images/edit_dialog/model.js.map +1 -0
- package/dist/images/selection_dialog/index.js +149 -0
- package/dist/images/selection_dialog/index.js.map +1 -0
- package/dist/index.js +1002 -0
- package/dist/index.js.map +1 -0
- package/dist/keymap.js +73 -0
- package/dist/keymap.js.map +1 -0
- package/dist/marginboxes/index.js +674 -0
- package/dist/marginboxes/index.js.map +1 -0
- package/dist/marginboxes/templates.js +447 -0
- package/dist/marginboxes/templates.js.map +1 -0
- package/dist/menus/code_block/index.js +2 -0
- package/dist/menus/code_block/index.js.map +1 -0
- package/dist/menus/code_block/model.js +49 -0
- package/dist/menus/code_block/model.js.map +1 -0
- package/dist/menus/figure/index.js +3 -0
- package/dist/menus/figure/index.js.map +1 -0
- package/dist/menus/figure/model.js +80 -0
- package/dist/menus/figure/model.js.map +1 -0
- package/dist/menus/figure/utils.js +6 -0
- package/dist/menus/figure/utils.js.map +1 -0
- package/dist/menus/headerbar/index.js +3 -0
- package/dist/menus/headerbar/index.js.map +1 -0
- package/dist/menus/headerbar/model.js +743 -0
- package/dist/menus/headerbar/model.js.map +1 -0
- package/dist/menus/headerbar/view.js +579 -0
- package/dist/menus/headerbar/view.js.map +1 -0
- package/dist/menus/image/index.js +2 -0
- package/dist/menus/image/index.js.map +1 -0
- package/dist/menus/image/model.js +32 -0
- package/dist/menus/image/model.js.map +1 -0
- package/dist/menus/index.js +10 -0
- package/dist/menus/index.js.map +1 -0
- package/dist/menus/navigator/index.js +2 -0
- package/dist/menus/navigator/index.js.map +1 -0
- package/dist/menus/navigator/model.js +29 -0
- package/dist/menus/navigator/model.js.map +1 -0
- package/dist/menus/ordered_list/index.js +2 -0
- package/dist/menus/ordered_list/index.js.map +1 -0
- package/dist/menus/ordered_list/model.js +17 -0
- package/dist/menus/ordered_list/model.js.map +1 -0
- package/dist/menus/selection/index.js +3 -0
- package/dist/menus/selection/index.js.map +1 -0
- package/dist/menus/selection/model.js +108 -0
- package/dist/menus/selection/model.js.map +1 -0
- package/dist/menus/selection/view.js +125 -0
- package/dist/menus/selection/view.js.map +1 -0
- package/dist/menus/table/index.js +2 -0
- package/dist/menus/table/index.js.map +1 -0
- package/dist/menus/table/model.js +319 -0
- package/dist/menus/table/model.js.map +1 -0
- package/dist/menus/toolbar/index.js +3 -0
- package/dist/menus/toolbar/index.js.map +1 -0
- package/dist/menus/toolbar/model.js +747 -0
- package/dist/menus/toolbar/model.js.map +1 -0
- package/dist/menus/toolbar/view.js +314 -0
- package/dist/menus/toolbar/view.js.map +1 -0
- package/dist/navigator/index.js +435 -0
- package/dist/navigator/index.js.map +1 -0
- package/dist/no_collab_save/index.js +169 -0
- package/dist/no_collab_save/index.js.map +1 -0
- package/dist/plugins/citation_dialog/index.js +2 -0
- package/dist/plugins/citation_dialog/index.js.map +1 -0
- package/dist/plugins/editor/index.js +2 -0
- package/dist/plugins/editor/index.js.map +1 -0
- package/dist/state_plugins/access_rights.js +30 -0
- package/dist/state_plugins/access_rights.js.map +1 -0
- package/dist/state_plugins/citation_render.js +78 -0
- package/dist/state_plugins/citation_render.js.map +1 -0
- package/dist/state_plugins/clipboard.js +217 -0
- package/dist/state_plugins/clipboard.js.map +1 -0
- package/dist/state_plugins/code_block.js +165 -0
- package/dist/state_plugins/code_block.js.map +1 -0
- package/dist/state_plugins/collab_carets.js +115 -0
- package/dist/state_plugins/collab_carets.js.map +1 -0
- package/dist/state_plugins/comments.js +197 -0
- package/dist/state_plugins/comments.js.map +1 -0
- package/dist/state_plugins/contributor_input/add_button.js +101 -0
- package/dist/state_plugins/contributor_input/add_button.js.map +1 -0
- package/dist/state_plugins/contributor_input/dropup.js +273 -0
- package/dist/state_plugins/contributor_input/dropup.js.map +1 -0
- package/dist/state_plugins/contributor_input/helpers.js +23 -0
- package/dist/state_plugins/contributor_input/helpers.js.map +1 -0
- package/dist/state_plugins/contributor_input/index.js +3 -0
- package/dist/state_plugins/contributor_input/index.js.map +1 -0
- package/dist/state_plugins/contributor_input/node_view.js +76 -0
- package/dist/state_plugins/contributor_input/node_view.js.map +1 -0
- package/dist/state_plugins/contributor_input/plugin.js +236 -0
- package/dist/state_plugins/contributor_input/plugin.js.map +1 -0
- package/dist/state_plugins/document_template.js +213 -0
- package/dist/state_plugins/document_template.js.map +1 -0
- package/dist/state_plugins/figure.js +90 -0
- package/dist/state_plugins/figure.js.map +1 -0
- package/dist/state_plugins/footnote_markers.js +187 -0
- package/dist/state_plugins/footnote_markers.js.map +1 -0
- package/dist/state_plugins/headerbar.js +10 -0
- package/dist/state_plugins/headerbar.js.map +1 -0
- package/dist/state_plugins/index.js +27 -0
- package/dist/state_plugins/index.js.map +1 -0
- package/dist/state_plugins/inline_math.js +719 -0
- package/dist/state_plugins/inline_math.js.map +1 -0
- package/dist/state_plugins/inline_reference/dropup.js +182 -0
- package/dist/state_plugins/inline_reference/dropup.js.map +1 -0
- package/dist/state_plugins/inline_reference/index.js +2 -0
- package/dist/state_plugins/inline_reference/index.js.map +1 -0
- package/dist/state_plugins/inline_reference/plugin.js +1134 -0
- package/dist/state_plugins/inline_reference/plugin.js.map +1 -0
- package/dist/state_plugins/jump_hidden_nodes.js +47 -0
- package/dist/state_plugins/jump_hidden_nodes.js.map +1 -0
- package/dist/state_plugins/links.js +622 -0
- package/dist/state_plugins/links.js.map +1 -0
- package/dist/state_plugins/marginboxes.js +13 -0
- package/dist/state_plugins/marginboxes.js.map +1 -0
- package/dist/state_plugins/ordered_list_menu.js +72 -0
- package/dist/state_plugins/ordered_list_menu.js.map +1 -0
- package/dist/state_plugins/placeholders.js +98 -0
- package/dist/state_plugins/placeholders.js.map +1 -0
- package/dist/state_plugins/search.js +212 -0
- package/dist/state_plugins/search.js.map +1 -0
- package/dist/state_plugins/selection_menu.js +10 -0
- package/dist/state_plugins/selection_menu.js.map +1 -0
- package/dist/state_plugins/settings.js +191 -0
- package/dist/state_plugins/settings.js.map +1 -0
- package/dist/state_plugins/table.js +104 -0
- package/dist/state_plugins/table.js.map +1 -0
- package/dist/state_plugins/tag_input/helpers.js +55 -0
- package/dist/state_plugins/tag_input/helpers.js.map +1 -0
- package/dist/state_plugins/tag_input/index.js +3 -0
- package/dist/state_plugins/tag_input/index.js.map +1 -0
- package/dist/state_plugins/tag_input/node_view.js +77 -0
- package/dist/state_plugins/tag_input/node_view.js.map +1 -0
- package/dist/state_plugins/tag_input/plugin.js +199 -0
- package/dist/state_plugins/tag_input/plugin.js.map +1 -0
- package/dist/state_plugins/tag_input/tag_editor.js +159 -0
- package/dist/state_plugins/tag_input/tag_editor.js.map +1 -0
- package/dist/state_plugins/tag_input/tag_editor_plugins.js +61 -0
- package/dist/state_plugins/tag_input/tag_editor_plugins.js.map +1 -0
- package/dist/state_plugins/toc_render.js +142 -0
- package/dist/state_plugins/toc_render.js.map +1 -0
- package/dist/state_plugins/toolbar.js +10 -0
- package/dist/state_plugins/toolbar.js.map +1 -0
- package/dist/state_plugins/track/find_selected_changes.js +82 -0
- package/dist/state_plugins/track/find_selected_changes.js.map +1 -0
- package/dist/state_plugins/track/helpers.js +67 -0
- package/dist/state_plugins/track/helpers.js.map +1 -0
- package/dist/state_plugins/track/index.js +3 -0
- package/dist/state_plugins/track/index.js.map +1 -0
- package/dist/state_plugins/track/plugin.js +114 -0
- package/dist/state_plugins/track/plugin.js.map +1 -0
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/key_bindings/index.js +20 -0
- package/dist/tools/key_bindings/index.js.map +1 -0
- package/dist/tools/key_bindings/templates.js +68 -0
- package/dist/tools/key_bindings/templates.js.map +1 -0
- package/dist/tools/search_replace/index.js +275 -0
- package/dist/tools/search_replace/index.js.map +1 -0
- package/dist/tools/search_replace/templates.js +18 -0
- package/dist/tools/search_replace/templates.js.map +1 -0
- package/dist/tools/word_count/index.js +40 -0
- package/dist/tools/word_count/index.js.map +1 -0
- package/dist/tools/word_count/templates.js +27 -0
- package/dist/tools/word_count/templates.js.map +1 -0
- package/dist/track/accept.js +66 -0
- package/dist/track/accept.js.map +1 -0
- package/dist/track/accept_all.js +51 -0
- package/dist/track/accept_all.js.map +1 -0
- package/dist/track/accept_all_no_insertions.js +63 -0
- package/dist/track/accept_all_no_insertions.js.map +1 -0
- package/dist/track/amend_transaction.js +390 -0
- package/dist/track/amend_transaction.js.map +1 -0
- package/dist/track/delete.js +62 -0
- package/dist/track/delete.js.map +1 -0
- package/dist/track/index.js +6 -0
- package/dist/track/index.js.map +1 -0
- package/dist/track/mod.js +86 -0
- package/dist/track/mod.js.map +1 -0
- package/dist/track/reject.js +67 -0
- package/dist/track/reject.js.map +1 -0
- package/dist/track/reject_all.js +56 -0
- package/dist/track/reject_all.js.map +1 -0
- package/package.json +80 -0
- package/src/bibliography/tools.js +58 -0
- package/src/citations/index.js +443 -0
- package/src/citations/render.js +68 -0
- package/src/clipboard/copy/index.js +1 -0
- package/src/clipboard/copy/schema.js +62 -0
- package/src/clipboard/copy/serializers.js +179 -0
- package/src/clipboard/paste/fidus_writer.js +55 -0
- package/src/clipboard/paste/general.js +80 -0
- package/src/clipboard/paste/google_docs.js +26 -0
- package/src/clipboard/paste/html.js +76 -0
- package/src/clipboard/paste/index.js +2 -0
- package/src/clipboard/paste/libreoffice_writer.js +32 -0
- package/src/clipboard/paste/microsoft_word.js +87 -0
- package/src/clipboard/paste/text.js +58 -0
- package/src/collab/chat.js +195 -0
- package/src/collab/colors.js +67 -0
- package/src/collab/doc.js +1436 -0
- package/src/collab/index.js +81 -0
- package/src/collab/merge/changeset.js +103 -0
- package/src/collab/merge/editor.js +1065 -0
- package/src/collab/merge/footnotes.js +175 -0
- package/src/collab/merge/index.js +401 -0
- package/src/collab/merge/recreate_transform.js +326 -0
- package/src/collab/merge/schema.js +135 -0
- package/src/collab/merge/state_plugins/action.js +171 -0
- package/src/collab/merge/state_plugins/clipboard.js +32 -0
- package/src/collab/merge/state_plugins/diff.js +780 -0
- package/src/collab/merge/state_plugins/index.js +2 -0
- package/src/collab/merge/tools.js +217 -0
- package/src/collab/templates.js +10 -0
- package/src/comments/comment.js +29 -0
- package/src/comments/editors/answer.js +55 -0
- package/src/comments/editors/comment.js +318 -0
- package/src/comments/editors/index.js +4 -0
- package/src/comments/editors/notify.js +13 -0
- package/src/comments/editors/schema.js +65 -0
- package/src/comments/index.js +11 -0
- package/src/comments/interactions.js +465 -0
- package/src/comments/store.js +513 -0
- package/src/contacts/add_dialog.js +110 -0
- package/src/contacts/templates.js +28 -0
- package/src/copyright_dialog/index.js +179 -0
- package/src/copyright_dialog/templates.js +56 -0
- package/src/databases/bibliography.js +179 -0
- package/src/databases/images.js +320 -0
- package/src/databases/index.js +69 -0
- package/src/dialogs/citation.js +428 -0
- package/src/dialogs/code_block.js +242 -0
- package/src/dialogs/contributor.js +173 -0
- package/src/dialogs/figure.js +479 -0
- package/src/dialogs/index.js +10 -0
- package/src/dialogs/language.js +58 -0
- package/src/dialogs/link.js +358 -0
- package/src/dialogs/math.js +148 -0
- package/src/dialogs/ordered_list.js +84 -0
- package/src/dialogs/revision.js +43 -0
- package/src/dialogs/subsup.js +116 -0
- package/src/dialogs/table.js +258 -0
- package/src/dialogs/templates.js +426 -0
- package/src/document_template/exporter.js +97 -0
- package/src/document_template/index.js +483 -0
- package/src/documents/access_rights/index.js +693 -0
- package/src/documents/access_rights/templates.js +178 -0
- package/src/e2ee/encryptor.js +228 -0
- package/src/e2ee/key-manager.js +202 -0
- package/src/e2ee/passphrase-crypto.js +606 -0
- package/src/e2ee/passphrase-dialog.js +655 -0
- package/src/e2ee/passphrase-manager.js +502 -0
- package/src/e2ee/password-dialog.js +652 -0
- package/src/e2ee/snapshot-manager.js +305 -0
- package/src/exporter/native/copy.js +54 -0
- package/src/exporter/native/file.js +37 -0
- package/src/exporter/native/index.js +3 -0
- package/src/exporter/native/revision.js +86 -0
- package/src/exporter/native/zip.js +1 -0
- package/src/footnotes/editor.js +227 -0
- package/src/footnotes/index.js +16 -0
- package/src/footnotes/layout.js +190 -0
- package/src/footnotes/state_plugins/access_rights.js +39 -0
- package/src/footnotes/state_plugins/index.js +1 -0
- package/src/images/edit_dialog/edit_dialog/index.js +222 -0
- package/src/images/edit_dialog/edit_dialog/model.js +183 -0
- package/src/images/edit_dialog/edit_dialog/templates.js +41 -0
- package/src/images/edit_dialog/model.js +5 -0
- package/src/images/selection_dialog/index.js +176 -0
- package/src/index.js +1252 -0
- package/src/keymap.js +102 -0
- package/src/marginboxes/index.js +946 -0
- package/src/marginboxes/templates.js +573 -0
- package/src/menus/code_block/index.js +1 -0
- package/src/menus/code_block/model.js +52 -0
- package/src/menus/figure/index.js +2 -0
- package/src/menus/figure/model.js +91 -0
- package/src/menus/figure/utils.js +5 -0
- package/src/menus/headerbar/index.js +2 -0
- package/src/menus/headerbar/model.js +1077 -0
- package/src/menus/headerbar/view.js +675 -0
- package/src/menus/image/index.js +1 -0
- package/src/menus/image/model.js +32 -0
- package/src/menus/index.js +9 -0
- package/src/menus/navigator/index.js +1 -0
- package/src/menus/navigator/model.js +28 -0
- package/src/menus/ordered_list/index.js +1 -0
- package/src/menus/ordered_list/model.js +19 -0
- package/src/menus/selection/index.js +2 -0
- package/src/menus/selection/model.js +134 -0
- package/src/menus/selection/view.js +154 -0
- package/src/menus/table/index.js +1 -0
- package/src/menus/table/model.js +414 -0
- package/src/menus/toolbar/index.js +2 -0
- package/src/menus/toolbar/model.js +920 -0
- package/src/menus/toolbar/view.js +354 -0
- package/src/navigator/index.js +515 -0
- package/src/no_collab_save/index.js +209 -0
- package/src/plugins/citation_dialog/index.js +1 -0
- package/src/plugins/editor/index.js +1 -0
- package/src/state_plugins/access_rights.js +47 -0
- package/src/state_plugins/citation_render.js +88 -0
- package/src/state_plugins/clipboard.js +289 -0
- package/src/state_plugins/code_block.js +201 -0
- package/src/state_plugins/collab_carets.js +152 -0
- package/src/state_plugins/comments.js +259 -0
- package/src/state_plugins/contributor_input/add_button.js +134 -0
- package/src/state_plugins/contributor_input/dropup.js +318 -0
- package/src/state_plugins/contributor_input/helpers.js +24 -0
- package/src/state_plugins/contributor_input/index.js +2 -0
- package/src/state_plugins/contributor_input/node_view.js +86 -0
- package/src/state_plugins/contributor_input/plugin.js +318 -0
- package/src/state_plugins/document_template.js +315 -0
- package/src/state_plugins/figure.js +108 -0
- package/src/state_plugins/footnote_markers.js +238 -0
- package/src/state_plugins/headerbar.js +12 -0
- package/src/state_plugins/index.js +73 -0
- package/src/state_plugins/inline_math.js +918 -0
- package/src/state_plugins/inline_reference/dropup.js +208 -0
- package/src/state_plugins/inline_reference/index.js +5 -0
- package/src/state_plugins/inline_reference/plugin.js +1429 -0
- package/src/state_plugins/jump_hidden_nodes.js +58 -0
- package/src/state_plugins/links.js +830 -0
- package/src/state_plugins/marginboxes.js +14 -0
- package/src/state_plugins/ordered_list_menu.js +84 -0
- package/src/state_plugins/placeholders.js +123 -0
- package/src/state_plugins/search.js +251 -0
- package/src/state_plugins/selection_menu.js +12 -0
- package/src/state_plugins/settings.js +223 -0
- package/src/state_plugins/table.js +127 -0
- package/src/state_plugins/tag_input/helpers.js +69 -0
- package/src/state_plugins/tag_input/index.js +2 -0
- package/src/state_plugins/tag_input/node_view.js +85 -0
- package/src/state_plugins/tag_input/plugin.js +278 -0
- package/src/state_plugins/tag_input/tag_editor.js +202 -0
- package/src/state_plugins/tag_input/tag_editor_plugins.js +74 -0
- package/src/state_plugins/toc_render.js +160 -0
- package/src/state_plugins/toolbar.js +12 -0
- package/src/state_plugins/track/find_selected_changes.js +107 -0
- package/src/state_plugins/track/helpers.js +108 -0
- package/src/state_plugins/track/index.js +6 -0
- package/src/state_plugins/track/plugin.js +140 -0
- package/src/tools/index.js +3 -0
- package/src/tools/key_bindings/index.js +21 -0
- package/src/tools/key_bindings/templates.js +68 -0
- package/src/tools/search_replace/index.js +421 -0
- package/src/tools/search_replace/templates.js +19 -0
- package/src/tools/word_count/index.js +59 -0
- package/src/tools/word_count/templates.js +34 -0
- package/src/track/accept.js +102 -0
- package/src/track/accept_all.js +103 -0
- package/src/track/accept_all_no_insertions.js +102 -0
- package/src/track/amend_transaction.js +562 -0
- package/src/track/delete.js +92 -0
- package/src/track/index.js +8 -0
- package/src/track/mod.js +116 -0
- package/src/track/reject.js +116 -0
- package/src/track/reject_all.js +121 -0
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import {BIBLIOGRAPHY_HEADERS} from "@fiduswriter/document/schema/i18n"
|
|
2
|
+
import {Dialog, cancelPromise} from "fwtoolkit"
|
|
3
|
+
import {RenderCitations} from "../../citations/render"
|
|
4
|
+
|
|
5
|
+
export class ModCitations {
|
|
6
|
+
constructor(editor) {
|
|
7
|
+
editor.mod.citations = this
|
|
8
|
+
this.editor = editor
|
|
9
|
+
this.citationType = ""
|
|
10
|
+
this.fnOverrideElement = false
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
init() {
|
|
14
|
+
/* Add a style to hold dynamic CSS info about footnote numbering overrides.
|
|
15
|
+
* Because we need footnotes in the editor and footnotes added through
|
|
16
|
+
* citations to be numbered but they aren't in the same order in the DOM,
|
|
17
|
+
* we need to organize the numbering manually.
|
|
18
|
+
*/
|
|
19
|
+
document.body.insertAdjacentHTML(
|
|
20
|
+
"beforeend",
|
|
21
|
+
'<style type="text/css" id="footnote-numbering-override"></style>'
|
|
22
|
+
)
|
|
23
|
+
this.fnOverrideElement = document.getElementById(
|
|
24
|
+
"footnote-numbering-override"
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
resetCitations() {
|
|
29
|
+
const citations = document.querySelectorAll(
|
|
30
|
+
"#paper-editable span.citation"
|
|
31
|
+
)
|
|
32
|
+
citations.forEach(citation => (citation.innerHTML = ""))
|
|
33
|
+
const docBibliography = document.querySelector(".doc-bibliography")
|
|
34
|
+
const citationsContainer = document.getElementById(
|
|
35
|
+
"citation-footnote-box-container"
|
|
36
|
+
)
|
|
37
|
+
if (!docBibliography || !citationsContainer) {
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
if (docBibliography.innerHTML !== "") {
|
|
41
|
+
docBibliography.innerHTML = ""
|
|
42
|
+
}
|
|
43
|
+
if (citationsContainer.innerHTML !== "") {
|
|
44
|
+
citationsContainer.innerHTML = ""
|
|
45
|
+
}
|
|
46
|
+
this.layoutCitations()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
layoutCitations() {
|
|
50
|
+
if (!this.editor.mod.db?.bibDB.db) {
|
|
51
|
+
// bibliography hasn't been loaded yet
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
const emptyCitations = document.querySelectorAll(
|
|
55
|
+
"#paper-editable span.citation:empty"
|
|
56
|
+
)
|
|
57
|
+
if (emptyCitations.length) {
|
|
58
|
+
const settings = this.editor.view.state.doc.attrs,
|
|
59
|
+
bibliographyHeader =
|
|
60
|
+
settings.bibliography_header[settings.language] ||
|
|
61
|
+
BIBLIOGRAPHY_HEADERS[settings.language]
|
|
62
|
+
this.citRenderer = new RenderCitations(
|
|
63
|
+
document.getElementById("paper-editable"),
|
|
64
|
+
settings.citationstyle,
|
|
65
|
+
bibliographyHeader,
|
|
66
|
+
this.editor.mod.db.bibDB,
|
|
67
|
+
this.editor.app.csl,
|
|
68
|
+
false,
|
|
69
|
+
settings.language
|
|
70
|
+
)
|
|
71
|
+
this.citRenderer
|
|
72
|
+
.init()
|
|
73
|
+
.then(() => this.layoutCitationsTwo())
|
|
74
|
+
.catch(() => this.recoverAfterCiteProcCrash())
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
recoverAfterCiteProcCrash() {
|
|
79
|
+
console.warn(
|
|
80
|
+
"CitationProcessor crashed. Falling back to simplified citation rendering."
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
// Create simplified citation texts for all citations
|
|
84
|
+
const citationNodes = document.querySelectorAll(
|
|
85
|
+
"#paper-editable span.citation"
|
|
86
|
+
)
|
|
87
|
+
citationNodes.forEach(citation => {
|
|
88
|
+
try {
|
|
89
|
+
// Get citation data from dataset
|
|
90
|
+
const referencesData = JSON.parse(
|
|
91
|
+
citation.dataset.references || "[]"
|
|
92
|
+
)
|
|
93
|
+
if (!referencesData.length) {
|
|
94
|
+
citation.innerHTML = "[?]"
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Create a basic fallback citation text
|
|
99
|
+
const citationText = referencesData
|
|
100
|
+
.map(ref => {
|
|
101
|
+
const entryId = ref.id
|
|
102
|
+
const item = this.editor.mod.db.bibDB.db[entryId]
|
|
103
|
+
|
|
104
|
+
if (!item) {
|
|
105
|
+
return `[${entryId || "?"}]`
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Extract basic author info
|
|
109
|
+
let authorText = ""
|
|
110
|
+
if (item.fields.author && item.fields.author.length) {
|
|
111
|
+
const author = item.fields.author[0]
|
|
112
|
+
authorText =
|
|
113
|
+
(
|
|
114
|
+
author.lastName ||
|
|
115
|
+
author.firstname ||
|
|
116
|
+
author.literal
|
|
117
|
+
)
|
|
118
|
+
?.map(part => part.text || "")
|
|
119
|
+
.join("") || "Unknown Author"
|
|
120
|
+
if (item.fields.author.length > 1) {
|
|
121
|
+
authorText += " et al."
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
authorText = "Unknown Author"
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Extract year
|
|
128
|
+
const year = item.fields.date
|
|
129
|
+
? item.fields.date.substring(0, 4)
|
|
130
|
+
: "n.d."
|
|
131
|
+
|
|
132
|
+
// Add locator if present
|
|
133
|
+
const locator = ref.locator ? `, ${ref.locator}` : ""
|
|
134
|
+
|
|
135
|
+
return `(${authorText}, ${year}${locator})`
|
|
136
|
+
})
|
|
137
|
+
.join("; ")
|
|
138
|
+
|
|
139
|
+
citation.innerHTML = citationText
|
|
140
|
+
} catch (error) {
|
|
141
|
+
console.error("Error creating fallback citation:", error)
|
|
142
|
+
citation.innerHTML = "[Citation]"
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
// Create a simplified bibliography
|
|
147
|
+
const docBibliography = document.querySelector(".doc-bibliography")
|
|
148
|
+
if (docBibliography) {
|
|
149
|
+
try {
|
|
150
|
+
const settings = this.editor.view.state.doc.attrs
|
|
151
|
+
const bibliographyHeader =
|
|
152
|
+
settings.bibliography_header[settings.language] ||
|
|
153
|
+
BIBLIOGRAPHY_HEADERS[settings.language]
|
|
154
|
+
|
|
155
|
+
let bibHTML = `<h1 class="doc-bibliography-header">${bibliographyHeader}</h1><div class="csl-bib-body">`
|
|
156
|
+
|
|
157
|
+
// Collect all citation references
|
|
158
|
+
const allCitations = Array.from(
|
|
159
|
+
document.querySelectorAll("#paper-editable span.citation")
|
|
160
|
+
)
|
|
161
|
+
const allRefs = new Set()
|
|
162
|
+
|
|
163
|
+
allCitations.forEach(citation => {
|
|
164
|
+
try {
|
|
165
|
+
const refs = JSON.parse(
|
|
166
|
+
citation.dataset.references || "[]"
|
|
167
|
+
)
|
|
168
|
+
refs.forEach(ref => allRefs.add(ref.id))
|
|
169
|
+
} catch (_error) {
|
|
170
|
+
// Skip invalid references
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
// Create simple bibliography entries
|
|
175
|
+
const bibDB = this.editor.mod.db.bibDB.db
|
|
176
|
+
Array.from(allRefs)
|
|
177
|
+
.sort()
|
|
178
|
+
.forEach(id => {
|
|
179
|
+
const item = bibDB[id]
|
|
180
|
+
if (!item) {
|
|
181
|
+
bibHTML += `<div class="csl-entry" data-reference="${id}">[Missing reference: ${id}]</div>`
|
|
182
|
+
return
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
let authors = ""
|
|
186
|
+
if (item.fields.author && item.fields.author.length) {
|
|
187
|
+
authors = item.fields.author
|
|
188
|
+
.map(author => {
|
|
189
|
+
return (
|
|
190
|
+
(
|
|
191
|
+
author.lastName ||
|
|
192
|
+
author.firstname ||
|
|
193
|
+
author.literal
|
|
194
|
+
)
|
|
195
|
+
?.map(part => part.text || "")
|
|
196
|
+
.join("") || "Unknown"
|
|
197
|
+
)
|
|
198
|
+
})
|
|
199
|
+
.join(", ")
|
|
200
|
+
} else {
|
|
201
|
+
authors = "Unknown Author"
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const year = item.fields.date
|
|
205
|
+
? `(${item.fields.date.substring(0, 4)})`
|
|
206
|
+
: "(n.d.)"
|
|
207
|
+
const title =
|
|
208
|
+
item.fields.title
|
|
209
|
+
?.map(part => part.text || "")
|
|
210
|
+
.join("") || "Untitled"
|
|
211
|
+
const publisher =
|
|
212
|
+
item.fields.publisher
|
|
213
|
+
?.map(part => part.text || "")
|
|
214
|
+
.join("") || ""
|
|
215
|
+
const itemType = item.bib_type || "misc"
|
|
216
|
+
|
|
217
|
+
bibHTML += `<div class="csl-entry" data-reference="${id}">${authors} ${year}. <i>${title}</i>. ${publisher}. [${itemType}]</div>`
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
bibHTML += "</div>"
|
|
221
|
+
docBibliography.innerHTML = bibHTML
|
|
222
|
+
// Add basic bibliography styling
|
|
223
|
+
let styleEl = document.querySelector(".doc-bibliography-style")
|
|
224
|
+
if (!styleEl) {
|
|
225
|
+
document.body.insertAdjacentHTML(
|
|
226
|
+
"beforeend",
|
|
227
|
+
'<style type="text/css" class="doc-bibliography-style"></style>'
|
|
228
|
+
)
|
|
229
|
+
styleEl = document.querySelector(".doc-bibliography-style")
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const basicCSS = `
|
|
233
|
+
.csl-bib-body { line-height: 1.35; }
|
|
234
|
+
.csl-entry { padding-bottom: 1em; padding-left: 2em; text-indent: -2em; }
|
|
235
|
+
div.csl-entry { cursor: pointer; }
|
|
236
|
+
div.csl-entry:hover { background-color: #f0f0f0; }
|
|
237
|
+
`
|
|
238
|
+
styleEl.innerHTML = basicCSS
|
|
239
|
+
|
|
240
|
+
// Rebind click handlers for bibliography entries
|
|
241
|
+
if (this.editor.docInfo.access_rights === "write") {
|
|
242
|
+
this.bindBibliographyClicks()
|
|
243
|
+
}
|
|
244
|
+
} catch (error) {
|
|
245
|
+
console.error("Error creating fallback bibliography:", error)
|
|
246
|
+
docBibliography.innerHTML =
|
|
247
|
+
"<h1>Bibliography (Error rendering)</h1>"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Reset citation type to avoid footnote layout issues
|
|
252
|
+
this.citationType = "in-text"
|
|
253
|
+
|
|
254
|
+
return Promise.resolve()
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
bindBibliographyClicks() {
|
|
258
|
+
document.querySelectorAll("div.csl-entry").forEach((el, index) => {
|
|
259
|
+
el.addEventListener("click", () => {
|
|
260
|
+
const eID = Number.parseInt(
|
|
261
|
+
this.citRenderer.fm.bibliography[0]?.entry_ids[index][0] ||
|
|
262
|
+
el.dataset.reference
|
|
263
|
+
)
|
|
264
|
+
this.checkTrackingDialog()
|
|
265
|
+
.then(() => import("../../bibliography/form"))
|
|
266
|
+
.then(({BibEntryForm}) => {
|
|
267
|
+
const form = new BibEntryForm(
|
|
268
|
+
this.editor.mod.db.bibDB,
|
|
269
|
+
false,
|
|
270
|
+
eID
|
|
271
|
+
)
|
|
272
|
+
form.init()
|
|
273
|
+
})
|
|
274
|
+
})
|
|
275
|
+
})
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
checkTrackingDialog() {
|
|
279
|
+
if (!this.editor.view.state.doc.attrs.tracked) {
|
|
280
|
+
return Promise.resolve()
|
|
281
|
+
}
|
|
282
|
+
const buttons = [],
|
|
283
|
+
promise = new Promise(resolve => {
|
|
284
|
+
buttons.push({
|
|
285
|
+
type: "cancel",
|
|
286
|
+
click: () => {
|
|
287
|
+
dialog.close()
|
|
288
|
+
resolve(cancelPromise())
|
|
289
|
+
}
|
|
290
|
+
})
|
|
291
|
+
buttons.push({
|
|
292
|
+
type: "ok",
|
|
293
|
+
click: () => {
|
|
294
|
+
dialog.close()
|
|
295
|
+
resolve()
|
|
296
|
+
}
|
|
297
|
+
})
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
const dialog = new Dialog({
|
|
301
|
+
title: gettext("No tracking"),
|
|
302
|
+
body: gettext("Changes to citation sources are not being tracked!"),
|
|
303
|
+
icon: "exclamation-triangle",
|
|
304
|
+
width: 400,
|
|
305
|
+
height: 100,
|
|
306
|
+
buttons
|
|
307
|
+
})
|
|
308
|
+
dialog.open()
|
|
309
|
+
return promise
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
layoutCitationsTwo() {
|
|
313
|
+
const citRenderer = this.citRenderer
|
|
314
|
+
let needFootnoteLayout = false
|
|
315
|
+
if (this.citationType !== citRenderer.fm.citationType) {
|
|
316
|
+
// The citation format has changed, so we need to relayout the footnotes as well
|
|
317
|
+
needFootnoteLayout = true
|
|
318
|
+
}
|
|
319
|
+
this.citationType = citRenderer.fm.citationType
|
|
320
|
+
// Add the rendered html and css of the bibliography to the DOM.
|
|
321
|
+
const docBibliography = document.querySelector(".doc-bibliography")
|
|
322
|
+
if (!docBibliography) {
|
|
323
|
+
return
|
|
324
|
+
}
|
|
325
|
+
docBibliography.innerHTML = citRenderer.fm.bibHTML
|
|
326
|
+
let styleEl = document.querySelector(".doc-bibliography-style")
|
|
327
|
+
if (!styleEl) {
|
|
328
|
+
document.body.insertAdjacentHTML(
|
|
329
|
+
"beforeend",
|
|
330
|
+
'<style type="text/css" class="doc-bibliography-style"></style>'
|
|
331
|
+
)
|
|
332
|
+
styleEl = document.querySelector(".doc-bibliography-style")
|
|
333
|
+
}
|
|
334
|
+
let css = citRenderer.fm.bibCSS
|
|
335
|
+
if (this.editor.docInfo.access_rights === "write") {
|
|
336
|
+
this.bindBibliographyClicks()
|
|
337
|
+
css += `
|
|
338
|
+
div.csl-entry {
|
|
339
|
+
cursor: pointer;
|
|
340
|
+
}
|
|
341
|
+
div.csl-entry:hover {
|
|
342
|
+
background-color: grey;
|
|
343
|
+
}`
|
|
344
|
+
}
|
|
345
|
+
if (styleEl.innerHTML !== css) {
|
|
346
|
+
styleEl.innerHTML = css
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
const citationsContainer = document.getElementById(
|
|
350
|
+
"citation-footnote-box-container"
|
|
351
|
+
)
|
|
352
|
+
if (this.citationType === "note") {
|
|
353
|
+
// Check if there is an empty citation in the main body text (not footnotes)
|
|
354
|
+
const emptyCitations = document.querySelector("span.citation:empty")
|
|
355
|
+
|
|
356
|
+
if (emptyCitations) {
|
|
357
|
+
// Find all the citations in the main body text (not footnotes)
|
|
358
|
+
const citationNodes = document.querySelectorAll(
|
|
359
|
+
"#document-editable span.citation"
|
|
360
|
+
),
|
|
361
|
+
citationsHTML = citRenderer.fm.citationTexts
|
|
362
|
+
.slice(0, citationNodes.length)
|
|
363
|
+
.map(
|
|
364
|
+
citText =>
|
|
365
|
+
`<div class="footnote-citation">${citText}</div>`
|
|
366
|
+
)
|
|
367
|
+
.join("")
|
|
368
|
+
if (citationsContainer.innerHTML !== citationsHTML) {
|
|
369
|
+
citationsContainer.innerHTML = citationsHTML
|
|
370
|
+
}
|
|
371
|
+
// The citations have not been filled, so we do so manually.
|
|
372
|
+
citationNodes.forEach(
|
|
373
|
+
citationNode =>
|
|
374
|
+
(citationNode.innerHTML =
|
|
375
|
+
'<span class="citation-footnote-marker"></span>')
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
const footnoteCitationNodes = document.querySelectorAll(
|
|
379
|
+
"#footnote-box-container span.citation"
|
|
380
|
+
)
|
|
381
|
+
const footnoteCitTexts = citRenderer.fm.citationTexts.slice(
|
|
382
|
+
citationNodes.length
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
footnoteCitTexts.forEach((citText, index) => {
|
|
386
|
+
const citationNode = footnoteCitationNodes[index]
|
|
387
|
+
if (citationNode) {
|
|
388
|
+
citationNode.innerHTML = citText
|
|
389
|
+
}
|
|
390
|
+
})
|
|
391
|
+
}
|
|
392
|
+
} else {
|
|
393
|
+
if (citationsContainer.innerHTML !== "") {
|
|
394
|
+
citationsContainer.innerHTML = ""
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
this.footnoteNumberOverride()
|
|
399
|
+
if (needFootnoteLayout) {
|
|
400
|
+
this.editor.mod.footnotes.layout.updateDOM()
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
footnoteNumberOverride() {
|
|
405
|
+
/* Find the order of footnotes and citations in the document and
|
|
406
|
+
* write CSS to number all the citation footnotes and other footnotes
|
|
407
|
+
* correspondingly. Update footnote-numbering-override correspondingly.
|
|
408
|
+
*/
|
|
409
|
+
|
|
410
|
+
let outputCSS = ""
|
|
411
|
+
|
|
412
|
+
if (this.citationType === "note") {
|
|
413
|
+
let editorFootnoteCounter = 1,
|
|
414
|
+
citationFootnoteCounter = 1,
|
|
415
|
+
footnoteCounter = 1
|
|
416
|
+
|
|
417
|
+
this.editor.view.state.doc.descendants(node => {
|
|
418
|
+
if (
|
|
419
|
+
node.isInline &&
|
|
420
|
+
(node.type.name === "footnote" ||
|
|
421
|
+
node.type.name === "citation")
|
|
422
|
+
) {
|
|
423
|
+
if (node.type.name === "footnote") {
|
|
424
|
+
outputCSS += `#footnote-box-container .footnote-container:nth-of-type(${editorFootnoteCounter}) > *:first-child::before {
|
|
425
|
+
content: "${footnoteCounter} ";
|
|
426
|
+
}\n`
|
|
427
|
+
editorFootnoteCounter++
|
|
428
|
+
} else {
|
|
429
|
+
outputCSS += `.footnote-citation:nth-of-type(${citationFootnoteCounter})::before {
|
|
430
|
+
content: "${footnoteCounter} ";
|
|
431
|
+
}\n`
|
|
432
|
+
citationFootnoteCounter++
|
|
433
|
+
}
|
|
434
|
+
footnoteCounter++
|
|
435
|
+
}
|
|
436
|
+
})
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (this.fnOverrideElement.innerHTML !== outputCSS) {
|
|
440
|
+
this.fnOverrideElement.innerHTML = outputCSS
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {FormatCitations} from "@fiduswriter/document/citations/format"
|
|
2
|
+
/**
|
|
3
|
+
* Render citations into the DOM.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export class RenderCitations {
|
|
7
|
+
constructor(
|
|
8
|
+
contentElement,
|
|
9
|
+
citationStyle,
|
|
10
|
+
bibliographyHeader,
|
|
11
|
+
bibDB,
|
|
12
|
+
csl,
|
|
13
|
+
synchronous = false,
|
|
14
|
+
lang = "en-US"
|
|
15
|
+
) {
|
|
16
|
+
this.contentElement = contentElement
|
|
17
|
+
this.citationStyle = citationStyle
|
|
18
|
+
this.bibliographyHeader = bibliographyHeader
|
|
19
|
+
this.bibDB = bibDB
|
|
20
|
+
this.csl = csl
|
|
21
|
+
this.synchronous = synchronous
|
|
22
|
+
this.lang = lang
|
|
23
|
+
|
|
24
|
+
this.allCitationNodes = []
|
|
25
|
+
this.allCitationInfos = []
|
|
26
|
+
this.fm = false
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
init() {
|
|
30
|
+
this.allCitationNodes =
|
|
31
|
+
this.contentElement.querySelectorAll("span.citation")
|
|
32
|
+
this.allCitationNodes.forEach(cElement => {
|
|
33
|
+
const citeInfo = Object.assign({}, cElement.dataset)
|
|
34
|
+
citeInfo.references = JSON.parse(citeInfo.references)
|
|
35
|
+
this.allCitationInfos.push(citeInfo)
|
|
36
|
+
})
|
|
37
|
+
this.fm = new FormatCitations(
|
|
38
|
+
this.csl,
|
|
39
|
+
this.allCitationInfos,
|
|
40
|
+
this.citationStyle,
|
|
41
|
+
this.bibliographyHeader,
|
|
42
|
+
this.bibDB,
|
|
43
|
+
this.synchronous,
|
|
44
|
+
this.lang
|
|
45
|
+
)
|
|
46
|
+
if (this.synchronous) {
|
|
47
|
+
if (!this.fm.init()) {
|
|
48
|
+
return false
|
|
49
|
+
}
|
|
50
|
+
this.renderCitations()
|
|
51
|
+
return true
|
|
52
|
+
} else {
|
|
53
|
+
return this.fm.init().then(() => {
|
|
54
|
+
this.renderCitations()
|
|
55
|
+
return Promise.resolve()
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
renderCitations() {
|
|
61
|
+
if ("note" !== this.fm.citationType) {
|
|
62
|
+
this.fm.citationTexts.forEach(
|
|
63
|
+
(citationText, index) =>
|
|
64
|
+
(this.allCitationNodes[index].innerHTML = citationText)
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {docClipboardSerializer, fnClipboardSerializer} from "./serializers"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// A slight modification of the document schema for the purpose of copying.
|
|
2
|
+
import {DOMSerializer, Node, Schema} from "prosemirror-model"
|
|
3
|
+
|
|
4
|
+
import {citation} from "@fiduswriter/document/schema/common/index"
|
|
5
|
+
import {footnote} from "@fiduswriter/document/schema/document/content"
|
|
6
|
+
import {fnSchema} from "@fiduswriter/document/schema/footnotes"
|
|
7
|
+
|
|
8
|
+
const copyCitation = Object.assign({}, citation)
|
|
9
|
+
|
|
10
|
+
copyCitation.toDOM = node => {
|
|
11
|
+
const bibDB = node.type.schema.cached.bibDB,
|
|
12
|
+
bibs = {}
|
|
13
|
+
node.attrs.references.forEach(ref => (bibs[ref.id] = bibDB.db[ref.id]))
|
|
14
|
+
return [
|
|
15
|
+
"span",
|
|
16
|
+
{
|
|
17
|
+
class: "citation",
|
|
18
|
+
"data-format": node.attrs.format,
|
|
19
|
+
"data-references": JSON.stringify(node.attrs.references),
|
|
20
|
+
"data-bibs": JSON.stringify(bibs)
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
Citations inside of footnotes copied from the main editor also need to have bibliography
|
|
27
|
+
information attached to them.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
export const fnCopySchema = new Schema({
|
|
31
|
+
marks: fnSchema.spec.marks,
|
|
32
|
+
nodes: fnSchema.spec.nodes.update("citation", copyCitation)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const copyFootnote = Object.assign({}, footnote)
|
|
36
|
+
|
|
37
|
+
copyFootnote.toDOM = node => {
|
|
38
|
+
if (!fnCopySchema.cached.bibDB) {
|
|
39
|
+
fnCopySchema.cached.bibDB = fnSchema.cached.bibDB
|
|
40
|
+
}
|
|
41
|
+
const fnCopySerializer = DOMSerializer.fromSchema(fnCopySchema)
|
|
42
|
+
const dom = document.createElement("span")
|
|
43
|
+
dom.classList.add("footnote-marker")
|
|
44
|
+
const pmNode = Node.fromJSON(fnCopySchema, {
|
|
45
|
+
type: "footnotecontainer",
|
|
46
|
+
content: node.attrs.footnote
|
|
47
|
+
})
|
|
48
|
+
dom.dataset.footnote = fnCopySerializer.serializeNode(pmNode).innerHTML
|
|
49
|
+
dom.innerHTML = " "
|
|
50
|
+
return dom
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const createDocCopySchema = docSchema => {
|
|
54
|
+
const newSchema = new Schema({
|
|
55
|
+
marks: docSchema.spec.marks,
|
|
56
|
+
nodes: docSchema.spec.nodes
|
|
57
|
+
.update("citation", copyCitation)
|
|
58
|
+
.update("footnote", copyFootnote)
|
|
59
|
+
})
|
|
60
|
+
newSchema.cached.bibDB = docSchema.cached.bibDB
|
|
61
|
+
return newSchema
|
|
62
|
+
}
|