|
|
@@ -21,6 +21,7 @@ export default class PageEditor extends React.Component {
|
|
|
markdown: this.props.markdown,
|
|
|
isUploadable,
|
|
|
isUploadableFile,
|
|
|
+ editorTheme: this.props.editorTheme,
|
|
|
};
|
|
|
|
|
|
this.setCaretLine = this.setCaretLine.bind(this);
|
|
|
@@ -61,11 +62,11 @@ export default class PageEditor extends React.Component {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * set theme
|
|
|
- * @param {string} theme name
|
|
|
+ * set theme (used from the outside)
|
|
|
+ * @param {string} theme theme name
|
|
|
*/
|
|
|
- setEditorTheme(name) {
|
|
|
- this.refs.editor.setTheme(name);
|
|
|
+ setEditorTheme(theme) {
|
|
|
+ this.setState({ editorTheme: theme });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -190,6 +191,9 @@ export default class PageEditor extends React.Component {
|
|
|
return top;
|
|
|
};
|
|
|
|
|
|
+ /*
|
|
|
+ * methods for draft
|
|
|
+ */
|
|
|
restoreDraft() {
|
|
|
// restore draft when the first time to edit
|
|
|
const draft = this.props.crowi.findDraft(this.props.pagePath);
|
|
|
@@ -285,6 +289,7 @@ export default class PageEditor extends React.Component {
|
|
|
<Editor ref="editor" value={this.state.markdown}
|
|
|
isUploadable={this.state.isUploadable}
|
|
|
isUploadableFile={this.state.isUploadableFile}
|
|
|
+ theme={this.state.editorTheme}
|
|
|
onScroll={this.onEditorScroll}
|
|
|
onChange={this.onMarkdownChanged}
|
|
|
onSave={this.onSave}
|
|
|
@@ -306,4 +311,5 @@ PageEditor.propTypes = {
|
|
|
revisionId: PropTypes.string,
|
|
|
pagePath: PropTypes.string,
|
|
|
onSaveSuccess: PropTypes.func,
|
|
|
+ editorTheme: PropTypes.string,
|
|
|
};
|