Move star out of editor into documentpreview (#174)
* Move star out of editor into documentpreview
* 💚
This commit is contained in:
@ -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%;
|
||||
|
Reference in New Issue
Block a user