import { NodeViewWrapper } from "@tiptap/react"; import React from "react"; import styled from "styled-components"; import "katex/dist/katex.min.css"; import { BlockMath } from "react-katex"; import { Save } from "lucide-react"; import Link from "next/link"; import { useEditorProvider } from "@components/Contexts/Editor/EditorContext"; function MathEquationBlockComponent(props: any) { const [equation, setEquation] = React.useState(props.node.attrs.math_equation); const [isEditing, setIsEditing] = React.useState(true); const editorState = useEditorProvider() as any; const isEditable = editorState.isEditable; const handleEquationChange = (event: React.ChangeEvent) => { setEquation(event.target.value); props.updateAttributes({ math_equation: equation, }); }; const saveEquation = () => { props.updateAttributes({ math_equation: equation, }); //setIsEditing(false); }; return ( {equation} {isEditing && isEditable && ( <> Please refer to this guide for supported TeX functions )} ); } export default MathEquationBlockComponent; const MathEqWrapper = styled.div` `; const EditBar = styled.div` display: flex; justify-content: flex-end; margin-top: 10px; background-color: white; border-radius: 10px; padding: 5px; color: #5252528d; align-items: center; justify-content: space-between; height: 50px; border: solid 1px #52525224; button { margin-left: 10px; margin-right: 7px; cursor: pointer; border: none; background: none; font-size: 14px; color: #494949; } input { border: none; background: none; font-size: 14px; color: #494949; width: 100%; font-family: "DM Sans", sans-serif; padding-left: 10px; &:focus { outline: none; } &::placeholder { color: #49494936; } } `;