Skip to content

Refactor: Declare all Content Editor Markdown serializers in a single module

What does this MR do?

It refactors the Content Editor extension modules with the following objectives:

  • Move all the serializer functions declared on each extension module to a single markdown_serializer module.
  • Export a single default value on every extension module that only contains the extended or configured Tiptap extension.
  • Change all the code to use the simpler import statements.

Why are we doing this?

We organized the Content Editor in a way that every extension module would contain every artifact related to a content type, for example: the bold.js module contains the tiptap extension to support bold content and a serializer function that allows converting a piece of bold text into Markdown. The benefit we expected from this organization was a vertical partitioning of the editor functionality into content type modules, i.e. bold.js, heading.js, etc.

However, in practice, we noticed that other artifacts related to a content type should be declared outside the extension module like Vue toolbar controls, node views components, etc. That introduces a lot of inconsistency with our initial approach. We also noticed that the single module approach creates unnecessary complexity in several areas of the Content Editor:

  • We had to create functions to dynamically build the Markdown Serializer config from iterating over all content type modules.
  • Most of the time we just want to import the Tiptap extension module to perform simple tasks like: reading the extension name and setting up test editors. We needed to unpack the module to extract the Tiptap extension and use it which is very unproductive.

This change optimizes for the most common use cases we’ve found over the last months of development.

Screenshots or Screencasts (strongly suggested)

This MR doesn’t introduce user-facing changes.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Enrique Alcántara

Merge request reports

Loading