stable

Clone or download

Read-only

fix: be able to insert an image in the middle of some text

part of story #38627: Choice of a new Rich Text Editor When the user drops a file, we now retrieve the exact position in the view where the DragEvent has occured, allowing us to precisely insert the image. When the user pastes a file, we do the replacement of the current selection with a new image node. Since we now use `view.posAtCoords`, we can't emit a drop event on the editor in the Cypress tests anymore (it uses elementFromPoint which fails because the Tuleap instance is displayed in a iframe). Instead, we paste the image in the editor section. Note: I have a bugs with my Chrome browser which prevents me to test the drop/paste of images. When I drop an image, I get an error because the DragEvent does not contain any files, and when I paste an image, it pastes only the filesystem path. It seems to be working on other teammates laptops though. How to test: - Drop a image from your filesystem into the editor description --> The image is uploaded --> It is inserted where the dropcursor was displayed - Copy an image from your filesystem - Select some content in the description OR simply click it* - Paste the image --> If some text was selected, it is replaced with an image node --> Else, the image is inserted where the cursor was - Cut an image (Ctrl+x) and paste in somewhere else in the same editor --> The image has been inserted at its new place Change-Id: I0bffe329c046e0d0305486250a972f3e43f9fb3d

Modified Files

Name
M lib/frontend/prose-mirror-editor/src/plugins/drop-file/plugin-drop-file.ts +79 −21 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/drop-file/upload-file.ts +2 −4 Go to diff View file
M plugins/artidoc/tests/e2e/cypress/cypress/e2e/artidoc.cy.ts +7 −8 Go to diff View file