Fixed: hasPendingChanges
Fixed: Vertical alignment changing between read/edit
This commit is contained in:
parent
31f3d72f01
commit
e40e372fed
|
@ -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}
|
||||
|
|
|
@ -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 = () => {
|
||||
|
|
Reference in New Issue