Quill: The "Blank space" before and after a string is ignored when pasting

Created on 10 Oct 2017  路  3Comments  路  Source: quilljs/quill

From: mozilla/notes#262

[Affected versions]:

  • Firefox Notes 1.8.0dev
  • Firefox 55 and up

[Affected Platforms]:

  • All Windows
  • All Mac
  • All Linux

[Prerequisites]:

  • Have a Firefox profile with the latest "Firefox Notes" add-on version (1.8.0dev) installed.

[Steps to reproduce]:

  1. Open the browser with the profiles from prerequisites.
  2. Write a string in the sidebar an press the space key (e.g. "Test ").
  3. Select and copy all content from the sidebar.
  4. Paste the copied string in the "Notes" sidebar and observe the behavior.

[Expected result]:

  • The string from step 2 is pasted (space included).

[Actual result]:

  • Space character is not pasted.

[Notes]:

  • The issue is also reproducible with the TxP. version of "Firefox Notes"
  • If the "Blank space" between two characters is copied and pasted without any issues.
  • Attached a screen recording of the issue:
    space
bug firefox

Most helpful comment

I tried this solution:

.ql-editor {
     white-space: normal !important;
}

it seems fixed this problem, coz this style rule will turn every space key stroke into  [space] in the html. (there is a space in  [space], example below)

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fdfsdfdsf</p>

but, when you put content that contains &nbsp;[space] in the editor with dangerouslyPasteHtml, the &nbsp;[space] will become &nbsp; the ending space is removed. example below:

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fdfsdfdsf</p>

Is there any solution for this, can I turn this remove-every-space feature off?

thx @jhchen @byronm

All 3 comments

Hi, is there any solution for this issue or that issue #1751 @jhchen

I tried this solution:

.ql-editor {
     white-space: normal !important;
}

it seems fixed this problem, coz this style rule will turn every space key stroke into &nbsp;[space] in the html. (there is a space in &nbsp;[space], example below)

<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fdfsdfdsf</p>

but, when you put content that contains &nbsp;[space] in the editor with dangerouslyPasteHtml, the &nbsp;[space] will become &nbsp; the ending space is removed. example below:

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fdfsdfdsf</p>

Is there any solution for this, can I turn this remove-every-space feature off?

thx @jhchen @byronm

i already tried white-space:normal , but its not working

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stas-kh picture stas-kh  路  3Comments

visore picture visore  路  3Comments

Kivylius picture Kivylius  路  3Comments

eamodio picture eamodio  路  3Comments

kheraud picture kheraud  路  3Comments