Remove slate-plain-serializer dependency
This commit is contained in:
parent
7b9fa9f4a7
commit
d7d13179d6
@ -5,7 +5,6 @@ import { observer } from 'mobx-react';
|
||||
import { Value, Change } from 'slate';
|
||||
import { Editor } from 'slate-react';
|
||||
import type { SlateNodeProps, Plugin } from './types';
|
||||
import Plain from 'slate-plain-serializer';
|
||||
import keydown from 'react-keydown';
|
||||
import getDataTransferFiles from 'utils/getDataTransferFiles';
|
||||
import Flex from 'shared/components/Flex';
|
||||
@ -52,11 +51,7 @@ class MarkdownEditor extends Component {
|
||||
onImageUploadStop: props.onImageUploadStop,
|
||||
});
|
||||
|
||||
if (props.text.trim().length) {
|
||||
this.editorValue = Markdown.deserialize(props.text);
|
||||
} else {
|
||||
this.editorValue = Plain.deserialize('');
|
||||
}
|
||||
this.editorValue = Markdown.deserialize(props.text);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@ -77,6 +72,7 @@ class MarkdownEditor extends Component {
|
||||
onChange = (change: Change) => {
|
||||
if (this.editorValue !== change.value) {
|
||||
this.props.onChange(Markdown.serialize(change.value));
|
||||
console.log('this.props.onChange', Markdown.serialize(change.value));
|
||||
this.editorValue = change.value;
|
||||
}
|
||||
};
|
||||
|
@ -28,7 +28,8 @@ class FormattingToolbar extends Component {
|
||||
};
|
||||
|
||||
isBlock = (type: string) => {
|
||||
return this.props.editor.value.startBlock.type === type;
|
||||
const startBlock = this.props.editor.value.startBlock;
|
||||
return startBlock && startBlock.type === type;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -167,7 +167,6 @@
|
||||
"slate-edit-list": "^0.10.1",
|
||||
"slate-md-serializer": "^1.0.4",
|
||||
"slate-paste-linkify": "^0.5.0",
|
||||
"slate-plain-serializer": "^0.4.12",
|
||||
"slate-prism": "^0.4.0",
|
||||
"slate-react": "^0.10.19",
|
||||
"slate-trailing-block": "^0.4.0",
|
||||
|
Reference in New Issue
Block a user