forked from github/plane
fix: unnecessary focus in editor on swr sync (#4215)
This commit is contained in:
parent
1549f3a808
commit
ec5667194f
@ -112,12 +112,9 @@ export const useEditor = ({
|
||||
editor.commands.setContent(value);
|
||||
const currentSavedSelection = savedSelectionRef.current;
|
||||
if (currentSavedSelection) {
|
||||
editor.view.focus();
|
||||
const docLength = editor.state.doc.content.size;
|
||||
const relativePosition = Math.min(currentSavedSelection.from, docLength - 1);
|
||||
editor.commands.setTextSelection(relativePosition);
|
||||
} else {
|
||||
editor.commands.focus("end");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error syncing editor content with external value:", error);
|
||||
|
Loading…
Reference in New Issue
Block a user