migrate Text.createFromString to Text.create
This commit is contained in:
parent
39f65476c3
commit
70e8eae599
@ -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;
|
||||
|
@ -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') {
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user