@kedao/editor
Version:
Rich Text Editor Based On Draft.js
9 lines • 455 B
JavaScript
import { EditorState, Modifier } from 'draft-js';
const insertText = (editorState, text) => {
const selection = editorState.getSelection();
const content = editorState.getCurrentContent();
const newContentState = Modifier.insertText(content, selection, text, editorState.getCurrentInlineStyle());
return EditorState.push(editorState, newContentState, 'insert-fragment');
};
export default insertText;
//# sourceMappingURL=insertText.js.map