Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25769

Refactor how BlockNote editor instance and its features are configured

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 18.10.0-rc-1
    • 17.10.0
    • BlockNote
    • None
    • Unit
    • Unknown

    Description

      The configuration of the BlockNote editor is spread inconsistently over its three layers (the BlockNote WebJar, blocknote-headless and blocknote-react), which makes it hard to integrate the editor correctly and leaves no room for extensions to add their own features:

      • the same information is passed several times, through different channels: the edited document, for instance, reaches the editor as a serialized reference, as the link context, and captured in several callbacks, each with its own fallback when it's missing
      • some options are passed directly while others go through a generic editorProps object, and some are raw BlockNote options, so there is no rule for where a new option belongs
      • generic services, that could be shared by all the editor instances on the page, are wrapped in callbacks and passed to each instance (e.g. the macro and image wizards), instead of being injected from the component container

      This leads to bugs, e.g. two BlockNote fields of the same document edited in realtime are bound to the same shared content, because the name of the editor instance is never passed.

      Proposal

      • configure an editor instance with a single options object, defined once by the lowest layer that uses it: instance-wide options (name, edited document, syntax, language, label, ...) at the top level, and the options of each feature (links, images, macros, ...) grouped under that feature
      • inject the services from the component container, passing only the options that change how they are used, and give them access to the editor instance they act on
      • introduce an extension point that lets a feature (built-in or contributed by an extension) contribute to the editor (blocks, menus, toolbars) and read its own per-instance options

      Attachments

        Issue Links

          Activity

            People

              mflorea Marius Dumitru Florea
              mflorea Marius Dumitru Florea
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: