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

Commit 2299714

Browse files
mrkevfacebook-github-bot
authored andcommitted
Type selection object in editOnBlur.js
Summary: No behaviour changed. Reviewed By: claudiopro Differential Revision: D20715111 fbshipit-source-id: 6438ea38fd15a34e38d46c8450b1f6969ec4b352
1 parent 41beae1 commit 2299714

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/component/handlers/edit/editOnBlur.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
'use strict';
1313

14+
import type {SelectionObject} from 'DraftDOMTypes';
1415
import type DraftEditor from 'DraftEditor.react';
1516

1617
const EditorState = require('EditorState');
@@ -34,7 +35,7 @@ function editOnBlur(editor: DraftEditor, e: SyntheticEvent<HTMLElement>): void {
3435
!Boolean(editor.props.preserveSelectionOnBlur) &&
3536
getActiveElement(ownerDocument) === ownerDocument.body
3637
) {
37-
const selection = ownerDocument.defaultView.getSelection();
38+
const selection: SelectionObject = ownerDocument.defaultView.getSelection();
3839
const editorNode = editor.editor;
3940
if (
4041
selection.rangeCount === 1 &&

src/component/utils/DraftDOMTypes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ export type SelectionObject = {|
2424
isCollapsed: boolean,
2525
rangeCount: number,
2626
type: string,
27+
28+
removeAllRanges(): void,
2729
// ...etc. This is a non-exhaustive definition.
2830
|};

0 commit comments

Comments
 (0)