Issue #2049Opened May 30, 2019by benvmatheson1 reactions

[Question]: Can the editor be instructed to ignore a class?

Question

Once the editor creates HTML/CSS we hand it off to another piece of code. That piece of code relies on classes using a predetermined class name to perform actions on the HTML. (switching out placeholders for actual data etc.) If this class is added to an element, once that element is clicked, it attempts to add styles to this class. Is it possible to tell the editor to ignore a class?

Answers (3)

artfJune 13, 20191 reactions

You could place a listener on a new selector

editor.on('selector:add', selector => {
		const name = selector.get('name');

      	if (someConditionForSelectors(name)) {
			selector.set({
				// Can't be seen by the style manager, therefore even by the user
				private: true,
			})
      	}
});
artfMay 31, 20190 reactions

What do you mean "to ignore"? To ignore where? Being available in the style manager or something else?

benvmathesonMay 31, 20190 reactions

Sorry, I was unclear there. When clicking an element/block and proceeding to styling the element, the class is chosen by default. Could this class be deselected by default and hidden from the Classes field?

image

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.