fix: Allow removing title via API
fix: Empty document title continously autofocuses closes #3108
This commit is contained in:
@@ -73,7 +73,7 @@ const ContentEditable = React.forwardRef(
|
||||
if (autoFocus) {
|
||||
ref.current?.focus();
|
||||
}
|
||||
});
|
||||
}, [autoFocus, ref]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (value !== ref.current?.innerText) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user