GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.4k stars 4.06k forks source link

BUG: Text disappears if pasted for a second time in text block #4195

Closed varadero closed 2 years ago

varadero commented 2 years ago

GrapesJS version

What browser are you using?

Chrome 99

Reproducible demo link

https://grapesjs.com/demo.html

Describe the bug

How to reproduce the bug?

  1. Open https://grapesjs.com/demo.html and delete all sample sections
  2. Place one "Text section"
  3. Open a text editor and type 3 lines of text. Something like this:
    Line 1
    Line 2
    Line 3
  4. Copy the 3 lines from the text editor
  5. Go back to GrapesJS demo page and double click the text section just before the word consecterur (other word would work too)
  6. Press CTRL+V to paste the text
  7. Click outside to commit the changes
  8. Hover your mouse over the Line 2 and notice it is its own Text element
  9. Double click on Line 2 just before the 2
  10. Press CTRL+V to paste the same 2 lines text
  11. Click outside to commit the changes

What is the expected behavior? The text that was pasted the second time should be kept where it was pasted

What is the current behavior? The text that was pasted the second time disappears

If is necessary to execute some code in order to reproduce the bug, paste it here below:

// your code here

Screenshots of the steps:

Code of Conduct

varadero commented 2 years ago

I can confirm that this problem occurs only with Grapesjs 0.18.3 - I downgraded to 0.18.2 and the problem does not occur. Older versions are OK too.

jmaks1 commented 2 years ago

@artf The problem is relevant to the latest version. (v0.19.4)

The bug occurs if you copy and paste a nested component while editing text. A regular paste (cmd + v) copies all html, including id, and after removing focus, html with identical id is deleted.

jmaks1 commented 2 years ago

I can confirm that this problem occurs only with Grapesjs 0.18.3 - I downgraded to 0.18.2 and the problem does not occur. Older versions are OK too.

in version 0.18.2, nested components were not created inside the text.

MaxaTech commented 2 years ago

@artf +1

@artf The problem is relevant to the latest version. (v0.19.4)

The bug occurs if you copy and paste a nested component while editing text. A regular paste (cmd + v) copies all html, including id, and after removing focus, html with identical id is deleted.