-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: finalize table feature for story markdown editor and viewer
- Loading branch information
Showing
9 changed files
with
161 additions
and
665 deletions.
There are no files selected for viewing
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,69 @@ | ||
import { ChevronDownIcon } from '@chakra-ui/icons' | ||
import { | ||
IconButton, | ||
Menu, | ||
MenuButton, | ||
MenuItem, | ||
MenuItemProps, | ||
MenuList, | ||
VStack, | ||
} from '@chakra-ui/react' | ||
import { useCommands } from '@remirror/react' | ||
import { useTranslation } from 'react-i18next' | ||
|
||
export const TableCellMenuComponent = () => { | ||
const { t } = useTranslation() | ||
const commands = useCommands() | ||
|
||
const ModifiedMenuItem = (props: MenuItemProps) => { | ||
return ( | ||
<MenuItem | ||
paddingX="10px" | ||
paddingY="5px" | ||
_hover={{ bg: 'neutral.200' }} | ||
{...props} | ||
/> | ||
) | ||
} | ||
|
||
return ( | ||
<Menu> | ||
<MenuButton | ||
mr="5px" | ||
size="sm" | ||
as={IconButton} | ||
icon={<ChevronDownIcon />} | ||
border="1px solid" | ||
borderRadius="4px" | ||
borderColor="neutral.200" | ||
_hover={{ color: 'primary.400', borderColor: 'primary.400' }} | ||
/> | ||
<MenuList | ||
as={VStack} | ||
bg="neutral.0" | ||
border="1px solid" | ||
borderColor="neutral.200" | ||
borderRadius={'4px'} | ||
> | ||
<ModifiedMenuItem onClick={() => commands.addTableRowBefore()}> | ||
{t('Add row above')} | ||
</ModifiedMenuItem> | ||
<ModifiedMenuItem onClick={() => commands.addTableRowAfter()}> | ||
{t('Add row below')} | ||
</ModifiedMenuItem> | ||
<ModifiedMenuItem onClick={() => commands.addTableColumnBefore()}> | ||
{t('Add column left')} | ||
</ModifiedMenuItem> | ||
<ModifiedMenuItem onClick={() => commands.addTableColumnAfter()}> | ||
{t('Add column right')} | ||
</ModifiedMenuItem> | ||
<ModifiedMenuItem onClick={() => commands.deleteTableColumn()}> | ||
{t('Remove column')} | ||
</ModifiedMenuItem> | ||
<ModifiedMenuItem onClick={() => commands.deleteTableRow()}> | ||
{t('Remove row')} | ||
</ModifiedMenuItem> | ||
</MenuList> | ||
</Menu> | ||
) | ||
} |
This file was deleted.
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
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
Oops, something went wrong.