RME upgrade, fix autoFocus logic

This commit is contained in:
Tom Moor
2018-08-16 22:51:51 -07:00
parent c140c64346
commit be09b290b7
4 changed files with 14 additions and 5 deletions

View File

@@ -347,7 +347,6 @@ class DocumentScene extends React.Component<Props> {
onCancel={this.onDiscard}
onShowToast={this.onShowToast}
readOnly={!this.isEditing}
autoFocus={!document.text}
toc
/>
</MaxWidth>

View File

@@ -41,10 +41,20 @@ schema.document.normalize = (
class Editor extends React.Component<Props> {
editor: *;
componentDidMount() {
if (!this.props.defaultValue) {
this.focusAtStart();
}
}
setEditorRef = (ref: RichMarkdownEditor) => {
this.editor = ref;
};
focusAtStart = () => {
if (this.editor) this.editor.focusAtStart();
};
focusAtEnd = () => {
if (this.editor) this.editor.focusAtEnd();
};

View File

@@ -158,7 +158,7 @@
"react-waypoint": "^7.3.1",
"redis": "^2.6.2",
"redis-lock": "^0.1.0",
"rich-markdown-editor": "4.0.0",
"rich-markdown-editor": "5.0.0",
"safestart": "1.1.0",
"sequelize": "4.28.6",
"sequelize-cli": "^2.7.0",

View File

@@ -8858,9 +8858,9 @@ retry-axios@0.3.2, retry-axios@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/retry-axios/-/retry-axios-0.3.2.tgz#5757c80f585b4cc4c4986aa2ffd47a60c6d35e13"
rich-markdown-editor@4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-4.0.0.tgz#483f2b24867553245b66a8c8f56ec3f8d70ae248"
rich-markdown-editor@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-5.0.0.tgz#7c581f5ec3a52f749bc7633ea46b9f3d5b113935"
dependencies:
"@tommoor/slate-drop-or-paste-images" "^0.8.1"
babel-plugin-transform-async-to-generator "^6.24.1"