Skip to content

Adding a span to an element of type flie does not take effect #1155

Closed
@Ambercssa

Description

@Ambercssa

`import {
useBlockNoteEditor,
useComponentsContext,
useEditorContentOrSelectionChange,
createReactStyleSpec
} from "@blocknote/react";
import "@blocknote/mantine/style.css";
import { useState } from "react";

export const enableDownload = createReactStyleSpec(
{
type: "enableDownload",
propSchema: "string",
},
{
render: (props) => {
console.log(props)
return (

)
},
}
);

export function EnableDownload() {
const editor = useBlockNoteEditor();
const Components = useComponentsContext();
const [isSelected, setIsSelected] = useState(
editor.getActiveStyles().enableDownload === "open"
);
useEditorContentOrSelectionChange(() => {
setIsSelected(
editor.getActiveStyles().enableDownload === "open"
);
}, editor);

return (
<Components.FormattingToolbar.Button
mainTooltip={"enableDownload"}
onClick={() => {
editor.toggleStyles({
enableDownload: 'open',
})
}}
isSelected={isSelected}>
enableDownload
</Components.FormattingToolbar.Button>
);
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions