stable

Clone or download

Read-only

feat: Ability to edit links in place

part of story #38627 : Choice of a new Rich Text Editor With this contribution, users are allowed to edit an existing link (not cross-references) using an [edit] button inside the LinkPopover. When clicked, the popover enters edition mode: - It is now displayed on the right (left if not enough space) - It contains a form where you can edit the url and the title Regarding the architecture, I chose to embed the EditLinkFormElement into the LinkPopoverElement in order to avoid the pain to deal with elements replacements outside of hybrids. With this strategy, we can easily toggle the menu or the form at will. Note: We should probably think about putting things in common regarding the create/edit link popover in the toolbar and the edit link popover in the editor. However, I have the feeling that we should finish the LinkPopover implementation first and see at the end what can be actually put in common. How to test: - Pick up an editor containing a link (or create a link node) - Click on the link - Click on the pencil button inside the popover --> The form is displayed --> The fields are filled with the link url and title - Cancel the edition --> The form popover is no longer displayed --> The menu is displayed again - Click on the pencil button - Edit the url and the title - Save --> The link has been updated with the new url and title. The following step is to ensure we have the same behavior with the toolbar popover: - edit once again the link, but leave the title field blank --> The title has been replaced with the provided href Change-Id: I3b5a02662b22850f0cd83ebc37954c6a8ed7e864

Modified Files

Name
M lib/frontend/prose-mirror-editor/po/fr_FR.po +6 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/helpers/replace-link-node.ts +42 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/LinkPopoverButtonsRenderers.test.ts +16 −11 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/LinkPopoverButtonsRenderers.ts +18 −9 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/LinkPopoverEditionFormRenderers.ts +62 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/LinkPopoverElement.test.ts +41 −2 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/LinkPopoverElement.ts +32 −5 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/LinkPopoverTemplate.test.ts +63 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/LinkPopoverTemplate.ts +18 −11 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/forms/EditLinkFormElement.test.ts +79 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/forms/EditLinkFormElement.ts +80 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/forms/EditLinkFormTemplate.test.ts +105 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/forms/EditLinkFormTemplate.ts +100 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/items/EditLinkButtonElement.test.ts +47 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/items/EditLinkButtonElement.ts +58 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/EditLinkCallbackBuilder.test.ts +54 −0 Go to diff View file
A lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/EditLinkCallbackBuilder.ts +37 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/LinkPopoverInserter.test.ts +17 −5 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/LinkPopoverInserter.ts +10 −9 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/create-link-popover.test.ts +24 −5 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/helper/create-link-popover.ts +18 −9 Go to diff View file
R lib/frontend/prose-mirror-editor/src/scss-shim.d.ts Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/link-popover/link-popover.ts +2 −0 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/toolbar/links/popover-link.ts +5 −23 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/toolbar/links/popover-links.test.ts +1 −1 Go to diff View file
M lib/frontend/prose-mirror-editor/src/types/internal-types.ts +5 −0 Go to diff View file
R lib/frontend/prose-mirror-editor/src/plugins/link-popover/element/link-popover-styles.scss Go to diff View file
M lib/frontend/prose-mirror-editor/themes/editor.scss +1 −0 Go to diff View file