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

Commit c07a404

Browse files
mrkevfacebook-github-bot
authored andcommitted
getEntityKeyForSelection.js
Summary: `getEntityKeyForSelection.js` could use some flowification. This doesn't change functionality, since `notEmptyKey` implements the same logic `entityKey` used to be checked with. Reviewed By: miorel Differential Revision: D16854973 fbshipit-source-id: 18a56b020a9f98cc27e4d1bd5acb6bd215c6ea05
1 parent 9b4a628 commit c07a404

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/model/entity/getEntityKeyForSelection.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*
77
* @format
8-
* @flow
8+
* @flow strict-local
99
* @emails oncall+draft_js
1010
*/
1111

@@ -15,6 +15,8 @@ import type ContentState from 'ContentState';
1515
import type {EntityMap} from 'EntityMap';
1616
import type SelectionState from 'SelectionState';
1717

18+
const {notEmptyKey} = require('draftKeyUtils');
19+
1820
/**
1921
* Return the entity key that should be used when inserting text for the
2022
* specified target selection, only if the entity is `MUTABLE`. `IMMUTABLE`
@@ -56,7 +58,7 @@ function getEntityKeyForSelection(
5658
* return it. If not, return null.
5759
*/
5860
function filterKey(entityMap: EntityMap, entityKey: ?string): ?string {
59-
if (entityKey) {
61+
if (notEmptyKey(entityKey)) {
6062
const entity = entityMap.__get(entityKey);
6163
return entity.getMutability() === 'MUTABLE' ? entityKey : null;
6264
}

0 commit comments

Comments
 (0)