Issue #2918💬 AnsweredOpened July 25, 2020by neon123450 reactions

Textnode is not removed from canvas

快速解答by artf

I don't follow your example, can you illustrate exact steps to reproduce, please?

Read full answer below ↓

Question

代码片段TEXT
Text imported directly to the wrapper is not removed from the canvas with the component. 

To verify one can import simple texts multiple times to the demo and watch how they combine instead of replacing the previous one.

Adding this seems to help:

        editor.DomComponents.addType('textnode', {
            model: {
                removed() {
                    var el = this.getEl();
                    el.parentNode.removeChild(el);
                }
            }
        });

Tested with the demo v0.16.18.

Answers (3)

artfAugust 7, 2020

I don't follow your example, can you illustrate exact steps to reproduce, please?

neon12345August 7, 2020

Go to the newsletter demo at https://grapesjs.com/demo-newsletter-editor.html and use the "Import template" function with simple text like "hello" but no html (or combine it with html and text on the root level). Repeat this and the text on the root level will not be removed but add up on each import.

artfAugust 27, 2020

Thanks @neon12345, I was able to find the issue and it should be fixed in the next release

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

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

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.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.