stable

Clone or download

Read-only

feat: update cross reference on submit

part of story #38627 : Choice of a new Rich Text Editor Update strategy: Given that we have two plugins: - The link-popover plugin (requesting the update) - The cross-references plugin (processing the update) These plugins cannot directly interact, because they don't know each other. Hence, the link-popover plugin cannot access the decorations created by the cross-reference plugin. The "prosemirror way" to process the update seems to be by using a special transaction "updated-cross-reference". When this transaction is detected by the cross-reference plugin, it will register an aditionnal transaction whose role is to replace the old reference in the editor by the new one (received as an EditorNode). This new reference will be decorated by the same plugin during the apply phase happening naturally right after the text replacement. How to test: - Pick up a cross reference - Edit it and submit --> It is updated in the editor Change-Id: I64ea9cbb7fbc36e4b13eda723277b5a926dd1ba8

Modified Files

Name
A lib/frontend/prose-mirror-editor/src/helpers/EditorTextNodeCreator.test.ts +36 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/helpers/EditorTextNodeCreator.ts +29 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/helpers/UpdatedCrossReferenceTransactionDispatcher.test.ts +58 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/helpers/UpdatedCrossReferenceTransactionDispatcher.ts +45 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/helpers/create-cross-reference-decoration.test.ts +41 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/helpers/create-cross-reference-decoration.ts +39 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/helpers/stubs/DispatchCrossReferenceUpdatedTransactionStub.ts +39 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/index.ts +13 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/link-decorator.test.ts +8 −3 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/link-decorator.ts +4 −5 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/update/CrossReferenceDecorationFinder.test.ts +83 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/update/CrossReferenceDecorationFinder.ts +41 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/update/CrossReferenceDecorationReplacer.test.ts +59 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/update/CrossReferenceDecorationReplacer.ts +40 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/update/UpdateCrossReferenceHandler.test.ts +78 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/update/UpdateCrossReferenceHandler.ts +47 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/update/UpdatedCrossReferenceInTransactionFinder.test.ts +59 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/update/UpdatedCrossReferenceInTransactionFinder.ts +40 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/update/stubs/FindCrossReferenceDecorationStub.ts +30 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/extract-referencies/update/stubs/ReplaceCrossReferenceDecorationStub.ts +53 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/EditCrossReferenceCallbackBuilder.test.ts +53 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/EditCrossReferenceCallbackBuilder.ts +41 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/LinkPopoverInserter.test.ts +7 −1 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/LinkPopoverInserter.ts +3 −3 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/stubs/BuildEditCrossReferenceCallbackStub.ts +27 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/link-popover.ts +9 −3 Go to diff View file