Comparing version 0.11.4 to 0.11.5
@@ -7,2 +7,39 @@ # Changelog | ||
## 0.11.5 (Mar 26, 2020) | ||
## Removed | ||
* Remove examples for draft.js 0.9.0 (#2358) (Kevin Chavez in fd16d8e2) | ||
## Changed | ||
* Update deps in 'universal' example (#2362) (Kevin Chavez in dc8bfbb2) | ||
* Remove unused Flow suppressions in WWW (George Zahariev in 3858858b) | ||
* Improve types for EditorState (Kevin Chavez in 792bd3ab) | ||
* Don't SSR example editor on website. (#2356) (Kevin Chavez in 9191a3f2) | ||
* Deprecate Travis Bot files and configuration (Chris Lüer in 6c1c6544) | ||
* Require ReactDOMComet instead of ReactDOM (Dan Abramov in 66301633) | ||
* Strictify DraftEditorLeaf.react.js (Kevin Chavez in b4a1db99) | ||
* Make decodeEntityRanges flow strict (Kevin Chavez in 7af73b70) | ||
* Move key to static argument instead of spread (Sebastian Markbage in d6527a95) | ||
* "ecmascript" => "ECMAScript" (#2327) (Agastya Chandrakant in 6cfed736) | ||
* Abstract ReactDOM as ReactDOMComet (Sebastian Markbage in 24339f12) | ||
* Prevent (but not fix) ‘Cannot read property 'getIn' of undefined’ in getUpdatedSelectionState (Steven Luscher in a9fcbb20) | ||
* Make some more modules strict(-local) (Kevin Chavez in c30ca735 and 70025659) | ||
* Update webpack deps (#2310) (Kevin Chavez in 0131e1d5) | ||
* Remove unused gulp task remained from docusaurus 2 migration (#2308) (Kanitkorn S in 963e3126) | ||
* Re-write `DraftEditorExample` in the website using react hooks (#2287) (Kevin Chavez in 9b9376bd) | ||
* Add a preventScroll prop (Dan Abramov in 3ba907bb) | ||
* Add editorRef prop to DraftEditor (Dan Abramov in 8c500424) | ||
* Remove findDOMNode from DraftEditorBlockNode (Sebastian Markbage in 0dd39781) | ||
* Remove findDOMNode in DraftEditorDragHandler (Sebastian Markbage in c1a55ceb) | ||
* Remove findDOMNode from getContentEditableContainer (Sebastian Markbage in 9d587d9f) | ||
* Upgrade to Flow explicit inexact object type syntax (Jordan Brown in b051fc1b) | ||
* Upgrade eslint + flow, and fix failed test from nullishCoalescingOperator (#2083) (Kanitkorn S in 824fd125) | ||
* chore(travis): bumps node versions used in Travis CI to 10 and 12 (#2300) (Claudio Procida in e711230f) | ||
## Fixed | ||
* Fix Uncaught TypeError: Cannot read property 'nodeType' of null at editOnInput (#2330) (Konstantin Tarkus in db3216d9) | ||
* Fix keyBindingFn documentation URL (Ryan Silva in 3251017d) | ||
* fix style handling in convertFromHTMLToContentBlocks (Frank Thompson in ad8374d2) | ||
* remove unused flow suppressions (Panagiotis Vekris in 822d2fbd) | ||
## 0.11.4 (January 7th, 2020) | ||
@@ -9,0 +46,0 @@ |
@@ -15,3 +15,4 @@ /** | ||
function applyEntityToContentBlock(contentBlock, start, end, entityKey) { | ||
function applyEntityToContentBlock(contentBlock, startArg, end, entityKey) { | ||
var start = startArg; | ||
var characterList = contentBlock.getCharacterList(); | ||
@@ -18,0 +19,0 @@ |
@@ -64,3 +64,3 @@ /** | ||
var boldValues = ['bold', 'bolder', '500', '600', '700', '800', '900']; | ||
var notBoldValues = ['light', 'lighter', '100', '200', '300', '400']; | ||
var notBoldValues = ['light', 'lighter', 'normal', '100', '200', '300', '400']; | ||
var anchorAttr = ['className', 'href', 'rel', 'target', 'title']; | ||
@@ -172,5 +172,3 @@ var imgAttr = ['alt', 'className', 'height', 'src', 'width']; | ||
var styleFromNodeAttributes = function styleFromNodeAttributes(node) { | ||
var style = OrderedSet(); | ||
var styleFromNodeAttributes = function styleFromNodeAttributes(node, style) { | ||
if (!isHTMLElement(node)) { | ||
@@ -266,4 +264,2 @@ return style; | ||
_defineProperty(this, "currentStyle", OrderedSet()); | ||
_defineProperty(this, "currentText", ''); | ||
@@ -300,3 +296,2 @@ | ||
this.currentEntity = null; | ||
this.currentStyle = OrderedSet(); | ||
this.currentText = ''; | ||
@@ -318,3 +313,3 @@ this.entityMap = DraftEntity; | ||
(_this$blockConfigs = this.blockConfigs).push.apply(_this$blockConfigs, this._toBlockConfigs([node])); // There might be some left over text in the builder's | ||
(_this$blockConfigs = this.blockConfigs).push.apply(_this$blockConfigs, this._toBlockConfigs([node], OrderedSet())); // There might be some left over text in the builder's | ||
// internal state, if so make a ContentBlock out of it. | ||
@@ -351,18 +346,2 @@ | ||
}; | ||
} | ||
/** | ||
* Add a new inline style to the upcoming nodes. | ||
*/ | ||
; | ||
_proto.addStyle = function addStyle(inlineStyle) { | ||
this.currentStyle = this.currentStyle.union(inlineStyle); | ||
} | ||
/** | ||
* Remove a currently applied inline style. | ||
*/ | ||
; | ||
_proto.removeStyle = function removeStyle(inlineStyle) { | ||
this.currentStyle = this.currentStyle.subtract(inlineStyle); | ||
} // ***********************************WARNING****************************** | ||
@@ -406,3 +385,3 @@ // The methods below this line are private - don't call them directly. | ||
_proto._toBlockConfigs = function _toBlockConfigs(nodes) { | ||
_proto._toBlockConfigs = function _toBlockConfigs(nodes, style) { | ||
var blockConfigs = []; | ||
@@ -436,3 +415,3 @@ | ||
blockConfigs.push.apply(blockConfigs, this._toBlockConfigs(Array.from(node.childNodes))); | ||
blockConfigs.push.apply(blockConfigs, this._toBlockConfigs(Array.from(node.childNodes), style)); | ||
this.currentDepth = wasCurrentDepth; | ||
@@ -469,3 +448,3 @@ this.wrapper = wasWrapper; | ||
var childConfigs = this._toBlockConfigs(Array.from(node.childNodes)); | ||
var childConfigs = this._toBlockConfigs(Array.from(node.childNodes), style); | ||
@@ -485,3 +464,3 @@ this._trimCurrentText(); | ||
if (nodeName === '#text') { | ||
this._addTextNode(node); | ||
this._addTextNode(node, style); | ||
@@ -492,3 +471,3 @@ continue; | ||
if (nodeName === 'br') { | ||
this._addBreakNode(node); | ||
this._addBreakNode(node, style); | ||
@@ -499,3 +478,3 @@ continue; | ||
if (isValidImage(node)) { | ||
this._addImgNode(node); | ||
this._addImgNode(node, style); | ||
@@ -506,3 +485,3 @@ continue; | ||
if (isValidAnchor(node)) { | ||
this._addAnchorNode(node, blockConfigs); | ||
this._addAnchorNode(node, blockConfigs, style); | ||
@@ -512,9 +491,10 @@ continue; | ||
var inlineStyle = HTMLTagToRawInlineStyleMap.has(nodeName) ? OrderedSet.of(HTMLTagToRawInlineStyleMap.get(nodeName)) : OrderedSet(); | ||
var attributesStyle = styleFromNodeAttributes(node); | ||
this.addStyle(inlineStyle); | ||
this.addStyle(attributesStyle); | ||
blockConfigs.push.apply(blockConfigs, this._toBlockConfigs(Array.from(node.childNodes))); | ||
this.removeStyle(attributesStyle); | ||
this.removeStyle(inlineStyle); | ||
var newStyle = style; | ||
if (HTMLTagToRawInlineStyleMap.has(nodeName)) { | ||
newStyle = newStyle.add(HTMLTagToRawInlineStyleMap.get(nodeName)); | ||
} | ||
newStyle = styleFromNodeAttributes(node, newStyle); | ||
blockConfigs.push.apply(blockConfigs, this._toBlockConfigs(Array.from(node.childNodes), newStyle)); | ||
} | ||
@@ -529,3 +509,3 @@ | ||
_proto._appendText = function _appendText(text) { | ||
_proto._appendText = function _appendText(text, style) { | ||
var _this$characterList; | ||
@@ -535,3 +515,3 @@ | ||
var characterMetadata = CharacterMetadata.create({ | ||
style: this.currentStyle, | ||
style: style, | ||
entity: this.currentEntity | ||
@@ -573,3 +553,3 @@ }); | ||
_proto._addTextNode = function _addTextNode(node) { | ||
_proto._addTextNode = function _addTextNode(node, style) { | ||
var text = node.textContent; | ||
@@ -590,6 +570,6 @@ var trimmedText = text.trim(); // If we are not in a pre block and the trimmed content is empty, | ||
this._appendText(text); | ||
this._appendText(text, style); | ||
}; | ||
_proto._addBreakNode = function _addBreakNode(node) { | ||
_proto._addBreakNode = function _addBreakNode(node, style) { | ||
if (!isHTMLBRElement(node)) { | ||
@@ -599,3 +579,3 @@ return; | ||
this._appendText('\n'); | ||
this._appendText('\n', style); | ||
} | ||
@@ -607,3 +587,3 @@ /** | ||
_proto._addImgNode = function _addImgNode(node) { | ||
_proto._addImgNode = function _addImgNode(node, style) { | ||
if (!isHTMLImageElement(node)) { | ||
@@ -629,6 +609,6 @@ return; | ||
if (image.getAttribute('role') !== 'presentation') { | ||
this._appendText("\uD83D\uDCF7"); | ||
this._appendText("\uD83D\uDCF7", style); | ||
} | ||
} else { | ||
this._appendText("\uD83D\uDCF7"); | ||
this._appendText("\uD83D\uDCF7", style); | ||
} | ||
@@ -645,3 +625,3 @@ | ||
_proto._addAnchorNode = function _addAnchorNode(node, blockConfigs) { | ||
_proto._addAnchorNode = function _addAnchorNode(node, blockConfigs, style) { | ||
// The check has already been made by isValidAnchor but | ||
@@ -665,3 +645,3 @@ // we have to do it again to keep flow happy. | ||
this.currentEntity = this.entityMap.__create('LINK', 'MUTABLE', entityConfig || {}); | ||
blockConfigs.push.apply(blockConfigs, this._toBlockConfigs(Array.from(node.childNodes))); | ||
blockConfigs.push.apply(blockConfigs, this._toBlockConfigs(Array.from(node.childNodes), style)); | ||
this.currentEntity = null; | ||
@@ -668,0 +648,0 @@ } |
@@ -38,2 +38,4 @@ /** | ||
var flushControlled = require("./DraftEditorFlushControlled"); | ||
var DraftEditorPlaceholder = require("./DraftEditorPlaceholder.react"); | ||
@@ -47,4 +49,2 @@ | ||
var ReactDOM = require("react-dom"); | ||
var Scroll = require("fbjs/lib/Scroll"); | ||
@@ -270,2 +270,10 @@ | ||
_defineProperty(_assertThisInitialized(_this), "_handleEditorContainerRef", function (node) { | ||
_this.editorContainer = node; // Instead of having a direct ref on the child, we'll grab it here. | ||
// This is safe as long as the rendered structure is static (which it is). | ||
// This lets the child support ref={props.editorRef} without merging refs. | ||
_this.editor = node !== null ? node.firstChild : null; | ||
}); | ||
_defineProperty(_assertThisInitialized(_this), "focus", function (scrollPosition) { | ||
@@ -326,5 +334,5 @@ var editorState = _this.props.editorState; | ||
if (onPaste) { | ||
/* $FlowFixMe(>=0.111.0) This comment suppresses an error found when Flow | ||
* v0.111.0 was deployed. To see the error, delete this comment and run | ||
* Flow. */ | ||
/* $FlowFixMe(>=0.117.0 site=www) This comment suppresses an error found | ||
* when Flow v0.117 was deployed. To see the error delete this comment | ||
* and run Flow. */ | ||
editHandler.onPaste = onPaste; | ||
@@ -423,3 +431,3 @@ } | ||
// eslint-disable-next-line no-console | ||
console.warn("Supplying an `".concat(propName, "` prop to `DraftEditor` has ") + 'been deprecated. If your handler needs access to the keyboard ' + 'event, supply a custom `keyBindingFn` prop that falls back to ' + 'the default one (eg. https://is.gd/RG31RJ).'); | ||
console.warn("Supplying an `".concat(propName, "` prop to `DraftEditor` has ") + 'been deprecated. If your handler needs access to the keyboard ' + 'event, supply a custom `keyBindingFn` prop that falls back to ' + 'the default one (eg. https://is.gd/wHKQ3W).'); | ||
} | ||
@@ -447,10 +455,5 @@ }); | ||
var flushControlled = | ||
/* $FlowFixMe(>=0.79.1 site=www) This comment suppresses an error found | ||
* when Flow v0.79 was deployed. To see the error delete this comment and | ||
* run Flow. */ | ||
ReactDOM.unstable_flushControlled; // Wrap event handlers in `flushControlled`. In sync mode, this is | ||
// Wrap event handlers in `flushControlled`. In sync mode, this is | ||
// effectively a no-op. In async mode, this ensures all updates scheduled | ||
// inside the handler are flushed before React yields to the browser. | ||
return function (e) { | ||
@@ -485,10 +488,2 @@ if (!_this2.props.readOnly) { | ||
}; | ||
/* $FlowFixMe(>=0.112.0 site=mobile) This comment suppresses an error | ||
* found when Flow v0.112 was deployed. To see the error delete this | ||
* comment and run Flow. */ | ||
/* $FlowFixMe(>=0.112.0 site=www) This comment suppresses an error found | ||
* when Flow v0.112 was deployed. To see the error delete this comment | ||
* and run Flow. */ | ||
/* $FlowFixMe(>=0.112.0 site=www,mobile) This comment suppresses an error | ||
@@ -505,4 +500,2 @@ * found when Flow v0.112 was deployed. To see the error delete this | ||
_proto2.render = function render() { | ||
var _this3 = this; | ||
var _this$props2 = this.props, | ||
@@ -515,2 +508,3 @@ blockRenderMap = _this$props2.blockRenderMap, | ||
editorState = _this$props2.editorState, | ||
preventScroll = _this$props2.preventScroll, | ||
readOnly = _this$props2.readOnly, | ||
@@ -549,2 +543,3 @@ textAlignment = _this$props2.textAlignment, | ||
editorState: editorState, | ||
preventScroll: preventScroll, | ||
textDirectionality: textDirectionality | ||
@@ -556,5 +551,3 @@ }; | ||
className: cx('DraftEditor/editorContainer'), | ||
ref: function ref(_ref3) { | ||
return _this3.editorContainer = _ref3; | ||
} | ||
ref: this._handleEditorContainerRef | ||
}, React.createElement("div", { | ||
@@ -603,5 +596,3 @@ "aria-activedescendant": readOnly ? null : this.props.ariaActiveDescendantID, | ||
onSelect: this._onSelect, | ||
ref: function ref(_ref2) { | ||
return _this3.editor = _ref2; | ||
}, | ||
ref: this.props.editorRef, | ||
role: readOnly ? null : ariaRole, | ||
@@ -608,0 +599,0 @@ spellCheck: allowSpellCheck && this.props.spellCheck, |
@@ -106,2 +106,6 @@ /** | ||
_proto.componentDidMount = function componentDidMount() { | ||
if (this.props.preventScroll) { | ||
return; | ||
} | ||
var selection = this.props.selection; | ||
@@ -210,3 +214,2 @@ var endKey = selection.getEndKey(); | ||
dir: dir, | ||
key: decoratorOffsetKey, | ||
start: start, | ||
@@ -218,3 +221,5 @@ end: end, | ||
}; | ||
return React.createElement(DecoratorComponent, _extends({}, decoratorProps, commonProps), leaves); | ||
return React.createElement(DecoratorComponent, _extends({}, decoratorProps, commonProps, { | ||
key: decoratorOffsetKey | ||
}), leaves); | ||
}).toArray(); | ||
@@ -221,0 +226,0 @@ }; |
@@ -22,2 +22,4 @@ /** | ||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } | ||
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } | ||
@@ -35,4 +37,2 @@ | ||
var ReactDOM = require("react-dom"); | ||
var Scroll = require("fbjs/lib/Scroll"); | ||
@@ -145,3 +145,3 @@ | ||
var getElementPropsConfig = function getElementPropsConfig(block, editorKey, offsetKey, blockStyleFn, customConfig) { | ||
var getElementPropsConfig = function getElementPropsConfig(block, editorKey, offsetKey, blockStyleFn, customConfig, ref) { | ||
var elementProps = { | ||
@@ -151,3 +151,4 @@ 'data-block': true, | ||
'data-offset-key': offsetKey, | ||
key: block.getKey() | ||
key: block.getKey(), | ||
ref: ref | ||
}; | ||
@@ -176,3 +177,13 @@ var customClass = blockStyleFn(block); | ||
function DraftEditorBlockNode() { | ||
return _React$Component.apply(this, arguments) || this; | ||
var _this; | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; | ||
_defineProperty(_assertThisInitialized(_this), "wrapperRef", React.createRef()); | ||
return _this; | ||
} | ||
@@ -215,3 +226,9 @@ | ||
var blockNode = ReactDOM.findDOMNode(this); | ||
var blockNode = this.wrapperRef.current; | ||
if (!blockNode) { | ||
// This Block Node was rendered without a wrapper element. | ||
return; | ||
} | ||
var scrollParent = Style.getScrollParent(blockNode); | ||
@@ -244,3 +261,3 @@ var scrollPosition = getScrollPosition(scrollParent); | ||
_proto.render = function render() { | ||
var _this = this; | ||
var _this2 = this; | ||
@@ -275,5 +292,5 @@ var _this$props2 = this.props, | ||
var elementProps = getElementPropsConfig(child, editorKey, offsetKey, blockStyleFn, customConfig); | ||
var elementProps = getElementPropsConfig(child, editorKey, offsetKey, blockStyleFn, customConfig, null); | ||
var childProps = _objectSpread({}, _this.props, { | ||
var childProps = _objectSpread({}, _this2.props, { | ||
tree: editorState.getBlockTree(key), | ||
@@ -329,3 +346,3 @@ blockProps: customConfig.customProps, | ||
var elementProps = getElementPropsConfig(block, editorKey, offsetKey, blockStyleFn, customConfig); // root block nodes needs to be wrapped | ||
var elementProps = getElementPropsConfig(block, editorKey, offsetKey, blockStyleFn, customConfig, this.wrapperRef); // root block nodes needs to be wrapped | ||
@@ -332,0 +349,0 @@ return React.createElement(Element, elementProps, blockNode); |
@@ -119,2 +119,3 @@ /** | ||
editorKey = _this$props.editorKey, | ||
preventScroll = _this$props.preventScroll, | ||
textDirectionality = _this$props.textDirectionality; | ||
@@ -162,2 +163,3 @@ var content = editorState.getCurrentContent(); | ||
offsetKey: offsetKey, | ||
preventScroll: preventScroll, | ||
selection: selection, | ||
@@ -202,10 +204,2 @@ tree: editorState.getBlockTree(key) | ||
var child = React.createElement(Element, childProps, | ||
/* $FlowFixMe(>=0.112.0 site=mobile) This comment suppresses an error | ||
* found when Flow v0.112 was deployed. To see the error delete this | ||
* comment and run Flow. */ | ||
/* $FlowFixMe(>=0.112.0 site=www) This comment suppresses an error | ||
* found when Flow v0.112 was deployed. To see the error delete this | ||
* comment and run Flow. */ | ||
/* $FlowFixMe(>=0.112.0 site=www,mobile) This comment suppresses an | ||
@@ -212,0 +206,0 @@ * error found when Flow v0.112 was deployed. To see the error delete |
@@ -126,10 +126,2 @@ /** | ||
processedBlocks.push({ | ||
/* $FlowFixMe(>=0.112.0 site=mobile) This comment suppresses an error | ||
* found when Flow v0.112 was deployed. To see the error delete this | ||
* comment and run Flow. */ | ||
/* $FlowFixMe(>=0.112.0 site=www) This comment suppresses an error | ||
* found when Flow v0.112 was deployed. To see the error delete this | ||
* comment and run Flow. */ | ||
/* $FlowFixMe(>=0.112.0 site=www,mobile) This comment suppresses an | ||
@@ -136,0 +128,0 @@ * error found when Flow v0.112 was deployed. To see the error delete |
@@ -19,4 +19,2 @@ /** | ||
var ReactDOM = require("react-dom"); | ||
var findAncestorOffsetKey = require("./findAncestorOffsetKey"); | ||
@@ -49,2 +47,5 @@ | ||
if (typeof eventTargetDocument.caretRangeFromPoint === 'function') { | ||
/* $FlowFixMe(>=0.68.0 site=www,mobile) This comment suppresses an error | ||
* found when Flow v0.68 was deployed. To see the error delete this comment | ||
* and run Flow. */ | ||
var dropRange = eventTargetDocument.caretRangeFromPoint(event.x, event.y); | ||
@@ -89,6 +90,3 @@ node = dropRange.startContainer; | ||
} | ||
/* $FlowFixMe This comment suppresses an error found DataTransfer was typed. | ||
* getFiles() returns an array of <Files extends Blob>, not Blob */ | ||
var files = data.getFiles(); | ||
@@ -100,3 +98,7 @@ | ||
} | ||
/* $FlowFixMe This comment suppresses an error found DataTransfer was | ||
* typed. getFiles() returns an array of <Files extends Blob>, not Blob | ||
*/ | ||
getTextContentFromFiles(files, function (fileText) { | ||
@@ -127,3 +129,3 @@ fileText && editor.update(insertTextAtSelection(editorState, dropSelection, fileText)); | ||
var editorNode = ReactDOM.findDOMNode(editor); | ||
var editorNode = editor.editorContainer; | ||
@@ -130,0 +132,0 @@ if (editorNode) { |
@@ -30,3 +30,5 @@ /** | ||
if (!Boolean(editor.props.preserveSelectionOnBlur) && getActiveElement(ownerDocument) === ownerDocument.body) { | ||
if ( // This ESLint rule conflicts with `sketchy-null-bool` flow check | ||
// eslint-disable-next-line no-extra-boolean-cast | ||
!Boolean(editor.props.preserveSelectionOnBlur) && getActiveElement(ownerDocument) === ownerDocument.body) { | ||
var _selection = ownerDocument.defaultView.getSelection(); | ||
@@ -33,0 +35,0 @@ |
@@ -77,3 +77,3 @@ /** | ||
isCollapsed = domSelection.isCollapsed; | ||
var isNotTextOrElementNode = anchorNode.nodeType !== Node.TEXT_NODE && anchorNode.nodeType !== Node.ELEMENT_NODE; | ||
var isNotTextOrElementNode = (anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.nodeType) !== Node.TEXT_NODE && (anchorNode === null || anchorNode === void 0 ? void 0 : anchorNode.nodeType) !== Node.ELEMENT_NODE; | ||
@@ -80,0 +80,0 @@ if (isNotTextOrElementNode) { |
@@ -44,4 +44,2 @@ /** | ||
if (!data.isRichText()) { | ||
/* $FlowFixMe This comment suppresses an error found DataTransfer was typed. | ||
* getFiles() returns an array of <Files extends Blob>, not Blob */ | ||
var files = data.getFiles(); | ||
@@ -56,3 +54,7 @@ var defaultFileText = data.getText(); | ||
} | ||
/* $FlowFixMe This comment suppresses an error found DataTransfer was | ||
* typed. getFiles() returns an array of <Files extends Blob>, not Blob | ||
*/ | ||
getTextContentFromFiles(files, function ( | ||
@@ -59,0 +61,0 @@ /*string*/ |
@@ -29,3 +29,6 @@ /** | ||
Record = Immutable.Record, | ||
Stack = Immutable.Stack; | ||
Stack = Immutable.Stack; // When configuring an editor, the user can chose to provide or not provide | ||
// basically all keys. `currentContent` varies, so this type doesn't include it. | ||
// (See the types defined below.) | ||
var defaultRecord = { | ||
@@ -32,0 +35,0 @@ allowUndo: true, |
@@ -13,4 +13,2 @@ /** | ||
var ReactDOM = require("react-dom"); | ||
var invariant = require("fbjs/lib/invariant"); | ||
@@ -21,3 +19,3 @@ | ||
function getContentEditableContainer(editor) { | ||
var editorNode = ReactDOM.findDOMNode(editor.editorContainer); | ||
var editorNode = editor.editorContainer; | ||
!editorNode ? process.env.NODE_ENV !== "production" ? invariant(false, 'Missing editorNode') : invariant(false) : void 0; | ||
@@ -24,0 +22,0 @@ !isHTMLElement(editorNode.firstChild) ? process.env.NODE_ENV !== "production" ? invariant(false, 'editorNode.firstChild is not an HTMLElement') : invariant(false) : void 0; |
@@ -30,6 +30,8 @@ /** | ||
var anchorBlockKey = anchorPath.blockKey; | ||
var anchorLeaf = editorState.getBlockTree(anchorBlockKey).getIn([anchorPath.decoratorKey, 'leaves', anchorPath.leafKey]); | ||
var anchorLeafBlockTree = editorState.getBlockTree(anchorBlockKey); | ||
var anchorLeaf = anchorLeafBlockTree && anchorLeafBlockTree.getIn([anchorPath.decoratorKey, 'leaves', anchorPath.leafKey]); | ||
var focusPath = DraftOffsetKey.decode(focusKey); | ||
var focusBlockKey = focusPath.blockKey; | ||
var focusLeaf = editorState.getBlockTree(focusBlockKey).getIn([focusPath.decoratorKey, 'leaves', focusPath.leafKey]); | ||
var focusLeafBlockTree = editorState.getBlockTree(focusBlockKey); | ||
var focusLeaf = focusLeafBlockTree && focusLeafBlockTree.getIn([focusPath.decoratorKey, 'leaves', focusPath.leafKey]); | ||
@@ -36,0 +38,0 @@ if (!anchorLeaf || !focusLeaf) { |
@@ -24,5 +24,4 @@ "use strict"; | ||
return node instanceof Node; | ||
} // $FlowFixMe https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11508#issuecomment-256045682 | ||
} | ||
if (node instanceof node.ownerDocument.defaultView.Node) { | ||
@@ -29,0 +28,0 @@ return true; |
{ | ||
"name": "draft-js", | ||
"description": "A React framework for building text editors.", | ||
"version": "0.11.4", | ||
"version": "0.11.5", | ||
"keywords": [ | ||
@@ -49,3 +49,3 @@ "draftjs", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4", | ||
"@babel/plugin-proposal-optional-chaining": "^7.6.0", | ||
"@babel/plugin-proposal-optional-chaining": "^7.9.0", | ||
"alex": "^8.0.0", | ||
@@ -57,13 +57,12 @@ "babel-eslint": "^10.0.3", | ||
"es6-shim": "^0.35.5", | ||
"eslint": "^6.6.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-fbjs": "^3.1.1", | ||
"eslint-config-prettier": "^6.5.0", | ||
"eslint-config-prettier": "^6.9.0", | ||
"eslint-plugin-babel": "^5.3.0", | ||
"eslint-plugin-flowtype": "^4.3.0", | ||
"eslint-plugin-flowtype": "^4.6.0", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-prettier": "^3.1.1", | ||
"eslint-plugin-react": "^7.16.0", | ||
"eslint-plugin-relay": "^1.3.12", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"eslint-plugin-react": "^7.17.0", | ||
"fbjs-scripts": "^1.2.0", | ||
"flow-bin": "^0.110.1", | ||
"flow-bin": "^0.115.0", | ||
"gulp": "^4.0.2", | ||
@@ -77,3 +76,3 @@ "gulp-babel": "^8.0.0", | ||
"gulp-if": "^3.0.0", | ||
"gulp-rename": "^1.4.0", | ||
"gulp-rename": "2", | ||
"gulp-util": "^3.0.6", | ||
@@ -87,7 +86,7 @@ "jest": "^24.9.0", | ||
"through2": "^3.0.1", | ||
"uglifyjs-webpack-plugin": "^1.1.6", | ||
"webpack-stream": "^4.0.0" | ||
"uglifyjs-webpack-plugin": "2", | ||
"webpack-stream": "5.2.1" | ||
}, | ||
"devEngines": { | ||
"node": "8.x || 9.x || 10.x", | ||
"node": "10.x || 12.x || 13.x", | ||
"npm": "2.x || 3.x || 5.x || 6.x" | ||
@@ -94,0 +93,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1783235
38
7