Text disappears if pasted for a second time in text block
@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.
Read full answer below ↓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?
- Open https://grapesjs.com/demo.html and delete all sample sections
- Place one "Text section"
- Open a text editor and type 3 lines of text. Something like this:
Line 1
Line 2
Line 3
- Copy the 3 lines from the text editor
- Go back to GrapesJS demo page and double click the text section just before the word
consecterur(other word would work too) - Press
CTRL+Vto paste the text - Click outside to commit the changes
- Hover your mouse over the
Line 2and notice it is its ownTextelement - Double click on
Line 2just before the2 - Press
CTRL+Vto paste the same 2 lines text - 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":

- 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
consecterurand press CTRL+V to paste the 3 lines and click outside to commit the changes:
- Double click on the second line and press CTRL+V again:

- Now click outside to commit the second paste - the last pasted lines disappear:

Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (4)
@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.
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.
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.
Thanks for reporting this, @varadero.
Great question about Text disappears if pasted for a second time in text block. The recommended approach with GrapesJS is to use the event-driven API.
Start here:
- Check the GrapesJS documentation for your specific module
- Look for the
on()event listener method - Most operations can be achieved by listening to editor and component events
Common patterns:
// Listen for changes
editor.on('change', () => console.log('something changed'));
// Component lifecycle
editor.on('component:mount', (c) => console.log('component ready', c));
editor.on('component:update', (c) => console.log('component updated', c));
If you're still stuck:
- Share a minimal CodeSandbox reproduction
- Include what you've already tried
- Mention your GrapesJS version
- The community is here to help!
Related Questions and Answers
Continue research with similar issue discussions.
Issue #5729
editing/replacing the text inside of a link
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v122 Reproducible demo link https:/...
Issue #5378
Uncaught TypeError: Cannot read properties of undefined (reading 'Canvas') while dragging a component in Layer Manager Panel
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v116.0.5845.97 Reproducible demo li...
Issue #4249
image src won't change in exported HTML
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? chrome 100 Reproducible demo link https://...
Issue #6348
It's possible to drag and drop literally anything inside grapesjs canvas
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome Reproducible demo link https://grap...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.
Browse premium plugins →Related tutorials
In-depth guides on the same topic.
Tutorial
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Tutorial
GrapesJS vs Webflow vs Tilda: What to Choose for Your Business in 2026
Choosing the right website platform in 2026 is no longer just about building a site
Tutorial
GJS Market 2.0 - Donations, Tracking, Labels and Better Product Discovery
We’ve rolled out a new set of GrapesJS marketplace updates across GJS Market, focused on improving how creators distribute products
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.