Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix bug in getting defaultView from editor ref
  • Loading branch information
haikyuu committed Sep 21, 2018
commit c12d93f025afb9f8ed63de494d12c216dfb70dbf
2 changes: 1 addition & 1 deletion meta/bundle-size-stats/Draft.js.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion meta/bundle-size-stats/Draft.min.js.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/component/base/DraftEditor.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ class DraftEditor extends React.Component<DraftEditorProps, State> {
// https://stackoverflow.com/questions/44074747/componentdidmount-called-before-ref-callback

const castedEditor: HTMLElement = (this.editor: any);
(castedEditor ? castedEditor.ownerDocument : global).execCommand(
(castedEditor ? castedEditor.editor.ownerDocument : global).execCommand(
'AutoUrlDetect',
false,
false,
Expand Down
2 changes: 1 addition & 1 deletion src/component/handlers/edit/editOnInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function editOnInput(editor: DraftEditor): void {
}
// at this point editor is not null for sure (after input)
const castedEditorElement: HTMLElement = (editor: any);
const domSelection = castedEditorElement.ownerDocument.defaultView.getSelection();
const domSelection = castedEditorElement.editor.ownerDocument.defaultView.getSelection();

const {anchorNode, isCollapsed} = domSelection;
const isNotTextNode = anchorNode.nodeType !== Node.TEXT_NODE;
Expand Down