feat: Editable titles in sidebar (#1544)

* feat/editable-titles

* feat: Double click to edit titles in the sidebar

* Take into account policies

* fix: Title update on another client

* Improved styling
This commit is contained in:
Tom Moor
2020-09-15 18:01:40 -07:00
committed by GitHub
parent ab3613af48
commit b3b71d2dc7
6 changed files with 152 additions and 19 deletions

View File

@@ -75,16 +75,10 @@ class DocumentScene extends React.Component<Props> {
@observable isDirty: boolean = false;
@observable isEmpty: boolean = true;
@observable moveModalOpen: boolean = false;
@observable lastRevision: number;
@observable title: string;
@observable lastRevision: number = this.props.document.revision;
@observable title: string = this.props.document.title;
getEditorText: () => string = () => this.props.document.text;
constructor(props) {
super();
this.title = props.document.title;
this.lastRevision = props.document.revision;
}
componentDidMount() {
this.updateIsDirty();
this.updateBackground();
@@ -112,10 +106,13 @@ class DocumentScene extends React.Component<Props> {
}
}
if (document.injectTemplate) {
this.isDirty = true;
if (!this.isDirty && document.title !== this.title) {
this.title = document.title;
}
if (document.injectTemplate) {
document.injectTemplate = false;
this.isDirty = true;
}
this.updateBackground();