I'm trying coding follow this :
https://github.com/ianstormtaylor/slate/blob/main/site/examples/hovering-toolbar.tsx
IDE tips:
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Omit<BaseText, "text">'. No index signature with a parameter of type 'string' was found on type 'Omit<BaseText, "text">'.
I seem to sense that I should change the type of 'format', but I've tried many types and they don't work correctly.
Here is the DEMO:
const isFormatActive = (editor:ReactEditor, format: string) => {
const [match] = Editor.nodes(editor, {
match: node => node[format] === true,
mode: "all",
});
return !!match;
}