diff --git a/packages/app/src/components/edgeless-toolbar/index.tsx b/packages/app/src/components/edgeless-toolbar/index.tsx index 30a2d43573..00f821e6ba 100644 --- a/packages/app/src/components/edgeless-toolbar/index.tsx +++ b/packages/app/src/components/edgeless-toolbar/index.tsx @@ -24,6 +24,15 @@ const toolbarList1 = [ icon: , toolTip: 'Select', disable: false, + callback: () => { + window.dispatchEvent( + new CustomEvent('affine.switch-mouse-mode', { + detail: { + type: 'default', + }, + }) + ); + }, }, { flavor: 'text', @@ -34,8 +43,19 @@ const toolbarList1 = [ { flavor: 'shape', icon: , - toolTip: 'Shape (coming soon)', - disable: true, + toolTip: 'Shape', + disable: false, + callback: () => { + window.dispatchEvent( + new CustomEvent('affine.switch-mouse-mode', { + detail: { + type: 'shape', + color: 'black', + shape: 'rectangle', + }, + }) + ); + }, }, { flavor: 'sticky', @@ -122,20 +142,23 @@ export const EdgelessToolbar = () => { > - {toolbarList1.map(({ icon, toolTip, flavor, disable }, index) => { - return ( - - { - console.log('flavor', flavor); - }} - > - {icon} - - - ); - })} + {toolbarList1.map( + ({ icon, toolTip, flavor, disable, callback }, index) => { + return ( + + { + console.log('click toolbar button:', flavor); + callback?.(); + }} + > + {icon} + + + ); + } + )}