Tuleap 16 est là ! Assistez à l'événement virtuel le 17 octobre à 10h30. Inscrivez-vous ici !

  •  
     
    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
On going
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-09-12 17:13
2024-06-24 11:30
39874

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
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