Issue #2337Opened October 17, 2019by navewi0 reactions

[BUG / QUESTION] Deleting default styles does not work

Question

Hello, i'm trying to delete some of the default styles of the blocks. I wrote everything I changed in a plugin.

I used this function to update for example the Text Components style-defaults: editor.DomComponents.addType(.....) seen here: https://grapesjs.com/docs/modules/Components.html#update-component-type

Am I getting this wrong?

Also I can't figure out where the style defaults are written, when I change the style-defaults in Text.js for testing, nothing changes in the editor.

Oh and i'm using the mjml-plugin, maybe this issue is wrong here sorry.

Edit: Okay i figured out "style" works but not "style-default": image

Is this a bug?

Answers (3)

pouyamiralayiOctober 18, 20190 reactions

Hi there! have you tried using setStyle ? cheers.

artfOctober 19, 20190 reactions

I'd expect something like this to work (update style-default)

editor.DomComponents.addType('mj-text', {
	model: {
		defaults: {
			'style-default': {
				// your new styles...
			}
		}
	}
})

Be sure to load your plugin after the mjml one

navewiOctober 21, 20190 reactions

Hello @artf, thanks for your reply. this is the exact same code, that i tried out. This one works if I use "style" instead of "style-default".

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.