-
-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Table row/column extension UI (#1172)
* Added buttons to extend table rows/columns * Added proper extend button implementations * Fixed table handle menu buttons not preserving column widths * Implemented PR feedback * Implemented PR feedback * Cleaned up code * Updated test snapshots & fixes * Added unit tests for column widths * remaining todos * prosemirror-tables upgrade * show buttons when to right / bottom of table * fix lint * fix names * fix small bugs * fix drag handle * fix safari support (will require prosemirror-tables upgrade * add comment * fix safari --------- Co-authored-by: yousefed <[email protected]>
- Loading branch information
1 parent
8867e64
commit a5e82dd
Showing
53 changed files
with
2,186 additions
and
271 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Button as AriakitButton } from "@ariakit/react"; | ||
|
||
import { assertEmpty, mergeCSSClasses } from "@blocknote/core"; | ||
import { ComponentProps } from "@blocknote/react"; | ||
import { forwardRef } from "react"; | ||
|
||
export const ExtendButton = forwardRef< | ||
HTMLButtonElement, | ||
ComponentProps["TableHandle"]["ExtendButton"] | ||
>((props, ref) => { | ||
const { children, className, onMouseDown, onClick, ...rest } = props; | ||
|
||
// false, because rest props can be added by mantine when button is used as a trigger | ||
// assertEmpty in this case is only used at typescript level, not runtime level | ||
assertEmpty(rest, false); | ||
|
||
return ( | ||
<AriakitButton | ||
className={mergeCSSClasses( | ||
"bn-ak-button bn-ak-secondary", | ||
className || "" | ||
)} | ||
ref={ref} | ||
onMouseDown={onMouseDown} | ||
onClick={onClick} | ||
{...rest}> | ||
{children} | ||
</AriakitButton> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.