stable

Clone or download

Read-only

feat: artidoc mono editor

Part of story #38627: Choice of a new Rich Text Editor Note: In order to allow the editor to have a structure grouping the section title and the section description, we had to introduce the concept of structure blocks. These blocks hold the content of the editor, and cannot be replaced, wrapped or modified. This is why they are explicitly ignored in some places of the prose-mirror-editor code. For instance: - In the lists detection code. - In the "wrap in blockquote" code. - In the drop file feature. Regarding the drop-file plugin, we had to slightly rework the way image nodes were created inside the editor. Before this contribution, they were savagely inserted by replacing the current selection. However, this way of inserting the image node wasn't great, because the image was actually inserted at the last place you clicked, and not where the drop cursor is when the drop event fires. In order to compute the insertion point, we now retrieve the position of the node inside the state where the image has been dropped. Moreover, the `insertPoint` function used to get the final position of the future image node takes in consideration the current schema, so it forbids the drop in the title node and the section node. Please note that the dropCursor plugins does not really work well. We couldn't prevent it to display the drop cursor on the artidoc-section element yet. It could be sometimes misleading for the user that it seems possible to drop an image, while it is not possible. We'll try to fix this behavior in a next contribution. How to test: - Edit the title and the description - Click on cancel --> The content has been reset - Edit the title and the description - Click on Save --> The content has been saved You can still: - Apply styles on the content (basically all the toolbar features work) - Drop images in the editor (where allowed, see explanations above) - Artidoc Cypress tests should pass successfully. Co-authored-by: Clarisse Deschamps <clarisse.deschamps@enalean.com> Co-authored-by: Thomas Gorka <thomas.gorka@enalean.com> Change-Id: I871c975537d8d333392c25b7c54b31c4f5d53d15

Modified Files

Name
M lib/frontend/prose-mirror-editor/src/custom_schema.ts +12 −8 Go to diff View file
A lib/frontend/prose-mirror-editor/src/helpers/isNodeAStructureBlock.ts +25 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/index.ts +1 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/drop-file/plugin-drop-file.ts +32 −5 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/input/input.ts +4 −2 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/toolbar/list/ListsInSelectionDetector.ts +6 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/toolbar/list/SingleListInSelectionDetector.ts +5 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/toolbar/quote/add-blockquote.test.ts +52 −14 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/toolbar/quote/add-blockquote.ts +10 −5 Go to diff View file
M lib/frontend/prose-mirror-editor/src/types/index.ts +2 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/types/prose-mirror.ts +2 −2 Go to diff View file
M lib/frontend/prose-mirror-editor/src/use-editor.ts +7 −10 Go to diff View file
M plugins/artidoc/scripts/artidoc/package.json +3 −0 Go to diff View file
M plugins/artidoc/scripts/artidoc/pnpm-lock.yaml +24 −0 Go to diff View file
M plugins/artidoc/scripts/artidoc/po/fr_FR.po +0 −3 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/components/print/SectionPrinterVersion.vue +2 −3 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/components/section/SectionContent.vue +5 −11 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/components/section/description/SectionDescription.test.ts +5 −3 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/components/section/description/SectionDescription.vue +4 −2 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/components/section/description/SectionDescriptionEditorProseMirror.vue +41 −25 Go to diff View file
A plugins/artidoc/scripts/artidoc/src/components/section/description/artidoc-editor-schema.ts +65 −0 Go to diff View file
A plugins/artidoc/scripts/artidoc/src/components/section/description/render-artidoc-section-node.test.ts +45 −0 Go to diff View file
A plugins/artidoc/scripts/artidoc/src/components/section/description/render-artidoc-section-node.ts +45 −0 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/components/section/header/SectionHeader.test.ts +17 −37 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/components/section/header/SectionHeader.vue +3 −83 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/composables/useEditorSectionContent.test.ts +57 −72 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/composables/useEditorSectionContent.ts +7 −17 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/composables/useSectionEditor.test.ts +4 −1 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/helpers/stubs/SectionEditorStub.ts +1 −2 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/helpers/toolbar-activator.test.ts +16 −11 Go to diff View file
M plugins/artidoc/scripts/artidoc/src/helpers/toolbar-activator.ts +1 −1 Go to diff View file
M plugins/artidoc/scripts/artidoc/vite.config.ts +7 −1 Go to diff View file
M plugins/artidoc/tests/e2e/cypress/cypress/e2e/artidoc.cy.ts +37 −28 Go to diff View file