fix: Allow removing title via API

fix: Empty document title continously autofocuses
closes #3108
This commit is contained in:
Tom Moor
2022-02-19 09:10:06 -08:00
parent 34c5b60656
commit 64d4462412
2 changed files with 2 additions and 3 deletions

View File

@@ -73,7 +73,7 @@ const ContentEditable = React.forwardRef(
if (autoFocus) {
ref.current?.focus();
}
});
}, [autoFocus, ref]);
React.useEffect(() => {
if (value !== ref.current?.innerText) {

View File

@@ -1009,7 +1009,6 @@ router.post("documents.update", auth(), async (ctx) => {
} = ctx.body;
const editorVersion = ctx.headers["x-editor-version"] as string | undefined;
assertPresent(id, "id is required");
assertPresent(title || text, "title or text is required");
if (append) {
assertPresent(text, "Text is required while appending");
}
@@ -1027,7 +1026,7 @@ router.post("documents.update", auth(), async (ctx) => {
const previousTitle = document.title;
// Update document
if (title) {
if (title !== undefined) {
document.title = title;
}
if (editorVersion) {