• I currently have a small plugin that adds formatting options to the classic editor, specifically a hanging indent for citations. It adds a p tag with a class, which is then styled.

    Moving ahead, is this something I should now write as a custom block, or is there a means of adding an option to the rich text editor for all paragraph blocks?

    I believe I have to create a custom block, but the workflow for authors seems clumsy. It used to be they would paste a while lot of paragraphs of citations (usually from Word), highlight them, choose ‘Hanging Indent’ from the formats menu and they were done. It now sounds like they would have to insert a block for each citation and paste the content in one at a time… greatly adding to the amount of work.

    Do I understand that correctly?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Please don’t post in the Alpha/Beta forum unless you’re actually testing the alpha/beta version of WordPress (not a plugin or a theme). It’s meant for bug reports and issues with the Beta ??

    This is a development question and has been moved to Developing with WordPress for you.

    Thread Starter verdonv

    (@verdonv)

    Thanks Mika, my mistake.

    Not all plugins have to create a new block. You should just change your existing code to work with the new editor, modifying whatever is selected.
    I think making a new block would be a mistake.

    Thread Starter verdonv

    (@verdonv)

    Hi @joyously,

    I appreciate the input. The problem is there is nothing in the new editor to modify. My plugin in essence added a new block-level element (like a heading or p or div) to the classic editor’s format menu, which doesn’t exist in the new editor. If I understand the new model, my only choice is to make a custom block. The end result I need is something that will generate this
    `<p class=”hangingIndent”>Some text here … </p>

    and of course register a small stylesheet to support it

    There is a formatting toolbar still. And there is a class already for drop-cap, which is very similar.
    Like you say, if you add a new block, the workflow is not very good. If you implement a way to modify a selection, that is better.

    Thread Starter verdonv

    (@verdonv)

    You’re right. Thanks for the example of the drop cap. My task is exactly the same. I’ll try finding documentation. I thought I had read that that formatting toolbar could not be modified, but I may have misunderstood.

    Thread Starter verdonv

    (@verdonv)

    It took me a while to find, but the Gutenberg RTE can be extended. It wasn’t possible up until the last couple months, but there is an API for this now. There is no documentation yet that I can find, though a project has been started for documentation.

    There is one plugin in the repository that extends the Gutenberg RTE in a couple of ways. It’s a great example.
    https://www.ads-software.com/plugins/advanced-rich-text-tools/

    Here is where the documentation will eventually be developed
    https://github.com/WordPress/gutenberg/issues/11105

    And here is where the conversation occurred leading to the development of the API
    https://github.com/WordPress/gutenberg/issues/4658

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Is this a case for a block?’ is closed to new replies.