Issue Bug Closed

#101726CKEditor5: Whitespace plugin does not highlight all non breaking spaces (nbsp)

Georg Tiefenbrunn 08/22/23, 08:36 updated 09/23/26, 17:11

Description

Paste the following code into a RTE in source editing mode and switch back into WYSIWYG mode:

<h3>
    Visible nbsp
</h3>
<p>
    Lorem&nbsp;i<strong>&nbsp;p&nbsp;</strong>&nbsp;sum
</p>
<p>
    &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; indentation
</p>
<h3>
    Invisible nbsp
</h3>
<p>
    &nbsp;
</p>
<p>
    <br>
    &nbsp;&nbsp;
    <br>
    Lorem impsum&nbsp;
    <br>
    &nbsp;&nbsp;
</p>
<p>
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; indentation
</p>
<p>
    &nbsp;dolor &nbsp;sit &nbsp; amet&nbsp;
</p>
  • nbsp after a whitespace are not marked
  • nbsp before line ending are not marked
  • multiple nbsp after line breaks are not marked

As an editor, I would expect the RTE to mark all   entities.

The HTML code above was copied from a RTE in source editing mode from https://demo.typo3.org/ (TYPO3 12.4.5) from an “Text & Media” element.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 6

  1. Georg Tiefenbrunn commented <span data-processor="relativetime" data-value="2023-08-22T08:48:05+00:00" > 08/22/23, 08:48 </span>

    Some strange behavior in Chrome on macOS:

    1. Paste the code in source editing mode
    2. Switch to WYSIWYG mode and back to source editing mode

    <p>
        <br>
        &nbsp;&nbsp;
        <br>
        Lorem impsum&nbsp;
        <br>
        &nbsp;&nbsp;
    </p>

    … is transformed to

    <p>
        <br>
        &nbsp;&nbsp;&nbsp;
        <br>
        Lorem impsum&nbsp;&nbsp;
        <br>
        &nbsp;&nbsp;
    </p>

    3. Switch to WYSIWYG mode and remove the two marked nbsp.
    4. Switch to source editing mode

    Now the two nbsp which were marked in 3. won’t be marked nor multiplied anymore on editor mode switches.

    <p>
        <br>
        &nbsp;&nbsp;
        <br>
        Lorem impsum&nbsp;
        <br>
        &nbsp;&nbsp;
    </p>
  2. Georg Tiefenbrunn commented <span data-processor="relativetime" data-value="2023-08-24T09:15:19+00:00" > 08/24/23, 09:15 </span>

    This is caused by ckeditor5’s model/view conversion.

    1. Enter 1<space><space>2<space><nbsp>3 into an empty RTE.
    2. Switch to source editing mode

    <p>
        1 &nbsp;2 &nbsp;3
    </p>

    As soon the content is changed (e.g. replace 3 with 4) the model gets updated and the content is changed from 1<\u0020><\u0020>2<\u0020><\u00A0>3 to 1<\u0020><\u0020>2<\u0020><\u0020>3.

  3. Benni Mack commented and changed status New Closed <span data-processor="relativetime" data-value="2026-09-23T17:11:53+00:00" > 09/23/26, 17:11 </span>

    This is a CKEditor issue – see https://github.com/ckeditor/ckeditor5/issues/20241 – we could only do workarounds.