@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,134 @@
|
|
|
1
|
+
import {keyName} from "w3c-keyname"
|
|
2
|
+
|
|
3
|
+
import {NodeSelection} from "prosemirror-state"
|
|
4
|
+
import {ContributorDialog} from "../../dialogs"
|
|
5
|
+
import {nextSelection} from "./helpers"
|
|
6
|
+
|
|
7
|
+
export class AddButton {
|
|
8
|
+
constructor(dom, getNode, getPos, view, idTypes) {
|
|
9
|
+
this.dom = dom
|
|
10
|
+
this.getNode = getNode
|
|
11
|
+
this.getPos = getPos
|
|
12
|
+
this.view = view
|
|
13
|
+
|
|
14
|
+
this.idTypes = idTypes
|
|
15
|
+
|
|
16
|
+
this.button = null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
init() {
|
|
20
|
+
const node = this.getNode()
|
|
21
|
+
const nodeTitle = node.attrs.item_title
|
|
22
|
+
this.dom.insertAdjacentHTML(
|
|
23
|
+
"beforeend",
|
|
24
|
+
`<button class="fw-button fw-light">${gettext("Add")} ${nodeTitle.toLowerCase()}...</button>`
|
|
25
|
+
)
|
|
26
|
+
this.button = this.dom.lastElementChild
|
|
27
|
+
this.button.addEventListener("click", event =>
|
|
28
|
+
this.handleActivation(event)
|
|
29
|
+
)
|
|
30
|
+
this.button.addEventListener("keydown", event =>
|
|
31
|
+
this.handleKeyDown(event)
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
handleKeyDown(event) {
|
|
36
|
+
const key = keyName(event)
|
|
37
|
+
switch (key) {
|
|
38
|
+
case "Enter":
|
|
39
|
+
case " ":
|
|
40
|
+
this.handleActivation(event)
|
|
41
|
+
break
|
|
42
|
+
case "ArrowRight":
|
|
43
|
+
case "ArrowDown":
|
|
44
|
+
if (this.handleArrowDown()) {
|
|
45
|
+
event.preventDefault()
|
|
46
|
+
}
|
|
47
|
+
break
|
|
48
|
+
case "ArrowLeft":
|
|
49
|
+
if (this.handleArrowLeft()) {
|
|
50
|
+
event.preventDefault()
|
|
51
|
+
}
|
|
52
|
+
break
|
|
53
|
+
case "ArrowUp":
|
|
54
|
+
if (this.handleArrowUp()) {
|
|
55
|
+
event.preventDefault()
|
|
56
|
+
}
|
|
57
|
+
break
|
|
58
|
+
default:
|
|
59
|
+
break
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
handleActivation(event) {
|
|
64
|
+
event.preventDefault()
|
|
65
|
+
const node = this.getNode()
|
|
66
|
+
|
|
67
|
+
const dialog = new ContributorDialog(
|
|
68
|
+
node,
|
|
69
|
+
this.view,
|
|
70
|
+
false,
|
|
71
|
+
this.idTypes
|
|
72
|
+
)
|
|
73
|
+
dialog.init()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
handleArrowLeft() {
|
|
77
|
+
const node = this.getNode()
|
|
78
|
+
if (node.nodeSize > 2) {
|
|
79
|
+
// At least one contributor
|
|
80
|
+
const startPos = this.getPos() + node.nodeSize - 2
|
|
81
|
+
this.view.dispatch(
|
|
82
|
+
this.view.state.tr.setSelection(
|
|
83
|
+
NodeSelection.create(this.view.state.doc, startPos)
|
|
84
|
+
)
|
|
85
|
+
)
|
|
86
|
+
this.view.focus()
|
|
87
|
+
return true
|
|
88
|
+
} else {
|
|
89
|
+
// There is no tag
|
|
90
|
+
return this.handleArrowUp()
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
handleArrowUp() {
|
|
95
|
+
// We jump to the section before this one.
|
|
96
|
+
const startPos = this.getPos()
|
|
97
|
+
|
|
98
|
+
const newSelection = nextSelection(this.view.state, startPos, -1)
|
|
99
|
+
|
|
100
|
+
if (!newSelection) {
|
|
101
|
+
return false
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
this.view.dispatch(this.view.state.tr.setSelection(newSelection))
|
|
105
|
+
this.view.focus()
|
|
106
|
+
return true
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
handleArrowDown() {
|
|
110
|
+
// Move the cursor beyond the contributors part
|
|
111
|
+
const node = this.getNode()
|
|
112
|
+
const pos = this.getPos() + node.nodeSize + 1
|
|
113
|
+
|
|
114
|
+
const newSelection = nextSelection(this.view.state, pos, 1)
|
|
115
|
+
|
|
116
|
+
if (!newSelection) {
|
|
117
|
+
return false
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
this.view.dispatch(this.view.state.tr.setSelection(newSelection))
|
|
121
|
+
this.view.focus()
|
|
122
|
+
return true
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
hasFocus() {
|
|
126
|
+
return this.button === window.document.activeElement
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
focus() {
|
|
130
|
+
if (this.button) {
|
|
131
|
+
this.button.focus()
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import {escapeText, noSpaceTmp} from "fwtoolkit"
|
|
2
|
+
import {ContributorDialog} from "../../dialogs"
|
|
3
|
+
|
|
4
|
+
/** @typedef {{text: string, className: string, action: Function}} MenuOption */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Contributor drop-up menu widget
|
|
8
|
+
* Shows a menu above the selected contributor with options like "Edit"
|
|
9
|
+
* Supports keyboard navigation and mouse interactions
|
|
10
|
+
*/
|
|
11
|
+
class ContributorDropUp {
|
|
12
|
+
/**
|
|
13
|
+
* @param {Object} selection - ProseMirror selection object
|
|
14
|
+
* @param {Object} view - ProseMirror editor view
|
|
15
|
+
* @param {Array<MenuOption>} [menuOptions] - Optional custom menu options
|
|
16
|
+
*/
|
|
17
|
+
constructor(selection, view, menuOptions = null) {
|
|
18
|
+
this.selection = selection
|
|
19
|
+
this.view = view
|
|
20
|
+
this.parentNode = selection.$anchor.parent
|
|
21
|
+
this.focusedIndex = -1
|
|
22
|
+
this.menuOptions = menuOptions || this.getDefaultMenuOptions()
|
|
23
|
+
// Flag to prevent blur handler from closing drop-up when opening dialog
|
|
24
|
+
this.openingDialog = false
|
|
25
|
+
this.dropUp = this.createDropUp()
|
|
26
|
+
this.setupEventHandlers()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get default menu options for contributor drop-up
|
|
31
|
+
* @returns {Array<MenuOption>} Default menu options
|
|
32
|
+
*/
|
|
33
|
+
getDefaultMenuOptions() {
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
text: gettext("Edit"),
|
|
37
|
+
className: "edit-contributor",
|
|
38
|
+
action: () => this.openContributorDialog()
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Create the drop-up DOM element
|
|
45
|
+
* @returns {HTMLElement} The drop-up element
|
|
46
|
+
*/
|
|
47
|
+
createDropUp() {
|
|
48
|
+
const dropUp = document.createElement("span")
|
|
49
|
+
const requiredPx = 120
|
|
50
|
+
|
|
51
|
+
dropUp.classList.add("drop-up-outer")
|
|
52
|
+
|
|
53
|
+
// Generate HTML for each menu option
|
|
54
|
+
const optionsHTML = this.menuOptions
|
|
55
|
+
.map(
|
|
56
|
+
(option, index) =>
|
|
57
|
+
`<li class="drop-up-option ${option.className}"
|
|
58
|
+
data-index="${index}"
|
|
59
|
+
tabindex="-1">${escapeText(option.text)}</li>`
|
|
60
|
+
)
|
|
61
|
+
.join("")
|
|
62
|
+
|
|
63
|
+
dropUp.innerHTML = noSpaceTmp`
|
|
64
|
+
<div class="link drop-up-inner" style="top: -${requiredPx}px;">
|
|
65
|
+
<div class="drop-up-head">
|
|
66
|
+
<div>${escapeText(this.parentNode.attrs.item_title)}</div>
|
|
67
|
+
</div>
|
|
68
|
+
<ul class="drop-up-options">
|
|
69
|
+
${optionsHTML}
|
|
70
|
+
</ul>
|
|
71
|
+
</div>`
|
|
72
|
+
|
|
73
|
+
return dropUp
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Set up all event handlers for the drop-up
|
|
78
|
+
*/
|
|
79
|
+
setupEventHandlers() {
|
|
80
|
+
const optionsList = this.dropUp.querySelector(".drop-up-options")
|
|
81
|
+
const options = this.dropUp.querySelectorAll(".drop-up-option")
|
|
82
|
+
|
|
83
|
+
// Make the options list focusable so it can receive keyboard events
|
|
84
|
+
optionsList.setAttribute("tabindex", "0")
|
|
85
|
+
|
|
86
|
+
// Setup handlers for each option
|
|
87
|
+
options.forEach((option, index) => {
|
|
88
|
+
// Mouse enter for visual highlight
|
|
89
|
+
option.addEventListener("mouseenter", () => {
|
|
90
|
+
this.focusOption(index)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
// Mouse leave to remove highlight
|
|
94
|
+
option.addEventListener("mouseleave", () => {
|
|
95
|
+
this.unfocusOption(index)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
// Click to activate the option
|
|
99
|
+
option.addEventListener("click", event => {
|
|
100
|
+
event.preventDefault()
|
|
101
|
+
this.activateOption(index)
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
// Mousedown to prevent blur issues and stop propagation
|
|
105
|
+
option.addEventListener("mousedown", event => {
|
|
106
|
+
event.preventDefault()
|
|
107
|
+
event.stopPropagation()
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
// Keyboard navigation for the options list
|
|
112
|
+
optionsList.addEventListener("keydown", event => {
|
|
113
|
+
this.handleKeyDown(event)
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
// Focus handler - focus first option when list gets focus
|
|
117
|
+
optionsList.addEventListener("focus", () => {
|
|
118
|
+
this.focusOption(0)
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
// Blur handler to close the drop-up
|
|
122
|
+
optionsList.addEventListener("blur", () => {
|
|
123
|
+
// Use requestAnimationFrame to check if focus moved outside drop-up
|
|
124
|
+
requestAnimationFrame(() => {
|
|
125
|
+
// If we're opening a dialog, don't close (prevents deselecting contributor)
|
|
126
|
+
if (this.openingDialog) {
|
|
127
|
+
this.openingDialog = false
|
|
128
|
+
return
|
|
129
|
+
}
|
|
130
|
+
// Close drop-up if focus moved outside it
|
|
131
|
+
if (!this.dropUp.contains(document.activeElement)) {
|
|
132
|
+
this.closeDropUp()
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
// Prevent mousedown events on the drop-up from propagating to ProseMirror
|
|
138
|
+
this.dropUp.addEventListener("mousedown", event => {
|
|
139
|
+
event.stopPropagation()
|
|
140
|
+
})
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Handle keyboard navigation events
|
|
145
|
+
* @param {KeyboardEvent} event - Keyboard event
|
|
146
|
+
*/
|
|
147
|
+
handleKeyDown(event) {
|
|
148
|
+
const optionCount = this.menuOptions.length
|
|
149
|
+
|
|
150
|
+
switch (event.key) {
|
|
151
|
+
case "ArrowDown":
|
|
152
|
+
event.preventDefault()
|
|
153
|
+
event.stopPropagation()
|
|
154
|
+
// If at last option and there's more than one option, close drop-up and return to contributor
|
|
155
|
+
if (this.focusedIndex === optionCount - 1 && optionCount > 1) {
|
|
156
|
+
this.closeDropUp()
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
// Move to next option
|
|
160
|
+
this.focusedIndex = (this.focusedIndex + 1) % optionCount
|
|
161
|
+
this.updateFocusedOption()
|
|
162
|
+
break
|
|
163
|
+
|
|
164
|
+
case "ArrowUp":
|
|
165
|
+
event.preventDefault()
|
|
166
|
+
event.stopPropagation()
|
|
167
|
+
// If at first option and there's more than one option, close drop-up and return to contributor
|
|
168
|
+
if (this.focusedIndex === 0 && optionCount > 1) {
|
|
169
|
+
this.closeDropUp()
|
|
170
|
+
return
|
|
171
|
+
}
|
|
172
|
+
// Move to previous option
|
|
173
|
+
this.focusedIndex =
|
|
174
|
+
(this.focusedIndex - 1 + optionCount) % optionCount
|
|
175
|
+
this.updateFocusedOption()
|
|
176
|
+
break
|
|
177
|
+
|
|
178
|
+
case "Enter":
|
|
179
|
+
case " ":
|
|
180
|
+
event.preventDefault()
|
|
181
|
+
if (this.focusedIndex >= 0) {
|
|
182
|
+
this.activateOption(this.focusedIndex)
|
|
183
|
+
}
|
|
184
|
+
break
|
|
185
|
+
|
|
186
|
+
case "Escape":
|
|
187
|
+
event.preventDefault()
|
|
188
|
+
event.stopPropagation()
|
|
189
|
+
this.closeDropUp()
|
|
190
|
+
break
|
|
191
|
+
|
|
192
|
+
case "Home":
|
|
193
|
+
event.preventDefault()
|
|
194
|
+
event.stopPropagation()
|
|
195
|
+
this.focusOption(0)
|
|
196
|
+
break
|
|
197
|
+
|
|
198
|
+
case "End":
|
|
199
|
+
event.preventDefault()
|
|
200
|
+
event.stopPropagation()
|
|
201
|
+
this.focusOption(optionCount - 1)
|
|
202
|
+
break
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Focus a specific option by index
|
|
208
|
+
* @param {number} index - Index of the option to focus
|
|
209
|
+
*/
|
|
210
|
+
focusOption(index) {
|
|
211
|
+
const options = this.dropUp.querySelectorAll(".drop-up-option")
|
|
212
|
+
// Unfocus previous option
|
|
213
|
+
if (this.focusedIndex >= 0 && this.focusedIndex < options.length) {
|
|
214
|
+
options[this.focusedIndex].classList.remove("fw-focused")
|
|
215
|
+
}
|
|
216
|
+
// Focus new option
|
|
217
|
+
this.focusedIndex = index
|
|
218
|
+
if (options[index]) {
|
|
219
|
+
options[index].classList.add("fw-focused")
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Unfocus a specific option by index (used for mouse leave)
|
|
225
|
+
* @param {number} index - Index of the option to unfocus
|
|
226
|
+
*/
|
|
227
|
+
unfocusOption(index) {
|
|
228
|
+
const options = this.dropUp.querySelectorAll(".drop-up-option")
|
|
229
|
+
if (options[index]) {
|
|
230
|
+
options[index].classList.remove("fw-focused")
|
|
231
|
+
}
|
|
232
|
+
// Only reset focusedIndex if this was the focused option
|
|
233
|
+
if (this.focusedIndex === index) {
|
|
234
|
+
this.focusedIndex = -1
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Update visual state of the currently focused option
|
|
240
|
+
*/
|
|
241
|
+
updateFocusedOption() {
|
|
242
|
+
const options = this.dropUp.querySelectorAll(".drop-up-option")
|
|
243
|
+
// Remove focused class from all options
|
|
244
|
+
options.forEach(option => {
|
|
245
|
+
option.classList.remove("fw-focused")
|
|
246
|
+
})
|
|
247
|
+
// Add focused class to current option
|
|
248
|
+
if (this.focusedIndex >= 0 && this.focusedIndex < options.length) {
|
|
249
|
+
options[this.focusedIndex].classList.add("fw-focused")
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Activate a menu option by index
|
|
255
|
+
* @param {number} index - Index of the option to activate
|
|
256
|
+
*/
|
|
257
|
+
activateOption(index) {
|
|
258
|
+
if (index >= 0 && index < this.menuOptions.length) {
|
|
259
|
+
const option = this.menuOptions[index]
|
|
260
|
+
if (option.action && typeof option.action === "function") {
|
|
261
|
+
option.action()
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Open the contributor edit dialog
|
|
268
|
+
*/
|
|
269
|
+
openContributorDialog() {
|
|
270
|
+
// Set flag to prevent blur handler from closing drop-up or deselecting contributor
|
|
271
|
+
this.openingDialog = true
|
|
272
|
+
// Open the dialog - it will take focus from drop-up
|
|
273
|
+
const idTypes =
|
|
274
|
+
this.view.editor.mod.documentTemplate?.currentTemplate?.id_types ||
|
|
275
|
+
[]
|
|
276
|
+
const dialog = new ContributorDialog(
|
|
277
|
+
this.parentNode,
|
|
278
|
+
this.view,
|
|
279
|
+
this.selection.node.attrs,
|
|
280
|
+
idTypes
|
|
281
|
+
)
|
|
282
|
+
dialog.init()
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Close the drop-up by deselecting the contributor
|
|
287
|
+
*/
|
|
288
|
+
closeDropUp() {
|
|
289
|
+
// Set a text selection to deselect the contributor, which will remove the drop-up
|
|
290
|
+
const tr = this.view.state.tr.setSelection(
|
|
291
|
+
this.view.state.selection.constructor.near(
|
|
292
|
+
this.view.state.doc.resolve(this.selection.from)
|
|
293
|
+
)
|
|
294
|
+
)
|
|
295
|
+
this.view.dispatch(tr)
|
|
296
|
+
this.view.focus()
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Get the DOM element for the drop-up
|
|
301
|
+
* @returns {HTMLElement} The drop-up DOM element
|
|
302
|
+
*/
|
|
303
|
+
getDOM() {
|
|
304
|
+
return this.dropUp
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Create a contributor drop-up menu
|
|
310
|
+
* @param {Object} selection - ProseMirror selection object
|
|
311
|
+
* @param {Object} view - ProseMirror editor view
|
|
312
|
+
* @param {Array<MenuOption>} [menuOptions] - Optional custom menu options
|
|
313
|
+
* @returns {HTMLElement} The drop-up DOM element
|
|
314
|
+
*/
|
|
315
|
+
export const createDropUp = (selection, view, menuOptions = null) => {
|
|
316
|
+
const dropUp = new ContributorDropUp(selection, view, menuOptions)
|
|
317
|
+
return dropUp.getDOM()
|
|
318
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {GapCursor} from "prosemirror-gapcursor"
|
|
2
|
+
import {TextSelection} from "prosemirror-state"
|
|
3
|
+
|
|
4
|
+
export const nextSelection = (state, pos, dir) => {
|
|
5
|
+
let newSelection
|
|
6
|
+
let newPos = pos
|
|
7
|
+
let $newPos
|
|
8
|
+
|
|
9
|
+
while (!newSelection) {
|
|
10
|
+
newPos += dir
|
|
11
|
+
if (newPos === 0 || newPos === state.doc.nodeSize) {
|
|
12
|
+
// Could not find any valid position
|
|
13
|
+
break
|
|
14
|
+
}
|
|
15
|
+
$newPos = state.doc.resolve(newPos)
|
|
16
|
+
if ($newPos.parent.inlineContent) {
|
|
17
|
+
newSelection = new TextSelection($newPos)
|
|
18
|
+
} else if (GapCursor.valid($newPos)) {
|
|
19
|
+
newSelection = new GapCursor($newPos)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return newSelection
|
|
24
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {keyName} from "w3c-keyname"
|
|
2
|
+
import {addDeletedPartWidget} from "../document_template"
|
|
3
|
+
|
|
4
|
+
import {AddButton} from "./add_button"
|
|
5
|
+
|
|
6
|
+
export class ContributorsPartView {
|
|
7
|
+
constructor(node, view, getPos) {
|
|
8
|
+
this.node = node
|
|
9
|
+
this.view = view
|
|
10
|
+
this.getPos = getPos
|
|
11
|
+
this.idTypes =
|
|
12
|
+
(view.state &&
|
|
13
|
+
view.state.doc &&
|
|
14
|
+
view.state.doc.attrs &&
|
|
15
|
+
view.state.doc.attrs.id_types) ||
|
|
16
|
+
[]
|
|
17
|
+
this.dom = document.createElement("div")
|
|
18
|
+
this.dom.classList.add("doc-part")
|
|
19
|
+
this.dom.classList.add(`doc-${this.node.type.name}`)
|
|
20
|
+
this.dom.classList.add(`doc-${this.node.attrs.id}`)
|
|
21
|
+
if (node.attrs.hidden) {
|
|
22
|
+
this.dom.dataset.hidden = true
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
this.contentDOM = document.createElement("span")
|
|
26
|
+
this.contentDOM.classList.add("contributors-inner")
|
|
27
|
+
this.contentDOM.contentEditable = node.attrs.locking !== "fixed"
|
|
28
|
+
this.dom.appendChild(this.contentDOM)
|
|
29
|
+
if (node.attrs.locking !== "fixed") {
|
|
30
|
+
this.addButton = new AddButton(
|
|
31
|
+
this.dom,
|
|
32
|
+
() => this.getNode(),
|
|
33
|
+
this.getPos,
|
|
34
|
+
this.view,
|
|
35
|
+
this.idTypes
|
|
36
|
+
)
|
|
37
|
+
this.addButton.init()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (node.attrs.deleted) {
|
|
41
|
+
addDeletedPartWidget(this.dom, view, getPos)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
stopEvent(event) {
|
|
46
|
+
// Trap events for addButton
|
|
47
|
+
if (["click", "mousedown"].includes(event.type)) {
|
|
48
|
+
return false
|
|
49
|
+
} else if (!this.addButton || this.node.attrs.locking === "fixed") {
|
|
50
|
+
return false
|
|
51
|
+
} else if (this.addButton.hasFocus() && event.type === "keydown") {
|
|
52
|
+
return true
|
|
53
|
+
} else {
|
|
54
|
+
return false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
update(node, _decorations, _innerDecorations) {
|
|
59
|
+
this.node = node
|
|
60
|
+
if (node.attrs.hidden) {
|
|
61
|
+
this.dom.dataset.hidden = true
|
|
62
|
+
} else {
|
|
63
|
+
delete this.dom.dataset.hidden
|
|
64
|
+
}
|
|
65
|
+
return true
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
getNode() {
|
|
69
|
+
return this.node
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
setSelection(anchor, head, _root) {
|
|
73
|
+
if (anchor === head && this.view.hasFocus()) {
|
|
74
|
+
// We must be in last position.
|
|
75
|
+
// Activate the tag input tag editor.
|
|
76
|
+
this.addButton.focus()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
ignoreMutation(_record) {
|
|
81
|
+
if (this.addButton?.hasFocus()) {
|
|
82
|
+
return true
|
|
83
|
+
}
|
|
84
|
+
return false
|
|
85
|
+
}
|
|
86
|
+
}
|