Closed john-traas closed 1 month ago
Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3000/
:tada: This PR is included in version 37.48.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
There's a risk of the prosemirror adapter becoming too heavy with different parts of the text editor being too tightly coupled.
We should adopt the same approach for extending the adaptor as we do for menu-state tracking, via plugins. This is the way prosemirror expects us to do it and it enables us to keep a good separation of concerns allowing for future development of this tool as and when it's needed.
This PR extracts the menu-state-tracking to a standalone plugin and does the same for handling interactions with the action bar items.
menu-state-tracking-plugin
tracks the state of the editor view to determine if a markType or nodeType is active within the active commands and returns an object of the active menu typesRecord<EditorMenuTypes, boolean>
prosemirror-adapter
updates theActionBarItems
settingselected
to true if the type corresponds with the active types returned by themenu-state-tracking-plugin
menu-action-interaction-plugin
tracks user interactions with the action bar and handles getting the relevant command, creating a transaction, and dispatching the transaction.Fixes https://github.com/Lundalogik/crm-feature/issues/4135
How to test
Bold
should cause theB
menu item to switch to an active state.