|
@@ -17,7 +17,6 @@ class PageEditorByHackmd extends React.Component {
|
|
|
super(props);
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
this.state = {
|
|
|
- markdown: this.props.pageContainer.state.markdown,
|
|
|
|
|
isInitialized: false,
|
|
isInitialized: false,
|
|
|
isInitializing: false,
|
|
isInitializing: false,
|
|
|
// for error
|
|
// for error
|
|
@@ -47,11 +46,7 @@ class PageEditorByHackmd extends React.Component {
|
|
|
return Promise.reject(new Error('HackmdEditor component has not initialized'));
|
|
return Promise.reject(new Error('HackmdEditor component has not initialized'));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return this.hackmdEditor.getValue()
|
|
|
|
|
- .then((document) => {
|
|
|
|
|
- this.setState({ markdown: document });
|
|
|
|
|
- return document;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ return this.hackmdEditor.getValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -188,7 +183,7 @@ class PageEditorByHackmd extends React.Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// do nothing if contents are same
|
|
// do nothing if contents are same
|
|
|
- if (this.state.markdown === body) {
|
|
|
|
|
|
|
+ if (pageContainer.state.markdown === body) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -336,7 +331,7 @@ class PageEditorByHackmd extends React.Component {
|
|
|
const hackmdUri = this.getHackmdUri();
|
|
const hackmdUri = this.getHackmdUri();
|
|
|
const { pageContainer } = this.props;
|
|
const { pageContainer } = this.props;
|
|
|
const {
|
|
const {
|
|
|
- pageIdOnHackmd, hasDraftOnHackmd,
|
|
|
|
|
|
|
+ markdown, pageIdOnHackmd, hasDraftOnHackmd,
|
|
|
} = pageContainer.state;
|
|
} = pageContainer.state;
|
|
|
|
|
|
|
|
const isPageExistsOnHackmd = (pageIdOnHackmd != null);
|
|
const isPageExistsOnHackmd = (pageIdOnHackmd != null);
|
|
@@ -350,7 +345,7 @@ class PageEditorByHackmd extends React.Component {
|
|
|
ref={(c) => { this.hackmdEditor = c }}
|
|
ref={(c) => { this.hackmdEditor = c }}
|
|
|
hackmdUri={hackmdUri}
|
|
hackmdUri={hackmdUri}
|
|
|
pageIdOnHackmd={pageIdOnHackmd}
|
|
pageIdOnHackmd={pageIdOnHackmd}
|
|
|
- initializationMarkdown={isResume ? null : this.state.markdown}
|
|
|
|
|
|
|
+ initializationMarkdown={isResume ? null : markdown}
|
|
|
onChange={this.hackmdEditorChangeHandler}
|
|
onChange={this.hackmdEditorChangeHandler}
|
|
|
onSaveWithShortcut={(document) => {
|
|
onSaveWithShortcut={(document) => {
|
|
|
this.onSaveWithShortcut(document);
|
|
this.onSaveWithShortcut(document);
|