feat: enable shape mode

This commit is contained in:
himself65
2022-12-16 11:52:28 -06:00
parent 888e0e49ec
commit fb1a2f5136
3 changed files with 63 additions and 34 deletions
+3 -3
View File
@@ -9,10 +9,10 @@
"lint": "next lint"
},
"dependencies": {
"@blocksuite/blocks": "0.3.0-alpha.8",
"@blocksuite/editor": "0.3.0-alpha.8",
"@blocksuite/blocks": "0.3.0-alpha.11",
"@blocksuite/editor": "0.3.0-alpha.11",
"@blocksuite/icons": "^2.0.0",
"@blocksuite/store": "0.3.0-alpha.8",
"@blocksuite/store": "0.3.0-alpha.11",
"@emotion/css": "^11.10.0",
"@emotion/react": "^11.10.4",
"@emotion/server": "^11.10.0",
@@ -24,6 +24,15 @@ const toolbarList1 = [
icon: <SelectIcon />,
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: <ShapeIcon />,
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 = () => {
>
<StyledEdgelessToolbar>
<StyledToolbarWrapper>
{toolbarList1.map(({ icon, toolTip, flavor, disable }, index) => {
return (
<Tooltip key={index} content={toolTip} placement="right-start">
<StyledToolbarItem
disable={disable}
onClick={() => {
console.log('flavor', flavor);
}}
>
{icon}
</StyledToolbarItem>
</Tooltip>
);
})}
{toolbarList1.map(
({ icon, toolTip, flavor, disable, callback }, index) => {
return (
<Tooltip key={index} content={toolTip} placement="right-start">
<StyledToolbarItem
disable={disable}
onClick={() => {
console.log('click toolbar button:', flavor);
callback?.();
}}
>
{icon}
</StyledToolbarItem>
</Tooltip>
);
}
)}
</StyledToolbarWrapper>
<UndoRedo />
</StyledEdgelessToolbar>
+21 -15
View File
@@ -22,10 +22,10 @@ importers:
packages/app:
specifiers:
'@blocksuite/blocks': 0.3.0-alpha.8
'@blocksuite/editor': 0.3.0-alpha.8
'@blocksuite/blocks': 0.3.0-alpha.11
'@blocksuite/editor': 0.3.0-alpha.11
'@blocksuite/icons': ^2.0.0
'@blocksuite/store': 0.3.0-alpha.8
'@blocksuite/store': 0.3.0-alpha.11
'@emotion/css': ^11.10.0
'@emotion/react': ^11.10.4
'@emotion/server': ^11.10.0
@@ -55,10 +55,10 @@ importers:
react-dom: 18.2.0
typescript: 4.8.3
dependencies:
'@blocksuite/blocks': 0.3.0-alpha.8
'@blocksuite/editor': 0.3.0-alpha.8
'@blocksuite/blocks': 0.3.0-alpha.11
'@blocksuite/editor': 0.3.0-alpha.11
'@blocksuite/icons': 2.0.0_w5j4k42lgipnm43s3brx6h3c34
'@blocksuite/store': 0.3.0-alpha.8
'@blocksuite/store': 0.3.0-alpha.11
'@emotion/css': 11.10.0
'@emotion/react': 11.10.4_w5j4k42lgipnm43s3brx6h3c34
'@emotion/server': 11.10.0_@emotion+css@11.10.0
@@ -176,12 +176,13 @@ packages:
to-fast-properties: 2.0.0
dev: false
/@blocksuite/blocks/0.3.0-alpha.8:
resolution: {integrity: sha512-Q7md4N1H0lTMG0nX1PnAdSlTjBfNX4nFLlcX3SrdgjSM9QOu0G6E6OvfHHHCj4SJPnzyHH5xb6Lb0jU9Lpas6Q==}
/@blocksuite/blocks/0.3.0-alpha.11:
resolution: {integrity: sha512-SwOTu9Ph5zsxczzPL0RoSfQKZLrrgEPhXiZycbv+tvsaXSwHq27JALJFh+G+HHP0uJvt/vSYfXzHck+3J1m+4Q==}
dependencies:
'@blocksuite/store': 0.3.0-alpha.8
'@blocksuite/store': 0.3.0-alpha.11
'@tldraw/intersect': 1.8.0
'@tldraw/vec': 1.8.0
highlight.js: 11.7.0
hotkeys-js: 3.10.0
lit: 2.4.0
perfect-freehand: 1.2.0
@@ -193,11 +194,11 @@ packages:
- utf-8-validate
dev: false
/@blocksuite/editor/0.3.0-alpha.8:
resolution: {integrity: sha512-Sx5E69LMZkUcc37q2PLXAnNTHy9okn/UFBfcWG8i5LO/T8QpYJgbllZGJDx7A3qP8Uz+BQyhgI5gp8S/dnra7g==}
/@blocksuite/editor/0.3.0-alpha.11:
resolution: {integrity: sha512-oEcc70bn0lYIhJo7DTHO+4Xx+iLjaLvRYfoQdkImJrgmEZ6WoFafENKRv4rpuFQKa9HFDS1Zf6V349ykATbHzw==}
dependencies:
'@blocksuite/blocks': 0.3.0-alpha.8
'@blocksuite/store': 0.3.0-alpha.8
'@blocksuite/blocks': 0.3.0-alpha.11
'@blocksuite/store': 0.3.0-alpha.11
lit: 2.4.0
marked: 4.1.1
turndown: 7.1.1
@@ -217,8 +218,8 @@ packages:
react: 18.2.0
dev: false
/@blocksuite/store/0.3.0-alpha.8:
resolution: {integrity: sha512-u63FWZSiYID8++tEIaQZ5FSj7NZu9XM2ZdTaTU+7PDEwucK5Gqo8+YrEC9gVl+2jkSW5cp43pxf2kZolUgkyYg==}
/@blocksuite/store/0.3.0-alpha.11:
resolution: {integrity: sha512-udcXVB83Tq3Q2vglAvWb3oPeKTceKIArtG2gSf05ugIbJ2oIlM8h7IpY9DZKofK/Du+5fE3pNxRb8ZhSyI9Apw==}
dependencies:
buffer: 6.0.3
flexsearch: 0.7.21
@@ -2338,6 +2339,11 @@ packages:
dependencies:
function-bind: 1.1.1
/highlight.js/11.7.0:
resolution: {integrity: sha512-1rRqesRFhMO/PRF+G86evnyJkCgaZFOI+Z6kdj15TA18funfoqJXvgPCLSf0SWq3SRfg1j3HlDs8o4s3EGq1oQ==}
engines: {node: '>=12.0.0'}
dev: false
/hoist-non-react-statics/3.3.2:
resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==}
dependencies: