Issue #4195Opened March 15, 2022by varadero1 reactions

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

Question

GrapesJS version

  • I confirm to use the latest version of GrapesJS

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
  1. Copy the 3 lines from the text editor
  2. Go back to GrapesJS demo page and double click the text section just before the word consecterur (other word would work too)
  3. Press CTRL+V to paste the text
  4. Click outside to commit the changes
  5. Hover your mouse over the Line 2 and notice it is its own Text element
  6. Double click on Line 2 just before the 2
  7. Press CTRL+V to paste the same 2 lines text
  8. 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:

  • Go to https://grapesjs.com/demo.html and delete all sample sections. Put one "Text section": image
  • Open text editor, type 3 lines and copy them. Double click on the text in the text section and move the caret just before the word consecterur and press CTRL+V to paste the 3 lines and click outside to commit the changes: image
  • Double click on the second line and press CTRL+V again: image
  • Now click outside to commit the second paste - the last pasted lines disappear: image

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (3)

jmaks1June 23, 20221 reactions

@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.

varaderoMarch 15, 20220 reactions

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.

jmaks1June 23, 20220 reactions

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.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.