@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,58 @@
|
|
|
1
|
+
import {Dialog} from "fwtoolkit"
|
|
2
|
+
|
|
3
|
+
import {LANGUAGES} from "@fiduswriter/document/schema/const"
|
|
4
|
+
import {languageTemplate} from "./templates"
|
|
5
|
+
|
|
6
|
+
export class LanguageDialog {
|
|
7
|
+
constructor(editor, language) {
|
|
8
|
+
this.editor = editor
|
|
9
|
+
this.language = language
|
|
10
|
+
this.dialog = false
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
init() {
|
|
14
|
+
const buttons = []
|
|
15
|
+
buttons.push({
|
|
16
|
+
text: gettext("Change"),
|
|
17
|
+
classes: "fw-dark",
|
|
18
|
+
click: () => {
|
|
19
|
+
const language =
|
|
20
|
+
this.dialog.dialogEl.querySelector("select").value
|
|
21
|
+
this.dialog.close()
|
|
22
|
+
|
|
23
|
+
if (language === this.language) {
|
|
24
|
+
// No change.
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
this.editor.view.dispatch(
|
|
28
|
+
this.editor.view.state.tr
|
|
29
|
+
.setDocAttribute("language", language)
|
|
30
|
+
.setMeta("settings", true)
|
|
31
|
+
)
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
buttons.push({
|
|
37
|
+
type: "cancel"
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
this.dialog = new Dialog({
|
|
41
|
+
width: 300,
|
|
42
|
+
height: 180,
|
|
43
|
+
id: "select-document-language",
|
|
44
|
+
title: gettext("Change language of the document"),
|
|
45
|
+
body: languageTemplate({
|
|
46
|
+
currentLanguage: this.language,
|
|
47
|
+
allowedLanguages: LANGUAGES.filter(lang =>
|
|
48
|
+
this.editor.view.state.doc.attrs.languages.includes(lang[0])
|
|
49
|
+
)
|
|
50
|
+
}),
|
|
51
|
+
buttons,
|
|
52
|
+
onClose: () => this.editor.currentView.focus(),
|
|
53
|
+
restoreActiveElement: false
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
this.dialog.open()
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import {TextSelection} from "prosemirror-state"
|
|
2
|
+
|
|
3
|
+
import {linkDialogTemplate} from "./templates"
|
|
4
|
+
|
|
5
|
+
import {Dialog} from "fwtoolkit"
|
|
6
|
+
import {getInternalTargets} from "../state_plugins"
|
|
7
|
+
|
|
8
|
+
export class LinkDialog {
|
|
9
|
+
constructor(editor) {
|
|
10
|
+
this.editor = editor
|
|
11
|
+
this.target = false // cross reference or internal link
|
|
12
|
+
this.linkType = "external"
|
|
13
|
+
this.defaultLink = "https://"
|
|
14
|
+
this.title = ""
|
|
15
|
+
this.submitButtonText = gettext("Insert")
|
|
16
|
+
this.dialog = false
|
|
17
|
+
this.internalTargets = []
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
init() {
|
|
21
|
+
this.checkCrossReference()
|
|
22
|
+
if (!this.target) {
|
|
23
|
+
this.checkLink()
|
|
24
|
+
}
|
|
25
|
+
this.internalTargets = getInternalTargets(
|
|
26
|
+
this.editor.view.state,
|
|
27
|
+
this.editor.view.state.doc.attrs.language,
|
|
28
|
+
"main"
|
|
29
|
+
).concat(
|
|
30
|
+
getInternalTargets(
|
|
31
|
+
this.editor.mod.footnotes.fnEditor.view.state,
|
|
32
|
+
this.editor.view.state.doc.attrs.language,
|
|
33
|
+
"foot"
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
this.createDialog()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Check if there is an existing link at the selection. If this is the case
|
|
40
|
+
// use its values in dialog.
|
|
41
|
+
checkLink() {
|
|
42
|
+
const state = this.editor.currentView.state,
|
|
43
|
+
from = state.selection.from,
|
|
44
|
+
linkMark = state.selection.$from
|
|
45
|
+
.marks()
|
|
46
|
+
.find(mark => mark.type.name === "link")
|
|
47
|
+
if (linkMark) {
|
|
48
|
+
if (linkMark.attrs.href[0] === "#") {
|
|
49
|
+
this.linkType = "internal"
|
|
50
|
+
this.target = linkMark.attrs.href.slice(1)
|
|
51
|
+
} else {
|
|
52
|
+
this.linkType = "external"
|
|
53
|
+
this.target = linkMark.attrs.href
|
|
54
|
+
this.title = linkMark.attrs.title ? linkMark.attrs.title : ""
|
|
55
|
+
}
|
|
56
|
+
this.extendSelectionToMark(from, linkMark)
|
|
57
|
+
this.submitButtonText = gettext("Update")
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Check if the selection spans over exactly one cross reference node. If so, use it.
|
|
62
|
+
checkCrossReference() {
|
|
63
|
+
if (
|
|
64
|
+
this.editor.currentView.state.selection.node?.type.name ===
|
|
65
|
+
"cross_reference"
|
|
66
|
+
) {
|
|
67
|
+
this.submitButtonText = gettext("Update")
|
|
68
|
+
this.target = this.editor.currentView.state.selection.node.attrs.id
|
|
69
|
+
this.linkType = "cross_reference"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// To check whether links, cross references or both can be added in current position.
|
|
74
|
+
checkAllowedContent() {
|
|
75
|
+
if (this.editor.currentView === this.editor.view) {
|
|
76
|
+
const settings =
|
|
77
|
+
this.editor.view.state.selection.$anchor.node(1).attrs
|
|
78
|
+
return {
|
|
79
|
+
link: settings.marks.includes("link"),
|
|
80
|
+
cross_reference: settings.elements.includes("cross_reference")
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
const settings = this.editor.view.state.doc.attrs
|
|
84
|
+
return {
|
|
85
|
+
link: settings.footnote_marks.includes("link"),
|
|
86
|
+
cross_reference:
|
|
87
|
+
settings.footnote_elements.includes("cross_reference")
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Find the start and end of the link currently selected.
|
|
93
|
+
extendSelectionToMark(pos, mark) {
|
|
94
|
+
const view = this.editor.currentView,
|
|
95
|
+
state = view.state,
|
|
96
|
+
$pos = state.doc.resolve(pos)
|
|
97
|
+
let startIndex = $pos.index(),
|
|
98
|
+
endIndex = $pos.indexAfter()
|
|
99
|
+
|
|
100
|
+
while (
|
|
101
|
+
startIndex > 0 &&
|
|
102
|
+
mark.isInSet($pos.parent.child(startIndex - 1).marks)
|
|
103
|
+
) {
|
|
104
|
+
startIndex--
|
|
105
|
+
}
|
|
106
|
+
while (
|
|
107
|
+
endIndex < $pos.parent.childCount &&
|
|
108
|
+
mark.isInSet($pos.parent.child(endIndex).marks)
|
|
109
|
+
) {
|
|
110
|
+
endIndex++
|
|
111
|
+
}
|
|
112
|
+
let startPos = $pos.start(),
|
|
113
|
+
endPos = startPos
|
|
114
|
+
|
|
115
|
+
for (let i = 0; i < endIndex; i++) {
|
|
116
|
+
const size = $pos.parent.child(i).nodeSize
|
|
117
|
+
if (i < startIndex) {
|
|
118
|
+
startPos += size
|
|
119
|
+
}
|
|
120
|
+
endPos += size
|
|
121
|
+
}
|
|
122
|
+
view.dispatch(
|
|
123
|
+
state.tr.setSelection(
|
|
124
|
+
TextSelection.create(state.doc, startPos, endPos)
|
|
125
|
+
)
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
createDialog() {
|
|
130
|
+
const buttons = []
|
|
131
|
+
buttons.push({
|
|
132
|
+
text: this.submitButtonText,
|
|
133
|
+
classes: "fw-dark",
|
|
134
|
+
click: () => {
|
|
135
|
+
const linkTypeEl = this.dialog.dialogEl.querySelector(
|
|
136
|
+
"input[name=link-type]:checked"
|
|
137
|
+
),
|
|
138
|
+
linkType = linkTypeEl ? linkTypeEl.value : "external"
|
|
139
|
+
let href, title, target, change
|
|
140
|
+
|
|
141
|
+
switch (linkType) {
|
|
142
|
+
case "internal": {
|
|
143
|
+
target = this.dialog.dialogEl.querySelector(
|
|
144
|
+
"select.internal-link-selector"
|
|
145
|
+
).value
|
|
146
|
+
href = `#${target}`
|
|
147
|
+
title = this.internalTargets.find(
|
|
148
|
+
iTarget => iTarget.id === target
|
|
149
|
+
).text
|
|
150
|
+
change =
|
|
151
|
+
target &&
|
|
152
|
+
(this.linkType !== "internal" ||
|
|
153
|
+
this.target !== target)
|
|
154
|
+
break
|
|
155
|
+
}
|
|
156
|
+
case "external": {
|
|
157
|
+
const linkEl =
|
|
158
|
+
this.dialog.dialogEl.querySelector("input.link")
|
|
159
|
+
if (
|
|
160
|
+
!new RegExp(/^\s*$/).test(linkEl.value) &&
|
|
161
|
+
linkEl.value !== this.defaultLink
|
|
162
|
+
) {
|
|
163
|
+
href = linkEl.value
|
|
164
|
+
}
|
|
165
|
+
title =
|
|
166
|
+
this.dialog.dialogEl.querySelector(
|
|
167
|
+
"input.link-title"
|
|
168
|
+
).value
|
|
169
|
+
if (new RegExp(/^\s*$/).test(title)) {
|
|
170
|
+
// The link title is empty. Make it the same as the link itself.
|
|
171
|
+
title = href
|
|
172
|
+
}
|
|
173
|
+
change =
|
|
174
|
+
href &&
|
|
175
|
+
(this.linkType !== "external" ||
|
|
176
|
+
this.target !== href ||
|
|
177
|
+
this.title !== title)
|
|
178
|
+
break
|
|
179
|
+
}
|
|
180
|
+
case "cross_reference": {
|
|
181
|
+
target = this.dialog.dialogEl.querySelector(
|
|
182
|
+
"select.cross-reference-selector"
|
|
183
|
+
).value
|
|
184
|
+
title = this.internalTargets.find(
|
|
185
|
+
iTarget => iTarget.id === target
|
|
186
|
+
).text
|
|
187
|
+
change =
|
|
188
|
+
target &&
|
|
189
|
+
(this.linkType !== "cross_reference" ||
|
|
190
|
+
this.target !== target)
|
|
191
|
+
break
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
this.dialog.close()
|
|
195
|
+
|
|
196
|
+
if (!change) {
|
|
197
|
+
// The link input is empty or hasn't been changed from the default value.
|
|
198
|
+
// Just close the dialog.
|
|
199
|
+
this.editor.currentView.focus()
|
|
200
|
+
return
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const view = this.editor.currentView,
|
|
204
|
+
posFrom = view.state.selection.from,
|
|
205
|
+
tr = view.state.tr
|
|
206
|
+
let posTo = view.state.selection.to
|
|
207
|
+
|
|
208
|
+
if (linkType === "cross_reference") {
|
|
209
|
+
const node = view.state.schema.nodes.cross_reference.create(
|
|
210
|
+
{
|
|
211
|
+
id: target,
|
|
212
|
+
title
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
tr.replaceSelectionWith(node)
|
|
216
|
+
} else {
|
|
217
|
+
// There is an empty selection. We insert the link title into the editor
|
|
218
|
+
// and then add the link to that.
|
|
219
|
+
if (posFrom === posTo) {
|
|
220
|
+
tr.insertText(title, posFrom, posTo)
|
|
221
|
+
posTo = tr.mapping.map(posFrom, 1)
|
|
222
|
+
}
|
|
223
|
+
const markType = view.state.schema.marks.link.create({
|
|
224
|
+
href,
|
|
225
|
+
title
|
|
226
|
+
})
|
|
227
|
+
tr.addMark(posFrom, posTo, markType)
|
|
228
|
+
}
|
|
229
|
+
view.dispatch(tr)
|
|
230
|
+
view.focus()
|
|
231
|
+
return
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
buttons.push({
|
|
236
|
+
type: "cancel"
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
const initialFocus =
|
|
240
|
+
this.linkType === "cross_reference"
|
|
241
|
+
? "select.cross-reference-selector"
|
|
242
|
+
: this.linkType === "internal"
|
|
243
|
+
? "select.internal-link-selector"
|
|
244
|
+
: "input.link-title"
|
|
245
|
+
|
|
246
|
+
this.dialog = new Dialog({
|
|
247
|
+
id: "edit-link",
|
|
248
|
+
title: gettext("Link"),
|
|
249
|
+
body: linkDialogTemplate({
|
|
250
|
+
target: this.target,
|
|
251
|
+
allowedContent: this.checkAllowedContent(),
|
|
252
|
+
title: this.title,
|
|
253
|
+
linkType: this.linkType,
|
|
254
|
+
defaultLink: this.defaultLink,
|
|
255
|
+
internalTargets: this.internalTargets
|
|
256
|
+
}),
|
|
257
|
+
buttons,
|
|
258
|
+
width: 836,
|
|
259
|
+
height: 360,
|
|
260
|
+
onClose: () => this.editor.currentView.focus(),
|
|
261
|
+
restoreActiveElement: false,
|
|
262
|
+
initialFocus
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
this.dialog.open()
|
|
266
|
+
|
|
267
|
+
if (this.internalTargets.length) {
|
|
268
|
+
const externalEls = this.dialog.dialogEl.querySelectorAll(
|
|
269
|
+
"input.link, input.link-title"
|
|
270
|
+
),
|
|
271
|
+
internalEls = this.dialog.dialogEl.querySelectorAll(
|
|
272
|
+
"select.internal-link-selector"
|
|
273
|
+
),
|
|
274
|
+
crossReferenceEls = this.dialog.dialogEl.querySelectorAll(
|
|
275
|
+
"select.cross-reference-selector"
|
|
276
|
+
),
|
|
277
|
+
externalSwitchers = this.dialog.dialogEl.querySelectorAll(
|
|
278
|
+
"input.link, input.link-title, label.link-external-label, input.link-external-check"
|
|
279
|
+
),
|
|
280
|
+
internalSwitchers = this.dialog.dialogEl.querySelectorAll(
|
|
281
|
+
"select.internal-link-selector, label.link-internal-label, input.link-internal-check"
|
|
282
|
+
),
|
|
283
|
+
crossReferenceSwitchers = this.dialog.dialogEl.querySelectorAll(
|
|
284
|
+
"select.cross-reference-selector, label.cross-reference-label, input.cross-reference-check"
|
|
285
|
+
),
|
|
286
|
+
radioInternal = this.dialog.dialogEl.querySelector(
|
|
287
|
+
"input.link-internal-check"
|
|
288
|
+
),
|
|
289
|
+
radioExternal = this.dialog.dialogEl.querySelector(
|
|
290
|
+
"input.link-external-check"
|
|
291
|
+
),
|
|
292
|
+
radioCrossReference = this.dialog.dialogEl.querySelector(
|
|
293
|
+
"input.cross-reference-check"
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
switch (this.linkType) {
|
|
297
|
+
case "internal":
|
|
298
|
+
externalEls.forEach(el => el.classList.add("fw-disabled"))
|
|
299
|
+
crossReferenceEls.forEach(el =>
|
|
300
|
+
el.classList.add("fw-disabled")
|
|
301
|
+
)
|
|
302
|
+
radioInternal.checked = true
|
|
303
|
+
break
|
|
304
|
+
case "external":
|
|
305
|
+
internalEls.forEach(el => el.classList.add("fw-disabled"))
|
|
306
|
+
crossReferenceEls.forEach(el =>
|
|
307
|
+
el.classList.add("fw-disabled")
|
|
308
|
+
)
|
|
309
|
+
radioExternal.checked = true
|
|
310
|
+
break
|
|
311
|
+
case "cross_reference":
|
|
312
|
+
internalEls.forEach(el => el.classList.add("fw-disabled"))
|
|
313
|
+
externalEls.forEach(el => el.classList.add("fw-disabled"))
|
|
314
|
+
radioCrossReference.checked = true
|
|
315
|
+
break
|
|
316
|
+
default:
|
|
317
|
+
break
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
internalSwitchers.forEach(el =>
|
|
321
|
+
el.addEventListener("click", () => {
|
|
322
|
+
externalEls.forEach(el => el.classList.add("fw-disabled"))
|
|
323
|
+
internalEls.forEach(el =>
|
|
324
|
+
el.classList.remove("fw-disabled")
|
|
325
|
+
)
|
|
326
|
+
crossReferenceEls.forEach(el =>
|
|
327
|
+
el.classList.add("fw-disabled")
|
|
328
|
+
)
|
|
329
|
+
radioInternal.checked = true
|
|
330
|
+
})
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
externalSwitchers.forEach(el =>
|
|
334
|
+
el.addEventListener("click", () => {
|
|
335
|
+
internalEls.forEach(el => el.classList.add("fw-disabled"))
|
|
336
|
+
externalEls.forEach(el =>
|
|
337
|
+
el.classList.remove("fw-disabled")
|
|
338
|
+
)
|
|
339
|
+
crossReferenceEls.forEach(el =>
|
|
340
|
+
el.classList.add("fw-disabled")
|
|
341
|
+
)
|
|
342
|
+
radioExternal.checked = true
|
|
343
|
+
})
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
crossReferenceSwitchers.forEach(el =>
|
|
347
|
+
el.addEventListener("click", () => {
|
|
348
|
+
internalEls.forEach(el => el.classList.add("fw-disabled"))
|
|
349
|
+
externalEls.forEach(el => el.classList.add("fw-disabled"))
|
|
350
|
+
crossReferenceEls.forEach(el =>
|
|
351
|
+
el.classList.remove("fw-disabled")
|
|
352
|
+
)
|
|
353
|
+
radioCrossReference.checked = true
|
|
354
|
+
})
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {Dialog} from "fwtoolkit"
|
|
2
|
+
import {sub, subChars, sup, supChars} from "./subsup"
|
|
3
|
+
import {mathDialogTemplate} from "./templates"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Class to work with formula dialog
|
|
7
|
+
*/
|
|
8
|
+
export class MathDialog {
|
|
9
|
+
constructor(editor) {
|
|
10
|
+
this.editor = editor
|
|
11
|
+
this.node = this.editor.currentView.state.selection.node
|
|
12
|
+
this.equationSelected =
|
|
13
|
+
this.node && this.node.attrs && this.node.attrs.equation
|
|
14
|
+
? true
|
|
15
|
+
: false
|
|
16
|
+
this.equation = this.equationSelected ? this.node.attrs.equation : ""
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
init() {
|
|
20
|
+
//get selected node
|
|
21
|
+
|
|
22
|
+
//initialize dialog and open it
|
|
23
|
+
this.dialog = new Dialog({
|
|
24
|
+
body: mathDialogTemplate(),
|
|
25
|
+
height: 150,
|
|
26
|
+
buttons: [
|
|
27
|
+
{
|
|
28
|
+
text: this.equationSelected
|
|
29
|
+
? gettext("Update")
|
|
30
|
+
: gettext("Insert"),
|
|
31
|
+
classes: "fw-dark insert-math",
|
|
32
|
+
click: () => {
|
|
33
|
+
const view = this.editor.currentView,
|
|
34
|
+
state = view.state
|
|
35
|
+
|
|
36
|
+
this.equation = this.getLatex()
|
|
37
|
+
|
|
38
|
+
if (new RegExp(/^\s*$/).test(this.equation)) {
|
|
39
|
+
// The math input is empty. Delete a math node if it exist. Then close the dialog.
|
|
40
|
+
if (this.equationSelected) {
|
|
41
|
+
view.dispatch(state.tr.deleteSelection())
|
|
42
|
+
}
|
|
43
|
+
this.dialog.close()
|
|
44
|
+
return
|
|
45
|
+
} else if (
|
|
46
|
+
new RegExp(
|
|
47
|
+
`^\\^({[${supChars}]*}|[${supChars}]?)$`
|
|
48
|
+
).test(this.equation)
|
|
49
|
+
) {
|
|
50
|
+
// The math input is pure superscript and
|
|
51
|
+
// can be converted to ordinary characters.
|
|
52
|
+
view.dispatch(
|
|
53
|
+
state.tr.insertText(sup(this.equation.slice(1)))
|
|
54
|
+
)
|
|
55
|
+
this.dialog.close()
|
|
56
|
+
return
|
|
57
|
+
} else if (
|
|
58
|
+
new RegExp(
|
|
59
|
+
`^\\_({[${subChars}]*}|[${subChars}]?)$`
|
|
60
|
+
).test(this.equation)
|
|
61
|
+
) {
|
|
62
|
+
// The math input is pure subscript and
|
|
63
|
+
// can be converted to ordinary characters.
|
|
64
|
+
view.dispatch(
|
|
65
|
+
state.tr.insertText(sub(this.equation.slice(1)))
|
|
66
|
+
)
|
|
67
|
+
this.dialog.close()
|
|
68
|
+
return
|
|
69
|
+
} else if (
|
|
70
|
+
this.equationSelected &&
|
|
71
|
+
this.equation === this.node.attrs.equation
|
|
72
|
+
) {
|
|
73
|
+
// Equation selected, but has not changed from last time.
|
|
74
|
+
this.dialog.close()
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
const nodeType = state.schema.nodes["equation"]
|
|
78
|
+
view.dispatch(
|
|
79
|
+
state.tr.replaceSelectionWith(
|
|
80
|
+
nodeType.createAndFill({
|
|
81
|
+
equation: this.equation
|
|
82
|
+
})
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
this.dialog.close()
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: "cancel"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
title: gettext("Mathematical formula"),
|
|
93
|
+
beforeClose: () => {
|
|
94
|
+
if (this.mathField) {
|
|
95
|
+
this.mathField = false
|
|
96
|
+
}
|
|
97
|
+
if (window.mathVirtualKeyboard) {
|
|
98
|
+
window.mathVirtualKeyboard.hide()
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
classes: "math",
|
|
102
|
+
onClose: () => this.editor.currentView.focus(),
|
|
103
|
+
restoreActiveElement: false
|
|
104
|
+
})
|
|
105
|
+
this.dialog.open()
|
|
106
|
+
|
|
107
|
+
this.mathliveDOM = this.dialog.dialogEl.querySelector(".math-field")
|
|
108
|
+
|
|
109
|
+
import("@fiduswriter/document/mathlive").then(MathLive => {
|
|
110
|
+
MathLive.MathfieldElement.strings = {
|
|
111
|
+
int: {
|
|
112
|
+
"keyboard.tooltip.functions": gettext("Functions"),
|
|
113
|
+
"keyboard.tooltip.greek": gettext("Greek Letters"),
|
|
114
|
+
"keyboard.tooltip.command": gettext("LaTeX Command Mode"),
|
|
115
|
+
"keyboard.tooltip.numeric": gettext("Numeric"),
|
|
116
|
+
"keyboard.tooltip.roman": gettext(
|
|
117
|
+
"Symbols and Roman Letters"
|
|
118
|
+
),
|
|
119
|
+
"tooltip.copy to clipboard": gettext("Copy to Clipboard"),
|
|
120
|
+
"tooltip.redo": gettext("Redo"),
|
|
121
|
+
"tooltip.toggle virtual keyboard": gettext(
|
|
122
|
+
"Toggle Virtual Keyboard"
|
|
123
|
+
),
|
|
124
|
+
"tooltip.undo": gettext("Undo")
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
MathLive.MathfieldElement.locale = "int"
|
|
128
|
+
MathLive.MathfieldElement.plonkSound = null
|
|
129
|
+
MathLive.MathfieldElement.keypressSound = null
|
|
130
|
+
this.mathField = new MathLive.MathfieldElement({
|
|
131
|
+
mathVirtualKeyboardPolicy: "manual"
|
|
132
|
+
})
|
|
133
|
+
this.mathField.value = this.equation
|
|
134
|
+
this.mathliveDOM.appendChild(this.mathField)
|
|
135
|
+
//this.mathField.addEventListener("focusin", () => window.mathVirtualKeyboard.show())
|
|
136
|
+
//this.mathField.addEventListener("focusout", () => window.mathVirtualKeyboard.hide())
|
|
137
|
+
this.mathField.select()
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Get latex representation as text
|
|
143
|
+
* @returns {string} latex formula
|
|
144
|
+
*/
|
|
145
|
+
getLatex() {
|
|
146
|
+
return this.mathField.getValue()
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {Dialog} from "fwtoolkit"
|
|
2
|
+
import {orderedListStartTemplate} from "./templates"
|
|
3
|
+
|
|
4
|
+
export class OrderedListStartDialog {
|
|
5
|
+
constructor(editor) {
|
|
6
|
+
this.editor = editor
|
|
7
|
+
this.dialogEl = false
|
|
8
|
+
this.order = 1
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
init() {
|
|
12
|
+
const {orderedList} = this.findOrderedList(
|
|
13
|
+
this.editor.currentView.state
|
|
14
|
+
)
|
|
15
|
+
if (orderedList) {
|
|
16
|
+
this.order = orderedList.attrs.order
|
|
17
|
+
}
|
|
18
|
+
this.insertDialog()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
findOrderedList(state) {
|
|
22
|
+
const $head = state.selection.$head
|
|
23
|
+
for (let d = $head.depth; d > 0; d--) {
|
|
24
|
+
if ($head.node(d).type.name == "ordered_list") {
|
|
25
|
+
return {
|
|
26
|
+
orderedList: $head.node(d),
|
|
27
|
+
orderedListPos: $head.before(d)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return {orderedList: false, orderedListPos: false}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
submitForm() {
|
|
35
|
+
const {orderedList, orderedListPos} = this.findOrderedList(
|
|
36
|
+
this.editor.currentView.state
|
|
37
|
+
)
|
|
38
|
+
if (!orderedList) {
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
const attrs = Object.assign({}, orderedList.attrs, {
|
|
42
|
+
order: this.order
|
|
43
|
+
})
|
|
44
|
+
this.editor.currentView.dispatch(
|
|
45
|
+
this.editor.currentView.state.tr.setNodeMarkup(
|
|
46
|
+
orderedListPos,
|
|
47
|
+
false,
|
|
48
|
+
attrs
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
insertDialog() {
|
|
54
|
+
const buttons = []
|
|
55
|
+
buttons.push({
|
|
56
|
+
text: gettext("Update"),
|
|
57
|
+
classes: "fw-dark",
|
|
58
|
+
click: () => {
|
|
59
|
+
this.submitForm()
|
|
60
|
+
this.dialog.close()
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
buttons.push({
|
|
64
|
+
type: "cancel"
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
this.dialog = new Dialog({
|
|
68
|
+
title: gettext("Set list start number"),
|
|
69
|
+
body: orderedListStartTemplate({order: this.order}),
|
|
70
|
+
width: 300,
|
|
71
|
+
height: 100,
|
|
72
|
+
buttons,
|
|
73
|
+
onClose: () => this.editor.currentView.focus(),
|
|
74
|
+
restoreActiveElement: false
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
this.dialog.open()
|
|
78
|
+
|
|
79
|
+
const listStartInput = document.querySelector("input.list-start")
|
|
80
|
+
listStartInput.addEventListener("change", _event => {
|
|
81
|
+
this.order = Number.parseInt(listStartInput.value) || 1
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {Dialog} from "fwtoolkit"
|
|
2
|
+
import {revisionDialogTemplate} from "./templates"
|
|
3
|
+
|
|
4
|
+
export class RevisionDialog {
|
|
5
|
+
constructor(dir) {
|
|
6
|
+
this.dir = dir
|
|
7
|
+
this.dialog = false
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
init() {
|
|
11
|
+
const buttons = []
|
|
12
|
+
const dialogDonePromise = new Promise(resolve => {
|
|
13
|
+
buttons.push({
|
|
14
|
+
text: gettext("Save"),
|
|
15
|
+
classes: "fw-dark",
|
|
16
|
+
click: () => {
|
|
17
|
+
const note =
|
|
18
|
+
this.dialog.dialogEl.querySelector(
|
|
19
|
+
".revision-note"
|
|
20
|
+
).value
|
|
21
|
+
this.dialog.close()
|
|
22
|
+
return resolve(note)
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
buttons.push({
|
|
27
|
+
type: "cancel"
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
this.dialog = new Dialog({
|
|
32
|
+
title: gettext("Revision description"),
|
|
33
|
+
body: revisionDialogTemplate({dir: this.dir}),
|
|
34
|
+
height: 100,
|
|
35
|
+
width: 300,
|
|
36
|
+
buttons,
|
|
37
|
+
restoreActiveElement: false
|
|
38
|
+
})
|
|
39
|
+
this.dialog.open()
|
|
40
|
+
|
|
41
|
+
return dialogDonePromise
|
|
42
|
+
}
|
|
43
|
+
}
|