Issue #2337💬 AnsweredOpened October 17, 2019by navewi0 reactions

Deleting default styles does not work

Quick answerby pouyamiralayi

Hi there! have you tried using setStyle ? cheers.

Read full answer below ↓

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

Answers (3)

pouyamiralayiOctober 18, 2019

Hi there! have you tried using setStyle ? cheers.

artfOctober 19, 2019

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, 2019

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

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.