Skip to content
Snippets Groups Projects

Support defining text nodes directly in the root document

Merged Enrique Alcántara requested to merge fix-direct-text-nodes-in-document into master
All threads resolved!

What does this MR do and why?

  • NOTICE: This change is behind a the preserve_unchanged_markdown feature flag.
  • Context: This change is part of a larger effort to preserve unchanged Markdown in the Content Editor. For this effort, we need to support client-side parsing of Markdown content.

This MR fixes a bug in the Content Editor’s client-side Markdown parser where text nodes that are direct children of the root document make the AST to ProseMirror document fail. The bug is fixed by wrapping those text nodes in a paragraph. This is what a text node looks like when it is a direct child of the root node:

{
  "type": "root",
  "children": [
    {
      "type": "html",
      "value": "<i class=\"foo\">\n  *bar*\n</i>",
      "position": {
        "start": {
          "line": 1,
          "column": 1,
          "offset": 0
        },
        "end": {
          "line": 3,
          "column": 5,
          "offset": 28
        }
      }
    }
  ],
}

That AST represents the Markdown snippet in example 164 of the Commonmark spec: https://spec.commonmark.org/0.30/#example-164

Screenshots or screen recordings

Before After
Before the fix demo After the fix demo

How to set up and validate locally

  1. Edit or create a Wiki page
  2. Enter the following Markdown snippet in the Classic Markdown Editor. The example comes from the Markdown spec: https://spec.commonmark.org/0.30/#example-164
    <i class="foo">
      *bar*
    </i>
  3. Switch to rich text mode. You should see the same result as the screenshots above.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Enrique Alcántara

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Enrique Alcántara
  • Bundle size analysis [beta]

    This compares changes in bundle size for entry points between the commits 9dc66dd1 and 188d97ee

    :sparkles: Special assets

    Entrypoint / Name Size before Size after Diff Diff in percent
    average 3.46 MB 3.46 MB - 0.0 %
    mainChunk 1.94 MB 1.94 MB - 0.0 %

    Note: We do not have exact data for 9dc66dd1. So we have used data from: b1f0ef03.
    The intended commit has no webpack pipeline, so we chose the last commit with one before it.

    Please look at the full report for more details


    Read more about how this report works.

    Generated by :no_entry_sign: Danger

  • Enrique Alcántara changed title from Allow text nodes inside the root document to Support defining text nodes directly in the root document

    changed title from Allow text nodes inside the root document to Support defining text nodes directly in the root document

  • Enrique Alcántara changed the description

    changed the description

  • requested review from @thomasrandolph

  • Enrique Alcántara
  • Allure report

    allure-report-publisher generated test report!

    review-qa-blocking: :exclamation: test report for 188d97ee

    expand test summary
    +-------------------------------------------------------------------+
    |                          suites summary                           |
    +----------------------+--------+--------+---------+-------+--------+
    |                      | passed | failed | skipped | flaky | result |
    +----------------------+--------+--------+---------+-------+--------+
    | Plan                 | 41     | 0      | 1       | 41    | ❗     |
    | Verify               | 12     | 0      | 1       | 12    | ❗     |
    | Manage               | 36     | 0      | 2       | 38    | ❗     |
    | Create               | 23     | 0      | 2       | 23    | ❗     |
    | Package              | 0      | 0      | 1       | 0     | ➖     |
    | Protect              | 2      | 0      | 0       | 2     | ❗     |
    | Version sanity check | 0      | 0      | 1       | 0     | ➖     |
    | Configure            | 0      | 0      | 1       | 0     | ➖     |
    +----------------------+--------+--------+---------+-------+--------+
    | Total                | 114    | 0      | 9       | 116   | ❗     |
    +----------------------+--------+--------+---------+-------+--------+
  • Setting label(s) devopscreate sectiondev based on ~"group::editor".

  • Thomas Randolph approved this merge request

    approved this merge request

  • Thomas Randolph requested review from @xanf and removed review request for @thomasrandolph

    requested review from @xanf and removed review request for @thomasrandolph

  • :wave: @thomasrandolph, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.

    For more info, please refer to the following links:

  • Illya Klymov resolved all threads

    resolved all threads

  • Illya Klymov approved this merge request

    approved this merge request

  • Illya Klymov enabled an automatic merge when the pipeline for 96a484cc succeeds

    enabled an automatic merge when the pipeline for 96a484cc succeeds

  • Enrique Alcántara aborted the automatic merge because source branch was updated

    aborted the automatic merge because source branch was updated

  • Enrique Alcántara added 113 commits

    added 113 commits

    Compare with previous version

  • mentioned in commit 7dc2ba2c

  • added workflowstaging label and removed workflowcanary label

  • Please register or sign in to reply
    Loading