UNPKG

@kedao/editor

Version:

Rich Text Editor Based On Draft.js

10 lines 586 B
import { Modifier, EditorState } from 'draft-js'; export function addText(editorState, bufferText) { const contentState = Modifier.insertText(editorState.getCurrentContent(), editorState.getSelection(), bufferText); return EditorState.push(editorState, contentState, 'insert-characters'); } export function replaceText(editorState, bufferText) { const contentState = Modifier.replaceText(editorState.getCurrentContent(), editorState.getSelection(), bufferText); return EditorState.push(editorState, contentState, 'insert-characters'); } //# sourceMappingURL=utils.js.map