Fixed: hasPendingChanges

Fixed: Vertical alignment changing between read/edit
This commit is contained in:
Tom Moor 2017-06-28 23:02:11 -07:00
parent 31f3d72f01
commit e40e372fed
No known key found for this signature in database
GPG Key ID: 495FE29B5F21BD41
2 changed files with 13 additions and 8 deletions

View File

@ -111,8 +111,6 @@ type KeyData = {
render = () => {
return (
<span>
{!this.props.readOnly &&
<ClickablePadding onClick={this.focusAtStart} />}
<Toolbar state={this.state.state} onChange={this.onChange} />
<Editor
key={this.props.starred}

View File

@ -50,7 +50,12 @@ type Props = {
loadDocument = async props => {
await this.props.documents.fetch(props.match.params.id);
if (this.document) this.document.view();
const document = this.document;
if (document) {
this.props.ui.setActiveDocument(document);
document.view();
}
if (this.props.match.params.edit) {
this.props.ui.enableEditMode();
@ -71,12 +76,14 @@ type Props = {
};
onSave = async (redirect: boolean = false) => {
if (!this.document) return;
await this.document.save();
const document = this.document;
if (!document) return;
await document.save();
this.props.ui.disableEditMode();
if (redirect && this.document) {
this.props.history.push(this.document.url);
if (redirect) {
this.props.history.push(document.url);
}
};
@ -90,7 +97,7 @@ type Props = {
onChange = text => {
if (!this.document) return;
this.document.updateData({ text });
this.document.updateData({ text, hasPendingChanges: true });
};
onCancel = () => {