Custom block styles hook on Structured Text not working?

I’m editing a custom plugin in order to be able to customize how heading & paragraph nodes appear in the Structured Text editor.

I’ve followed this example in the docs in order to use the customBlockStylesForStructuredTextField() hook and tried to update the heading 2 node by doing something like:

  customBlockStylesForStructuredTextField() {
    return [
      {
        id: 'heading-2',
        node: 'heading',
        label: 'Heading 2',
        level: 2,
        appliedStyle: {
          fontSize: '8rem',
        },
      },
    ]
  },

which made no difference, so I tried following the example exactly by doing:

  customBlockStylesForStructuredTextField(field: Field, ctx: FieldIntentCtx) {
    return [
      {
        id: 'emphasized',
        node: 'paragraph',
        label: 'Emphasized',
        appliedStyle: {
          fontFamily: 'Georgia',
          fontStyle: 'italic',
          fontSize: '1.4em',
          lineHeight: '1.2',
        }
      }
    ];
  },

and it made no change to the editor- no difference in italic text, no new “Emphasized” option in the heading/ paragraph dropdown like there is in the video example.

(Moderator note: Removed empty boilerplate text)

Hey @brett,

Sorry about that! This looks like a bug on our side. I’ve reported it to the devs and will let you know as soon as it’s fixed.

1 Like

@brett,

This should be fixed now. Could you please try again? There should be another dropdown next to the main formatting dropdown now, with your custom node styles.

Confirmed this is working now- thanks!

1 Like