Fixed: hasPendingChanges
Fixed: Vertical alignment changing between read/edit
This commit is contained in:
@ -111,8 +111,6 @@ type KeyData = {
|
|||||||
render = () => {
|
render = () => {
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
{!this.props.readOnly &&
|
|
||||||
<ClickablePadding onClick={this.focusAtStart} />}
|
|
||||||
<Toolbar state={this.state.state} onChange={this.onChange} />
|
<Toolbar state={this.state.state} onChange={this.onChange} />
|
||||||
<Editor
|
<Editor
|
||||||
key={this.props.starred}
|
key={this.props.starred}
|
||||||
|
@ -50,7 +50,12 @@ type Props = {
|
|||||||
|
|
||||||
loadDocument = async props => {
|
loadDocument = async props => {
|
||||||
await this.props.documents.fetch(props.match.params.id);
|
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) {
|
if (this.props.match.params.edit) {
|
||||||
this.props.ui.enableEditMode();
|
this.props.ui.enableEditMode();
|
||||||
@ -71,12 +76,14 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onSave = async (redirect: boolean = false) => {
|
onSave = async (redirect: boolean = false) => {
|
||||||
if (!this.document) return;
|
const document = this.document;
|
||||||
await this.document.save();
|
|
||||||
|
if (!document) return;
|
||||||
|
await document.save();
|
||||||
this.props.ui.disableEditMode();
|
this.props.ui.disableEditMode();
|
||||||
|
|
||||||
if (redirect && this.document) {
|
if (redirect) {
|
||||||
this.props.history.push(this.document.url);
|
this.props.history.push(document.url);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -90,7 +97,7 @@ type Props = {
|
|||||||
|
|
||||||
onChange = text => {
|
onChange = text => {
|
||||||
if (!this.document) return;
|
if (!this.document) return;
|
||||||
this.document.updateData({ text });
|
this.document.updateData({ text, hasPendingChanges: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
onCancel = () => {
|
onCancel = () => {
|
||||||
|
Reference in New Issue
Block a user