Move star out of editor into documentpreview (#174)

* Move star out of editor into documentpreview

* 💚
This commit is contained in:
Tom Moor
2017-08-02 20:45:09 -07:00
committed by GitHub
parent 09b0f9f860
commit ca35cee841
7 changed files with 61 additions and 70 deletions

View File

@ -1,6 +1,5 @@
// @flow
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import { Editor, Plain } from 'slate';
import keydown from 'react-keydown';
@ -24,11 +23,8 @@ type Props = {
onChange: Function,
onSave: Function,
onCancel: Function,
onStar: Function,
onUnstar: Function,
onImageUploadStart: Function,
onImageUploadStop: Function,
starred: boolean,
emoji: string,
readOnly: boolean,
heading?: ?React.Element<*>,
@ -52,10 +48,7 @@ type KeyData = {
constructor(props: Props) {
super(props);
this.schema = createSchema({
onStar: props.onStar,
onUnstar: props.onUnstar,
});
this.schema = createSchema();
this.plugins = createPlugins({
onImageUploadStart: props.onImageUploadStart,
onImageUploadStop: props.onImageUploadStop,
@ -84,10 +77,6 @@ type KeyData = {
}
}
getChildContext() {
return { starred: this.props.starred };
}
onChange = (state: State) => {
this.setState({ state });
};
@ -207,7 +196,6 @@ type KeyData = {
</HeaderContainer>
<Toolbar state={this.state.state} onChange={this.onChange} />
<Editor
key={this.props.starred}
ref={ref => (this.editor = ref)}
placeholder="Start with a title…"
bodyPlaceholder="Insert witty platitude here"
@ -232,10 +220,6 @@ type KeyData = {
};
}
MarkdownEditor.childContextTypes = {
starred: PropTypes.bool,
};
const MaxWidth = styled(Flex)`
max-width: 50em;
height: 100%;