Update the document title to include the document name. (#3197)
We now update the `document.title` with the document name. For empty rooms we default back to `tldraw`, just as we have it in `index.html`. ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [ ] `sdk` — Changes the tldraw SDK - [x] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [ ] `bugfix` — Bug fix - [ ] `feature` — New feature - [x] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Release Notes - Use the document name in the `document.title`.
This commit is contained in:
parent
16a28bfd90
commit
d16e06ff40
1 changed files with 8 additions and 0 deletions
|
@ -239,6 +239,14 @@ const DocumentNameEditor = track(function DocumentNameEditor({
|
|||
}
|
||||
}, [documentSettings.name, editor, state.isEditing, state.name, setState])
|
||||
|
||||
useEffect(() => {
|
||||
if (documentSettings.name) {
|
||||
document.title = `${documentSettings.name} · tldraw`
|
||||
} else {
|
||||
document.title = 'tldraw'
|
||||
}
|
||||
}, [documentSettings.name])
|
||||
|
||||
const handleChange = useCallback(
|
||||
(e: ChangeEvent<HTMLInputElement>) => {
|
||||
const value = e.currentTarget.value
|
||||
|
|
Loading…
Reference in a new issue