Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit c1a55ce

Browse files
sebmarkbagefacebook-github-bot
authored andcommitted
Remove findDOMNode in DraftEditorDragHandler
Summary: As in my previous change, editor.editorContainer is always an element and doesn't need findDOMNode. https://github.com/facebook/draft-js/blob/822d2fbd3597c3fe20cc2508d6a12d9a6f856999/src/component/base/DraftEditor.react.js#L370 This isn't exactly the same because the previous code got the parent node: https://github.com/facebook/draft-js/blob/822d2fbd3597c3fe20cc2508d6a12d9a6f856999/src/component/base/DraftEditor.react.js#L366 However for this purpose they're the same. There are no listeners on the inner one and the event bubbles. We already have a ref to the inner one so might as well use it. Now I think that this has since been fixed in React so we might not need this workaround at all anymore. Reviewed By: gaearon Differential Revision: D19540873 fbshipit-source-id: 89f91105b97ae6b0eeb5b4d615642a79eef6ab92
1 parent 9d587d9 commit c1a55ce

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/component/handlers/drag/DraftEditorDragHandler.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import type SelectionState from 'SelectionState';
1717
const DataTransfer = require('DataTransfer');
1818
const DraftModifier = require('DraftModifier');
1919
const EditorState = require('EditorState');
20-
const ReactDOM = require('ReactDOM');
2120

2221
const findAncestorOffsetKey = require('findAncestorOffsetKey');
2322
const getCorrectDocumentFromNode = require('getCorrectDocumentFromNode');
@@ -142,7 +141,7 @@ function endDrag(editor) {
142141
// Prior to React v16.5.0 onDrop breaks onSelect event:
143142
// https://github.com/facebook/react/issues/11379.
144143
// Dispatching a mouseup event on DOM node will make it go back to normal.
145-
const editorNode = ReactDOM.findDOMNode(editor);
144+
const editorNode = editor.editorContainer;
146145
if (editorNode) {
147146
const mouseUpEvent = new MouseEvent('mouseup', {
148147
view: getWindowForNode(editorNode),

0 commit comments

Comments
 (0)