diff --git a/app/scenes/Document/components/DocumentMove/components/PathToDocument.js b/app/components/PathToDocument.js similarity index 100% rename from app/scenes/Document/components/DocumentMove/components/PathToDocument.js rename to app/components/PathToDocument.js diff --git a/app/scenes/Document/Document.js b/app/scenes/Document/Document.js index 684f03105..9421f0f53 100644 --- a/app/scenes/Document/Document.js +++ b/app/scenes/Document/Document.js @@ -169,7 +169,7 @@ class DocumentScene extends React.Component { // prevent autosave if nothing has changed if (options.autosave && document.text.trim() === text.trim()) return; - document.updateData({ text }, true); + document.updateData({ text }); if (!document.allowSave) return; // prevent autosave before anything has been written @@ -197,7 +197,10 @@ class DocumentScene extends React.Component { }, AUTOSAVE_DELAY); updateIsDirty = debounce(() => { - this.isDirty = this.getEditorText().trim() !== this.document.text.trim(); + const document = this.document; + + this.isDirty = + document && this.getEditorText().trim() !== document.text.trim(); }, IS_DIRTY_DELAY); onImageUploadStart = () => { diff --git a/app/scenes/Document/components/DocumentMove/DocumentMove.js b/app/scenes/Document/components/DocumentMove.js similarity index 98% rename from app/scenes/Document/components/DocumentMove/DocumentMove.js rename to app/scenes/Document/components/DocumentMove.js index 8a61d5633..ce444122b 100644 --- a/app/scenes/Document/components/DocumentMove/DocumentMove.js +++ b/app/scenes/Document/components/DocumentMove.js @@ -12,8 +12,8 @@ import styled from 'styled-components'; import Modal from 'components/Modal'; import Input from 'components/Input'; import Labeled from 'components/Labeled'; +import PathToDocument from 'components/PathToDocument'; import Flex from 'shared/components/Flex'; -import PathToDocument from './components/PathToDocument'; import Document from 'models/Document'; import DocumentsStore from 'stores/DocumentsStore'; diff --git a/app/scenes/Document/components/DocumentMove/index.js b/app/scenes/Document/components/DocumentMove/index.js deleted file mode 100644 index 3f3eb8bf1..000000000 --- a/app/scenes/Document/components/DocumentMove/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// @flow -import DocumentMove from './DocumentMove'; -export default DocumentMove; diff --git a/app/scenes/Document/components/Editor.js b/app/scenes/Document/components/Editor.js index cb11a2218..238c96b1e 100644 --- a/app/scenes/Document/components/Editor.js +++ b/app/scenes/Document/components/Editor.js @@ -8,6 +8,7 @@ import ClickablePadding from 'components/ClickablePadding'; type Props = { titlePlaceholder: string, bodyPlaceholder: string, + defaultValue?: string, readOnly: boolean, }; diff --git a/app/stores/DocumentsStore.js b/app/stores/DocumentsStore.js index 9a8e98934..4fbb1f197 100644 --- a/app/stores/DocumentsStore.js +++ b/app/stores/DocumentsStore.js @@ -128,6 +128,7 @@ class DocumentsStore extends BaseStore { const data = await this.fetchPage('list', options); runInAction('DocumentsStore#fetchRecentlyEdited', () => { + // $FlowFixMe this.recentlyEditedIds.replace( uniq(this.recentlyEditedIds.concat(map(data, 'id'))) ); @@ -140,6 +141,7 @@ class DocumentsStore extends BaseStore { const data = await this.fetchPage('viewed', options); runInAction('DocumentsStore#fetchRecentlyViewed', () => { + // $FlowFixMe this.recentlyViewedIds.replace( uniq(this.recentlyViewedIds.concat(map(data, 'id'))) );