Fixes: New document creation
This commit is contained in:
@ -5,7 +5,7 @@ import styled from 'styled-components';
|
||||
import breakpoint from 'styled-components-breakpoint';
|
||||
import { observable } from 'mobx';
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import { Prompt, Route } from 'react-router-dom';
|
||||
import { Prompt, Route, withRouter } from 'react-router-dom';
|
||||
import type { Location } from 'react-router-dom';
|
||||
import keydown from 'react-keydown';
|
||||
import Flex from 'shared/components/Flex';
|
||||
@ -125,7 +125,7 @@ class DocumentScene extends React.Component<Props> {
|
||||
title: '',
|
||||
text: '',
|
||||
},
|
||||
this.props.documents
|
||||
props.documents
|
||||
);
|
||||
} else {
|
||||
const { shareId, revisionId } = props.match.params;
|
||||
@ -404,4 +404,6 @@ const LoadingState = styled(LoadingPlaceholder)`
|
||||
margin: 40px 0;
|
||||
`;
|
||||
|
||||
export default inject('ui', 'auth', 'documents', 'revisions')(DocumentScene);
|
||||
export default withRouter(
|
||||
inject('ui', 'auth', 'documents', 'revisions')(DocumentScene)
|
||||
);
|
||||
|
@ -16,7 +16,7 @@ class DocumentEditor extends React.Component<Props> {
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.props.defaultValue) {
|
||||
this.focusAtStart();
|
||||
setImmediate(this.focusAtStart);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ import * as React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import keydown from 'react-keydown';
|
||||
import Waypoint from 'react-waypoint';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { observable, action } from 'mobx';
|
||||
import { observer, inject } from 'mobx-react';
|
||||
import { debounce } from 'lodash';
|
||||
@ -216,4 +217,4 @@ class Search extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default inject('documents')(Search);
|
||||
export default withRouter(inject('documents')(Search));
|
||||
|
@ -358,7 +358,7 @@ export default class DocumentsStore extends BaseStore<Document> {
|
||||
return client.post('/documents.unstar', { id: document.id });
|
||||
};
|
||||
|
||||
getByUrl = (url: string): ?Document => {
|
||||
getByUrl = (url: string = ''): ?Document => {
|
||||
return find(Array.from(this.data.values()), doc => url.endsWith(doc.urlId));
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user