Skip to content

Commit

Permalink
fix typescript error
Browse files Browse the repository at this point in the history
  • Loading branch information
coolov committed Jan 25, 2024
1 parent 6ed17da commit ab988e9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions demo/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,15 @@ export function Button(props: {
export default function Menu() {
const state = useEditorState();

const { marks } = state.schema;

const toggleBold = useEditorEventCallback((view) => {
if (!view) return;
const toggleBoldMark = toggleMark(marks["bold"]);
const toggleBoldMark = toggleMark(view.state.schema.marks["bold"]);
toggleBoldMark(view.state, view.dispatch, view);
});

const toggleItalic = useEditorEventCallback((view) => {
if (!view) return;
const toggleBoldMark = toggleMark(marks["em"]);
const toggleBoldMark = toggleMark(view.state.schema.marks["em"]);
toggleBoldMark(view.state, view.dispatch, view);
});

Expand All @@ -59,15 +57,15 @@ export default function Menu() {
<Button
className="bold"
title="Bold (⌘b)"
isActive={isMarkActive(marks["strong"], state)}
isActive={!!state && isMarkActive(state.schema.marks["strong"], state)}
onClick={toggleBold}
>
B
</Button>
<Button
className="italic"
title="Italic (⌘i)"
isActive={isMarkActive(marks["em"], state)}
isActive={!!state && isMarkActive(state.schema.marks["em"], state)}
onClick={toggleItalic}
>
I
Expand Down

0 comments on commit ab988e9

Please sign in to comment.