Upgrade Editor – Slate 0.44 / RME 8.0.0 (#863)

* Upgrade Slate

* Normalization

* Remove dupe dep

* Fixes placeholders

* Image uploading fixed

* Verbose but solid placeholder handling

* RME 8.0.0

* Fixes: Ability to delete embeds
This commit is contained in:
Tom Moor
2019-01-18 22:44:31 -08:00
committed by GitHub
parent 0be5aef1c6
commit d21dd710bb
11 changed files with 185 additions and 306 deletions

View File

@ -0,0 +1,27 @@
// @flow
import { Node, Editor } from 'slate';
import Placeholder from 'rich-markdown-editor/lib/plugins/Placeholder';
export default [
Placeholder({
placeholder: 'Start with a title…',
when: (editor: Editor, node: Node) => {
if (editor.readOnly) return false;
if (node.object !== 'block') return false;
if (node.type !== 'heading1') return false;
if (node.text !== '') return false;
if (editor.value.document.nodes.first() !== node) return false;
return true;
},
}),
Placeholder({
placeholder: '…the rest is your canvas',
when: (editor: Editor, node: Node) => {
if (editor.readOnly) return false;
if (node.object !== 'block') return false;
if (node.type !== 'paragraph') return false;
if (node.text !== '') return false;
return true;
},
}),
];