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 singlemarkdown_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
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
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