•  
     
    story #38627 New Rich Text Editor
Summary
Empty
New Rich Text Editor
Empty

For a great technical writing experience there are a couple of things that needs to be considered:

  • Support of Tables
  • Support of preformatted text and inline code
  • Support of emojis
  • Support of Graphs

At the beginning of Artidoc, Ckeditor 5 was selected mainly because it was the successor of ckeditor 4, already end of life. However we had to revert this change because it was not possible to have both versions of the editor in parallel (artifact view v4 and artidoc v5) due to HTML format change between the two versions. In additon to that, it felt easier to have the image support in v4 than in v5 because we already did it elsewhere.

Now Artidoc v1 is out there, it’s time to get back to Rich Text Edition selection.

Why do we need to change:

  • Ckeditor 4 is end of life
  • The edition experience is not great. Having to manually switch to edit mode is painful when the documents are long: we scroll down to read, identify something to change, scroll up to switch to edit, scroll down again to find the right place where to do the switch. It's also made painful because there is no sub-heading in the Section (eg no 1.a that would correspond to first <h1> in the artifact description). Hence we cannot scan easily to find the right place where to edit.

The scope of this story is to evaluate the alternative we have right now and to produce an Architecture Decision Record that will detail which solution was selected and why.

The editor must have

  • formatting (bold, italic, lists, quote, links, code blocks, inline, exposant...)
  • headings (titles, subtitles, etc)
  • images (copy/paste and drag n'drop)
  • tables (including copy/paste)
  • keyboard shortcuts (eg typing `*` starts a new bullet list)
  • must not interfer with browsers native capabilities like spell check
  • HTML paste
  • select text and have the ability to attach a comment to it

The editor should

  • allow to have the artidoc in transparent edit mode or offer a usable alternative (cf problem of scroll described at the beginning)
  • include graphs (hypothesis, graphs will be done externally using draw.io and then included in the RTE but the navigation between the two contexts should be as seamless as possible).
  • have the possibility to support realtime concurrent edition
  • support Tuleap specifics like typing art #... and have a link. In the futur we might also imagine that it would trigger an autocompleter.

Not mandatory / can be challenged

  • ability to deal with conversion text <-> markdown <-> html

Things to keep in mind:

  • There is a strong need of diff, including inside tables. It should be possible to produce one (between two versions of the document or between two documents) but its not mandatory that the RTE should manage the diff.

Editor tests:

General concerns:

  • Yjs-websocket documentation for Realtime
  • tuleap tooltip (like art #38627) can be supported on every editor and needs a specific development to support mention art #123, transform them into an updatable link
  • draw.io integration has no impact on editor choice
  • markdown support is not a requirement here, we need to have an editor who is smooth for editing and not developper oriented like

Milkdown (doc | examples | other example | code | playground):

✔️ Good

  • easy to start
  • doc and examples seems accessible
  • it comes with almost everything we need, and code integration seems easy `npm i plugin` and `.use(plugin)` in code
  • tested plugin are supported by editor and not the community

❌ Bad

  • does not support typographic replacement `(c) (C) (r) (R) (tm) (TM) (p) (P) `
  • does not support emoticons `:-) :-( 8-) ;)`
  • the toolbar is provided by an external plugin not supported by milkdown team, I did not want to spent lot of time on it, it seems to do the job, but I didn't see anything to support link and/or image.
    • The copy/paste of image and the dnd looks good enough for me but to be checked
    • the official way of making link is by hovering text and adding a link (storybook)(code). I find this usage a bit hard to discover for our users
    • /!\ we need to write css for the toolbar

📑 wysiwyg needs

  • ✅ Support of Tables (preset-gfm)
  • ✅ Support of preformatted text and inline code
  • ✅ RTE
  • ✅ formatting (bold, italic, lists, quote, links, code blocks, inline, exposant...)
  • ✅ headings (titles, subtitles, etc)
  • ✅ images (copy/paste and drag n'drop)
  • ✅ tables (including copy/paste) 
  • ✅ keyboard shortcuts (eg typing `*` starts a new bullet list)
  • ✅ must not interfer with browsers native capabilities like spell check
  • ❗ Support of emojis (ok but no emoticons)
  • ❗toolbar (needs lots of customisation, css and new custom button, worth probably to write our own toolbar plugin or extension to toolbar plugin)
  • ❗ seems to support checkboxes (like in playground), does not work on my POC (probably pebkac)
  • ❌ HTML paste
  • ❌ select text and have the ability to attach a comment to it
  • ❌ anchor/refs
  • ❌ support au diff
  • writting our own pluging

Other (not tested)

 

Quill (doc | examples | code | playground) :

✔️ Good

  • easy to start
  • toolbar plugin is easy to add and configure, seems easy to add new option in toolbar if needed (like done by emoji plugin)

❌ Bad

  • markdown support is low, It does not display image ou table
  • does not support typographic replacement `(c) (C) (r) (R) (tm) (TM) (p) (P) `
  • does not support emoticons `:-) :-( 8-) ;)`
  • emoji plugin is outdated, no update since 2021, I have build issues (due to es6 module)
  • every plugin I dig into is outdated, I don't think we can rely on external quill plugins
  • even plugin list powered by quill is outdated

📑 wysiwyg needs

  • ✅ Support of preformatted text and inline code
  • ✅ RTE (seems ok over yjs code + demo)
  • ✅ formatting (bold, italic, lists, quote, links, code blocks, inline, exposant...)
  • ✅ headings (titles, subtitles, etc)
  • ✅keyboard shortcuts (eg typing `*` starts a new bullet list)
  • ✅ must not interfer with browsers native capabilities like spell check
  • ✅ toolbar 
  • ❗Markdown support is less complete than milkdown
  • ❗ Support of emojis (outdated)
  • ❗images (copy/paste and drag n'drop), lib is not updated even dependencies since a year
  • ❗select text and have the ability to attach a comment to it (found an example, little bit broken, but can be a good start) 
  • ❗support au diff
  • ❌ tables (including copy/paste) seems not ok, plugins are outdated, no maj since several years
  • ❌ HTML paste
  • ❌ anchor/refs
  • writting our own plugin

ProseMirror (doc | examples | code | playground) :

✔️ Good

  • modern editor like milkdown or tiptap are an overlay of prose mirror, we should be able to have the same coverage than them
  • enables us to customize everything
  • we'll be able to concentrate fully on user experience we want to provide to end users
  • does not comes with css, we'll have to write our own (probably a good thing, we'll be able to make it tlp like)
  • undo/redo comes for free, don't know if it's a need, but i find it handy
  • y-prosemirror: Yjs integration for real time for code mirror

❌ Bad

  • we'll need to implement almost everything, it will cost developpement time, even when we'll try to have same coverage than ckeditor

📑 wysiwyg needs

  • ✅ Support of preformatted text and inline code
  • ✅ toolbar ("easy" to add our own actions)
  • ✅ formatting (bold, italic, lists, quote, links, code blocks, inline, exposant...)
  • ✅ headings (titles, subtitles, etc)
  • ✅ must not interfer with browsers native capabilities like spell check

other needs who can be supported

  • ✅ RTE, as we managed to test it over milkdown, should be ok here, plus there is a full functional demo here, with associate code
  • ✅ Markdown support markdown-it-table 
  • ✅ keyboards shortcuts comes with prose-mirror demo code (like `Ctrl+b` for bold or `*` to create a list)
  • ✅ images (copy/paste and drag n'drop)
  • ✅ anchor/refs, the live editing of Tuleap reference will be possible thru a custom plugin, in POC we reached the state where we can directlly add a new link (by typing art #123, then space key will automatically convert it into a link), algo is not done for editing the link, but the API enables us to replace everything with what we want, it should not be an issue
  • ❌ Support of emojis, but we can implement it
  • ❌ select text and have the ability to attach a comment to it 
  • ❌ support au diff
  • ❌ tables (including copy/paste)
  • ❌ HTML paste

Jodit (doc | examples | code | playground) :

✔️ Good

  • written in ts only
  • enables us to customize everything
  • we'll be able to concentrate fully on user experience we want to provide to end users
  • does not comes with css, we'll have to write our own (probably a good thing, we'll be able to make it tlp like)
  • comes with color: possibility to have color on text/elements
  • it's easy to add plugins and new behaviour

❌ Bad

  • we'll need to write RTE from scratch

📑 wysiwyg needs

  • ✅ Support of preformatted text and inline code
  • ✅ toolbar ("easy" to add our own actions)
  • ✅ formatting (bold, italic, lists, quote, links, code blocks, inline, exposant...)
  • ✅ headings (titles, subtitles, etc)
  • ✅ must not interfer with browsers native capabilities like spell check
  • ✅ tables (including copy/paste)
  • ✅ HTML paste
  • ✅ images (copy/paste and drag n'drop)

other needs who can be supported

  • ✅ anchor/refs, the live editing of Tuleap reference will be possible thru a custom plugin, in POC we reached the state where we can directlly add a new link (by typing art #123, then space key will automatically convert it into a link), algo is not done for editing the link, but the API enables us to replace everything with what we want, it should not be an issue 
  • ❗ keyboards shortcuts, seems customizable, not tested
  • ❌ Markdown support
  • ❌ Support of emojis, but we can implement it
  • ❌ RTE
  • ❌ select text and have the ability to attach a comment to it 
  • ❌ support au diff

Froala :

❌ Bad

  • not open source, didn't see it in my first candidat selection

Etherpad :

❌ Badsee

  • it's a standalone app, can not be included in artidoc

Plate :

✔️ Good

❌ Bad

  • it's in REACT needs to build and maintain an other js framework
  • question about how the collaboration edition is supported, as there is no RTE demo yet

Tiny MCE && tiptap

  • Features we need are not open source

 

Conclusion

  • due to our customization and real time needs we choose to use ProseMirror
  • as described above, we need to write some code in order to have the same feature coverage than ckeditor
  • we will lose the possibility to switch from markdown to html to plain text

MVP to reach ckeditor features

  • having a toolbar, and choose how we display it (note toolbar comes without css, we can customise it tlp like)
  • copy/paste | dnd image
  • references support (type art #123 should create a link, /!\ editing link)
  • save and load data

Identified risks

  • references support
  • table
  • attaching comment to a line/text, we will have same challenges than we had for code mirror in pull request (position of comment, comment at the top/bottom). Plus in term of functional what is a comment? can we close/hide it? can we reply to it ?

Others

  • we should think quickly about which shortcut we re going to support in editor, it comes for "free" for standard toolbar option 
  • how do we handle tooltip for tuleap reference ? (what do we display when we havoer art #123)
Empty
Empty
Status
Artidoc
Done
Development
  • [ ] Does it involves User Interface? 
  • [ ] Are there any mockups?
  • [ ] Are permissions checked?
  • [ ] Does it need Javascript development?
  • [ ] Does it need a forge upgrade bucket?
  • [ ] Does it need to execute things in system events?
  • [ ] Does it impact project creation (templates)?
  • [ ] Is it exploratory?
Empty
Details
#38627
Manuel Vacelet (vaceletm)
2024-11-06 16:40
2024-06-24 11:30
39877

References
Referencing story #38627

Git commit

tuleap/tuleap/stable

ADR on choice of new editor b449ec0eee
chores: rename lib/frontend/editor to lib/frontend/prose-mirror-editor 8c42fb1f97
feat: support drag and drop with prose mirror 1fb636326c
Add bold option in toolbar d1903240f3
Prose mirror - toolbar: Add em to toolbar 0db85bbd79
Prose mirror - toolbar: Add code to toolbar abc13717d2
feat: Have custom yet simple prose-mirror styling ed355102dc
feat: highlight background while editing section 3ab8cce105
Drag and drop multiples files 97d35cd6a9
removes unused nodes.ts 390ba69871
fix: reset list-style-type for section content 838ba05257
Prose mirror - toolbar: add quote into toolbar 9ab5181ec9
feat: Closing editor should stop ongoing file uploads d8909e8fd1
[Issue] When editor is empty, the focus is lost during text input 5c4361f5af
fix: initGettext async in prose-mirror-editor 1a1ea79904
fix: drag and drop fda5308aa4
chore: Fix scss import of prose-mirror-editor in watch f582e7e3ab
Prose mirror - toolbar: Add link to toolbar 43dcb07f74
feat: add drop-cursor plugin af61edf303
feat: disable save button while upload is loading c290c67d65
fix: display border editor and box-shadow hover section footer 19e8f893de
Prose mirror - toolbar: Add list to toolbar 3ff8da4d91
[toolbar] we should not select exact text in order to update a link 9c832eb2cf
feat: add toolbar transform text 1951f770ce
[toolbar] image 172a315985
fix: some types are not properly imported 5a26f87483
feat: have a link popover 1e211d8c99
feat: add upload global store and multiple progress bars 8cc0ff95e5
Minimal reference support 39895753b3
fix: potential content injection in link popover e63b038dde
Click on a reference should open popover link 1c687f5414
HeadingDropDown should not be under footer 8c3ddc1c5a
feat: ability to copy link url adae0fa45a
Load cross references at init 0653f49294
feat: copy xref instead of link url 62613aa47d
fix: first artidoc configuration cbdf45ff82
fix: first artidoc configuration 359976faf3
refactor: move useSectionEditorsCollection and useOpenConfigurationModalBusStore in stores 0b4d1a72f3
refactor: unit test insertion of link popovers 7692d505b7
feat: add notification message and upgrade UX 595e9cf75f
feat: Have a remove link button in links popovers 91abb3fc56
Bump prosemirror-schema-basic e07de86bca
issue: Ctrl + Enter creates an incorrect DOM e2d466bed1
refactor: rethink popover buttons inclusion 8e788bc0b1
feat: add subscript support in prose-mirror editor ffb7a5c3c5
fix: quote icon flickering e6a007169b
feat: add superscript support in prose-mirror editor 7a58c2fc31
feat: Ability to edit links in place 8cda29dc6e
fix: when selection has more than one link, toolbar button should be disabled 58c27b5e1d
fix: when selection has more than a link, unlink should remove all links b8dc4a528f
Introduce monotoolbar with `Bold` b43036ea8a
feat: add automagic link 3b7c9d39a0
feat: Have an edit reference button and a form f47c0de282
fix: @tuleap/prose-mirror-editor should not use vue-tsc 48a4bdaf74
fix: do not display mono-toolbar when in ckeditor mode 6e0f141cff
feat: update cross reference on submit 1be54a5d4e
refactor: have a better folder structure 30c5015d8e
fix: exclude toolbar from component resolution in artidoc 662d793cee
refactor: toolbar buttons should register their own view callbacks 03ea7fe2ff
Use button instead of only an icon for better a11y a082003fde
Add text-elements into toolbar c5f9387c67
fix: toolbar styles should match the mockup's d3053e0a86
Add ScriptsElement into mono toolbar 96565fc432
feat: have an edit|create link button and popover in toolbar 09358fffd7
fix: rename "embedded" to "italic" d4b3e1d2fc
feat: have an unlink button in toolbar f2118c9f02
feat: have an edit|create image button and popover in toolbar a0c06ad6f1
Add ListElements into mono toolbar 77e55c0d88
[issue] reference replacement can go wrong e509f59fdc
fix: toolbar flickering when sticky 3e5e490204
fix: the cursor disappears when a toolbar button is clicked 2d2b6a0e8e
design: apply box-shadow on toolbar when stuck 2fd70ab13f
feat: Heading select in toolbar 7bc298de89
fix: use standard select behavior for heading select e7a4e2d2e0
fix: toolbar should not appear above the TOC 002cb45ebe
feat: wrap buttons together 547ad03ba6
fix: Add missing backtick in fr_FR.po bab01e5b81
feat: Preformatted text in toolbar text-style select 4d261385c5
fix: broken url validation in link and image popovers 4dd2fbd2c0
fix: Use async gettext in prose-mirror-toolbar 16af4b6ed9
fix: change the title of code button 2f9df3012a
fix: Unable to apply heading|preformatted styles on list items dd127774cc
refacto: remove useless custom_hard_break b8666a3292
fix: e2e tests fails on artidoc a3687cedee
fix: list buttons do no work as expected 303e896c54
feat: Disable toolbar when user clicks outside editor or toolbar 9d8648cd12
fix: display a readonly document when user cannot edit it fd41f635eb
fix: remove uploader from list when upload is successful 3dec832078
feat: prosemirror replaces ckeditor b97f018b5c
fix: popover elements not found when toolbar is disconnected 669670e9a5
fix: unable to upload file after adding the field 0a596a2f95
fix: remove editor border 444e49368d
fix: dropdown menu should not appear below the TOC b697b77efa
refactor: stop importing custom_schema everywhere 1f88b05bac
feat: artidoc mono editor 6041a0b1a9
fix: forbid marks in artidoc-section-title 807e37c767
fix: unable to set text style in Chrome 20b17ccd1a
fix: editor content is not saved the right way 5afdffd9cb
fix: dropCursor should not be full black 35ab13b114
feat: Heading 1 becomes Large heading 85a71f587a
feat: Heading 1 becomes Large heading 7d8c0d0ead
fix: be able to insert an image in the middle of some text 8f15648257
fix: Remove extra whitespace for titles 9e746609d4
fix: title of the TOC should be aligned with monotoolbar bee4bc0661
fix: TOC is hidden when there is a platform banner 867ae2562b
feat: Jump back and forth from title to description 50e0130633
fix: patch dropcursor above the title 0c6161172e
fix: Do not incitate user to drop when not allowed 39b7205a64
fix: chrome should indicate that user click on an image bf7a460ee9
feat: artidoc support markdown bloquote 4751ff5298
feat: artidoc support markdown headings 1620d279e9
refactor: artidoc containers height b69e41490c
Cursor can go back into title when user press backspace e6f1eb8c7d
fix: Bug with right arrow after pressing enter from title f0419c7284
fix: enable/disable mono-toolbar according to the current selection. cc68bddc5b
feat: artidoc support markdown bold e5f37dedb0
Referenced by story #38627

Follow-ups

User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes
User avatar
  • Acceptance criteria
    Something went wrong, the follow up content couldn't be loaded
    Only formatting have been changed, you should switch to markup to see the changes