@fiduswriter/editor 0.1.20 → 0.1.21
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/dist/bibliography/tools.d.ts +14 -0
- package/dist/bibliography/tools.d.ts.map +1 -0
- package/dist/bibliography/tools.js +1 -1
- package/dist/bibliography/tools.js.map +1 -1
- package/dist/citations/index.d.ts +17 -0
- package/dist/citations/index.d.ts.map +1 -0
- package/dist/citations/index.js +22 -13
- package/dist/citations/index.js.map +1 -1
- package/dist/citations/render.d.ts +29 -0
- package/dist/citations/render.d.ts.map +1 -0
- package/dist/citations/render.js +25 -8
- package/dist/citations/render.js.map +1 -1
- package/dist/clipboard/copy/index.d.ts +2 -0
- package/dist/clipboard/copy/index.d.ts.map +1 -0
- package/dist/clipboard/copy/index.js.map +1 -1
- package/dist/clipboard/copy/schema.d.ts +4 -0
- package/dist/clipboard/copy/schema.d.ts.map +1 -0
- package/dist/clipboard/copy/schema.js +6 -5
- package/dist/clipboard/copy/schema.js.map +1 -1
- package/dist/clipboard/copy/serializers.d.ts +24 -0
- package/dist/clipboard/copy/serializers.d.ts.map +1 -0
- package/dist/clipboard/copy/serializers.js +19 -9
- package/dist/clipboard/copy/serializers.js.map +1 -1
- package/dist/clipboard/paste/fidus_writer.d.ts +7 -0
- package/dist/clipboard/paste/fidus_writer.d.ts.map +1 -0
- package/dist/clipboard/paste/fidus_writer.js +5 -2
- package/dist/clipboard/paste/fidus_writer.js.map +1 -1
- package/dist/clipboard/paste/general.d.ts +18 -0
- package/dist/clipboard/paste/general.d.ts.map +1 -0
- package/dist/clipboard/paste/general.js +18 -6
- package/dist/clipboard/paste/general.js.map +1 -1
- package/dist/clipboard/paste/google_docs.d.ts +6 -0
- package/dist/clipboard/paste/google_docs.d.ts.map +1 -0
- package/dist/clipboard/paste/google_docs.js +3 -2
- package/dist/clipboard/paste/google_docs.js.map +1 -1
- package/dist/clipboard/paste/html.d.ts +22 -0
- package/dist/clipboard/paste/html.d.ts.map +1 -0
- package/dist/clipboard/paste/html.js +15 -0
- package/dist/clipboard/paste/html.js.map +1 -1
- package/dist/clipboard/paste/index.d.ts +3 -0
- package/dist/clipboard/paste/index.d.ts.map +1 -0
- package/dist/clipboard/paste/index.js.map +1 -1
- package/dist/clipboard/paste/libreoffice_writer.d.ts +5 -0
- package/dist/clipboard/paste/libreoffice_writer.d.ts.map +1 -0
- package/dist/clipboard/paste/libreoffice_writer.js +2 -2
- package/dist/clipboard/paste/libreoffice_writer.js.map +1 -1
- package/dist/clipboard/paste/microsoft_word.d.ts +7 -0
- package/dist/clipboard/paste/microsoft_word.d.ts.map +1 -0
- package/dist/clipboard/paste/microsoft_word.js +13 -14
- package/dist/clipboard/paste/microsoft_word.js.map +1 -1
- package/dist/clipboard/paste/text.d.ts +11 -0
- package/dist/clipboard/paste/text.d.ts.map +1 -0
- package/dist/clipboard/paste/text.js +5 -3
- package/dist/clipboard/paste/text.js.map +1 -1
- package/dist/collab/chat.d.ts +24 -0
- package/dist/collab/chat.d.ts.map +1 -0
- package/dist/collab/chat.js +46 -16
- package/dist/collab/chat.js.map +1 -1
- package/dist/collab/colors.d.ts +16 -0
- package/dist/collab/colors.d.ts.map +1 -0
- package/dist/collab/colors.js +6 -0
- package/dist/collab/colors.js.map +1 -1
- package/dist/collab/doc.d.ts +147 -0
- package/dist/collab/doc.d.ts.map +1 -0
- package/dist/collab/doc.js +77 -42
- package/dist/collab/doc.js.map +1 -1
- package/dist/collab/index.d.ts +23 -0
- package/dist/collab/index.d.ts.map +1 -0
- package/dist/collab/index.js +14 -3
- package/dist/collab/index.js.map +1 -1
- package/dist/collab/merge/changeset.d.ts +23 -0
- package/dist/collab/merge/changeset.d.ts.map +1 -0
- package/dist/collab/merge/changeset.js +5 -4
- package/dist/collab/merge/changeset.js.map +1 -1
- package/dist/collab/merge/editor.d.ts +53 -0
- package/dist/collab/merge/editor.d.ts.map +1 -0
- package/dist/collab/merge/editor.js +62 -35
- package/dist/collab/merge/editor.js.map +1 -1
- package/dist/collab/merge/footnotes.d.ts +26 -0
- package/dist/collab/merge/footnotes.d.ts.map +1 -0
- package/dist/collab/merge/footnotes.js +14 -5
- package/dist/collab/merge/footnotes.js.map +1 -1
- package/dist/collab/merge/index.d.ts +32 -0
- package/dist/collab/merge/index.d.ts.map +1 -0
- package/dist/collab/merge/index.js +38 -26
- package/dist/collab/merge/index.js.map +1 -1
- package/dist/collab/merge/recreate_transform.d.ts +4 -0
- package/dist/collab/merge/recreate_transform.d.ts.map +1 -0
- package/dist/collab/merge/recreate_transform.js +25 -5
- package/dist/collab/merge/recreate_transform.js.map +1 -1
- package/dist/collab/merge/schema.d.ts +4 -0
- package/dist/collab/merge/schema.d.ts.map +1 -0
- package/dist/collab/merge/schema.js +35 -26
- package/dist/collab/merge/schema.js.map +1 -1
- package/dist/collab/merge/state_plugins/action.d.ts +16 -0
- package/dist/collab/merge/state_plugins/action.d.ts.map +1 -0
- package/dist/collab/merge/state_plugins/action.js +4 -5
- package/dist/collab/merge/state_plugins/action.js.map +1 -1
- package/dist/collab/merge/state_plugins/clipboard.d.ts +6 -0
- package/dist/collab/merge/state_plugins/clipboard.d.ts.map +1 -0
- package/dist/collab/merge/state_plugins/clipboard.js +1 -1
- package/dist/collab/merge/state_plugins/clipboard.js.map +1 -1
- package/dist/collab/merge/state_plugins/diff.d.ts +32 -0
- package/dist/collab/merge/state_plugins/diff.d.ts.map +1 -0
- package/dist/collab/merge/state_plugins/diff.js +108 -84
- package/dist/collab/merge/state_plugins/diff.js.map +1 -1
- package/dist/collab/merge/state_plugins/index.d.ts +3 -0
- package/dist/collab/merge/state_plugins/index.d.ts.map +1 -0
- package/dist/collab/merge/state_plugins/index.js.map +1 -1
- package/dist/collab/merge/tools.d.ts +11 -0
- package/dist/collab/merge/tools.d.ts.map +1 -0
- package/dist/collab/merge/tools.js +16 -14
- package/dist/collab/merge/tools.js.map +1 -1
- package/dist/collab/templates.d.ts +14 -0
- package/dist/collab/templates.d.ts.map +1 -0
- package/dist/collab/templates.js +1 -1
- package/dist/collab/templates.js.map +1 -1
- package/dist/comments/comment.d.ts +29 -0
- package/dist/comments/comment.d.ts.map +1 -0
- package/dist/comments/comment.js +12 -0
- package/dist/comments/comment.js.map +1 -1
- package/dist/comments/editors/answer.d.ts +14 -0
- package/dist/comments/editors/answer.d.ts.map +1 -0
- package/dist/comments/editors/answer.js +5 -3
- package/dist/comments/editors/answer.js.map +1 -1
- package/dist/comments/editors/comment.d.ts +65 -0
- package/dist/comments/editors/comment.d.ts.map +1 -0
- package/dist/comments/editors/comment.js +43 -14
- package/dist/comments/editors/comment.js.map +1 -1
- package/dist/comments/editors/index.d.ts +4 -0
- package/dist/comments/editors/index.d.ts.map +1 -0
- package/dist/comments/editors/index.js.map +1 -1
- package/dist/comments/editors/notify.d.ts +3 -0
- package/dist/comments/editors/notify.d.ts.map +1 -0
- package/dist/comments/editors/notify.js.map +1 -1
- package/dist/comments/editors/schema.d.ts +12 -0
- package/dist/comments/editors/schema.d.ts.map +1 -0
- package/dist/comments/editors/schema.js +5 -5
- package/dist/comments/editors/schema.js.map +1 -1
- package/dist/comments/index.d.ts +10 -0
- package/dist/comments/index.d.ts.map +1 -0
- package/dist/comments/index.js +5 -2
- package/dist/comments/index.js.map +1 -1
- package/dist/comments/interactions.d.ts +49 -0
- package/dist/comments/interactions.d.ts.map +1 -0
- package/dist/comments/interactions.js +33 -18
- package/dist/comments/interactions.js.map +1 -1
- package/dist/comments/store.d.ts +59 -0
- package/dist/comments/store.d.ts.map +1 -0
- package/dist/comments/store.js +36 -16
- package/dist/comments/store.js.map +1 -1
- package/dist/contacts/add_dialog.d.ts +7 -0
- package/dist/contacts/add_dialog.d.ts.map +1 -0
- package/dist/contacts/add_dialog.js +25 -26
- package/dist/contacts/add_dialog.js.map +1 -1
- package/dist/contacts/templates.d.ts +12 -0
- package/dist/contacts/templates.d.ts.map +1 -0
- package/dist/contacts/templates.js +3 -2
- package/dist/contacts/templates.js.map +1 -1
- package/dist/copyright_dialog/index.d.ts +25 -0
- package/dist/copyright_dialog/index.d.ts.map +1 -0
- package/dist/copyright_dialog/index.js +34 -26
- package/dist/copyright_dialog/index.js.map +1 -1
- package/dist/copyright_dialog/templates.d.ts +17 -0
- package/dist/copyright_dialog/templates.d.ts.map +1 -0
- package/dist/copyright_dialog/templates.js.map +1 -1
- package/dist/databases/bibliography.d.ts +42 -0
- package/dist/databases/bibliography.d.ts.map +1 -0
- package/dist/databases/bibliography.js +24 -9
- package/dist/databases/bibliography.js.map +1 -1
- package/dist/databases/images.d.ts +66 -0
- package/dist/databases/images.d.ts.map +1 -0
- package/dist/databases/images.js +19 -9
- package/dist/databases/images.js.map +1 -1
- package/dist/databases/index.d.ts +26 -0
- package/dist/databases/index.d.ts.map +1 -0
- package/dist/databases/index.js +9 -8
- package/dist/databases/index.js.map +1 -1
- package/dist/dialogs/citation.d.ts +58 -0
- package/dist/dialogs/citation.d.ts.map +1 -0
- package/dist/dialogs/citation.js +43 -22
- package/dist/dialogs/citation.js.map +1 -1
- package/dist/dialogs/code_block.d.ts +25 -0
- package/dist/dialogs/code_block.d.ts.map +1 -0
- package/dist/dialogs/code_block.js +32 -11
- package/dist/dialogs/code_block.js.map +1 -1
- package/dist/dialogs/contributor.d.ts +13 -0
- package/dist/dialogs/contributor.d.ts.map +1 -0
- package/dist/dialogs/contributor.js +17 -20
- package/dist/dialogs/contributor.js.map +1 -1
- package/dist/dialogs/figure.d.ts +51 -0
- package/dist/dialogs/figure.d.ts.map +1 -0
- package/dist/dialogs/figure.js +123 -81
- package/dist/dialogs/figure.js.map +1 -1
- package/dist/dialogs/index.d.ts +11 -0
- package/dist/dialogs/index.d.ts.map +1 -0
- package/dist/dialogs/index.js.map +1 -1
- package/dist/dialogs/language.d.ts +10 -0
- package/dist/dialogs/language.d.ts.map +1 -0
- package/dist/dialogs/language.js +4 -1
- package/dist/dialogs/language.js.map +1 -1
- package/dist/dialogs/link.d.ts +30 -0
- package/dist/dialogs/link.d.ts.map +1 -0
- package/dist/dialogs/link.js +27 -15
- package/dist/dialogs/link.js.map +1 -1
- package/dist/dialogs/math.d.ts +22 -0
- package/dist/dialogs/math.d.ts.map +1 -0
- package/dist/dialogs/math.js +27 -14
- package/dist/dialogs/math.js.map +1 -1
- package/dist/dialogs/ordered_list.d.ts +22 -0
- package/dist/dialogs/ordered_list.d.ts.map +1 -0
- package/dist/dialogs/ordered_list.js +12 -5
- package/dist/dialogs/ordered_list.js.map +1 -1
- package/dist/dialogs/revision.d.ts +8 -0
- package/dist/dialogs/revision.d.ts.map +1 -0
- package/dist/dialogs/revision.js +2 -0
- package/dist/dialogs/revision.js.map +1 -1
- package/dist/dialogs/subsup.d.ts +5 -0
- package/dist/dialogs/subsup.d.ts.map +1 -0
- package/dist/dialogs/subsup.js +3 -3
- package/dist/dialogs/subsup.js.map +1 -1
- package/dist/dialogs/table.d.ts +33 -0
- package/dist/dialogs/table.d.ts.map +1 -0
- package/dist/dialogs/table.js +43 -21
- package/dist/dialogs/table.js.map +1 -1
- package/dist/dialogs/templates.d.ts +85 -0
- package/dist/dialogs/templates.d.ts.map +1 -0
- package/dist/dialogs/templates.js +8 -8
- package/dist/dialogs/templates.js.map +1 -1
- package/dist/document_template/exporter.d.ts +23 -0
- package/dist/document_template/exporter.d.ts.map +1 -0
- package/dist/document_template/exporter.js +14 -5
- package/dist/document_template/exporter.js.map +1 -1
- package/dist/document_template/index.d.ts +35 -0
- package/dist/document_template/index.d.ts.map +1 -0
- package/dist/document_template/index.js +61 -53
- package/dist/document_template/index.js.map +1 -1
- package/dist/document_template/schema.d.ts +13 -0
- package/dist/document_template/schema.d.ts.map +1 -0
- package/dist/document_template/schema.js +2 -2
- package/dist/document_template/schema.js.map +1 -1
- package/dist/documents/access_rights/index.d.ts +85 -0
- package/dist/documents/access_rights/index.d.ts.map +1 -0
- package/dist/documents/access_rights/index.js +96 -60
- package/dist/documents/access_rights/index.js.map +1 -1
- package/dist/documents/access_rights/templates.d.ts +47 -0
- package/dist/documents/access_rights/templates.d.ts.map +1 -0
- package/dist/documents/access_rights/templates.js.map +1 -1
- package/dist/e2ee/snapshot-manager.d.ts +120 -0
- package/dist/e2ee/snapshot-manager.d.ts.map +1 -0
- package/dist/e2ee/snapshot-manager.js +27 -38
- package/dist/e2ee/snapshot-manager.js.map +1 -1
- package/dist/exporter/native/copy.d.ts +16 -0
- package/dist/exporter/native/copy.d.ts.map +1 -0
- package/dist/exporter/native/copy.js +51 -35
- package/dist/exporter/native/copy.js.map +1 -1
- package/dist/exporter/native/file.d.ts +6 -0
- package/dist/exporter/native/file.d.ts.map +1 -0
- package/dist/exporter/native/file.js +1 -1
- package/dist/exporter/native/file.js.map +1 -1
- package/dist/exporter/native/index.d.ts +4 -0
- package/dist/exporter/native/index.d.ts.map +1 -0
- package/dist/exporter/native/index.js.map +1 -1
- package/dist/exporter/native/revision.d.ts +8 -0
- package/dist/exporter/native/revision.d.ts.map +1 -0
- package/dist/exporter/native/revision.js +2 -2
- package/dist/exporter/native/revision.js.map +1 -1
- package/dist/exporter/native/zip.d.ts +2 -0
- package/dist/exporter/native/zip.d.ts.map +1 -0
- package/dist/exporter/native/zip.js.map +1 -1
- package/dist/footnotes/editor.d.ts +25 -0
- package/dist/footnotes/editor.d.ts.map +1 -0
- package/dist/footnotes/editor.js +5 -3
- package/dist/footnotes/editor.js.map +1 -1
- package/dist/footnotes/index.d.ts +11 -0
- package/dist/footnotes/index.d.ts.map +1 -0
- package/dist/footnotes/index.js +5 -2
- package/dist/footnotes/index.js.map +1 -1
- package/dist/footnotes/layout.d.ts +15 -0
- package/dist/footnotes/layout.d.ts.map +1 -0
- package/dist/footnotes/layout.js +26 -17
- package/dist/footnotes/layout.js.map +1 -1
- package/dist/footnotes/state_plugins/access_rights.d.ts +6 -0
- package/dist/footnotes/state_plugins/access_rights.d.ts.map +1 -0
- package/dist/footnotes/state_plugins/access_rights.js +1 -1
- package/dist/footnotes/state_plugins/access_rights.js.map +1 -1
- package/dist/footnotes/state_plugins/index.d.ts +2 -0
- package/dist/footnotes/state_plugins/index.d.ts.map +1 -0
- package/dist/footnotes/state_plugins/index.js.map +1 -1
- package/dist/images/edit_dialog/model.d.ts +4 -0
- package/dist/images/edit_dialog/model.d.ts.map +1 -0
- package/dist/images/edit_dialog/model.js.map +1 -1
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -59
- package/dist/index.js.map +1 -1
- package/dist/keymap.d.ts +5 -0
- package/dist/keymap.d.ts.map +1 -0
- package/dist/keymap.js +1 -1
- package/dist/keymap.js.map +1 -1
- package/dist/marginboxes/index.d.ts +107 -0
- package/dist/marginboxes/index.d.ts.map +1 -0
- package/dist/marginboxes/index.js +165 -88
- package/dist/marginboxes/index.js.map +1 -1
- package/dist/marginboxes/templates.d.ts +118 -0
- package/dist/marginboxes/templates.d.ts.map +1 -0
- package/dist/marginboxes/templates.js +25 -24
- package/dist/marginboxes/templates.js.map +1 -1
- package/dist/menus/code_block/index.d.ts +2 -0
- package/dist/menus/code_block/index.d.ts.map +1 -0
- package/dist/menus/code_block/index.js.map +1 -1
- package/dist/menus/code_block/model.d.ts +14 -0
- package/dist/menus/code_block/model.d.ts.map +1 -0
- package/dist/menus/code_block/model.js +5 -4
- package/dist/menus/code_block/model.js.map +1 -1
- package/dist/menus/figure/index.d.ts +3 -0
- package/dist/menus/figure/index.d.ts.map +1 -0
- package/dist/menus/figure/index.js.map +1 -1
- package/dist/menus/figure/model.d.ts +32 -0
- package/dist/menus/figure/model.d.ts.map +1 -0
- package/dist/menus/figure/model.js +11 -12
- package/dist/menus/figure/model.js.map +1 -1
- package/dist/menus/figure/utils.d.ts +3 -0
- package/dist/menus/figure/utils.d.ts.map +1 -0
- package/dist/menus/figure/utils.js +4 -1
- package/dist/menus/figure/utils.js.map +1 -1
- package/dist/menus/headerbar/index.d.ts +3 -0
- package/dist/menus/headerbar/index.d.ts.map +1 -0
- package/dist/menus/headerbar/index.js.map +1 -1
- package/dist/menus/headerbar/model.d.ts +192 -0
- package/dist/menus/headerbar/model.d.ts.map +1 -0
- package/dist/menus/headerbar/model.js +141 -110
- package/dist/menus/headerbar/model.js.map +1 -1
- package/dist/menus/headerbar/view.d.ts +89 -0
- package/dist/menus/headerbar/view.d.ts.map +1 -0
- package/dist/menus/headerbar/view.js +76 -45
- package/dist/menus/headerbar/view.js.map +1 -1
- package/dist/menus/image/index.d.ts +2 -0
- package/dist/menus/image/index.d.ts.map +1 -0
- package/dist/menus/image/index.js.map +1 -1
- package/dist/menus/image/model.d.ts +18 -0
- package/dist/menus/image/model.d.ts.map +1 -0
- package/dist/menus/image/model.js +2 -2
- package/dist/menus/image/model.js.map +1 -1
- package/dist/menus/index.d.ts +10 -0
- package/dist/menus/index.d.ts.map +1 -0
- package/dist/menus/index.js.map +1 -1
- package/dist/menus/navigator/index.d.ts +2 -0
- package/dist/menus/navigator/index.d.ts.map +1 -0
- package/dist/menus/navigator/index.js.map +1 -1
- package/dist/menus/navigator/model.d.ts +9 -0
- package/dist/menus/navigator/model.d.ts.map +1 -0
- package/dist/menus/navigator/model.js.map +1 -1
- package/dist/menus/ordered_list/index.d.ts +2 -0
- package/dist/menus/ordered_list/index.d.ts.map +1 -0
- package/dist/menus/ordered_list/index.js.map +1 -1
- package/dist/menus/ordered_list/model.d.ts +11 -0
- package/dist/menus/ordered_list/model.d.ts.map +1 -0
- package/dist/menus/ordered_list/model.js +1 -1
- package/dist/menus/ordered_list/model.js.map +1 -1
- package/dist/menus/selection/index.d.ts +3 -0
- package/dist/menus/selection/index.d.ts.map +1 -0
- package/dist/menus/selection/index.js.map +1 -1
- package/dist/menus/selection/model.d.ts +16 -0
- package/dist/menus/selection/model.d.ts.map +1 -0
- package/dist/menus/selection/model.js +18 -16
- package/dist/menus/selection/model.js.map +1 -1
- package/dist/menus/selection/view.d.ts +49 -0
- package/dist/menus/selection/view.d.ts.map +1 -0
- package/dist/menus/selection/view.js +33 -18
- package/dist/menus/selection/view.js.map +1 -1
- package/dist/menus/table/index.d.ts +2 -0
- package/dist/menus/table/index.d.ts.map +1 -0
- package/dist/menus/table/index.js.map +1 -1
- package/dist/menus/table/model.d.ts +39 -0
- package/dist/menus/table/model.d.ts.map +1 -0
- package/dist/menus/table/model.js +53 -50
- package/dist/menus/table/model.js.map +1 -1
- package/dist/menus/toolbar/index.d.ts +3 -0
- package/dist/menus/toolbar/index.d.ts.map +1 -0
- package/dist/menus/toolbar/index.js.map +1 -1
- package/dist/menus/toolbar/model.d.ts +125 -0
- package/dist/menus/toolbar/model.d.ts.map +1 -0
- package/dist/menus/toolbar/model.js +160 -140
- package/dist/menus/toolbar/model.js.map +1 -1
- package/dist/menus/toolbar/view.d.ts +72 -0
- package/dist/menus/toolbar/view.d.ts.map +1 -0
- package/dist/menus/toolbar/view.js +61 -36
- package/dist/menus/toolbar/view.js.map +1 -1
- package/dist/navigator/index.d.ts +38 -0
- package/dist/navigator/index.d.ts.map +1 -0
- package/dist/navigator/index.js +42 -21
- package/dist/navigator/index.js.map +1 -1
- package/dist/no_collab_save/index.d.ts +20 -0
- package/dist/no_collab_save/index.d.ts.map +1 -0
- package/dist/no_collab_save/index.js +20 -11
- package/dist/no_collab_save/index.js.map +1 -1
- package/dist/plugins/citation_dialog/index.d.ts +2 -0
- package/dist/plugins/citation_dialog/index.d.ts.map +1 -0
- package/dist/plugins/citation_dialog/index.js.map +1 -1
- package/dist/plugins/editor/index.d.ts +2 -0
- package/dist/plugins/editor/index.d.ts.map +1 -0
- package/dist/plugins/editor/index.js.map +1 -1
- package/dist/state_plugins/access_rights.d.ts +6 -0
- package/dist/state_plugins/access_rights.d.ts.map +1 -0
- package/dist/state_plugins/access_rights.js +5 -3
- package/dist/state_plugins/access_rights.js.map +1 -1
- package/dist/state_plugins/citation_render.d.ts +9 -0
- package/dist/state_plugins/citation_render.d.ts.map +1 -0
- package/dist/state_plugins/citation_render.js +12 -43
- package/dist/state_plugins/citation_render.js.map +1 -1
- package/dist/state_plugins/clipboard.d.ts +12 -0
- package/dist/state_plugins/clipboard.d.ts.map +1 -0
- package/dist/state_plugins/clipboard.js +13 -11
- package/dist/state_plugins/clipboard.js.map +1 -1
- package/dist/state_plugins/code_block.d.ts +6 -0
- package/dist/state_plugins/code_block.d.ts.map +1 -0
- package/dist/state_plugins/code_block.js +23 -9
- package/dist/state_plugins/code_block.js.map +1 -1
- package/dist/state_plugins/collab_carets.d.ts +26 -0
- package/dist/state_plugins/collab_carets.d.ts.map +1 -0
- package/dist/state_plugins/collab_carets.js +24 -16
- package/dist/state_plugins/collab_carets.js.map +1 -1
- package/dist/state_plugins/comments.d.ts +15 -0
- package/dist/state_plugins/comments.d.ts.map +1 -0
- package/dist/state_plugins/comments.js +26 -21
- package/dist/state_plugins/comments.js.map +1 -1
- package/dist/state_plugins/contributor_input/dropup.d.ts +17 -0
- package/dist/state_plugins/contributor_input/dropup.d.ts.map +1 -0
- package/dist/state_plugins/contributor_input/dropup.js +19 -20
- package/dist/state_plugins/contributor_input/dropup.js.map +1 -1
- package/dist/state_plugins/contributor_input/index.d.ts +3 -0
- package/dist/state_plugins/contributor_input/index.d.ts.map +1 -0
- package/dist/state_plugins/contributor_input/index.js.map +1 -1
- package/dist/state_plugins/contributor_input/node_view.d.ts +7 -0
- package/dist/state_plugins/contributor_input/node_view.d.ts.map +1 -0
- package/dist/state_plugins/contributor_input/node_view.js.map +1 -1
- package/dist/state_plugins/contributor_input/plugin.d.ts +19 -0
- package/dist/state_plugins/contributor_input/plugin.d.ts.map +1 -0
- package/dist/state_plugins/contributor_input/plugin.js +14 -45
- package/dist/state_plugins/contributor_input/plugin.js.map +1 -1
- package/dist/state_plugins/document_template.d.ts +33 -0
- package/dist/state_plugins/document_template.d.ts.map +1 -0
- package/dist/state_plugins/document_template.js +34 -15
- package/dist/state_plugins/document_template.js.map +1 -1
- package/dist/state_plugins/figure.d.ts +6 -0
- package/dist/state_plugins/figure.d.ts.map +1 -0
- package/dist/state_plugins/figure.js +26 -8
- package/dist/state_plugins/figure.js.map +1 -1
- package/dist/state_plugins/footnote_markers.d.ts +15 -0
- package/dist/state_plugins/footnote_markers.d.ts.map +1 -0
- package/dist/state_plugins/footnote_markers.js +72 -153
- package/dist/state_plugins/footnote_markers.js.map +1 -1
- package/dist/state_plugins/headerbar.d.ts +6 -0
- package/dist/state_plugins/headerbar.d.ts.map +1 -0
- package/dist/state_plugins/headerbar.js +1 -1
- package/dist/state_plugins/headerbar.js.map +1 -1
- package/dist/state_plugins/index.d.ts +28 -0
- package/dist/state_plugins/index.d.ts.map +1 -0
- package/dist/state_plugins/index.js +13 -12
- package/dist/state_plugins/index.js.map +1 -1
- package/dist/state_plugins/inline_math.d.ts +6 -0
- package/dist/state_plugins/inline_math.d.ts.map +1 -0
- package/dist/state_plugins/inline_math.js +28 -19
- package/dist/state_plugins/inline_math.js.map +1 -1
- package/dist/state_plugins/inline_reference/dropup.d.ts +62 -0
- package/dist/state_plugins/inline_reference/dropup.d.ts.map +1 -0
- package/dist/state_plugins/inline_reference/dropup.js +17 -17
- package/dist/state_plugins/inline_reference/dropup.js.map +1 -1
- package/dist/state_plugins/inline_reference/index.d.ts +2 -0
- package/dist/state_plugins/inline_reference/index.d.ts.map +1 -0
- package/dist/state_plugins/inline_reference/index.js.map +1 -1
- package/dist/state_plugins/inline_reference/plugin.d.ts +35 -0
- package/dist/state_plugins/inline_reference/plugin.d.ts.map +1 -0
- package/dist/state_plugins/inline_reference/plugin.js +68 -55
- package/dist/state_plugins/inline_reference/plugin.js.map +1 -1
- package/dist/state_plugins/jump_hidden_nodes.d.ts +5 -0
- package/dist/state_plugins/jump_hidden_nodes.d.ts.map +1 -0
- package/dist/state_plugins/jump_hidden_nodes.js +35 -22
- package/dist/state_plugins/jump_hidden_nodes.js.map +1 -1
- package/dist/state_plugins/links.d.ts +11 -0
- package/dist/state_plugins/links.d.ts.map +1 -0
- package/dist/state_plugins/links.js +39 -25
- package/dist/state_plugins/links.js.map +1 -1
- package/dist/state_plugins/marginboxes.d.ts +6 -0
- package/dist/state_plugins/marginboxes.d.ts.map +1 -0
- package/dist/state_plugins/marginboxes.js +2 -1
- package/dist/state_plugins/marginboxes.js.map +1 -1
- package/dist/state_plugins/ordered_list_menu.d.ts +6 -0
- package/dist/state_plugins/ordered_list_menu.d.ts.map +1 -0
- package/dist/state_plugins/ordered_list_menu.js +20 -6
- package/dist/state_plugins/ordered_list_menu.js.map +1 -1
- package/dist/state_plugins/placeholders.d.ts +6 -0
- package/dist/state_plugins/placeholders.d.ts.map +1 -0
- package/dist/state_plugins/placeholders.js +18 -54
- package/dist/state_plugins/placeholders.js.map +1 -1
- package/dist/state_plugins/search.d.ts +34 -0
- package/dist/state_plugins/search.d.ts.map +1 -0
- package/dist/state_plugins/search.js +31 -27
- package/dist/state_plugins/search.js.map +1 -1
- package/dist/state_plugins/selection_menu.d.ts +6 -0
- package/dist/state_plugins/selection_menu.d.ts.map +1 -0
- package/dist/state_plugins/selection_menu.js +1 -1
- package/dist/state_plugins/selection_menu.js.map +1 -1
- package/dist/state_plugins/settings.d.ts +8 -0
- package/dist/state_plugins/settings.d.ts.map +1 -0
- package/dist/state_plugins/settings.js +31 -21
- package/dist/state_plugins/settings.js.map +1 -1
- package/dist/state_plugins/table.d.ts +6 -0
- package/dist/state_plugins/table.d.ts.map +1 -0
- package/dist/state_plugins/table.js +33 -13
- package/dist/state_plugins/table.js.map +1 -1
- package/dist/state_plugins/tag_input/index.d.ts +3 -0
- package/dist/state_plugins/tag_input/index.d.ts.map +1 -0
- package/dist/state_plugins/tag_input/index.js.map +1 -1
- package/dist/state_plugins/tag_input/node_view.d.ts +7 -0
- package/dist/state_plugins/tag_input/node_view.d.ts.map +1 -0
- package/dist/state_plugins/tag_input/node_view.js.map +1 -1
- package/dist/state_plugins/tag_input/plugin.d.ts +14 -0
- package/dist/state_plugins/tag_input/plugin.d.ts.map +1 -0
- package/dist/state_plugins/tag_input/plugin.js +7 -6
- package/dist/state_plugins/tag_input/plugin.js.map +1 -1
- package/dist/state_plugins/toc_render.d.ts +6 -0
- package/dist/state_plugins/toc_render.d.ts.map +1 -0
- package/dist/state_plugins/toc_render.js +59 -96
- package/dist/state_plugins/toc_render.js.map +1 -1
- package/dist/state_plugins/toolbar.d.ts +6 -0
- package/dist/state_plugins/toolbar.d.ts.map +1 -0
- package/dist/state_plugins/toolbar.js +1 -1
- package/dist/state_plugins/toolbar.js.map +1 -1
- package/dist/state_plugins/track/find_selected_changes.d.ts +13 -0
- package/dist/state_plugins/track/find_selected_changes.d.ts.map +1 -0
- package/dist/state_plugins/track/find_selected_changes.js +4 -3
- package/dist/state_plugins/track/find_selected_changes.js.map +1 -1
- package/dist/state_plugins/track/helpers.d.ts +29 -0
- package/dist/state_plugins/track/helpers.d.ts.map +1 -0
- package/dist/state_plugins/track/helpers.js +9 -3
- package/dist/state_plugins/track/helpers.js.map +1 -1
- package/dist/state_plugins/track/index.d.ts +3 -0
- package/dist/state_plugins/track/index.d.ts.map +1 -0
- package/dist/state_plugins/track/index.js.map +1 -1
- package/dist/state_plugins/track/plugin.d.ts +14 -0
- package/dist/state_plugins/track/plugin.d.ts.map +1 -0
- package/dist/state_plugins/track/plugin.js +10 -6
- package/dist/state_plugins/track/plugin.js.map +1 -1
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/key_bindings/index.d.ts +7 -0
- package/dist/tools/key_bindings/index.d.ts.map +1 -0
- package/dist/tools/key_bindings/index.js +1 -3
- package/dist/tools/key_bindings/index.js.map +1 -1
- package/dist/tools/key_bindings/templates.d.ts +2 -0
- package/dist/tools/key_bindings/templates.d.ts.map +1 -0
- package/dist/tools/key_bindings/templates.js.map +1 -1
- package/dist/tools/search_replace/index.d.ts +28 -0
- package/dist/tools/search_replace/index.d.ts.map +1 -0
- package/dist/tools/search_replace/index.js +53 -27
- package/dist/tools/search_replace/index.js.map +1 -1
- package/dist/tools/search_replace/templates.d.ts +6 -0
- package/dist/tools/search_replace/templates.d.ts.map +1 -0
- package/dist/tools/search_replace/templates.js.map +1 -1
- package/dist/tools/word_count/index.d.ts +15 -0
- package/dist/tools/word_count/index.d.ts.map +1 -0
- package/dist/tools/word_count/index.js +2 -1
- package/dist/tools/word_count/index.js.map +1 -1
- package/dist/tools/word_count/templates.d.ts +11 -0
- package/dist/tools/word_count/templates.d.ts.map +1 -0
- package/dist/tools/word_count/templates.js.map +1 -1
- package/dist/track/accept.d.ts +3 -0
- package/dist/track/accept.d.ts.map +1 -0
- package/dist/track/accept.js +10 -5
- package/dist/track/accept.js.map +1 -1
- package/dist/track/accept_all.d.ts +3 -0
- package/dist/track/accept_all.d.ts.map +1 -0
- package/dist/track/accept_all.js +2 -2
- package/dist/track/accept_all.js.map +1 -1
- package/dist/track/accept_all_no_insertions.d.ts +3 -0
- package/dist/track/accept_all_no_insertions.d.ts.map +1 -0
- package/dist/track/accept_all_no_insertions.js +2 -2
- package/dist/track/accept_all_no_insertions.js.map +1 -1
- package/dist/track/amend_transaction.d.ts +5 -0
- package/dist/track/amend_transaction.d.ts.map +1 -0
- package/dist/track/amend_transaction.js +55 -32
- package/dist/track/amend_transaction.js.map +1 -1
- package/dist/track/delete.d.ts +3 -0
- package/dist/track/delete.d.ts.map +1 -0
- package/dist/track/delete.js +4 -3
- package/dist/track/delete.js.map +1 -1
- package/dist/track/index.d.ts +6 -0
- package/dist/track/index.d.ts.map +1 -0
- package/dist/track/index.js.map +1 -1
- package/dist/track/mod.d.ts +10 -0
- package/dist/track/mod.d.ts.map +1 -0
- package/dist/track/mod.js +9 -5
- package/dist/track/mod.js.map +1 -1
- package/dist/track/reject.d.ts +3 -0
- package/dist/track/reject.d.ts.map +1 -0
- package/dist/track/reject.js +14 -5
- package/dist/track/reject.js.map +1 -1
- package/dist/track/reject_all.d.ts +3 -0
- package/dist/track/reject_all.d.ts.map +1 -0
- package/dist/track/reject_all.js +6 -2
- package/dist/track/reject_all.js.map +1 -1
- package/dist/types.d.ts +182 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/package.json +38 -3
- package/src/bibliography/{tools.js → tools.ts} +16 -5
- package/src/citations/{index.js → index.ts} +100 -80
- package/src/citations/{render.js → render.ts} +43 -15
- package/src/clipboard/copy/{schema.js → schema.ts} +19 -8
- package/src/clipboard/copy/{serializers.js → serializers.ts} +44 -32
- package/src/clipboard/paste/{fidus_writer.js → fidus_writer.ts} +28 -8
- package/src/clipboard/paste/{general.js → general.ts} +28 -13
- package/src/clipboard/paste/{google_docs.js → google_docs.ts} +7 -4
- package/src/clipboard/paste/{html.js → html.ts} +35 -8
- package/src/clipboard/paste/{libreoffice_writer.js → libreoffice_writer.ts} +4 -4
- package/src/clipboard/paste/{microsoft_word.js → microsoft_word.ts} +22 -21
- package/src/clipboard/paste/{text.js → text.ts} +11 -7
- package/src/collab/{chat.js → chat.ts} +78 -27
- package/src/collab/{colors.js → colors.ts} +21 -5
- package/src/collab/{doc.js → doc.ts} +290 -184
- package/src/collab/{index.js → index.ts} +47 -13
- package/src/collab/merge/{changeset.js → changeset.ts} +33 -20
- package/src/collab/merge/{editor.js → editor.ts} +211 -107
- package/src/collab/merge/{footnotes.js → footnotes.ts} +43 -22
- package/src/collab/merge/{index.js → index.ts} +147 -70
- package/src/collab/merge/{recreate_transform.js → recreate_transform.ts} +60 -29
- package/src/collab/merge/{schema.js → schema.ts} +55 -35
- package/src/collab/merge/state_plugins/{action.js → action.ts} +65 -27
- package/src/collab/merge/state_plugins/{clipboard.js → clipboard.ts} +13 -3
- package/src/collab/merge/state_plugins/{diff.js → diff.ts} +279 -168
- package/src/collab/merge/{tools.js → tools.ts} +57 -27
- package/src/collab/{templates.js → templates.ts} +17 -2
- package/src/comments/{comment.js → comment.ts} +26 -0
- package/src/comments/editors/{answer.js → answer.ts} +27 -12
- package/src/comments/editors/{comment.js → comment.ts} +112 -36
- package/src/comments/editors/{notify.js → notify.ts} +6 -1
- package/src/comments/editors/{schema.js → schema.ts} +9 -8
- package/src/comments/index.ts +16 -0
- package/src/comments/{interactions.js → interactions.ts} +150 -89
- package/src/comments/{store.js → store.ts} +149 -73
- package/src/contacts/{add_dialog.js → add_dialog.ts} +50 -37
- package/src/contacts/{templates.js → templates.ts} +9 -3
- package/src/copyright_dialog/{index.js → index.ts} +92 -57
- package/src/copyright_dialog/{templates.js → templates.ts} +18 -3
- package/src/databases/{bibliography.js → bibliography.ts} +62 -36
- package/src/databases/{images.js → images.ts} +146 -96
- package/src/databases/index.ts +116 -0
- package/src/dialogs/{citation.js → citation.ts} +187 -106
- package/src/dialogs/{code_block.js → code_block.ts} +75 -33
- package/src/dialogs/{contributor.js → contributor.ts} +74 -49
- package/src/dialogs/{figure.js → figure.ts} +250 -149
- package/src/dialogs/{language.js → language.ts} +11 -6
- package/src/dialogs/{link.js → link.ts} +105 -60
- package/src/dialogs/{math.js → math.ts} +56 -28
- package/src/dialogs/{ordered_list.js → ordered_list.ts} +25 -12
- package/src/dialogs/{revision.js → revision.ts} +13 -9
- package/src/dialogs/{subsup.js → subsup.ts} +9 -7
- package/src/dialogs/{table.js → table.ts} +129 -70
- package/src/dialogs/{templates.js → templates.ts} +102 -22
- package/src/document_template/exporter.ts +158 -0
- package/src/document_template/{index.js → index.ts} +158 -117
- package/src/document_template/{schema.js → schema.ts} +31 -28
- package/src/documents/access_rights/{index.js → index.ts} +240 -123
- package/src/documents/access_rights/{templates.js → templates.ts} +41 -5
- package/src/e2ee/{snapshot-manager.js → snapshot-manager.ts} +80 -49
- package/src/exporter/native/copy.ts +302 -0
- package/src/exporter/native/{file.js → file.ts} +12 -5
- package/src/exporter/native/{revision.js → revision.ts} +17 -9
- package/src/footnotes/{editor.js → editor.ts} +37 -18
- package/src/footnotes/index.ts +21 -0
- package/src/footnotes/{layout.js → layout.ts} +53 -36
- package/src/footnotes/state_plugins/{access_rights.js → access_rights.ts} +6 -4
- package/src/global.d.ts +29 -0
- package/src/images/edit_dialog/{model.js → model.ts} +1 -1
- package/src/{index.js → index.ts} +193 -132
- package/src/{keymap.js → keymap.ts} +36 -16
- package/src/marginboxes/{index.js → index.ts} +341 -171
- package/src/marginboxes/{templates.js → templates.ts} +236 -38
- package/src/menus/code_block/{model.js → model.ts} +16 -5
- package/src/menus/figure/{model.js → model.ts} +21 -16
- package/src/menus/figure/utils.ts +13 -0
- package/src/menus/headerbar/{model.js → model.ts} +243 -153
- package/src/menus/headerbar/{view.js → view.ts} +189 -92
- package/src/menus/image/{model.js → model.ts} +13 -4
- package/src/menus/navigator/{model.js → model.ts} +6 -1
- package/src/menus/ordered_list/{model.js → model.ts} +2 -1
- package/src/menus/selection/{model.js → model.ts} +38 -20
- package/src/menus/selection/{view.js → view.ts} +88 -35
- package/src/menus/table/{model.js → model.ts} +84 -63
- package/src/menus/toolbar/{model.js → model.ts} +267 -215
- package/src/menus/toolbar/{view.js → view.ts} +135 -65
- package/src/modules.d.ts +84 -0
- package/src/navigator/{index.js → index.ts} +90 -56
- package/src/no_collab_save/{index.js → index.ts} +54 -31
- package/src/state_plugins/{access_rights.js → access_rights.ts} +12 -7
- package/src/state_plugins/citation_render.ts +63 -0
- package/src/state_plugins/{clipboard.js → clipboard.ts} +38 -23
- package/src/state_plugins/{code_block.js → code_block.ts} +62 -28
- package/src/state_plugins/{collab_carets.js → collab_carets.ts} +56 -25
- package/src/state_plugins/{comments.js → comments.ts} +70 -40
- package/src/state_plugins/contributor_input/{dropup.js → dropup.ts} +70 -38
- package/src/state_plugins/contributor_input/{node_view.js → node_view.ts} +13 -4
- package/src/state_plugins/contributor_input/{plugin.js → plugin.ts} +74 -75
- package/src/state_plugins/{document_template.js → document_template.ts} +108 -49
- package/src/state_plugins/{figure.js → figure.ts} +61 -23
- package/src/state_plugins/footnote_markers.ts +142 -0
- package/src/state_plugins/{headerbar.js → headerbar.ts} +4 -2
- package/src/state_plugins/{index.js → index.ts} +23 -56
- package/src/state_plugins/{inline_math.js → inline_math.ts} +151 -65
- package/src/state_plugins/inline_reference/{dropup.js → dropup.ts} +68 -34
- package/src/state_plugins/inline_reference/{plugin.js → plugin.ts} +221 -101
- package/src/state_plugins/jump_hidden_nodes.ts +67 -0
- package/src/state_plugins/{links.js → links.ts} +153 -99
- package/src/state_plugins/marginboxes.ts +17 -0
- package/src/state_plugins/{ordered_list_menu.js → ordered_list_menu.ts} +43 -17
- package/src/state_plugins/placeholders.ts +78 -0
- package/src/state_plugins/{search.js → search.ts} +110 -48
- package/src/state_plugins/{selection_menu.js → selection_menu.ts} +4 -2
- package/src/state_plugins/{settings.js → settings.ts} +68 -39
- package/src/state_plugins/table.ts +169 -0
- package/src/state_plugins/tag_input/{node_view.js → node_view.ts} +12 -3
- package/src/state_plugins/tag_input/plugin.ts +292 -0
- package/src/state_plugins/toc_render.ts +133 -0
- package/src/state_plugins/{toolbar.js → toolbar.ts} +4 -2
- package/src/state_plugins/track/{find_selected_changes.js → find_selected_changes.ts} +34 -19
- package/src/state_plugins/track/{helpers.js → helpers.ts} +36 -10
- package/src/state_plugins/track/{plugin.js → plugin.ts} +38 -14
- package/src/tools/key_bindings/{index.js → index.ts} +7 -3
- package/src/tools/key_bindings/{templates.js → templates.ts} +1 -1
- package/src/tools/search_replace/{index.js → index.ts} +115 -69
- package/src/tools/search_replace/{templates.js → templates.ts} +6 -1
- package/src/tools/word_count/{index.js → index.ts} +16 -6
- package/src/tools/word_count/{templates.js → templates.ts} +10 -1
- package/src/track/{accept.js → accept.ts} +20 -9
- package/src/track/{accept_all.js → accept_all.ts} +27 -17
- package/src/track/{accept_all_no_insertions.js → accept_all_no_insertions.ts} +16 -10
- package/src/track/{amend_transaction.js → amend_transaction.ts} +130 -70
- package/src/track/{delete.js → delete.ts} +15 -12
- package/src/track/{mod.js → mod.ts} +51 -32
- package/src/track/{reject.js → reject.ts} +34 -19
- package/src/track/{reject_all.js → reject_all.ts} +44 -24
- package/src/types.ts +214 -0
- package/src/comments/index.js +0 -11
- package/src/databases/index.js +0 -69
- package/src/document_template/exporter.js +0 -97
- package/src/exporter/native/copy.js +0 -191
- package/src/footnotes/index.js +0 -16
- package/src/menus/figure/utils.js +0 -5
- package/src/state_plugins/citation_render.js +0 -88
- package/src/state_plugins/footnote_markers.js +0 -238
- package/src/state_plugins/jump_hidden_nodes.js +0 -58
- package/src/state_plugins/marginboxes.js +0 -14
- package/src/state_plugins/placeholders.js +0 -123
- package/src/state_plugins/table.js +0 -127
- package/src/state_plugins/tag_input/plugin.js +0 -278
- package/src/state_plugins/toc_render.js +0 -160
- /package/src/clipboard/copy/{index.js → index.ts} +0 -0
- /package/src/clipboard/paste/{index.js → index.ts} +0 -0
- /package/src/collab/merge/state_plugins/{index.js → index.ts} +0 -0
- /package/src/comments/editors/{index.js → index.ts} +0 -0
- /package/src/dialogs/{index.js → index.ts} +0 -0
- /package/src/exporter/native/{index.js → index.ts} +0 -0
- /package/src/exporter/native/{zip.js → zip.ts} +0 -0
- /package/src/footnotes/state_plugins/{index.js → index.ts} +0 -0
- /package/src/menus/code_block/{index.js → index.ts} +0 -0
- /package/src/menus/figure/{index.js → index.ts} +0 -0
- /package/src/menus/headerbar/{index.js → index.ts} +0 -0
- /package/src/menus/image/{index.js → index.ts} +0 -0
- /package/src/menus/{index.js → index.ts} +0 -0
- /package/src/menus/navigator/{index.js → index.ts} +0 -0
- /package/src/menus/ordered_list/{index.js → index.ts} +0 -0
- /package/src/menus/selection/{index.js → index.ts} +0 -0
- /package/src/menus/table/{index.js → index.ts} +0 -0
- /package/src/menus/toolbar/{index.js → index.ts} +0 -0
- /package/src/plugins/citation_dialog/{index.js → index.ts} +0 -0
- /package/src/plugins/editor/{index.js → index.ts} +0 -0
- /package/src/state_plugins/contributor_input/{index.js → index.ts} +0 -0
- /package/src/state_plugins/inline_reference/{index.js → index.ts} +0 -0
- /package/src/state_plugins/tag_input/{index.js → index.ts} +0 -0
- /package/src/state_plugins/track/{index.js → index.ts} +0 -0
- /package/src/tools/{index.js → index.ts} +0 -0
- /package/src/track/{index.js → index.ts} +0 -0
|
@@ -1,22 +1,67 @@
|
|
|
1
1
|
import {SchemaExport} from "@fiduswriter/document/schema/export"
|
|
2
|
+
import type {BibDB, ImageDB} from "@fiduswriter/document"
|
|
2
3
|
import {Dialog, activateWait, deactivateWait, makeWorker} from "fwtoolkit"
|
|
3
|
-
import {receiveTransaction, sendableSteps} from "prosemirror-collab"
|
|
4
|
-
import {EditorState} from "prosemirror-state"
|
|
5
|
-
import {Step} from "prosemirror-transform"
|
|
6
4
|
import {E2EEEncryptor} from "fwtoolkit/e2ee/encryptor"
|
|
7
5
|
import {E2EEKeyManager} from "fwtoolkit/e2ee/key-manager"
|
|
8
6
|
import {enterPassphraseDialog} from "fwtoolkit/e2ee/passphrase-dialog"
|
|
9
7
|
import {PassphraseManager} from "fwtoolkit/e2ee/passphrase-manager"
|
|
10
8
|
import {enterPasswordDialog} from "fwtoolkit/e2ee/password-dialog"
|
|
9
|
+
import {receiveTransaction, sendableSteps} from "prosemirror-collab"
|
|
10
|
+
import type {Node} from "prosemirror-model"
|
|
11
|
+
import {EditorState} from "prosemirror-state"
|
|
12
|
+
import type {Transaction} from "prosemirror-state"
|
|
13
|
+
import {Step} from "prosemirror-transform"
|
|
14
|
+
|
|
11
15
|
import {
|
|
12
16
|
getSelectionUpdate,
|
|
13
17
|
removeCollaboratorSelection,
|
|
14
18
|
updateCollaboratorSelection
|
|
15
19
|
} from "../state_plugins/index.js"
|
|
16
20
|
import {Merge} from "./merge/index.js"
|
|
21
|
+
import type {ModCollab} from "./index.js"
|
|
22
|
+
|
|
23
|
+
interface IncomingDoc {
|
|
24
|
+
v: number
|
|
25
|
+
content: unknown
|
|
26
|
+
comments: unknown
|
|
27
|
+
bibliography: unknown
|
|
28
|
+
images?: Record<string, {copyright?: unknown}>
|
|
29
|
+
template?: {content: unknown}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface DiffData {
|
|
33
|
+
type?: string
|
|
34
|
+
v?: number
|
|
35
|
+
rid?: number
|
|
36
|
+
cid?: string | number
|
|
37
|
+
ds?: unknown[]
|
|
38
|
+
fs?: unknown[]
|
|
39
|
+
cu?: unknown[]
|
|
40
|
+
bu?: unknown[]
|
|
41
|
+
iu?: unknown[]
|
|
42
|
+
footnoterender?: boolean
|
|
43
|
+
reject_request_id?: number
|
|
44
|
+
ep?: string
|
|
45
|
+
e2ee_salt?: string
|
|
46
|
+
}
|
|
17
47
|
|
|
18
48
|
export class ModCollabDoc {
|
|
19
|
-
|
|
49
|
+
mod: ModCollab
|
|
50
|
+
merge: Merge
|
|
51
|
+
unconfirmedDiffs: Record<number, any>
|
|
52
|
+
confirmStepsRequestCounter: number
|
|
53
|
+
awaitingDiffResponse: boolean
|
|
54
|
+
receiving: boolean
|
|
55
|
+
currentlyCheckingVersion: boolean
|
|
56
|
+
enableCheckVersion?: number
|
|
57
|
+
footnoteRender: boolean
|
|
58
|
+
initialVersionConfirmed: boolean
|
|
59
|
+
initialDocLoaded: boolean
|
|
60
|
+
templateAdjustmentPending: boolean
|
|
61
|
+
sendNextDiffTimer?: number
|
|
62
|
+
lastSelectionUpdateState?: EditorState
|
|
63
|
+
|
|
64
|
+
constructor(mod: ModCollab) {
|
|
20
65
|
mod.doc = this
|
|
21
66
|
this.mod = mod
|
|
22
67
|
this.merge = new Merge(mod)
|
|
@@ -31,18 +76,19 @@ export class ModCollabDoc {
|
|
|
31
76
|
this.templateAdjustmentPending = false
|
|
32
77
|
}
|
|
33
78
|
|
|
34
|
-
cancelCurrentlyCheckingVersion() {
|
|
79
|
+
cancelCurrentlyCheckingVersion(): void {
|
|
35
80
|
this.currentlyCheckingVersion = false
|
|
36
81
|
window.clearTimeout(this.enableCheckVersion)
|
|
37
82
|
}
|
|
38
83
|
|
|
39
|
-
checkVersion(offline = false) {
|
|
84
|
+
checkVersion(offline = false): void {
|
|
40
85
|
// Guard: WebSocket may not be initialized yet (e.g. during
|
|
41
86
|
// loadDocument before the WS connector is created).
|
|
42
87
|
if (!this.mod.editor.ws) {
|
|
43
88
|
return
|
|
44
89
|
}
|
|
45
|
-
this.mod.editor.ws
|
|
90
|
+
const ws = this.mod.editor.ws
|
|
91
|
+
ws.send(() => {
|
|
46
92
|
if (
|
|
47
93
|
this.currentlyCheckingVersion ||
|
|
48
94
|
this.mod.editor.docInfo.version === undefined
|
|
@@ -53,11 +99,11 @@ export class ModCollabDoc {
|
|
|
53
99
|
this.enableCheckVersion = window.setTimeout(() => {
|
|
54
100
|
this.currentlyCheckingVersion = false
|
|
55
101
|
}, 1000)
|
|
56
|
-
if (
|
|
102
|
+
if (ws.connected) {
|
|
57
103
|
this.disableDiffSending()
|
|
58
104
|
}
|
|
59
105
|
|
|
60
|
-
const msg = {
|
|
106
|
+
const msg: Record<string, unknown> = {
|
|
61
107
|
type: "check_version",
|
|
62
108
|
v: this.mod.editor.docInfo.version
|
|
63
109
|
}
|
|
@@ -68,7 +114,7 @@ export class ModCollabDoc {
|
|
|
68
114
|
})
|
|
69
115
|
}
|
|
70
116
|
|
|
71
|
-
disableDiffSending() {
|
|
117
|
+
disableDiffSending(): void {
|
|
72
118
|
this.awaitingDiffResponse = true
|
|
73
119
|
// If no answer has been received from the server within 2 seconds,
|
|
74
120
|
// check the version
|
|
@@ -78,25 +124,25 @@ export class ModCollabDoc {
|
|
|
78
124
|
}, 8000)
|
|
79
125
|
}
|
|
80
126
|
|
|
81
|
-
enableDiffSending() {
|
|
127
|
+
enableDiffSending(): void {
|
|
82
128
|
window.clearTimeout(this.sendNextDiffTimer)
|
|
83
129
|
this.awaitingDiffResponse = false
|
|
84
130
|
this.sendToCollaborators()
|
|
85
131
|
}
|
|
86
132
|
|
|
87
|
-
receiveDocument(data) {
|
|
133
|
+
receiveDocument(data: {doc: IncomingDoc}): void {
|
|
88
134
|
this.cancelCurrentlyCheckingVersion()
|
|
89
135
|
if (
|
|
90
136
|
this.mod.editor.docInfo.confirmedDoc &&
|
|
91
137
|
!this.mod.editor.e2ee?.encrypted
|
|
92
138
|
) {
|
|
93
|
-
this.merge.adjustDocument(data)
|
|
139
|
+
this.merge.adjustDocument(data as any)
|
|
94
140
|
} else {
|
|
95
|
-
this.loadDocument(data)
|
|
141
|
+
this.loadDocument(data as any)
|
|
96
142
|
}
|
|
97
143
|
}
|
|
98
144
|
|
|
99
|
-
finishInitialLoad() {
|
|
145
|
+
finishInitialLoad(): void {
|
|
100
146
|
if (
|
|
101
147
|
this.initialDocLoaded &&
|
|
102
148
|
this.initialVersionConfirmed &&
|
|
@@ -107,7 +153,7 @@ export class ModCollabDoc {
|
|
|
107
153
|
}
|
|
108
154
|
}
|
|
109
155
|
|
|
110
|
-
confirmVersion(version) {
|
|
156
|
+
confirmVersion(version: number): void {
|
|
111
157
|
if (!this.mod.editor.docInfo.confirmedDoc) {
|
|
112
158
|
return
|
|
113
159
|
}
|
|
@@ -119,7 +165,11 @@ export class ModCollabDoc {
|
|
|
119
165
|
}
|
|
120
166
|
}
|
|
121
167
|
|
|
122
|
-
loadDocument(
|
|
168
|
+
loadDocument(data: {
|
|
169
|
+
doc: IncomingDoc
|
|
170
|
+
time: number
|
|
171
|
+
doc_info: Record<string, any>
|
|
172
|
+
}): void {
|
|
123
173
|
const isInitialLoad = !this.mod.editor.docInfo.confirmedDoc
|
|
124
174
|
// Reset collaboration
|
|
125
175
|
this.unconfirmedDiffs = {}
|
|
@@ -127,10 +177,10 @@ export class ModCollabDoc {
|
|
|
127
177
|
this.enableDiffSending()
|
|
128
178
|
}
|
|
129
179
|
|
|
130
|
-
this.mod.editor.clientTimeAdjustment = Date.now() - time
|
|
180
|
+
this.mod.editor.clientTimeAdjustment = Date.now() - data.time
|
|
131
181
|
|
|
132
182
|
const token = this.mod.editor.docInfo.token
|
|
133
|
-
this.mod.editor.docInfo = doc_info
|
|
183
|
+
this.mod.editor.docInfo = data.doc_info as any
|
|
134
184
|
this.mod.editor.docInfo.token = token
|
|
135
185
|
// For guests, update user object with the token UUID (stable identity)
|
|
136
186
|
// and session_id (for display). Token UUID persists across reconnections.
|
|
@@ -138,28 +188,28 @@ export class ModCollabDoc {
|
|
|
138
188
|
// the session_info WebSocket message). Only update if available.
|
|
139
189
|
if (
|
|
140
190
|
!this.mod.editor.user.is_authenticated &&
|
|
141
|
-
doc_info.session_id !== undefined
|
|
191
|
+
data.doc_info.session_id !== undefined
|
|
142
192
|
) {
|
|
143
|
-
const sessionId = doc_info.session_id
|
|
193
|
+
const sessionId = data.doc_info.session_id as string
|
|
144
194
|
this.mod.editor.user = {
|
|
145
|
-
id: token, // stable — same token UUID even after reconnect
|
|
195
|
+
id: token as unknown as number, // stable — same token UUID even after reconnect
|
|
146
196
|
username: `guest${sessionId}`, // display name per session
|
|
147
197
|
name: `Guest ${sessionId}`,
|
|
148
198
|
is_authenticated: false
|
|
149
|
-
}
|
|
199
|
+
} as any
|
|
150
200
|
}
|
|
151
201
|
this.mod.editor.docInfo.token = token
|
|
152
|
-
this.mod.editor.docInfo.version = doc.v
|
|
202
|
+
this.mod.editor.docInfo.version = data.doc.v
|
|
153
203
|
this.mod.editor.docInfo.updated = new Date()
|
|
154
204
|
|
|
155
205
|
// Check if this is an E2EE document. If so, we need to decrypt
|
|
156
206
|
// the content before loading it into ProseMirror.
|
|
157
|
-
const isE2EE = doc_info.e2ee === true
|
|
207
|
+
const isE2EE = data.doc_info.e2ee === true
|
|
158
208
|
if (isE2EE) {
|
|
159
|
-
this._loadE2EEDocument(doc, doc_info, isInitialLoad)
|
|
209
|
+
this._loadE2EEDocument(data.doc, data.doc_info, isInitialLoad)
|
|
160
210
|
} else {
|
|
161
211
|
this.mod.editor.e2ee = {encrypted: false}
|
|
162
|
-
this._loadUnencryptedDocument(doc, isInitialLoad)
|
|
212
|
+
this._loadUnencryptedDocument(data.doc, isInitialLoad)
|
|
163
213
|
}
|
|
164
214
|
}
|
|
165
215
|
|
|
@@ -168,12 +218,16 @@ export class ModCollabDoc {
|
|
|
168
218
|
* per-document password prompt, decrypt, then load.
|
|
169
219
|
* @private
|
|
170
220
|
*/
|
|
171
|
-
async _loadE2EEDocument(
|
|
221
|
+
async _loadE2EEDocument(
|
|
222
|
+
doc: IncomingDoc,
|
|
223
|
+
doc_info: Record<string, any>,
|
|
224
|
+
isInitialLoad: boolean,
|
|
225
|
+
urlFragmentPassword = ""
|
|
226
|
+
): Promise<void> {
|
|
172
227
|
// Extract password from URL fragment if present (share link format:
|
|
173
228
|
// https://example.com/share/TOKEN/#target?password=PASSWORD). The fragment is never
|
|
174
229
|
// sent to the server, so this is safe.
|
|
175
230
|
const locationHash = window.location.hash
|
|
176
|
-
let urlFragmentPassword = ""
|
|
177
231
|
if (locationHash && locationHash.includes("?")) {
|
|
178
232
|
urlFragmentPassword = decodeURIComponent(
|
|
179
233
|
new URLSearchParams(locationHash.split("?")[1]).get(
|
|
@@ -185,7 +239,7 @@ export class ModCollabDoc {
|
|
|
185
239
|
// Get the salt and iterations. These may come from the REST response
|
|
186
240
|
// (doc_info) or from the WebSocket session_info message (already
|
|
187
241
|
// stored in this.mod.editor.e2ee).
|
|
188
|
-
let salt, iterations
|
|
242
|
+
let salt: string | undefined, iterations: number | undefined
|
|
189
243
|
if (this.mod.editor.e2ee) {
|
|
190
244
|
salt = this.mod.editor.e2ee.encryptionSalt
|
|
191
245
|
iterations = this.mod.editor.e2ee.encryptionIterations
|
|
@@ -197,11 +251,11 @@ export class ModCollabDoc {
|
|
|
197
251
|
iterations = doc_info.e2ee_iterations
|
|
198
252
|
}
|
|
199
253
|
|
|
200
|
-
const docId = this.mod.editor.docInfo.id
|
|
254
|
+
const docId = this.mod.editor.docInfo.id as number as number
|
|
201
255
|
|
|
202
256
|
// Helper to save password for passphrase users after successful decryption
|
|
203
257
|
// (migrates per-document-password docs into the passphrase system)
|
|
204
|
-
const maybeSavePasswordForPassphrase = async password => {
|
|
258
|
+
const maybeSavePasswordForPassphrase = async (password: string) => {
|
|
205
259
|
if (!PassphraseManager.hasKeysInSession()) {
|
|
206
260
|
return
|
|
207
261
|
}
|
|
@@ -212,7 +266,7 @@ export class ModCollabDoc {
|
|
|
212
266
|
await PassphraseManager.saveDocumentPassword(
|
|
213
267
|
docId,
|
|
214
268
|
password,
|
|
215
|
-
null,
|
|
269
|
+
null as any,
|
|
216
270
|
"user",
|
|
217
271
|
true
|
|
218
272
|
)
|
|
@@ -226,7 +280,7 @@ export class ModCollabDoc {
|
|
|
226
280
|
}
|
|
227
281
|
|
|
228
282
|
// Helper to resolve a password to a key and attempt decryption
|
|
229
|
-
const tryPassword = async password => {
|
|
283
|
+
const tryPassword = async (password: string) => {
|
|
230
284
|
const key = await E2EEKeyManager.resolvePasswordToKey(
|
|
231
285
|
password,
|
|
232
286
|
salt
|
|
@@ -235,7 +289,7 @@ export class ModCollabDoc {
|
|
|
235
289
|
.split("")
|
|
236
290
|
.map(c => c.charCodeAt(0))
|
|
237
291
|
)
|
|
238
|
-
: null,
|
|
292
|
+
: (null as any),
|
|
239
293
|
iterations || 600000
|
|
240
294
|
)
|
|
241
295
|
await this._decryptAndLoadDoc(
|
|
@@ -280,9 +334,13 @@ export class ModCollabDoc {
|
|
|
280
334
|
let errorMessage = ""
|
|
281
335
|
let unlocked = false
|
|
282
336
|
while (!unlocked) {
|
|
283
|
-
const result = await new Promise
|
|
337
|
+
const result = await new Promise<{
|
|
338
|
+
action: string
|
|
339
|
+
passphrase?: string
|
|
340
|
+
}>(resolve => {
|
|
284
341
|
enterPassphraseDialog(
|
|
285
|
-
pwd
|
|
342
|
+
(pwd: string) =>
|
|
343
|
+
resolve({action: "unlock", passphrase: pwd}),
|
|
286
344
|
() => resolve({action: "recover"}),
|
|
287
345
|
{errorMessage}
|
|
288
346
|
)
|
|
@@ -314,20 +372,23 @@ export class ModCollabDoc {
|
|
|
314
372
|
const {recoverWithKeyDialog} = await import(
|
|
315
373
|
"fwtoolkit/e2ee/passphrase-dialog"
|
|
316
374
|
)
|
|
317
|
-
const recoverResult = await new Promise
|
|
375
|
+
const recoverResult = await new Promise<{
|
|
376
|
+
recoveryKey: string
|
|
377
|
+
newPassphrase: string
|
|
378
|
+
} | null>(resolve => {
|
|
318
379
|
recoverWithKeyDialog(resolve)
|
|
319
380
|
})
|
|
320
381
|
if (recoverResult) {
|
|
321
382
|
try {
|
|
322
383
|
const {newRecoveryKey} =
|
|
323
|
-
await PassphraseManager.recoverWithRecoveryKey(
|
|
384
|
+
(await PassphraseManager.recoverWithRecoveryKey(
|
|
324
385
|
recoverResult.recoveryKey,
|
|
325
386
|
recoverResult.newPassphrase
|
|
326
|
-
)
|
|
387
|
+
)) as {newRecoveryKey: string}
|
|
327
388
|
const {showRecoveryKeyDialog} = await import(
|
|
328
389
|
"fwtoolkit/e2ee/passphrase-dialog"
|
|
329
390
|
)
|
|
330
|
-
await new Promise(resolve => {
|
|
391
|
+
await new Promise<void>(resolve => {
|
|
331
392
|
showRecoveryKeyDialog(
|
|
332
393
|
newRecoveryKey,
|
|
333
394
|
resolve
|
|
@@ -431,7 +492,7 @@ export class ModCollabDoc {
|
|
|
431
492
|
error
|
|
432
493
|
)
|
|
433
494
|
if (this.mod.editor.e2ee) {
|
|
434
|
-
this.mod.editor.e2ee.key = null
|
|
495
|
+
this.mod.editor.e2ee.key = null as any
|
|
435
496
|
}
|
|
436
497
|
await this._promptPasswordAndDecrypt(
|
|
437
498
|
doc,
|
|
@@ -461,15 +522,15 @@ export class ModCollabDoc {
|
|
|
461
522
|
* @private
|
|
462
523
|
*/
|
|
463
524
|
async _promptPasswordAndDecrypt(
|
|
464
|
-
doc,
|
|
465
|
-
doc_info,
|
|
466
|
-
salt,
|
|
467
|
-
iterations,
|
|
468
|
-
isInitialLoad,
|
|
469
|
-
urlFragmentPassword
|
|
470
|
-
) {
|
|
525
|
+
doc: IncomingDoc,
|
|
526
|
+
doc_info: Record<string, any>,
|
|
527
|
+
salt: string | undefined,
|
|
528
|
+
iterations: number | undefined,
|
|
529
|
+
isInitialLoad: boolean,
|
|
530
|
+
urlFragmentPassword = ""
|
|
531
|
+
): Promise<void> {
|
|
471
532
|
// Decode the salt from Base64 to Uint8Array
|
|
472
|
-
let saltBytes = null
|
|
533
|
+
let saltBytes: Uint8Array | null = null
|
|
473
534
|
if (salt) {
|
|
474
535
|
const binary = atob(salt)
|
|
475
536
|
saltBytes = new Uint8Array(binary.length)
|
|
@@ -495,11 +556,11 @@ export class ModCollabDoc {
|
|
|
495
556
|
}
|
|
496
557
|
|
|
497
558
|
await enterPasswordDialog(
|
|
498
|
-
async password => {
|
|
559
|
+
async (password: string) => {
|
|
499
560
|
try {
|
|
500
561
|
const key = await E2EEKeyManager.resolvePasswordToKey(
|
|
501
562
|
password,
|
|
502
|
-
saltBytes,
|
|
563
|
+
saltBytes as any,
|
|
503
564
|
iterations || 600000
|
|
504
565
|
)
|
|
505
566
|
await this._decryptAndLoadDoc(
|
|
@@ -512,11 +573,11 @@ export class ModCollabDoc {
|
|
|
512
573
|
)
|
|
513
574
|
// Cache password and key for this session
|
|
514
575
|
E2EEKeyManager.storePasswordInSession(
|
|
515
|
-
this.mod.editor.docInfo.id,
|
|
576
|
+
this.mod.editor.docInfo.id as number,
|
|
516
577
|
password
|
|
517
578
|
)
|
|
518
579
|
await E2EEKeyManager.storeKeyInSession(
|
|
519
|
-
this.mod.editor.docInfo.id,
|
|
580
|
+
this.mod.editor.docInfo.id as number,
|
|
520
581
|
key
|
|
521
582
|
)
|
|
522
583
|
if (this.mod.editor.e2ee) {
|
|
@@ -528,13 +589,13 @@ export class ModCollabDoc {
|
|
|
528
589
|
try {
|
|
529
590
|
const existing =
|
|
530
591
|
await PassphraseManager.getDocumentPassword(
|
|
531
|
-
this.mod.editor.docInfo.id
|
|
592
|
+
this.mod.editor.docInfo.id as number
|
|
532
593
|
)
|
|
533
594
|
if (!existing) {
|
|
534
595
|
await PassphraseManager.saveDocumentPassword(
|
|
535
|
-
this.mod.editor.docInfo.id,
|
|
596
|
+
this.mod.editor.docInfo.id as number,
|
|
536
597
|
password,
|
|
537
|
-
null,
|
|
598
|
+
null as any,
|
|
538
599
|
"user",
|
|
539
600
|
true
|
|
540
601
|
)
|
|
@@ -584,7 +645,7 @@ export class ModCollabDoc {
|
|
|
584
645
|
}
|
|
585
646
|
},
|
|
586
647
|
urlFragmentPassword,
|
|
587
|
-
goBack
|
|
648
|
+
goBack as any
|
|
588
649
|
)
|
|
589
650
|
}
|
|
590
651
|
|
|
@@ -601,13 +662,13 @@ export class ModCollabDoc {
|
|
|
601
662
|
* @private
|
|
602
663
|
*/
|
|
603
664
|
async _decryptAndLoadDoc(
|
|
604
|
-
doc,
|
|
605
|
-
key,
|
|
606
|
-
salt,
|
|
607
|
-
iterations,
|
|
608
|
-
isInitialLoad,
|
|
609
|
-
urlFragmentPassword
|
|
610
|
-
) {
|
|
665
|
+
doc: IncomingDoc,
|
|
666
|
+
key: CryptoKey,
|
|
667
|
+
salt: string | undefined,
|
|
668
|
+
iterations: number | undefined,
|
|
669
|
+
isInitialLoad: boolean,
|
|
670
|
+
urlFragmentPassword: string
|
|
671
|
+
): Promise<void> {
|
|
611
672
|
let decryptedContent = doc.content
|
|
612
673
|
if (typeof doc.content === "string") {
|
|
613
674
|
decryptedContent = await E2EEEncryptor.decryptObject(
|
|
@@ -649,13 +710,13 @@ export class ModCollabDoc {
|
|
|
649
710
|
this.mod.editor
|
|
650
711
|
)
|
|
651
712
|
}
|
|
652
|
-
this.mod.editor.e2ee.snapshotManager.setKey(key)
|
|
713
|
+
;(this.mod.editor.e2ee.snapshotManager as any).setKey(key)
|
|
653
714
|
|
|
654
715
|
// Cache the key in sessionStorage so the user doesn't have to
|
|
655
716
|
// re-enter the password when reopening the document this session.
|
|
656
717
|
try {
|
|
657
718
|
await E2EEKeyManager.storeKeyInSession(
|
|
658
|
-
this.mod.editor.docInfo.id,
|
|
719
|
+
this.mod.editor.docInfo.id as number,
|
|
659
720
|
key
|
|
660
721
|
)
|
|
661
722
|
} catch (_e) {
|
|
@@ -687,14 +748,15 @@ export class ModCollabDoc {
|
|
|
687
748
|
decryptedImages = {}
|
|
688
749
|
const {E2EEEncryptor} = await import("fwtoolkit/e2ee/encryptor")
|
|
689
750
|
for (const [id, image] of Object.entries(doc.images)) {
|
|
690
|
-
decryptedImages[id] = image
|
|
751
|
+
;(decryptedImages as Record<string, any>)[id] = image
|
|
691
752
|
if (typeof image.copyright === "string") {
|
|
692
753
|
try {
|
|
693
|
-
decryptedImages[
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
754
|
+
;(decryptedImages as Record<string, any>)[
|
|
755
|
+
id
|
|
756
|
+
].copyright = await E2EEEncryptor.decryptObject(
|
|
757
|
+
image.copyright,
|
|
758
|
+
key
|
|
759
|
+
)
|
|
698
760
|
} catch (_e) {
|
|
699
761
|
// If decryption fails, leave as-is (legacy plaintext)
|
|
700
762
|
}
|
|
@@ -710,18 +772,18 @@ export class ModCollabDoc {
|
|
|
710
772
|
bibliography: decryptedBibliography,
|
|
711
773
|
images: decryptedImages
|
|
712
774
|
}
|
|
713
|
-
this._loadUnencryptedDocument(decryptedDoc, isInitialLoad)
|
|
775
|
+
this._loadUnencryptedDocument(decryptedDoc as IncomingDoc, isInitialLoad)
|
|
714
776
|
|
|
715
777
|
// Cache the decrypted title in sessionStorage so the document overview
|
|
716
778
|
// can display the real title without prompting for the password again.
|
|
717
779
|
let title = ""
|
|
718
|
-
this.mod.editor.view.state.doc.firstChild
|
|
780
|
+
this.mod.editor.view.state.doc.firstChild?.forEach(child => {
|
|
719
781
|
if (!child.marks.find(mark => mark.type.name === "deletion")) {
|
|
720
782
|
title += child.textContent
|
|
721
783
|
}
|
|
722
784
|
})
|
|
723
785
|
sessionStorage.setItem(
|
|
724
|
-
`e2ee_title_${this.mod.editor.docInfo.id}`,
|
|
786
|
+
`e2ee_title_${this.mod.editor.docInfo.id as number}`,
|
|
725
787
|
title
|
|
726
788
|
)
|
|
727
789
|
|
|
@@ -733,7 +795,7 @@ export class ModCollabDoc {
|
|
|
733
795
|
const isNewE2EEDocument =
|
|
734
796
|
isInitialLoad && typeof doc.content !== "string"
|
|
735
797
|
if (isNewE2EEDocument && this.mod.editor.e2ee.snapshotManager) {
|
|
736
|
-
this.mod.editor.e2ee.snapshotManager.sendInitialSnapshot(
|
|
798
|
+
;(this.mod.editor.e2ee.snapshotManager as any).sendInitialSnapshot(
|
|
737
799
|
decryptedContent,
|
|
738
800
|
decryptedComments,
|
|
739
801
|
decryptedBibliography,
|
|
@@ -749,7 +811,7 @@ export class ModCollabDoc {
|
|
|
749
811
|
} else if (!this.mod.editor.ws) {
|
|
750
812
|
// Non-collaborative mode: mark version as confirmed so the editor
|
|
751
813
|
// finishes loading and periodic saves can begin.
|
|
752
|
-
this.mod.editor.mod.collab.doc.confirmVersion(
|
|
814
|
+
;(this.mod.editor.mod.collab as any).doc.confirmVersion(
|
|
753
815
|
this.mod.editor.docInfo.version
|
|
754
816
|
)
|
|
755
817
|
}
|
|
@@ -760,17 +822,19 @@ export class ModCollabDoc {
|
|
|
760
822
|
* This is the original loadDocument logic, extracted for reuse.
|
|
761
823
|
* @private
|
|
762
824
|
*/
|
|
763
|
-
_loadUnencryptedDocument(doc, isInitialLoad) {
|
|
825
|
+
_loadUnencryptedDocument(doc: IncomingDoc, isInitialLoad: boolean): void {
|
|
764
826
|
// Remember location hash to scroll there subsequently.
|
|
765
827
|
const [locationHash, _queryString] = window.location.hash.split("?")
|
|
766
|
-
this.mod.editor.mod.db
|
|
767
|
-
this.mod.editor.mod.db
|
|
768
|
-
const stateDoc = this.mod.editor.schema.nodeFromJSON(
|
|
828
|
+
this.mod.editor.mod.db!.bibDB.setDB(doc.bibliography as unknown as BibDB)
|
|
829
|
+
this.mod.editor.mod.db!.imageDB.setDB(doc.images as unknown as ImageDB)
|
|
830
|
+
const stateDoc = this.mod.editor.schema.nodeFromJSON(
|
|
831
|
+
doc.content as Record<string, unknown>
|
|
832
|
+
)
|
|
769
833
|
const plugins = this.mod.editor.statePlugins.map(plugin => {
|
|
770
834
|
if (plugin[1]) {
|
|
771
|
-
return plugin[0](plugin[1](
|
|
835
|
+
return (plugin[0] as (...args: any[]) => any)(plugin[1]())
|
|
772
836
|
} else {
|
|
773
|
-
return plugin[0]()
|
|
837
|
+
return (plugin[0] as (...args: any[]) => any)()
|
|
774
838
|
}
|
|
775
839
|
})
|
|
776
840
|
|
|
@@ -781,18 +845,20 @@ export class ModCollabDoc {
|
|
|
781
845
|
}
|
|
782
846
|
|
|
783
847
|
// Set document in prosemirror
|
|
784
|
-
this.mod.editor.view.setProps({
|
|
848
|
+
this.mod.editor.view.setProps({
|
|
849
|
+
state: EditorState.create(stateConfig)
|
|
850
|
+
})
|
|
785
851
|
this.mod.editor.view.setProps({nodeViews: {}}) // Needed to initialize nodeViews in plugins
|
|
786
852
|
// Set initial confirmed doc
|
|
787
853
|
this.mod.editor.docInfo.confirmedDoc = this.mod.editor.view.state.doc
|
|
788
854
|
|
|
789
855
|
// Render footnotes based on main doc
|
|
790
|
-
this.mod.editor.mod.footnotes.fnEditor.renderAllFootnotes()
|
|
856
|
+
;(this.mod.editor.mod.footnotes as any).fnEditor.renderAllFootnotes()
|
|
791
857
|
|
|
792
858
|
// Setup comment handling
|
|
793
|
-
this.mod.editor.mod.comments.store.reset()
|
|
794
|
-
this.mod.editor.mod.comments.store.loadComments(doc.comments)
|
|
795
|
-
this.mod.editor.mod.marginboxes.view(this.mod.editor.view)
|
|
859
|
+
;(this.mod.editor.mod.comments as any).store.reset()
|
|
860
|
+
;(this.mod.editor.mod.comments as any).store.loadComments(doc.comments)
|
|
861
|
+
;(this.mod.editor.mod.marginboxes as any).view(this.mod.editor.view)
|
|
796
862
|
if (locationHash && locationHash.length) {
|
|
797
863
|
this.mod.editor.scrollIdIntoView(locationHash.slice(1))
|
|
798
864
|
}
|
|
@@ -801,7 +867,9 @@ export class ModCollabDoc {
|
|
|
801
867
|
// runs before loadDocument(), so the header still shows "Untitled"
|
|
802
868
|
// from the empty initial document.
|
|
803
869
|
if (this.mod.editor.menu.headerView) {
|
|
804
|
-
|
|
870
|
+
;(
|
|
871
|
+
this.mod.editor.menu.headerView as {update: () => void}
|
|
872
|
+
).update()
|
|
805
873
|
}
|
|
806
874
|
if (isInitialLoad) {
|
|
807
875
|
this.initialDocLoaded = true
|
|
@@ -829,11 +897,11 @@ export class ModCollabDoc {
|
|
|
829
897
|
const adjustWorker = makeWorker(
|
|
830
898
|
staticUrl("js/adjust_doc_to_template_worker.js")
|
|
831
899
|
)
|
|
832
|
-
adjustWorker.onmessage = message => {
|
|
900
|
+
adjustWorker.onmessage = (message: MessageEvent) => {
|
|
833
901
|
if (message.data.type === "result") {
|
|
834
902
|
if (message.data.steps.length) {
|
|
835
903
|
const tr = this.mod.editor.view.state.tr
|
|
836
|
-
message.data.steps.forEach(step =>
|
|
904
|
+
message.data.steps.forEach((step: unknown) =>
|
|
837
905
|
tr.step(Step.fromJSON(this.mod.editor.schema, step))
|
|
838
906
|
)
|
|
839
907
|
tr.setMeta("remote", true)
|
|
@@ -850,16 +918,15 @@ export class ModCollabDoc {
|
|
|
850
918
|
this.setDocSettings()
|
|
851
919
|
}
|
|
852
920
|
}
|
|
853
|
-
adjustWorker.onerror = error => console.error(error)
|
|
921
|
+
adjustWorker.onerror = (error: ErrorEvent) => console.error(error)
|
|
854
922
|
const schemaExporter = new SchemaExport()
|
|
855
923
|
adjustWorker.postMessage({
|
|
856
924
|
schemaSpec: JSON.parse(schemaExporter.init()),
|
|
857
925
|
doc: doc.content,
|
|
858
926
|
template: doc.template.content,
|
|
859
|
-
documentStyleSlugs:
|
|
860
|
-
this.mod.editor.mod.documentTemplate
|
|
861
|
-
|
|
862
|
-
)
|
|
927
|
+
documentStyleSlugs: (
|
|
928
|
+
this.mod.editor.mod.documentTemplate as any
|
|
929
|
+
).documentStyles.map((style: {slug: string}) => style.slug)
|
|
863
930
|
})
|
|
864
931
|
} else {
|
|
865
932
|
this.setDocSettings()
|
|
@@ -869,13 +936,13 @@ export class ModCollabDoc {
|
|
|
869
936
|
}
|
|
870
937
|
}
|
|
871
938
|
|
|
872
|
-
setDocSettings() {
|
|
939
|
+
setDocSettings(): void {
|
|
873
940
|
// Set part specific settings
|
|
874
|
-
this.mod.editor.mod.documentTemplate.addDocPartSettings()
|
|
875
|
-
this.mod.editor.mod.documentTemplate.addCitationStylesMenuEntries()
|
|
941
|
+
;(this.mod.editor.mod.documentTemplate as any).addDocPartSettings()
|
|
942
|
+
;(this.mod.editor.mod.documentTemplate as any).addCitationStylesMenuEntries()
|
|
876
943
|
}
|
|
877
944
|
|
|
878
|
-
sendToCollaborators() {
|
|
945
|
+
sendToCollaborators(): void {
|
|
879
946
|
// Guard: WebSocket may not be initialized yet (e.g. during
|
|
880
947
|
// loadDocument before the WS connector is created).
|
|
881
948
|
if (!this.mod.editor.ws) {
|
|
@@ -905,20 +972,26 @@ export class ModCollabDoc {
|
|
|
905
972
|
return false
|
|
906
973
|
} else if (
|
|
907
974
|
sendableSteps(this.mod.editor.view.state) ||
|
|
908
|
-
this.mod.editor.mod.comments.store
|
|
909
|
-
|
|
910
|
-
|
|
975
|
+
(this.mod.editor.mod.comments as any).store
|
|
976
|
+
.unsentEvents()
|
|
977
|
+
.length ||
|
|
978
|
+
(this.mod.editor.mod.db!.bibDB as any).unsentEvents().length ||
|
|
979
|
+
(this.mod.editor.mod.db!.imageDB as any).unsentEvents().length
|
|
911
980
|
) {
|
|
912
981
|
this.disableDiffSending()
|
|
913
982
|
const stepsToSend = sendableSteps(this.mod.editor.view.state),
|
|
914
983
|
fnStepsToSend = sendableSteps(
|
|
915
|
-
this.mod.editor.mod.footnotes.fnEditor.view
|
|
984
|
+
(this.mod.editor.mod.footnotes as any).fnEditor.view
|
|
985
|
+
.state
|
|
916
986
|
),
|
|
917
|
-
commentUpdates =
|
|
918
|
-
|
|
919
|
-
bibliographyUpdates =
|
|
920
|
-
this.mod.editor.mod.db
|
|
921
|
-
|
|
987
|
+
commentUpdates = (this.mod.editor.mod.comments as any).store
|
|
988
|
+
.unsentEvents(),
|
|
989
|
+
bibliographyUpdates = (
|
|
990
|
+
this.mod.editor.mod.db!.bibDB as any
|
|
991
|
+
).unsentEvents(),
|
|
992
|
+
imageUpdates = (
|
|
993
|
+
this.mod.editor.mod.db!.imageDB as any
|
|
994
|
+
).unsentEvents()
|
|
922
995
|
|
|
923
996
|
if (
|
|
924
997
|
!stepsToSend &&
|
|
@@ -931,7 +1004,7 @@ export class ModCollabDoc {
|
|
|
931
1004
|
return
|
|
932
1005
|
}
|
|
933
1006
|
const rid = this.confirmStepsRequestCounter++,
|
|
934
|
-
unconfirmedDiff = {
|
|
1007
|
+
unconfirmedDiff: Record<string, any> = {
|
|
935
1008
|
type: "diff",
|
|
936
1009
|
v: this.mod.editor.docInfo.version,
|
|
937
1010
|
rid
|
|
@@ -947,28 +1020,30 @@ export class ModCollabDoc {
|
|
|
947
1020
|
// update the title field instantly - important for the
|
|
948
1021
|
// document overview page.
|
|
949
1022
|
let newTitle = ""
|
|
950
|
-
this.mod.editor.view.state.doc.firstChild
|
|
951
|
-
if (
|
|
952
|
-
!child.marks.find(
|
|
953
|
-
mark => mark.type.name === "deletion"
|
|
954
|
-
)
|
|
955
|
-
) {
|
|
956
|
-
newTitle += child.textContent
|
|
957
|
-
}
|
|
958
|
-
})
|
|
959
|
-
newTitle = newTitle.slice(0, 255)
|
|
960
|
-
let oldTitle = ""
|
|
961
|
-
this.mod.editor.docInfo.confirmedDoc.firstChild.forEach(
|
|
1023
|
+
this.mod.editor.view.state.doc.firstChild?.forEach(
|
|
962
1024
|
child => {
|
|
963
1025
|
if (
|
|
964
1026
|
!child.marks.find(
|
|
965
1027
|
mark => mark.type.name === "deletion"
|
|
966
1028
|
)
|
|
967
1029
|
) {
|
|
968
|
-
|
|
1030
|
+
newTitle += child.textContent
|
|
969
1031
|
}
|
|
970
1032
|
}
|
|
971
1033
|
)
|
|
1034
|
+
newTitle = newTitle.slice(0, 255)
|
|
1035
|
+
let oldTitle = ""
|
|
1036
|
+
;(
|
|
1037
|
+
this.mod.editor.docInfo.confirmedDoc as Node
|
|
1038
|
+
).firstChild?.forEach(child => {
|
|
1039
|
+
if (
|
|
1040
|
+
!child.marks.find(
|
|
1041
|
+
mark => mark.type.name === "deletion"
|
|
1042
|
+
)
|
|
1043
|
+
) {
|
|
1044
|
+
oldTitle += child.textContent
|
|
1045
|
+
}
|
|
1046
|
+
})
|
|
972
1047
|
oldTitle = oldTitle.slice(0, 255)
|
|
973
1048
|
if (newTitle !== oldTitle) {
|
|
974
1049
|
unconfirmedDiff["ti"] = newTitle
|
|
@@ -1012,7 +1087,9 @@ export class ModCollabDoc {
|
|
|
1012
1087
|
}
|
|
1013
1088
|
this.lastSelectionUpdateState = currentView.state
|
|
1014
1089
|
// Create a new caret as the current user
|
|
1015
|
-
const selectionUpdate = getSelectionUpdate(
|
|
1090
|
+
const selectionUpdate = getSelectionUpdate(
|
|
1091
|
+
currentView.state
|
|
1092
|
+
) as {anchor: number; head: number}
|
|
1016
1093
|
return {
|
|
1017
1094
|
type: "selection_change",
|
|
1018
1095
|
id: this.mod.editor.user.id,
|
|
@@ -1045,7 +1122,7 @@ export class ModCollabDoc {
|
|
|
1045
1122
|
*
|
|
1046
1123
|
* @private
|
|
1047
1124
|
*/
|
|
1048
|
-
async _sendE2EEDiff() {
|
|
1125
|
+
async _sendE2EEDiff(): Promise<void> {
|
|
1049
1126
|
// Check if there's anything to send
|
|
1050
1127
|
if (
|
|
1051
1128
|
this.awaitingDiffResponse ||
|
|
@@ -1063,9 +1140,9 @@ export class ModCollabDoc {
|
|
|
1063
1140
|
|
|
1064
1141
|
if (
|
|
1065
1142
|
!sendableSteps(this.mod.editor.view.state) &&
|
|
1066
|
-
!this.mod.editor.mod.comments.store.unsentEvents().length &&
|
|
1067
|
-
!this.mod.editor.mod.db
|
|
1068
|
-
!this.mod.editor.mod.db
|
|
1143
|
+
!(this.mod.editor.mod.comments as any).store.unsentEvents().length &&
|
|
1144
|
+
!(this.mod.editor.mod.db!.bibDB as any).unsentEvents().length &&
|
|
1145
|
+
!(this.mod.editor.mod.db!.imageDB as any).unsentEvents().length
|
|
1069
1146
|
) {
|
|
1070
1147
|
// No diff, check for selection update
|
|
1071
1148
|
if (this.mod.editor.view) {
|
|
@@ -1078,11 +1155,14 @@ export class ModCollabDoc {
|
|
|
1078
1155
|
|
|
1079
1156
|
const stepsToSend = sendableSteps(this.mod.editor.view.state),
|
|
1080
1157
|
fnStepsToSend = sendableSteps(
|
|
1081
|
-
this.mod.editor.mod.footnotes.fnEditor.view.state
|
|
1158
|
+
(this.mod.editor.mod.footnotes as any).fnEditor.view.state
|
|
1082
1159
|
),
|
|
1083
|
-
commentUpdates = this.mod.editor.mod.comments.store
|
|
1084
|
-
|
|
1085
|
-
|
|
1160
|
+
commentUpdates = (this.mod.editor.mod.comments as any).store
|
|
1161
|
+
.unsentEvents(),
|
|
1162
|
+
bibliographyUpdates = (this.mod.editor.mod.db!.bibDB as any)
|
|
1163
|
+
.unsentEvents(),
|
|
1164
|
+
imageUpdates = (this.mod.editor.mod.db!.imageDB as any)
|
|
1165
|
+
.unsentEvents()
|
|
1086
1166
|
|
|
1087
1167
|
if (
|
|
1088
1168
|
!stepsToSend &&
|
|
@@ -1097,7 +1177,7 @@ export class ModCollabDoc {
|
|
|
1097
1177
|
}
|
|
1098
1178
|
|
|
1099
1179
|
const rid = this.confirmStepsRequestCounter++,
|
|
1100
|
-
unconfirmedDiff = {
|
|
1180
|
+
unconfirmedDiff: Record<string, any> = {
|
|
1101
1181
|
type: "diff",
|
|
1102
1182
|
v: this.mod.editor.docInfo.version,
|
|
1103
1183
|
rid
|
|
@@ -1106,24 +1186,30 @@ export class ModCollabDoc {
|
|
|
1106
1186
|
unconfirmedDiff["cid"] = this.mod.editor.client_id
|
|
1107
1187
|
|
|
1108
1188
|
// Collect the payload fields that need encryption
|
|
1109
|
-
const encryptedPayload = {}
|
|
1189
|
+
const encryptedPayload: Record<string, any> = {}
|
|
1110
1190
|
|
|
1111
1191
|
if (stepsToSend) {
|
|
1112
1192
|
encryptedPayload["ds"] = stepsToSend.steps.map(s => s.toJSON())
|
|
1113
1193
|
// Track title changes for the document overview
|
|
1114
1194
|
let newTitle = ""
|
|
1115
|
-
this.mod.editor.view.state.doc.firstChild
|
|
1195
|
+
this.mod.editor.view.state.doc.firstChild?.forEach(child => {
|
|
1116
1196
|
if (!child.marks.find(mark => mark.type.name === "deletion")) {
|
|
1117
1197
|
newTitle += child.textContent
|
|
1118
1198
|
}
|
|
1119
1199
|
})
|
|
1120
1200
|
newTitle = newTitle.slice(0, 255)
|
|
1121
1201
|
let oldTitle = ""
|
|
1122
|
-
this.mod.editor.docInfo.confirmedDoc.firstChild
|
|
1123
|
-
|
|
1124
|
-
|
|
1202
|
+
;(this.mod.editor.docInfo.confirmedDoc as Node).firstChild?.forEach(
|
|
1203
|
+
child => {
|
|
1204
|
+
if (
|
|
1205
|
+
!child.marks.find(
|
|
1206
|
+
mark => mark.type.name === "deletion"
|
|
1207
|
+
)
|
|
1208
|
+
) {
|
|
1209
|
+
oldTitle += child.textContent
|
|
1210
|
+
}
|
|
1125
1211
|
}
|
|
1126
|
-
|
|
1212
|
+
)
|
|
1127
1213
|
oldTitle = oldTitle.slice(0, 255)
|
|
1128
1214
|
if (newTitle !== oldTitle) {
|
|
1129
1215
|
// For E2EE documents, the title is encrypted too.
|
|
@@ -1160,25 +1246,25 @@ export class ModCollabDoc {
|
|
|
1160
1246
|
|
|
1161
1247
|
try {
|
|
1162
1248
|
// Encrypt the payload fields as a single blob
|
|
1163
|
-
const key = this.mod.editor.e2ee
|
|
1249
|
+
const key = this.mod.editor.e2ee!.key as CryptoKey
|
|
1164
1250
|
const ep = await E2EEEncryptor.encryptObject(encryptedPayload, key)
|
|
1165
1251
|
|
|
1166
1252
|
// Build the wire-format diff: metadata in plaintext,
|
|
1167
1253
|
// payload encrypted
|
|
1168
|
-
const wireDiff = {
|
|
1254
|
+
const wireDiff: Record<string, any> = {
|
|
1169
1255
|
type: "diff",
|
|
1170
1256
|
v: unconfirmedDiff.v,
|
|
1171
1257
|
rid: unconfirmedDiff.rid,
|
|
1172
1258
|
cid: unconfirmedDiff.cid,
|
|
1173
1259
|
ep, // encrypted payload
|
|
1174
|
-
e2ee_salt: this.mod.editor.e2ee
|
|
1260
|
+
e2ee_salt: this.mod.editor.e2ee!.encryptionSalt
|
|
1175
1261
|
}
|
|
1176
1262
|
if (unconfirmedDiff.footnoterender) {
|
|
1177
1263
|
wireDiff.footnoterender = true
|
|
1178
1264
|
}
|
|
1179
1265
|
|
|
1180
1266
|
// Send the encrypted diff
|
|
1181
|
-
this.mod.editor.ws
|
|
1267
|
+
this.mod.editor.ws!.send(() => wireDiff)
|
|
1182
1268
|
} catch (error) {
|
|
1183
1269
|
console.error("E2EE: Failed to encrypt diff", error)
|
|
1184
1270
|
// Re-enable diff sending so we can try again
|
|
@@ -1192,7 +1278,7 @@ export class ModCollabDoc {
|
|
|
1192
1278
|
*
|
|
1193
1279
|
* @private
|
|
1194
1280
|
*/
|
|
1195
|
-
_sendE2EESelectionChange() {
|
|
1281
|
+
_sendE2EESelectionChange(): void {
|
|
1196
1282
|
if (
|
|
1197
1283
|
!this.mod.editor.currentView ||
|
|
1198
1284
|
!this.mod.editor.currentView.state
|
|
@@ -1207,8 +1293,11 @@ export class ModCollabDoc {
|
|
|
1207
1293
|
return
|
|
1208
1294
|
}
|
|
1209
1295
|
this.lastSelectionUpdateState = currentView.state
|
|
1210
|
-
const selectionUpdate = getSelectionUpdate(currentView.state)
|
|
1211
|
-
|
|
1296
|
+
const selectionUpdate = getSelectionUpdate(currentView.state) as {
|
|
1297
|
+
anchor: number
|
|
1298
|
+
head: number
|
|
1299
|
+
}
|
|
1300
|
+
this.mod.editor.ws!.send(() => ({
|
|
1212
1301
|
type: "selection_change",
|
|
1213
1302
|
id: this.mod.editor.user.id,
|
|
1214
1303
|
v: this.mod.editor.docInfo.version,
|
|
@@ -1219,30 +1308,36 @@ export class ModCollabDoc {
|
|
|
1219
1308
|
}))
|
|
1220
1309
|
}
|
|
1221
1310
|
|
|
1222
|
-
receiveSelectionChange(data
|
|
1311
|
+
receiveSelectionChange(data: {
|
|
1312
|
+
id: number
|
|
1313
|
+
editor: string
|
|
1314
|
+
session_id: string
|
|
1315
|
+
anchor: number
|
|
1316
|
+
head: number
|
|
1317
|
+
}): void {
|
|
1223
1318
|
const participant = this.mod.participants.find(
|
|
1224
1319
|
par => par.id === data.id
|
|
1225
1320
|
)
|
|
1226
|
-
let tr, fnTr
|
|
1321
|
+
let tr: Transaction | false, fnTr: Transaction | false
|
|
1227
1322
|
if (!participant) {
|
|
1228
1323
|
// participant is still unknown to us. Ignore
|
|
1229
1324
|
return
|
|
1230
1325
|
}
|
|
1231
1326
|
if (data.editor === "footnotes") {
|
|
1232
1327
|
fnTr = updateCollaboratorSelection(
|
|
1233
|
-
this.mod.editor.mod.footnotes.fnEditor.view.state,
|
|
1234
|
-
participant,
|
|
1328
|
+
(this.mod.editor.mod.footnotes as any).fnEditor.view.state,
|
|
1329
|
+
participant as {id: number; name: string},
|
|
1235
1330
|
data
|
|
1236
1331
|
)
|
|
1237
1332
|
tr = removeCollaboratorSelection(this.mod.editor.view.state, data)
|
|
1238
1333
|
} else {
|
|
1239
1334
|
tr = updateCollaboratorSelection(
|
|
1240
1335
|
this.mod.editor.view.state,
|
|
1241
|
-
participant,
|
|
1336
|
+
participant as {id: number; name: string},
|
|
1242
1337
|
data
|
|
1243
1338
|
)
|
|
1244
1339
|
fnTr = removeCollaboratorSelection(
|
|
1245
|
-
this.mod.editor.mod.footnotes.fnEditor.view.state,
|
|
1340
|
+
(this.mod.editor.mod.footnotes as any).fnEditor.view.state,
|
|
1246
1341
|
data
|
|
1247
1342
|
)
|
|
1248
1343
|
}
|
|
@@ -1250,11 +1345,11 @@ export class ModCollabDoc {
|
|
|
1250
1345
|
this.mod.editor.view.dispatch(tr)
|
|
1251
1346
|
}
|
|
1252
1347
|
if (fnTr) {
|
|
1253
|
-
this.mod.editor.mod.footnotes.fnEditor.view.dispatch(fnTr)
|
|
1348
|
+
;(this.mod.editor.mod.footnotes as any).fnEditor.view.dispatch(fnTr)
|
|
1254
1349
|
}
|
|
1255
1350
|
}
|
|
1256
1351
|
|
|
1257
|
-
receiveDiff(data, serverFix = false) {
|
|
1352
|
+
receiveDiff(data: DiffData, serverFix = false): void {
|
|
1258
1353
|
// Check if this is an encrypted diff for an E2EE document.
|
|
1259
1354
|
// Encrypted diffs have an "ep" (encrypted payload) field instead
|
|
1260
1355
|
// of plaintext ds/fs/cu/bu/iu fields. We decrypt the payload
|
|
@@ -1270,19 +1365,19 @@ export class ModCollabDoc {
|
|
|
1270
1365
|
* Process a diff (unencrypted or already decrypted).
|
|
1271
1366
|
* @private
|
|
1272
1367
|
*/
|
|
1273
|
-
_processDiff(data, serverFix = false) {
|
|
1274
|
-
this.mod.editor.docInfo.version
|
|
1368
|
+
_processDiff(data: DiffData, serverFix = false): void {
|
|
1369
|
+
this.mod.editor.docInfo.version!++
|
|
1275
1370
|
if (data["bu"]) {
|
|
1276
1371
|
// bibliography updates
|
|
1277
|
-
this.mod.editor.mod.db
|
|
1372
|
+
(this.mod.editor.mod.db!.bibDB as any).receive(data["bu"])
|
|
1278
1373
|
}
|
|
1279
1374
|
if (data["iu"]) {
|
|
1280
1375
|
// images updates
|
|
1281
|
-
this.mod.editor.mod.db
|
|
1376
|
+
(this.mod.editor.mod.db!.imageDB as any).receive(data["iu"])
|
|
1282
1377
|
}
|
|
1283
1378
|
if (data["cu"]) {
|
|
1284
1379
|
// comment updates
|
|
1285
|
-
this.mod.editor.mod.comments.store.receive(data["cu"])
|
|
1380
|
+
(this.mod.editor.mod.comments as any).store.receive(data["cu"])
|
|
1286
1381
|
}
|
|
1287
1382
|
if (data["ds"]) {
|
|
1288
1383
|
// document steps
|
|
@@ -1290,20 +1385,20 @@ export class ModCollabDoc {
|
|
|
1290
1385
|
}
|
|
1291
1386
|
if (data["fs"]) {
|
|
1292
1387
|
// footnote steps
|
|
1293
|
-
this.mod.editor.mod.footnotes.fnEditor.applyDiffs(
|
|
1388
|
+
;(this.mod.editor.mod.footnotes as any).fnEditor.applyDiffs(
|
|
1294
1389
|
data["fs"],
|
|
1295
1390
|
data["cid"]
|
|
1296
1391
|
)
|
|
1297
1392
|
}
|
|
1298
1393
|
if (data["footnoterender"]) {
|
|
1299
1394
|
// re-render footnotes properly
|
|
1300
|
-
this.mod.editor.mod.footnotes.fnEditor.renderAllFootnotes()
|
|
1395
|
+
;(this.mod.editor.mod.footnotes as any).fnEditor.renderAllFootnotes()
|
|
1301
1396
|
}
|
|
1302
1397
|
|
|
1303
1398
|
if (serverFix) {
|
|
1304
1399
|
// Diff is a fix created by server due to missing diffs.
|
|
1305
1400
|
if ("reject_request_id" in data) {
|
|
1306
|
-
delete this.unconfirmedDiffs[data.reject_request_id]
|
|
1401
|
+
delete this.unconfirmedDiffs[data.reject_request_id as number]
|
|
1307
1402
|
}
|
|
1308
1403
|
this.cancelCurrentlyCheckingVersion()
|
|
1309
1404
|
|
|
@@ -1322,21 +1417,24 @@ export class ModCollabDoc {
|
|
|
1322
1417
|
* image updates. This method decrypts the payload and then processes
|
|
1323
1418
|
* the diff using the standard _processDiff path.
|
|
1324
1419
|
*
|
|
1325
|
-
* @param
|
|
1326
|
-
* @param
|
|
1420
|
+
* @param data - The diff message with "ep" field
|
|
1421
|
+
* @param serverFix - Whether this is a server-generated fix
|
|
1327
1422
|
* @private
|
|
1328
1423
|
*/
|
|
1329
|
-
async _receiveE2EEDiff(
|
|
1424
|
+
async _receiveE2EEDiff(
|
|
1425
|
+
data: DiffData,
|
|
1426
|
+
serverFix = false
|
|
1427
|
+
): Promise<void> {
|
|
1330
1428
|
try {
|
|
1331
|
-
const key = this.mod.editor.e2ee
|
|
1429
|
+
const key = this.mod.editor.e2ee!.key as CryptoKey
|
|
1332
1430
|
const decryptedPayload = await E2EEEncryptor.decryptObject(
|
|
1333
|
-
data["ep"],
|
|
1431
|
+
data["ep"] as string,
|
|
1334
1432
|
key
|
|
1335
1433
|
)
|
|
1336
1434
|
|
|
1337
1435
|
// Merge the decrypted payload with the metadata fields
|
|
1338
1436
|
// that were sent in plaintext (cid, rid, footnoterender)
|
|
1339
|
-
const mergedData = {
|
|
1437
|
+
const mergedData: DiffData = {
|
|
1340
1438
|
cid: data["cid"],
|
|
1341
1439
|
rid: data["rid"],
|
|
1342
1440
|
footnoterender: data["footnoterender"],
|
|
@@ -1351,30 +1449,30 @@ export class ModCollabDoc {
|
|
|
1351
1449
|
// If decryption fails, we still need to increment the version
|
|
1352
1450
|
// to stay in sync with the server, but we skip applying the
|
|
1353
1451
|
// diff content.
|
|
1354
|
-
this.mod.editor.docInfo.version
|
|
1452
|
+
this.mod.editor.docInfo.version!++
|
|
1355
1453
|
}
|
|
1356
1454
|
}
|
|
1357
1455
|
|
|
1358
|
-
setConfirmedDoc(tr, stepsLength) {
|
|
1456
|
+
setConfirmedDoc(tr: Transaction, stepsLength: number): void {
|
|
1359
1457
|
// Find the latest version of the doc without any unconfirmed local changes
|
|
1360
1458
|
|
|
1361
|
-
const rebased = tr.getMeta("rebased"),
|
|
1459
|
+
const rebased = tr.getMeta("rebased") as number,
|
|
1362
1460
|
docNumber = rebased + stepsLength
|
|
1363
1461
|
|
|
1364
1462
|
this.mod.editor.docInfo.confirmedDoc =
|
|
1365
1463
|
docNumber === tr.docs.length ? tr.doc : tr.docs[docNumber]
|
|
1366
1464
|
}
|
|
1367
1465
|
|
|
1368
|
-
confirmDiff(request_id) {
|
|
1466
|
+
confirmDiff(request_id: number): void {
|
|
1369
1467
|
const unconfirmedDiffs = this.unconfirmedDiffs[request_id]
|
|
1370
1468
|
if (!unconfirmedDiffs) {
|
|
1371
1469
|
return
|
|
1372
1470
|
}
|
|
1373
|
-
this.mod.editor.docInfo.version
|
|
1471
|
+
this.mod.editor.docInfo.version!++
|
|
1374
1472
|
|
|
1375
1473
|
const sentSteps = unconfirmedDiffs["ds"] // document steps
|
|
1376
1474
|
if (sentSteps) {
|
|
1377
|
-
const ourIds = sentSteps.map(_step => this.mod.editor.client_id)
|
|
1475
|
+
const ourIds = sentSteps.map((_step: any) => this.mod.editor.client_id)
|
|
1378
1476
|
const tr = receiveTransaction(
|
|
1379
1477
|
this.mod.editor.view.state,
|
|
1380
1478
|
sentSteps,
|
|
@@ -1387,41 +1485,49 @@ export class ModCollabDoc {
|
|
|
1387
1485
|
const sentFnSteps = unconfirmedDiffs["fs"] // footnote steps
|
|
1388
1486
|
if (sentFnSteps) {
|
|
1389
1487
|
const fnTr = receiveTransaction(
|
|
1390
|
-
this.mod.editor.mod.footnotes.fnEditor.view.state,
|
|
1488
|
+
(this.mod.editor.mod.footnotes as any).fnEditor.view.state,
|
|
1391
1489
|
sentFnSteps,
|
|
1392
|
-
sentFnSteps.map(_step => this.mod.editor.client_id)
|
|
1490
|
+
sentFnSteps.map((_step: any) => this.mod.editor.client_id)
|
|
1393
1491
|
)
|
|
1394
|
-
this.mod.editor.mod.footnotes.fnEditor.view.dispatch(fnTr)
|
|
1492
|
+
;(this.mod.editor.mod.footnotes as any).fnEditor.view.dispatch(fnTr)
|
|
1395
1493
|
}
|
|
1396
1494
|
|
|
1397
1495
|
const sentComments = unconfirmedDiffs["cu"] // comment updates
|
|
1398
1496
|
if (sentComments) {
|
|
1399
|
-
this.mod.editor.mod.comments.store.eventsSent(
|
|
1497
|
+
;(this.mod.editor.mod.comments as any).store.eventsSent(
|
|
1498
|
+
sentComments
|
|
1499
|
+
)
|
|
1400
1500
|
}
|
|
1401
1501
|
|
|
1402
1502
|
const sentBibliographyUpdates = unconfirmedDiffs["bu"] // bibliography updates
|
|
1403
1503
|
if (sentBibliographyUpdates) {
|
|
1404
|
-
this.mod.editor.mod.db
|
|
1504
|
+
;(this.mod.editor.mod.db!.bibDB as any).eventsSent(
|
|
1505
|
+
sentBibliographyUpdates
|
|
1506
|
+
)
|
|
1405
1507
|
}
|
|
1406
1508
|
|
|
1407
1509
|
const sentImageUpdates = unconfirmedDiffs["iu"] // image updates
|
|
1408
1510
|
if (sentImageUpdates) {
|
|
1409
|
-
this.mod.editor.mod.db
|
|
1511
|
+
;(this.mod.editor.mod.db!.imageDB as any).eventsSent(
|
|
1512
|
+
sentImageUpdates
|
|
1513
|
+
)
|
|
1410
1514
|
}
|
|
1411
1515
|
|
|
1412
1516
|
delete this.unconfirmedDiffs[request_id]
|
|
1413
1517
|
this.enableDiffSending()
|
|
1414
1518
|
}
|
|
1415
1519
|
|
|
1416
|
-
rejectDiff(request_id) {
|
|
1520
|
+
rejectDiff(request_id: number): void {
|
|
1417
1521
|
delete this.unconfirmedDiffs[request_id]
|
|
1418
1522
|
this.enableDiffSending()
|
|
1419
1523
|
}
|
|
1420
1524
|
|
|
1421
|
-
applyDiffs(diffs, cid) {
|
|
1525
|
+
applyDiffs(diffs: unknown[], cid: string | number | undefined): void {
|
|
1422
1526
|
this.receiving = true
|
|
1423
1527
|
const steps = diffs.map(j => Step.fromJSON(this.mod.editor.schema, j))
|
|
1424
|
-
const clientIds = diffs
|
|
1528
|
+
const clientIds = diffs
|
|
1529
|
+
.map(_ => cid)
|
|
1530
|
+
.filter((id): id is string | number => id !== undefined)
|
|
1425
1531
|
const tr = receiveTransaction(
|
|
1426
1532
|
this.mod.editor.view.state,
|
|
1427
1533
|
steps,
|