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