This commit is contained in:
Tom Moor 2020-08-11 18:59:57 -07:00
parent 6e61df0729
commit 63371d8f5b
4 changed files with 10 additions and 11 deletions

View File

@ -1,6 +1,4 @@
// @flow
import { observable } from "mobx";
import { observer } from "mobx-react";
import { lighten } from "polished";
import * as React from "react";
import { withRouter, type RouterHistory } from "react-router-dom";
@ -28,10 +26,7 @@ type PropsWithRef = Props & {
history: RouterHistory,
};
@observer
class Editor extends React.Component<PropsWithRef> {
@observable redirectTo: ?string;
onUploadImage = async (file: File) => {
const result = await uploadFile(file, { documentId: this.props.id });
return result.url;

View File

@ -6,7 +6,7 @@ import { InputIcon } from "outline-icons";
import * as React from "react";
import keydown from "react-keydown";
import { Prompt, Route, withRouter } from "react-router-dom";
import type { Location, RouterHistory, Match } from "react-router-dom";
import type { RouterHistory, Match } from "react-router-dom";
import styled, { withTheme } from "styled-components";
import breakpoint from "styled-components-breakpoint";
@ -29,6 +29,7 @@ import KeyboardShortcutsButton from "./KeyboardShortcutsButton";
import Loading from "./Loading";
import MarkAsViewed from "./MarkAsViewed";
import References from "./References";
import { type LocationWithState } from "types";
import { emojiToUrl } from "utils/emoji";
import {
collectionUrl,
@ -53,7 +54,7 @@ Are you sure you want to discard them?
type Props = {
match: Match,
history: RouterHistory,
location: Location,
location: LocationWithState,
abilities: Object,
document: Document,
revision: Revision,

View File

@ -3,6 +3,7 @@ import { observable } from "mobx";
import { observer } from "mobx-react";
import * as React from "react";
import Textarea from "react-autosize-textarea";
import RichMarkdownEditor from "rich-markdown-editor";
import styled from "styled-components";
import parseTitle from "shared/utils/parseTitle";
import Document from "models/Document";
@ -25,7 +26,7 @@ type Props = {
@observer
class DocumentEditor extends React.Component<Props> {
@observable activeLinkEvent: ?MouseEvent;
editor = React.createRef<typeof Editor>();
editor = React.createRef<RichMarkdownEditor>();
focusAtStart = () => {
if (this.editor.current) {

View File

@ -9,7 +9,7 @@ import * as React from "react";
import ReactDOM from "react-dom";
import keydown from "react-keydown";
import { withRouter, Link } from "react-router-dom";
import type { Location, RouterHistory, Match } from "react-router-dom";
import type { RouterHistory, Match } from "react-router-dom";
import { Waypoint } from "react-waypoint";
import styled from "styled-components";
@ -32,13 +32,14 @@ import SearchField from "./components/SearchField";
import StatusFilter from "./components/StatusFilter";
import UserFilter from "./components/UserFilter";
import NewDocumentMenu from "menus/NewDocumentMenu";
import { type LocationWithState } from "types";
import { meta } from "utils/keyboard";
import { newDocumentUrl, searchUrl } from "utils/routeHelpers";
type Props = {
history: RouterHistory,
match: Match,
location: Location,
location: LocationWithState,
documents: DocumentsStore,
users: UsersStore,
notFound: ?boolean,
@ -46,7 +47,7 @@ type Props = {
@observer
class Search extends React.Component<Props> {
firstDocument: ?typeof DocumentPreview;
firstDocument: ?React.Component<typeof DocumentPreview>;
@observable
query: string = decodeURIComponent(this.props.match.params.term || "");
@ -222,6 +223,7 @@ class Search extends React.Component<Props> {
};
setFirstDocumentRef = (ref) => {
// $FlowFixMe
this.firstDocument = ref;
};