How to create a menu item like <strong>
(bold label, hereafter referred to as <strong>
()). Click the Expand drop-down to add a span tag to the selected font and add css properties to it, such as font color/font size. But at the same time, if the parent is a strong tag, to create a new span tag inside it, and cross-line selection also need to be able to handle the <strong>
(that)
You mentioned three different actions:
- Adding a mark—
<span>
—with certain properties to a selection when clicking a menu item - Adding a mark—
<span>
— when the selection is inside of a<strong>
- Adding the mark to a “cross-line selection”, by which I assume you mean a selection that crosses an applied mark’s boundaries (for example, selecting some non-emphasised text as well as the start of some emphasised text, but not the end of it)
All three actions can be performed using toggleMark()
from prosemirror-commands, and you can look at the creation of the menu items for marks in prosemirror-example-setup
to get started on creating your own menu item in a similar fashion.