Replace the WYSIWYG editor with TipTap#10196
Conversation
The image upload response handling was not always returning a promise which caused inconsistent behavior across browsers.
- In order to control the editor styling while the modal dialogs are open, add a new dialog extension that stores the dialog state for the editor itself - Refactor the image extension to move the custom node view for image resizing to its own file
In order to maintain consistency for the structuring of the code, move other extensions to a folder stucture after the image extension required its own folder.
The `img` element's src can also get the hostname prepended to it when the previous check would not work. Updated to check if the actual node attribute has changed.
As the generated editor HTML changed, the expectation also needs to be changed.
In case the editor container contains the classes to indicate these features are needed, only add those extensions in that case.
The editor implements its own hashtags and mentions functionality which is why we do not need to attach tribute to the editors.
And add the tests for the content toolbar.
|
@decidim/maintainers This is now finally ready for technical review after the current editor toolbar issues have been resolved at Meanwhile we have been waiting to merge this, we have also received a stable release last month for Tiptap version 2 🥳: I have also updated the Tiptap to the stable version. EDIT: Staging/QA environment has also been updated with the latest code. |
Great news!! 👏🏽 👏🏽
@carolromero could you give it an eye? Thanks! |
alecslupu
left a comment
There was a problem hiding this comment.
Partial Reviewed, I have a quill related issue while upgrading.
decidim-core/app/packs/src/decidim/redesigned_input_character_counter.js
Show resolved
Hide resolved
I took a look and everything seems to be fine 👍 |
To be able to utilize the front-end helpers in other tests as well.
alecslupu
left a comment
There was a problem hiding this comment.
As per documentation, the task bin/rails decidim:upgrade:migrate_wysiwyg_content should migrate all the content . However, when i run the task, i get the following error:
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "admin_terms_of_use_body" does not exist
LINE 1: ...cidim_organizations"."welcome_notification_body", "admin_ter...
^
/code/decidim/decidim-core/lib/decidim/upgrade/wysiwyg_migrator.rb:48:in `block in convert_model_data'
/code/decidim/decidim-core/lib/decidim/upgrade/wysiwyg_migrator.rb:47:in `convert_model_data'
/code/decidim/decidim-core/lib/decidim/upgrade/wysiwyg_migrator.rb:32:in `block in update_records_batches'
/code/decidim/decidim-core/lib/decidim/upgrade/wysiwyg_migrator.rb:31:in `each_with_index'
/code/decidim/decidim-core/lib/decidim/upgrade/wysiwyg_migrator.rb:31:in `update_records_batches'
/code/decidim/decidim-core/lib/decidim/upgrade/wysiwyg_migrator.rb:80:in `block in update_models'
/code/decidim/decidim-core/lib/decidim/upgrade/wysiwyg_migrator.rb:79:in `each'
/code/decidim/decidim-core/lib/decidim/upgrade/wysiwyg_migrator.rb:79:in `update_models'
/code/decidim/decidim-core/lib/tasks/upgrade/decidim_migrate_wysiwyg_content.rake:53:in `block (3 levels) in <main>'
/code/bin/rails:5:in `<top (required)>'
/code/bin/spring:10:in `block in <top (required)>'
/code/bin/spring:7:in `<top (required)>'
It seems that in the task ( decidim:upgrade:register_wysiwyg_migration) the old field name ( admin_terms_of_use_body ) is being used. As per change done in #10614, the field should be renamed to admin_terms_of_service_body.
After this change is being made, all should be ok from my end.
🎩 What? Why?
This PR implements the TipTap editor for Decidim.
This is feature complete and works both in the legacy design (admin panel) as well as in the redesign (you need to test it locally not to break staging, instructions below).
Can be tested at (use default seed credentials):
https://tiptap.decidimqa.mainiotech.fi/
📌 Related Issues
Here are also some issues we have had in the past with Quill that should be confirmed to be fixed when testing this:
Rich text editor sub-lists are broken when re-editing the content #9866
Character counter takes into account the HTML tags when rich text editor is enabled #9821
Can't paste in WYSIWYG #7180
Cannot copy/paste in the description field of assembly meetings #4873
Bold type is lost when copying/pasting in the editor #8982
Video isn't saved in rich tech editor #8331
Fix editor content saving when the content has only one video #9629
Admin editor breaks with some specific contents #7896
Image file upload in WYSWYG editor #7712
Unremovable trailing paragraph after embedded videos #3067
Videos in page component do not display #2130
Cookie policy: accept and reject #9170 (note: not yet implemented under redesign)
The text editor adds a "line break" #2000
First paragraph\n\nSecond paragraphFix hashtags not recognized at the beginning of the string #9616
Dont add external link container inside editor #9095
nofollow,noopenerandnoreferrerfor participant entered contentAdd noreferrer and ugc to links #9047
Add "nofollow noopener" rel to the profile personal URL #8779
Add nofollow to parsed links #5651
Fix character counter with emoji picker close to maximum characters #8916
Fix editor: shift+enter makes single br tag before link #7877
Fix line breaks in external links #7280
Fix editor image alt tag #6920
Testing
packageshave changed)Currently there does not seem to be any redesigned view yet with the editor (e.g. new proposal / new meeting / new initiative / etc.) but you can test it locally under the redesign by adding it to some page, e.g. at the static page view as follows:
And if you want to test the full toolbar with the video embed and image embed functionality, replace the line with
form.editorwith this (note that you need to be logged in for the image embedding to work because of the permissions set for the image upload endpoint):Note that this PR already includes E2E tests (system tests) for testing the editor functionality under both, the legacy design as well as the redesign.
Extra features
The new editor also comes with some extra features that you can test:
https://www.youtube.com/watch?v=f6JMgJAQ2tc**this should appear as bold**##+SPACEand continue writing your heading**followed by some text and then again double stars**📷 Screenshots
Participant editor with demonstration of the available controls
Admin editor with extra controls
Link dialog
Image dialog
Video dialog
Supports YouTube and Vimeo by default or any arbitrary service as long as they provide embeddable video URLs.
Image resizing support
As in the old editor, we have image resizing support also in the new editor.
Redesigned editor
Link dialog (redesigned)
Image dialog (redesigned)
Video dialog (redesigned)