fix: Flash of content when selecting text on RHS of document (#2981)

fix: Double portal
This commit is contained in:
Tom Moor
2022-01-22 18:10:23 -08:00
committed by GitHub
parent 80c6e57aa3
commit e8c88b3c33
5 changed files with 79 additions and 81 deletions

View File

@@ -1,6 +1,6 @@
import { EditorView } from "prosemirror-view";
import * as React from "react";
import styled, { useTheme } from "styled-components";
import styled from "styled-components";
import { CommandFactory } from "@shared/editor/lib/Extension";
import { MenuItem } from "@shared/editor/types";
import ToolbarButton from "./ToolbarButton";
@@ -14,12 +14,12 @@ type Props = {
};
const FlexibleWrapper = styled.div`
color: ${(props) => props.theme.toolbarItem};
display: flex;
gap: 8px;
`;
function ToolbarMenu(props: Props) {
const theme = useTheme();
const { view, items } = props;
const { state } = view;
@@ -36,13 +36,12 @@ function ToolbarMenu(props: Props) {
const isActive = item.active ? item.active(state) : false;
return (
<Tooltip tooltip={item.tooltip}>
<Tooltip tooltip={item.tooltip} key={index}>
<ToolbarButton
key={index}
onClick={() => item.name && props.commands[item.name](item.attrs)}
active={isActive}
>
<Icon color={theme.toolbarItem} />
<Icon color="currentColor" />
</ToolbarButton>
</Tooltip>
);