From 6ba04f47316cc7428fa94601da3bb90d2511dfba Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Mon, 6 Mar 2023 16:43:33 +0500 Subject: [PATCH] editor: move cell properties button outside of table settings this fixes #1410 --- .../src/toolbar/components/more-tools.tsx | 5 +- packages/editor/src/toolbar/icons.ts | 6 +- .../editor/src/toolbar/tool-definitions.ts | 1 + packages/editor/src/toolbar/tools/table.tsx | 66 ++++++++++--------- 4 files changed, 42 insertions(+), 36 deletions(-) diff --git a/packages/editor/src/toolbar/components/more-tools.tsx b/packages/editor/src/toolbar/components/more-tools.tsx index 8b3693fb2..5b34f84d9 100644 --- a/packages/editor/src/toolbar/components/more-tools.tsx +++ b/packages/editor/src/toolbar/components/more-tools.tsx @@ -32,9 +32,10 @@ type MoreToolsProps = ToolProps & { tools: ToolId[]; autoCloseOnUnmount?: boolean; autoOpen?: boolean; + group?: string; }; export function MoreTools(props: MoreToolsProps) { - const { popupId, editor, tools, autoCloseOnUnmount, autoOpen } = props; + const { popupId, editor, tools, autoCloseOnUnmount, autoOpen, group } = props; const toolbarLocation = useToolbarLocation(); const isBottom = toolbarLocation === "bottom"; const buttonRef = useRef(null); @@ -51,7 +52,7 @@ export function MoreTools(props: MoreToolsProps) { /> { - return Math.max(1, borderWidth - 1); - }, [borderWidth]); + return Math.max(1, borderWidthAsNumber.current - 1); + }, [borderWidthAsNumber]); const increaseBorderWidth = useCallback(() => { - return Math.min(10, borderWidth + 1); - }, [borderWidth]); + return Math.min(10, borderWidthAsNumber.current + 1); + }, [borderWidthAsNumber]); return ( - - - Border width: - - - editor.current?.commands.setCellAttribute( - "borderWidth", - decreaseBorderWidth() - ) - } - onIncrease={() => - editor.current?.commands.setCellAttribute( - "borderWidth", - increaseBorderWidth() - ) - } - onReset={() => - editor.current?.commands.setCellAttribute("borderWidth", 1) - } - value={borderWidth + "px"} - /> - + + editor.current?.commands.setCellAttribute( + "borderWidth", + decreaseBorderWidth() + ) + } + onIncrease={() => + editor.current?.commands.setCellAttribute( + "borderWidth", + increaseBorderWidth() + ) + } + onReset={() => + editor.current?.commands.setCellAttribute("borderWidth", 1) + } + value={borderWidth + "px"} + /> ); }