Issue #2168💬 AnsweredOpened July 25, 2019by jadejahardipsinh0 reactions

Custom html DOM changes does reflected when saving changes to database

Quick answerby artf

Be sure to use the latest version and try to call sync:content on selected component before calling the desired command, eg.

Read full answer below ↓

Question

I created new toolbar option called text-align using following code In order to make above code work, I added following function into grapes.js file : Due to above code, my changes working in the editor in UI refer: I am getting html of editor using following code : Now, the issue is, in the HTML got using above command, I don't see my formatting changes done using above code. Please help me to fix this issue. Due to this, I can't save changes done using text-align feature into database

Answers (3)

artfAugust 7, 2019

Be sure to use the latest version and try to call sync:content on selected component before calling the desired command, eg.

editor.getSelected().trigger('sync:content');
editor.runCommand('gjs-get-inlined-html')
jadejahardipsinhAugust 7, 2019

@artf, Thanks for the answer. I tried with that but unfortunately not working. I am getting that using following code: I already did this but nothing happens. Please correct me if something wrong. Again, highly appreciate your help on this.

artfAugust 12, 2019

@jadejahardipsinh grapesjs version?

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.