EdgelessElementToolbarWidget is not extensible
goldsam opened this issue · 1 comments
EdgelessElementToolbarWidget
has hardcoded logic which supports very specific buttons for various block types. This makes it impossible for 3d party library vendors to add support for their own element toolbar buttons and customization.
Instead, it would be desirable to have a service or other other mechanism through which a block could register its own element toolbar buttons and capabilities.
Looks like it was supported after all.
For the benefit of others, the solution (observed in the ai
preset code) is to implement the setup
method of your BlockSpec to handle when EdgelessElementToolbarWidget
is connected and call registerEntry
with your custom toolbar button handler:
blocksuite/packages/presets/src/ai/ai-spec.ts
Lines 94 to 96 in c4af5d1