Skip to content

Commit

Permalink
feat(react-tables): expose split and merge in the dropdown menu (#1897)
Browse files Browse the repository at this point in the history
  • Loading branch information
whawker committed Oct 6, 2022
1 parent 8e33d89 commit 64fa279
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/thick-badgers-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@remirror/extension-react-tables': patch
'@remirror/styles': patch
'@remirror/theme': patch
---

Expose the ability to split and merge cells in the default React tables menu
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ const DefaultTableCellMenuButton: React.FC<TableCellMenuComponentProps> = ({ set
interface DefaultTableCellMenuItemProps {
label: string;
onClick: () => void;
disabled?: boolean;
}
const DefaultTableCellMenuItem: React.FC<DefaultTableCellMenuItemProps> = (props) => (
<button onClick={props.onClick} className={ComponentsTheme.MENU_ITEM}>
<button disabled={props.disabled} onClick={props.onClick} className={ComponentsTheme.MENU_ITEM}>
{props.label}
</button>
);
Expand Down Expand Up @@ -114,7 +115,16 @@ const DefaultTableCellMenuPopup: React.FC<TableCellMenuComponentProps> = ({
label='Add column after'
onClick={handleClick(commands.addTableColumnAfter)}
/>

<DefaultTableCellMenuItem
label='Merge cells'
onClick={handleClick(commands.mergeTableCells)}
disabled={!commands.mergeTableCells.enabled()}
/>
<DefaultTableCellMenuItem
label='Split cells'
onClick={handleClick(commands.splitTableCell)}
disabled={!commands.splitTableCell.enabled()}
/>
<DefaultTableCellMenuItem
label='Remove column'
onClick={handleClick(commands.deleteTableColumn)}
Expand Down
4 changes: 4 additions & 0 deletions packages/remirror__styles/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ button:active .remirror-menu-pane-shortcut,
color: var(--rmr-color-active-primary-text) !important;
}

.remirror-menu-item:disabled {
opacity: 0.5;
}

.remirror-menu-item-row {
padding: 0 var(--rmr-space-2);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/remirror__styles/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ button:active .remirror-menu-pane-shortcut,
color: var(--rmr-color-active-primary-text) !important;
}

.remirror-menu-item:disabled {
opacity: 0.5;
}

.remirror-menu-item-row {
padding: 0 var(--rmr-space-2);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/remirror__styles/src/dom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ export const componentsStyledCss: ReturnType<typeof css> = css`
color: var(--rmr-color-active-primary-text) !important;
}
.remirror-menu-item:disabled {
opacity: 0.5;
}
.remirror-menu-item-row {
padding: 0 var(--rmr-space-2);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/remirror__styles/src/emotion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,10 @@ export const componentsStyledCss: ReturnType<typeof css> = css`
color: var(--rmr-color-active-primary-text) !important;
}
.remirror-menu-item:disabled {
opacity: 0.5;
}
.remirror-menu-item-row {
padding: 0 var(--rmr-space-2);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/remirror__styles/src/styled-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ export const componentsStyledCss: ReturnType<typeof css> = css`
color: var(--rmr-color-active-primary-text) !important;
}
.remirror-menu-item:disabled {
opacity: 0.5;
}
.remirror-menu-item-row {
padding: 0 var(--rmr-space-2);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/remirror__theme/src/components-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ export const MENU_ITEM = css`
background-color: ${primaryActive} !important;
color: ${primaryActiveText} !important;
}
&:disabled {
opacity: 0.5;
}
`;

export const MENU_ITEM_ROW = css`
Expand Down

1 comment on commit 64fa279

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://remirror.io as production
🚀 Deployed on https://633efddccd26a21db503814f--remirror.netlify.app

Please sign in to comment.