Skip to content

Replace TinyMCE #7

@apexdodge

Description

@apexdodge

I have evaluated dozens of HTML WYSIWYG editors and its quite something.

Obviously the two best are TinyMCE and CKEditor. Trix is MIT but disappointing because it lacks the true flexibility we need.

TinyMCE went MIT license for a brief period but changed course and is now no longer MIT licensed for future versions. CKEditor is not open source friendly either.

However, this looks fantastic: https://github.com/ueberdosis/tiptap and is MIT licensed. The catch is that it is headless.

The task:

  • Create a drop-in replacement for wysiwig hotwire.dev controllers.
  • Migrate existing long text to wysiwyg fields
  • Make long text field not formatted

Our current long text field: https://github.com/RaythaHQ/raytha/blob/main/src/Raytha.Web/wwwroot/raytha_admin/js/src/controllers/contentitems/longtext_controller.js
Our current wysiwig field: https://github.com/RaythaHQ/raytha/blob/main/src/Raytha.Web/wwwroot/raytha_admin/js/src/controllers/contentitems/wysiwyg_controller.js

  1. Build the UI on top of TipTap using bootstrap 5 from our current admin template.

I am fine with v1's UI looking somewhat rudimentary with just buttons like this: https://tiptap.dev/docs/examples/basics/default-text-editor but if able to have more toolbar style similar to this: https://www.tiny.cloud/docs/tinymce/latest/full-featured-premium-demo/ all the better.

  1. The toolbar/buttons should be floating / fixed so it doesn't scroll away

  2. Most of the extensions are free: https://tiptap.dev/docs/editor/extensions/overview.

Make sure to enable:

Marks

  • Bold
  • Code
  • Highlight
  • Italic
  • Link
  • Strike
  • Subscript
  • Superscript
  • Text style
  • Underline

Nodes

  • Block quote
  • Bullet list
  • Code block
  • Document
  • Text
  • Hard break
  • Heading
  • Horizontal
  • List item
  • Ordered list
  • Paragraph
  • Table and all table related extensions
  • Youtube

Functionality

  • Character count
  • Color
  • Text align
  • Typography
  1. We need 3 custom extensions to be built
  • Image - we should have the ability to insert an image via URL, or upload a new image and update the dimensions / set text of the image. Appears as a regular image.
  • Video - same for video, insert via URL or upload a video. Appears as an html5 video.
  • File - Upload an arbitrary file in accordance with appsettings.json file upload rules. Can also set the 'link text' Appears as a link.

Note in the future we may enhance these extensions to allow to pick from a media gallery of already uploaded items.

  1. Update long text field.

The long text field should no longer be a formatted field, just a <textarea> field only with nothing else with it. Remove all code connected to Trix editor and the hotwire controller for it. Simplify the code.

  1. Migration
  • We need a migration script to convert any existing long text fields to wysiwig fields
  1. Post your thoughts and analysis after doing all this engineering as to whether this editor can and should be used in OpenWater.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions