@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,674 @@
|
|
|
1
|
+
import { DiffDOM, stringToObj } from "diff-dom";
|
|
2
|
+
import fastdom from "fastdom";
|
|
3
|
+
import { cancelPromise, findTarget } from "fwtoolkit";
|
|
4
|
+
import { READ_ONLY_ROLES } from "..";
|
|
5
|
+
import { getCommentDuringCreationDecoration, getFootnoteMarkers, getSelectedChanges } from "../state_plugins";
|
|
6
|
+
import { globalCommentsTemplate, marginBoxOptions, marginBoxesTemplate, marginboxFilterTemplate } from "./templates";
|
|
7
|
+
/* Functions related to layouting of comments */
|
|
8
|
+
export class ModMarginboxes {
|
|
9
|
+
constructor(editor) {
|
|
10
|
+
editor.mod.marginboxes = this;
|
|
11
|
+
this.editor = editor;
|
|
12
|
+
this.activeCommentStyle = "";
|
|
13
|
+
this.filterOptions = {
|
|
14
|
+
track: true,
|
|
15
|
+
comments: true,
|
|
16
|
+
info: true,
|
|
17
|
+
help: true,
|
|
18
|
+
warning: true,
|
|
19
|
+
commentsResolved: false,
|
|
20
|
+
author: 0,
|
|
21
|
+
assigned: 0
|
|
22
|
+
};
|
|
23
|
+
this.commentColors = {
|
|
24
|
+
isMajor: "#f4c9d9",
|
|
25
|
+
marker: "#f9f9f9",
|
|
26
|
+
active: "#fffacf"
|
|
27
|
+
};
|
|
28
|
+
this.dd = new DiffDOM({
|
|
29
|
+
valueDiffing: false
|
|
30
|
+
});
|
|
31
|
+
this.marginBoxesContainerString =
|
|
32
|
+
'<div id="margin-box-container"><div></div></div>';
|
|
33
|
+
this.marginBoxesContainerObj = stringToObj(this.marginBoxesContainerString);
|
|
34
|
+
this.globalCommentsContainerString =
|
|
35
|
+
'<div id="global-comment-container"><div></div></div>';
|
|
36
|
+
this.globalCommentsContainerObj = stringToObj(this.globalCommentsContainerString);
|
|
37
|
+
this.marginBoxesPlacementStyle = "";
|
|
38
|
+
this.marginBoxes = [];
|
|
39
|
+
}
|
|
40
|
+
init() {
|
|
41
|
+
// Add two elements to hold dynamic CSS info about comments.
|
|
42
|
+
document.body.insertAdjacentHTML("beforeend", '<style type="text/css" id="active-comment-style"></style><style type="text/css" id="track-options-style"></style><style type="text/css" id="margin-box-placement-style"></style>');
|
|
43
|
+
this.marginBoxesContainer = document.getElementById("margin-box-container");
|
|
44
|
+
this.globalCommentsContainer = document.getElementById("global-comment-container");
|
|
45
|
+
this.activeCommentStyleElement = document.getElementById("active-comment-style");
|
|
46
|
+
this.trackOptionsStyleElement = document.getElementById("track-options-style");
|
|
47
|
+
const newGlobalCommentButton = document.getElementById("new-global-comment");
|
|
48
|
+
if (newGlobalCommentButton &&
|
|
49
|
+
READ_ONLY_ROLES.includes(this.editor.docInfo.access_rights)) {
|
|
50
|
+
newGlobalCommentButton.classList.add("fw-hide");
|
|
51
|
+
}
|
|
52
|
+
this.bindEvents();
|
|
53
|
+
}
|
|
54
|
+
bindEvents() {
|
|
55
|
+
// Bind all the click events related to the margin box filter
|
|
56
|
+
document.body.addEventListener("click", event => {
|
|
57
|
+
const el = {};
|
|
58
|
+
switch (true) {
|
|
59
|
+
case findTarget(event, "#new-global-comment", el):
|
|
60
|
+
this.editor.mod.comments.interactions.createNewGlobalComment();
|
|
61
|
+
break;
|
|
62
|
+
case findTarget(event, ".margin-box-filter-check", el):
|
|
63
|
+
// do not react to clicks on checkboxes within sub menus
|
|
64
|
+
break;
|
|
65
|
+
case findTarget(event, ".margin-box-filter-comments-author", el):
|
|
66
|
+
this.filterOptions.commentsAuthor = Number.parseInt(el.target.dataset.id);
|
|
67
|
+
this.view(this.editor.currentView);
|
|
68
|
+
break;
|
|
69
|
+
case findTarget(event, ".margin-box-filter-comments-assigned", el):
|
|
70
|
+
this.filterOptions.assigned = Number.parseInt(el.target.dataset.id);
|
|
71
|
+
this.view(this.editor.currentView);
|
|
72
|
+
break;
|
|
73
|
+
case findTarget(event, ".show-marginbox-options-submenu", el):
|
|
74
|
+
this.closeAllMenus(".marginbox-options-submenu.fw-open");
|
|
75
|
+
Array.from(el.target.parentElement.children)
|
|
76
|
+
.find(node => node.matches(".marginbox-options-submenu"))
|
|
77
|
+
.classList.add("fw-open");
|
|
78
|
+
break;
|
|
79
|
+
case findTarget(event, ".show-marginbox-options", el):
|
|
80
|
+
this.closeAllMenus();
|
|
81
|
+
if (el.target.parentElement.classList.contains("margin-box-filter-button")) {
|
|
82
|
+
Array.from(el.target.parentElement.children)
|
|
83
|
+
.find(node => node.matches(".fw-marginbox-options"))
|
|
84
|
+
.classList.add("fw-open");
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
let resolved = false;
|
|
88
|
+
if (el.target.parentElement?.parentElement) {
|
|
89
|
+
resolved =
|
|
90
|
+
el.target.parentElement.parentElement.classList.contains("resolved");
|
|
91
|
+
}
|
|
92
|
+
const user = this.editor.user;
|
|
93
|
+
const docInfo = this.editor.docInfo;
|
|
94
|
+
const elData = el.target.dataset;
|
|
95
|
+
const comment = {
|
|
96
|
+
answer: elData.hasOwnProperty("answer"),
|
|
97
|
+
id: elData.id,
|
|
98
|
+
commentId: elData.commentid,
|
|
99
|
+
user: Number(elData.commentuser),
|
|
100
|
+
resolved: resolved
|
|
101
|
+
};
|
|
102
|
+
document.body.insertAdjacentHTML("beforeend", marginBoxOptions(comment, user, docInfo));
|
|
103
|
+
const marginboxOptions = document.body.querySelector(".comment-answer-options.fw-marginbox-options");
|
|
104
|
+
marginboxOptions.classList.add("fw-open");
|
|
105
|
+
this.positionMarginBoxOptions(marginboxOptions, el.target);
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
108
|
+
case findTarget(event, ".margin-box-filter-track-author", el):
|
|
109
|
+
this.filterOptions.trackAuthor = Number.parseInt(el.target.dataset.id);
|
|
110
|
+
this.setTrackStyle();
|
|
111
|
+
this.view(this.editor.currentView);
|
|
112
|
+
break;
|
|
113
|
+
case findTarget(event, "#margin-box-filter-track", el):
|
|
114
|
+
this.filterOptions.track = !this.filterOptions.track;
|
|
115
|
+
this.setTrackStyle();
|
|
116
|
+
this.view(this.editor.currentView);
|
|
117
|
+
break;
|
|
118
|
+
case findTarget(event, "#margin-box-filter-comments", el):
|
|
119
|
+
this.filterOptions.comments = !this.filterOptions.comments;
|
|
120
|
+
this.view(this.editor.currentView);
|
|
121
|
+
break;
|
|
122
|
+
case findTarget(event, "#margin-box-filter-info", el):
|
|
123
|
+
this.filterOptions.info = !this.filterOptions.info;
|
|
124
|
+
this.view(this.editor.currentView);
|
|
125
|
+
break;
|
|
126
|
+
case findTarget(event, ".margin-box.comment.inactive", el):
|
|
127
|
+
{
|
|
128
|
+
const commentId = el.target.dataset.id;
|
|
129
|
+
const comment = this.editor.mod.comments.store.findComment(commentId);
|
|
130
|
+
if (!comment?.isGlobal) {
|
|
131
|
+
this.editor.mod.comments.interactions.deactivateSelectedChanges();
|
|
132
|
+
}
|
|
133
|
+
this.editor.mod.comments.interactions.activateComment(commentId);
|
|
134
|
+
this.scrollToGlobalComment(commentId);
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
case findTarget(event, ".margin-box.track.inactive", el): {
|
|
138
|
+
let boxNumber = 0;
|
|
139
|
+
let seekItem = el.target;
|
|
140
|
+
while (seekItem.previousElementSibling) {
|
|
141
|
+
boxNumber += 1;
|
|
142
|
+
seekItem = seekItem.previousElementSibling;
|
|
143
|
+
}
|
|
144
|
+
const box = this.marginBoxes[boxNumber];
|
|
145
|
+
this.editor.mod.track.activateTrack(box.view, box.type, box.pos);
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
case findTarget(event, ".margin-box.comment.fw-active .show-more-less", el):
|
|
149
|
+
this.toggleShowMore(el);
|
|
150
|
+
break;
|
|
151
|
+
default:
|
|
152
|
+
this.closeAllMenus();
|
|
153
|
+
this.closeAllLongComments();
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
document.body.addEventListener("change", evt => {
|
|
158
|
+
switch (evt.target.id) {
|
|
159
|
+
case "margin-box-filter-comments-resolved":
|
|
160
|
+
this.filterOptions.commentsResolved = evt.target.checked;
|
|
161
|
+
this.view(this.editor.currentView);
|
|
162
|
+
break;
|
|
163
|
+
case "margin-box-filter-comments-only-major":
|
|
164
|
+
this.filterOptions.commentsOnlyMajor =
|
|
165
|
+
evt.target.checked;
|
|
166
|
+
this.view(this.editor.currentView);
|
|
167
|
+
break;
|
|
168
|
+
case "margin-box-filter-info-help":
|
|
169
|
+
this.filterOptions.help = evt.target.checked;
|
|
170
|
+
this.view(this.editor.currentView);
|
|
171
|
+
break;
|
|
172
|
+
case "margin-box-filter-info-warning":
|
|
173
|
+
this.filterOptions.warning = evt.target.checked;
|
|
174
|
+
this.view(this.editor.currentView);
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
}, false);
|
|
178
|
+
setTimeout(this.commentOptionsOnScroll, 100);
|
|
179
|
+
}
|
|
180
|
+
closeAllMenus(selector = ".marginbox-options-submenu.fw-open, .fw-marginbox-options.fw-open") {
|
|
181
|
+
document.querySelectorAll(selector).forEach(el => {
|
|
182
|
+
if (el.classList.contains("comment-answer-options")) {
|
|
183
|
+
el.parentElement.removeChild(el);
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
el.classList.remove("fw-open");
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
view(view) {
|
|
191
|
+
// Give up if the user is currently editing a comment.
|
|
192
|
+
if (this.editor.mod.comments.interactions.isCurrentlyEditing()) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
this.editor.mod.comments.interactions.activateSelectedComment(view);
|
|
196
|
+
}
|
|
197
|
+
updateDOM() {
|
|
198
|
+
// Handle the layout of the comments on the screen.
|
|
199
|
+
// DOM write phase
|
|
200
|
+
const marginBoxes = [], globalComments = [], referrers = [], selectedChanges = getSelectedChanges(this.editor.currentView.state);
|
|
201
|
+
let fnIndex = 0, fnPosCount = 0, lastNodeTracks = [], lastNode = this.editor.view.state.doc;
|
|
202
|
+
this.activeCommentStyle = "";
|
|
203
|
+
this.editor.view.state.doc.descendants((node, pos) => {
|
|
204
|
+
if (node.attrs.hidden) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
lastNodeTracks = this.getMarginBoxes(node, pos, pos, lastNode, lastNodeTracks, "main", marginBoxes, referrers, selectedChanges, this.editor.view.state.selection);
|
|
208
|
+
lastNode = node;
|
|
209
|
+
if (node.type.name === "footnote") {
|
|
210
|
+
let lastFnNode = this.editor.mod.footnotes.fnEditor.view.state.doc, lastFnNodeTracks = [];
|
|
211
|
+
const footnote = lastFnNode.childCount > fnIndex
|
|
212
|
+
? lastFnNode.child(fnIndex)
|
|
213
|
+
: false;
|
|
214
|
+
if (!footnote) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
this.editor.mod.footnotes.fnEditor.view.state.doc.nodesBetween(fnPosCount, fnPosCount + footnote.nodeSize, (fnNode, fnPos) => {
|
|
218
|
+
if (fnPos < fnPosCount) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
lastFnNodeTracks = this.getMarginBoxes(fnNode, fnPos, pos, lastFnNode, lastFnNodeTracks, "footnote", marginBoxes, referrers, selectedChanges, this.editor.view.state.selection);
|
|
222
|
+
lastFnNode = fnNode;
|
|
223
|
+
});
|
|
224
|
+
fnIndex++;
|
|
225
|
+
fnPosCount += footnote.nodeSize;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
// Add a comment that is currently under construction to the list.
|
|
229
|
+
if (this.editor.mod.comments.store.commentDuringCreation) {
|
|
230
|
+
const comment = this.editor.mod.comments.store.commentDuringCreation.comment;
|
|
231
|
+
if (comment.isGlobal) {
|
|
232
|
+
globalComments.push({
|
|
233
|
+
type: "comment",
|
|
234
|
+
data: comment,
|
|
235
|
+
view: "main",
|
|
236
|
+
pos: this.editor.view.state.doc.content.size,
|
|
237
|
+
active: true
|
|
238
|
+
});
|
|
239
|
+
this.activeCommentStyle +=
|
|
240
|
+
".active-comment, .active-comment .comment {background-color: #fffacf !important;}";
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
const deco = getCommentDuringCreationDecoration(this.editor.view.state);
|
|
244
|
+
let pos, view;
|
|
245
|
+
if (deco) {
|
|
246
|
+
pos = deco.from;
|
|
247
|
+
view = "main";
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
const fnDeco = getCommentDuringCreationDecoration(this.editor.mod.footnotes.fnEditor.view.state);
|
|
251
|
+
if (fnDeco) {
|
|
252
|
+
pos = this.fnPosToPos(fnDeco.from);
|
|
253
|
+
view = "footnote";
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (pos) {
|
|
257
|
+
let index = 0;
|
|
258
|
+
// We need the position of the new comment in relation to the other
|
|
259
|
+
// comments in order to insert it in the right place
|
|
260
|
+
while (referrers.length > index && referrers[index] < pos) {
|
|
261
|
+
index++;
|
|
262
|
+
}
|
|
263
|
+
marginBoxes.splice(index, 0, {
|
|
264
|
+
type: "comment",
|
|
265
|
+
data: comment,
|
|
266
|
+
view,
|
|
267
|
+
pos,
|
|
268
|
+
active: true
|
|
269
|
+
});
|
|
270
|
+
referrers.splice(index, 0, pos);
|
|
271
|
+
this.activeCommentStyle +=
|
|
272
|
+
".active-comment, .active-comment .comment {background-color: #fffacf !important;}";
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// Add global comments at the bottom of the main column.
|
|
277
|
+
Object.values(this.editor.mod.comments.store.comments).forEach(comment => {
|
|
278
|
+
if (!comment.isGlobal) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const active = comment.id ===
|
|
282
|
+
this.editor.mod.comments.interactions.activeCommentId;
|
|
283
|
+
globalComments.push({
|
|
284
|
+
type: "comment",
|
|
285
|
+
data: comment,
|
|
286
|
+
view: "main",
|
|
287
|
+
pos: this.editor.view.state.doc.content.size,
|
|
288
|
+
active
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
const marginBoxesHTML = marginBoxesTemplate({
|
|
292
|
+
marginBoxes,
|
|
293
|
+
user: this.editor.user,
|
|
294
|
+
docInfo: this.editor.docInfo,
|
|
295
|
+
editComment: this.editor.mod.comments.interactions.editComment,
|
|
296
|
+
activeCommentAnswerId: this.editor.mod.comments.interactions.activeCommentAnswerId,
|
|
297
|
+
filterOptions: this.filterOptions
|
|
298
|
+
});
|
|
299
|
+
const globalCommentsHTML = globalCommentsTemplate({
|
|
300
|
+
globalComments,
|
|
301
|
+
user: this.editor.user,
|
|
302
|
+
docInfo: this.editor.docInfo,
|
|
303
|
+
editComment: this.editor.mod.comments.interactions.editComment,
|
|
304
|
+
activeCommentAnswerId: this.editor.mod.comments.interactions.activeCommentAnswerId,
|
|
305
|
+
filterOptions: this.filterOptions
|
|
306
|
+
});
|
|
307
|
+
this.marginBoxes = marginBoxes;
|
|
308
|
+
if (this.marginBoxesContainerString !== marginBoxesHTML) {
|
|
309
|
+
const newMarginBoxesContainerObj = stringToObj(marginBoxesHTML);
|
|
310
|
+
const diff = this.dd.diff(this.marginBoxesContainerObj, newMarginBoxesContainerObj);
|
|
311
|
+
this.dd.apply(this.marginBoxesContainer, diff);
|
|
312
|
+
this.marginBoxesContainerString = marginBoxesHTML;
|
|
313
|
+
this.marginBoxesContainerObj = newMarginBoxesContainerObj;
|
|
314
|
+
}
|
|
315
|
+
if (this.globalCommentsContainerString !== globalCommentsHTML) {
|
|
316
|
+
const newGlobalCommentsContainerObj = stringToObj(globalCommentsHTML);
|
|
317
|
+
const diff = this.dd.diff(this.globalCommentsContainerObj, newGlobalCommentsContainerObj);
|
|
318
|
+
this.dd.apply(this.globalCommentsContainer, diff);
|
|
319
|
+
this.globalCommentsContainerString = globalCommentsHTML;
|
|
320
|
+
this.globalCommentsContainerObj = newGlobalCommentsContainerObj;
|
|
321
|
+
}
|
|
322
|
+
if (this.activeCommentStyleElement.innerHTML != this.activeCommentStyle) {
|
|
323
|
+
this.activeCommentStyleElement.innerHTML = this.activeCommentStyle;
|
|
324
|
+
}
|
|
325
|
+
const marginBoxFilterHTML = marginboxFilterTemplate({
|
|
326
|
+
marginBoxes,
|
|
327
|
+
filterOptions: this.filterOptions,
|
|
328
|
+
pastParticipants: this.editor.mod.collab.pastParticipants
|
|
329
|
+
});
|
|
330
|
+
const marginBoxFilterElement = document.getElementById("margin-box-filter");
|
|
331
|
+
if (!marginBoxFilterElement) {
|
|
332
|
+
// User has navigated away already.
|
|
333
|
+
return cancelPromise();
|
|
334
|
+
}
|
|
335
|
+
if (marginBoxFilterElement.innerHTML != marginBoxFilterHTML) {
|
|
336
|
+
marginBoxFilterElement.innerHTML = marginBoxFilterHTML;
|
|
337
|
+
}
|
|
338
|
+
return new Promise(resolve => {
|
|
339
|
+
fastdom.measure(() => {
|
|
340
|
+
// DOM read phase
|
|
341
|
+
let marginBoxesPlacementStyle = "";
|
|
342
|
+
if (getComputedStyle(marginBoxFilterElement).position ===
|
|
343
|
+
"fixed") {
|
|
344
|
+
// We are in mobile/tablet mode. We don't need to place margin boxes.
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
const marginBoxesDOM = document.querySelectorAll("#margin-box-container .margin-box");
|
|
348
|
+
if (marginBoxesDOM.length !== referrers.length ||
|
|
349
|
+
!marginBoxesDOM.length) {
|
|
350
|
+
// Number of comment boxes and referrers differ.
|
|
351
|
+
// This isn't right. Abort.
|
|
352
|
+
resolve();
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
const bodyTop = document.body.getBoundingClientRect().top, marginBoxPlacements = Array.from(marginBoxesDOM).map((mboxDOM, index) => {
|
|
356
|
+
const mboxDOMRect = mboxDOM.getBoundingClientRect();
|
|
357
|
+
return {
|
|
358
|
+
height: mboxDOMRect.height,
|
|
359
|
+
refPos: this.editor.view.coordsAtPos(referrers[index]).top - bodyTop
|
|
360
|
+
};
|
|
361
|
+
}), firstActiveIndex = marginBoxes.findIndex(mBox => mBox.active), firstActiveMboxPlacement = marginBoxPlacements[firstActiveIndex];
|
|
362
|
+
let activeIndex = firstActiveIndex, currentPos = 0;
|
|
363
|
+
while (activeIndex > -1) {
|
|
364
|
+
const mboxPlacement = marginBoxPlacements[activeIndex];
|
|
365
|
+
if (mboxPlacement.height === 0) {
|
|
366
|
+
mboxPlacement.pos = currentPos;
|
|
367
|
+
}
|
|
368
|
+
else if (mboxPlacement === firstActiveMboxPlacement) {
|
|
369
|
+
mboxPlacement.pos = mboxPlacement.refPos;
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
mboxPlacement.pos = Math.min(currentPos - 2 - mboxPlacement.height, mboxPlacement.refPos);
|
|
373
|
+
}
|
|
374
|
+
currentPos = mboxPlacement.pos;
|
|
375
|
+
activeIndex--;
|
|
376
|
+
}
|
|
377
|
+
if (firstActiveIndex > -1) {
|
|
378
|
+
currentPos =
|
|
379
|
+
firstActiveMboxPlacement.pos +
|
|
380
|
+
firstActiveMboxPlacement.height;
|
|
381
|
+
activeIndex = firstActiveIndex + 1;
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
activeIndex = 0;
|
|
385
|
+
}
|
|
386
|
+
while (activeIndex < marginBoxPlacements.length) {
|
|
387
|
+
const mboxPlacement = marginBoxPlacements[activeIndex];
|
|
388
|
+
mboxPlacement.pos = Math.max(currentPos + 2, mboxPlacement.refPos);
|
|
389
|
+
currentPos = mboxPlacement.pos + mboxPlacement.height;
|
|
390
|
+
activeIndex++;
|
|
391
|
+
}
|
|
392
|
+
const initialOffset = document.body.classList.contains("header-closed")
|
|
393
|
+
? 72 + 90
|
|
394
|
+
: 225 + 90;
|
|
395
|
+
const $head = this.editor.view.state.selection.$head;
|
|
396
|
+
const selectionInTitle = $head.depth > 0 &&
|
|
397
|
+
Array.from({ length: $head.depth }, (_, index) => index + 1).some(depth => $head.node(depth).type.name === "title");
|
|
398
|
+
let totalOffset = 0;
|
|
399
|
+
marginBoxesPlacementStyle = marginBoxPlacements
|
|
400
|
+
.map((mboxPlacement, index) => {
|
|
401
|
+
if (mboxPlacement.height === 0) {
|
|
402
|
+
return "";
|
|
403
|
+
}
|
|
404
|
+
const pos = mboxPlacement.pos - initialOffset;
|
|
405
|
+
let css = "";
|
|
406
|
+
if (pos !== totalOffset) {
|
|
407
|
+
let topMargin = Number.parseInt(pos - totalOffset);
|
|
408
|
+
if (selectionInTitle) {
|
|
409
|
+
topMargin = Math.max(topMargin, 0);
|
|
410
|
+
}
|
|
411
|
+
css += `#margin-box-container div.margin-box:nth-of-type(${index + 1}) {margin-top: ${topMargin}px;}\n`;
|
|
412
|
+
totalOffset += topMargin;
|
|
413
|
+
}
|
|
414
|
+
totalOffset += mboxPlacement.height;
|
|
415
|
+
return css;
|
|
416
|
+
})
|
|
417
|
+
.join("");
|
|
418
|
+
if (firstActiveIndex > -1) {
|
|
419
|
+
const topMenuHeight = this.editor.dom.querySelector("header").offsetHeight;
|
|
420
|
+
const refDistanceFromTop = this.editor.view.coordsAtPos(referrers[firstActiveIndex]).top;
|
|
421
|
+
if (refDistanceFromTop - topMenuHeight < 0 ||
|
|
422
|
+
refDistanceFromTop > window.innerHeight - 30) {
|
|
423
|
+
const scrollTop = refDistanceFromTop - (topMenuHeight + 90);
|
|
424
|
+
window.scrollBy({
|
|
425
|
+
left: 0,
|
|
426
|
+
top: scrollTop,
|
|
427
|
+
behavior: "smooth",
|
|
428
|
+
block: "center"
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
fastdom.mutate(() => {
|
|
434
|
+
//DOM write phase
|
|
435
|
+
if (this.marginBoxesPlacementStyle !==
|
|
436
|
+
marginBoxesPlacementStyle) {
|
|
437
|
+
document.getElementById("margin-box-placement-style").innerHTML = marginBoxesPlacementStyle;
|
|
438
|
+
this.marginBoxesPlacementStyle =
|
|
439
|
+
marginBoxesPlacementStyle;
|
|
440
|
+
}
|
|
441
|
+
if (this.editor.mod.comments.store.commentDuringCreation) {
|
|
442
|
+
this.editor.mod.comments.store.commentDuringCreation.inDOM = true;
|
|
443
|
+
}
|
|
444
|
+
resolve();
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
fnPosToPos(fnPos) {
|
|
450
|
+
const fnIndex = this.editor.mod.footnotes.fnEditor.view.state.doc
|
|
451
|
+
.resolve(fnPos)
|
|
452
|
+
.index(0), fnMarker = getFootnoteMarkers(this.editor.view.state)[fnIndex];
|
|
453
|
+
return fnMarker.from;
|
|
454
|
+
}
|
|
455
|
+
getMarginBoxes(node, pos, refPos, lastNode, lastNodeTracks, view, marginBoxes, referrers, selectedChanges, selection // Selection in main editor
|
|
456
|
+
) {
|
|
457
|
+
if (node.attrs.help) {
|
|
458
|
+
// Help/instruction margin boxes
|
|
459
|
+
const helpBox = {
|
|
460
|
+
type: "help",
|
|
461
|
+
data: {
|
|
462
|
+
active: selection.$anchor.node(1) === node ? true : false,
|
|
463
|
+
help: node.attrs.help
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
marginBoxes.push(helpBox);
|
|
467
|
+
referrers.push(refPos);
|
|
468
|
+
}
|
|
469
|
+
if (node.type.name === "cross_reference" && !node.attrs.title) {
|
|
470
|
+
const warningBox = {
|
|
471
|
+
type: "warning",
|
|
472
|
+
data: {
|
|
473
|
+
active: selection.node && selection.node === node,
|
|
474
|
+
warning: gettext("A cross reference has lost its target.")
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
marginBoxes.push(warningBox);
|
|
478
|
+
referrers.push(refPos);
|
|
479
|
+
}
|
|
480
|
+
if (node.marks.find(mark => mark.type.name === "link" &&
|
|
481
|
+
mark.attrs.href.charAt(0) === "#" &&
|
|
482
|
+
!mark.attrs.title)) {
|
|
483
|
+
const linkMark = node.marks.find(mark => mark.type.name === "link");
|
|
484
|
+
const warningBox = {
|
|
485
|
+
type: "warning",
|
|
486
|
+
data: {
|
|
487
|
+
active: linkMark.isInSet(selection.$anchor.marks()),
|
|
488
|
+
warning: gettext("An internal link has lost its target.")
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
marginBoxes.push(warningBox);
|
|
492
|
+
referrers.push(refPos);
|
|
493
|
+
}
|
|
494
|
+
const commentIds = node.isInline || node.isLeaf
|
|
495
|
+
? this.editor.mod.comments.interactions.findCommentIds(node)
|
|
496
|
+
: [];
|
|
497
|
+
const nodeTracks = node.attrs.track
|
|
498
|
+
? node.attrs.track.map(track => {
|
|
499
|
+
const nodeTrack = {
|
|
500
|
+
type: track.type,
|
|
501
|
+
data: {
|
|
502
|
+
user: track.user,
|
|
503
|
+
username: track.username,
|
|
504
|
+
date: track.date
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
if (track.type === "block_change") {
|
|
508
|
+
nodeTrack.data.before = track.before;
|
|
509
|
+
}
|
|
510
|
+
return nodeTrack;
|
|
511
|
+
})
|
|
512
|
+
: node.marks
|
|
513
|
+
.filter(mark => ["deletion", "format_change"].includes(mark.type.name) ||
|
|
514
|
+
(mark.type.name === "insertion" &&
|
|
515
|
+
!mark.attrs.approved))
|
|
516
|
+
.map(mark => ({ type: mark.type.name, data: mark.attrs }));
|
|
517
|
+
// Filter out trackmarks already present in the last node (if it's an inline node).
|
|
518
|
+
const tracks = node.isInline === lastNode.isInline
|
|
519
|
+
? nodeTracks.filter(track => !lastNodeTracks.find(lastTrack => track.type === lastTrack.type &&
|
|
520
|
+
track.data.user === lastTrack.data.user &&
|
|
521
|
+
track.data.date === lastTrack.data.date &&
|
|
522
|
+
(node.isInline || // block level changes almost always need new boxes
|
|
523
|
+
(node.type.name === "paragraph" &&
|
|
524
|
+
lastNode.type.name === "list_item" &&
|
|
525
|
+
lastTrack.type === "insertion")) && // Don't show first paragraphs in list items.
|
|
526
|
+
(["insertion", "deletion"].includes(track.type) ||
|
|
527
|
+
(track.type === "format_change" &&
|
|
528
|
+
track.data.before.length ===
|
|
529
|
+
lastTrack.data.before.length &&
|
|
530
|
+
track.data.after.length ===
|
|
531
|
+
lastTrack.data.after.length &&
|
|
532
|
+
track.data.before.every(markName => lastTrack.data.before.includes(markName)) &&
|
|
533
|
+
track.data.after.every(markName => lastTrack.data.after.includes(markName))) ||
|
|
534
|
+
(track.type === "block_change" &&
|
|
535
|
+
track.data.before.type ===
|
|
536
|
+
lastTrack.data.before.type &&
|
|
537
|
+
track.data.before.attrs.level ===
|
|
538
|
+
lastTrack.data.before.attrs
|
|
539
|
+
.level))))
|
|
540
|
+
: nodeTracks;
|
|
541
|
+
tracks.forEach(track => {
|
|
542
|
+
marginBoxes.push(Object.assign({
|
|
543
|
+
node,
|
|
544
|
+
pos,
|
|
545
|
+
view,
|
|
546
|
+
active: selectedChanges[track.type] &&
|
|
547
|
+
selectedChanges[track.type].from === pos
|
|
548
|
+
}, track));
|
|
549
|
+
referrers.push(refPos);
|
|
550
|
+
});
|
|
551
|
+
if (!commentIds.length && !tracks.length) {
|
|
552
|
+
return nodeTracks;
|
|
553
|
+
}
|
|
554
|
+
commentIds.forEach(commentId => {
|
|
555
|
+
const comment = this.editor.mod.comments.store.findComment(commentId);
|
|
556
|
+
if (!comment ||
|
|
557
|
+
(this.filterOptions.commentsOnlyMajor && !comment.isMajor) ||
|
|
558
|
+
(!this.filterOptions.commentsResolved && comment.resolved)) {
|
|
559
|
+
// We have no comment with this ID. Ignore the referrer.
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
if (marginBoxes.find(marginBox => marginBox.data === comment)) {
|
|
563
|
+
// comment already placed
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
const active = comment.id ===
|
|
567
|
+
this.editor.mod.comments.interactions.activeCommentId;
|
|
568
|
+
if (this.filterOptions.comments) {
|
|
569
|
+
if (active) {
|
|
570
|
+
this.activeCommentStyle += `.comment[data-id="${comment.id}"], .comment[data-id="${comment.id}"] .comment {background-color: ${this.commentColors.active} !important;}`;
|
|
571
|
+
}
|
|
572
|
+
else if (comment.isMajor) {
|
|
573
|
+
this.activeCommentStyle += `#paper-editable .comment[data-id="${comment.id}"] {background-color: ${this.commentColors.isMajor};}`;
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
this.activeCommentStyle += `#paper-editable .comment[data-id="${comment.id}"] {background-color: ${this.commentColors.marker};}`;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
marginBoxes.push({
|
|
580
|
+
type: "comment",
|
|
581
|
+
data: comment,
|
|
582
|
+
pos,
|
|
583
|
+
view,
|
|
584
|
+
active
|
|
585
|
+
});
|
|
586
|
+
referrers.push(refPos);
|
|
587
|
+
});
|
|
588
|
+
return nodeTracks;
|
|
589
|
+
}
|
|
590
|
+
closeAllLongComments(selector = ".comment-p.show-more") {
|
|
591
|
+
document.body.querySelectorAll(selector).forEach(el => {
|
|
592
|
+
el.classList.remove("show-more");
|
|
593
|
+
const showMoreButton = el.parentElement.parentElement.querySelector(".show-more-less");
|
|
594
|
+
if (showMoreButton) {
|
|
595
|
+
showMoreButton.innerText = `${gettext("show more")}`;
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
positionMarginBoxOptions(marginBoxDialog, showMarginboxOptionsBtn) {
|
|
600
|
+
const btnTop = showMarginboxOptionsBtn.getBoundingClientRect().top, scrollTopOffset = window.pageYOffset, mBoxRight = showMarginboxOptionsBtn
|
|
601
|
+
.closest(".comment-answer-container")
|
|
602
|
+
.getBoundingClientRect().right;
|
|
603
|
+
marginBoxDialog.style.top = `${btnTop + scrollTopOffset + 30}px`;
|
|
604
|
+
marginBoxDialog.style.left = `${mBoxRight - marginBoxDialog.getBoundingClientRect().width - 10}px`;
|
|
605
|
+
}
|
|
606
|
+
scrollToGlobalComment(id) {
|
|
607
|
+
const commentDOM = document.querySelector(`#global-comments #margin-box-${id}`);
|
|
608
|
+
if (!commentDOM) {
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
const topMenuHeight = this.editor.dom.querySelector("header").offsetHeight, rect = commentDOM.getBoundingClientRect();
|
|
612
|
+
if (rect.top < topMenuHeight || rect.bottom > window.innerHeight - 30) {
|
|
613
|
+
const scrollTop = rect.top - (topMenuHeight + 90);
|
|
614
|
+
window.scrollBy({
|
|
615
|
+
left: 0,
|
|
616
|
+
top: scrollTop,
|
|
617
|
+
behavior: "smooth"
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
commentOptionsOnScroll() {
|
|
622
|
+
document
|
|
623
|
+
.querySelectorAll(".comment-answer-container")
|
|
624
|
+
.forEach(element => {
|
|
625
|
+
element.addEventListener("scroll", () => {
|
|
626
|
+
const scrollTop = element.scrollTop;
|
|
627
|
+
const marginBoxOption = Array.from(element.children).find(node => node.matches(".show-marginbox-options"));
|
|
628
|
+
if (scrollTop > 50) {
|
|
629
|
+
marginBoxOption?.classList.add("fw-hide");
|
|
630
|
+
}
|
|
631
|
+
else {
|
|
632
|
+
marginBoxOption?.classList.remove("fw-hide");
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
toggleShowMore(element) {
|
|
638
|
+
const commentText = element.target.parentElement.parentElement.querySelector(".comment-p");
|
|
639
|
+
commentText.classList.toggle("show-more");
|
|
640
|
+
if (commentText.classList.contains("show-more")) {
|
|
641
|
+
element.target.innerText = `${gettext("show less")}`;
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
element.target.innerText = `${gettext("show more")}`;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
setTrackStyle() {
|
|
648
|
+
if (!this.filterOptions.track) {
|
|
649
|
+
this.trackOptionsStyleElement.innerHTML = `span.insertion, .selected-insertion, .selected-format_change, .selected-block_change {
|
|
650
|
+
color: inherit !important;
|
|
651
|
+
background-color: inherit !important;
|
|
652
|
+
}
|
|
653
|
+
span.deletion {
|
|
654
|
+
display: none;
|
|
655
|
+
}`;
|
|
656
|
+
}
|
|
657
|
+
else if (this.filterOptions.trackAuthor) {
|
|
658
|
+
this.trackOptionsStyleElement.innerHTML = `span.insertion:not([data-user="${this.filterOptions.trackAuthor}"]),
|
|
659
|
+
span.insertion:not([data-user="${this.filterOptions.trackAuthor}"]) .selected-insertion,
|
|
660
|
+
.selected-format_change:not([data-user="${this.filterOptions.trackAuthor}"]),
|
|
661
|
+
.selected-block_change:not([data-user="${this.filterOptions.trackAuthor}"]) {
|
|
662
|
+
color: inherit !important;
|
|
663
|
+
background-color: inherit !important;
|
|
664
|
+
}
|
|
665
|
+
span.deletion:not([data-user="${this.filterOptions.trackAuthor}"]) {
|
|
666
|
+
display: none;
|
|
667
|
+
}`;
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
this.trackOptionsStyleElement.innerHTML = "";
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
//# sourceMappingURL=index.js.map
|