fix: Bag 'o fixes

Remove menu hover styles on mobile
Fixed duplicate hover+active behavior on editor menus
Fixed editor menus visibly scroll to the top when reopened
Fixed some minor editor spacing issues
Renamed shred routeHelpers -> urlHelpers
This commit is contained in:
Tom Moor
2022-01-25 23:43:11 -08:00
parent 13b8ed58fd
commit 175857753e
21 changed files with 103 additions and 64 deletions

View File

@@ -10,13 +10,9 @@ type BlockMenuProps = Omit<
> &
Required<Pick<Props, "onLinkToolbarOpen" | "embeds">>;
class BlockMenu extends React.Component<BlockMenuProps> {
get items() {
return getMenuItems(this.props.dictionary);
}
clearSearch = () => {
const { state, dispatch } = this.props.view;
function BlockMenu(props: BlockMenuProps) {
const clearSearch = () => {
const { state, dispatch } = props.view;
const parent = findParentNode((node) => !!node)(state.selection);
if (parent) {
@@ -24,27 +20,25 @@ class BlockMenu extends React.Component<BlockMenuProps> {
}
};
render() {
return (
<CommandMenu
{...this.props}
filterable={true}
onClearSearch={this.clearSearch}
renderMenuItem={(item, _index, options) => {
return (
<BlockMenuItem
onClick={options.onClick}
selected={options.selected}
icon={item.icon}
title={item.title}
shortcut={item.shortcut}
/>
);
}}
items={this.items}
/>
);
}
return (
<CommandMenu
{...props}
filterable={true}
onClearSearch={clearSearch}
renderMenuItem={(item, _index, options) => {
return (
<BlockMenuItem
onClick={options.onClick}
selected={options.selected}
icon={item.icon}
title={item.title}
shortcut={item.shortcut}
/>
);
}}
items={getMenuItems(props.dictionary)}
/>
);
}
export default BlockMenu;