forked from github/plane
removed console logs and improved structure
This commit is contained in:
parent
d714079c1c
commit
2ff953896d
@ -1,5 +1,10 @@
|
|||||||
import { useEditor as useCustomEditor, Editor } from "@tiptap/react";
|
import { useEditor as useCustomEditor, Editor } from "@tiptap/react";
|
||||||
import { useImperativeHandle, useRef, MutableRefObject, useEffect } from "react";
|
import {
|
||||||
|
useImperativeHandle,
|
||||||
|
useRef,
|
||||||
|
MutableRefObject,
|
||||||
|
useEffect,
|
||||||
|
} from "react";
|
||||||
import { CoreReadOnlyEditorExtensions } from "../../ui/read-only/extensions";
|
import { CoreReadOnlyEditorExtensions } from "../../ui/read-only/extensions";
|
||||||
import { CoreReadOnlyEditorProps } from "../../ui/read-only/props";
|
import { CoreReadOnlyEditorProps } from "../../ui/read-only/props";
|
||||||
import { EditorProps } from "@tiptap/pm/view";
|
import { EditorProps } from "@tiptap/pm/view";
|
||||||
@ -29,10 +34,8 @@ export const useReadOnlyEditor = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const hasIntiliazedContent = useRef(false);
|
const hasIntiliazedContent = useRef(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (editor && !value && !hasIntiliazedContent.current) {
|
if (editor && !value && !hasIntiliazedContent.current) {
|
||||||
console.log("setting content");
|
|
||||||
editor.commands.setContent(value);
|
editor.commands.setContent(value);
|
||||||
hasIntiliazedContent.current = true;
|
hasIntiliazedContent.current = true;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,6 @@ export const IssueDescriptionForm: FC<IssueDetailsProps> = (props) => {
|
|||||||
|
|
||||||
const [localValue, setLocalValue] = useState("");
|
const [localValue, setLocalValue] = useState("");
|
||||||
const nameValue = watch("name");
|
const nameValue = watch("name");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (localValue === "" && nameValue !== "") {
|
if (localValue === "" && nameValue !== "") {
|
||||||
setLocalValue(nameValue);
|
setLocalValue(nameValue);
|
||||||
|
Loading…
Reference in New Issue
Block a user