migrate Text.createFromString to Text.create

This commit is contained in:
Shawn Erquhart 2017-09-28 17:23:34 -04:00
parent 39f65476c3
commit 70e8eae599
4 changed files with 5 additions and 5 deletions

View File

@ -16,7 +16,7 @@ import styles from './index.css';
export default class Editor extends Component {
constructor(props) {
super(props);
const emptyText = Text.createFromString('');
const emptyText = Text.create('');
const emptyBlock = Block.create({ kind: 'block', type: 'paragraph', nodes: [ emptyText ] });
const emptyRawDoc = { nodes: [emptyBlock] };
const rawDoc = this.props.value && markdownToSlate(this.props.value);
@ -133,7 +133,7 @@ export default class Editor extends Component {
shortcode: plugin.id,
shortcodeData,
};
const nodes = [Text.createFromString('')];
const nodes = [Text.create('')];
const block = { kind: 'block', type: 'shortcode', data, isVoid: true, nodes };
let change = editorState.change();
const { focusBlock } = change.state;

View File

@ -6,7 +6,7 @@ function onKeyDown(e, data, change) {
const createDefaultBlock = () => {
return Block.create({
type: 'paragraph',
nodes: [Text.createFromString('')]
nodes: [Text.create('')]
});
};
if (data.key === 'enter') {

View File

@ -19,7 +19,7 @@ const SoftBreak = (options = {}) => ({
return trimmed.insertBlock(defaultBlock);
}
const textNode = Text.createFromString('\n');
const textNode = Text.create('\n');
const breakNode = Inline.create({ type: 'break', nodes: [ textNode ] });
return change
.insertInline(breakNode)

View File

@ -18,7 +18,7 @@ const enforceNeverEmpty = {
normalize: change => {
const block = Block.create({
type: 'paragraph',
nodes: [Text.createFromString('')],
nodes: [Text.create('')],
});
const { key } = change.state.document;
return change.insertNodeByKey(key, 0, block).focus();