last-draft-js-plugins
Version:
Last Draft draft-js-plugins
14 lines (11 loc) • 483 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _draftJs = require('draft-js');
exports.default = function (editorState, url) {
var urlType = 'embed';
var entityKey = _draftJs.Entity.create(urlType, 'IMMUTABLE', { src: url });
var newEditorState = _draftJs.AtomicBlockUtils.insertAtomicBlock(editorState, entityKey, ' ');
return _draftJs.EditorState.forceSelection(newEditorState, editorState.getCurrentContent().getSelectionAfter());
};