1

I want to show different editor styles based on one of the post's value in the core/editor store. Let's say, for example, that I've got a setting like, picture_frame in my post meta, that adds gimicky "picture frame" border around all of the content in the post. (Ignore whether this is a good or bad idea, it's just an example). On the front end, I use the_content filter to add the classes I need for CSS. But in Gutenberg, I'm not sure what filter to use. If I dispatch an action to change that value in the editor, like this;

dispatch('core/editor').editPost({
  meta: { _picture_frame: true },
});

I want the styles in the editor to change accordingly. Either by adding a .has-picture-frame class to a parent element, or enqueueing a picture-frame-styles.css stylesheet. But I can't figure out the correct filter for either modifying the editor's classes, or changing which stylesheets are enqueued.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.