Fix file loading, saving and navigation issues

This commit is contained in:
2024-10-05 23:38:35 +02:00
parent 6406265df6
commit cf4378edf6
4 changed files with 105 additions and 61 deletions

View File

@@ -12,8 +12,6 @@ const Editor = ({ content, handleContentChange, handleSave, selectedFile }) => {
const editorRef = useRef();
const viewRef = useRef();
console.log('Editor content:', content);
useEffect(() => {
const handleEditorSave = (view) => {
handleSave(selectedFile, view.state.doc.toString());
@@ -72,7 +70,7 @@ const Editor = ({ content, handleContentChange, handleSave, selectedFile }) => {
return () => {
view.destroy();
};
}, [selectedFile, settings.theme, handleContentChange, handleSave]);
}, [settings.theme, handleContentChange]);
useEffect(() => {
if (viewRef.current && content !== viewRef.current.state.doc.toString()) {