Issue #701đź’¬ AnsweredOpened January 2, 2018by austinbiggs1 reactions

Modifying a component in the editor clears the model content

Quick answerby artf❤ 1

Hi Austin, the reason behind your issue it's just because the built-in RTE works differently from a custom one (eg. CKEditor plugin) which just writes all changes inside content. https://github.com/artf/grapesjs/blob/dev/src/dom_components/view/ComponentTextView.js#L67-L90 The default RTE resets its components with a...

Read full answer below ↓

Question

What I'm trying to achieve: I have special "data-" attributes on some of the components I pull into the editor. When one of these is modified, I want to get the value of the "data-" attribute and the new content. I have code listening to when a component is modified. When this event fires, I'm checking the content (work-in-progress). However, when I get the content, it's empty, even though the component isn't... The issue seems to be that instead of modifying the existing component model, a new one is created. editor.on( 'component:update' , function( model ) { console.log( JSON.stringify( mo...

Answers (3)

artf• January 4, 2018

Hi Austin, the reason behind your issue it's just because the built-in RTE works differently from a custom one (eg. CKEditor plugin) which just writes all changes inside content. https://github.com/artf/grapesjs/blob/dev/src/dom_components/view/ComponentTextView.js#L67-L90 The default RTE resets it...

austinbiggs• January 3, 2018

I’ve been digging through more code and from what I can tell, this doesn’t happen in when using the CKEditor plugin (tested using the newsletter demo). However, when using the default RTE it does occur (tested on my own code and the website demo) <sub>Sent with <a href="http://githawk.com">GitHawk<...

lock[bot]• September 18, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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.