stable

Clone or download

Read-only

refactor: toolbar buttons should register their own view callbacks

part of story #38627 : Choice of a new Rich Text Editor Problem: Currently the ToolbarBus has a method setView() whose role is to register callbacks to be executed when the editor view is updated. However, the current design forces the toolbar to register all the callbacks at the same time, which forces us to deal with the buttons states oustide of the buttons custom elements, making the toolbar root element complex for no reason. Proposition: ToolbarBus.setView accepts a Partial<ToolbarView> instead of a ToolbarView object. When called, it updates the callback in its current view according to the one provided by each buttons. -- no functional change expected Change-Id: If1fc57bbeb84d859079b4e111d624b0c73f1319e

Modified Files

Name
M lib/frontend/prose-mirror-editor-toolbar/src/elements/buttons/bold.test.ts +37 −23 Go to diff View file
M lib/frontend/prose-mirror-editor-toolbar/src/elements/buttons/bold.ts +18 −4 Go to diff View file
D lib/frontend/prose-mirror-editor-toolbar/src/elements/toolbar-element.test.ts +0 −58 Go to diff View file
M lib/frontend/prose-mirror-editor-toolbar/src/elements/toolbar-element.ts +3 −20 Go to diff View file
M lib/frontend/prose-mirror-editor/src/plugins/toolbar/helper/toolbar-bus.ts +16 −5 Go to diff View file