1 | /**
|
2 | * Copyright (c) Facebook, Inc. and its affiliates.
|
3 | *
|
4 | * This source code is licensed under the MIT license found in the
|
5 | * LICENSE file in the root directory of this source tree.
|
6 | *
|
7 | * @format
|
8 | *
|
9 | * @emails oncall+draft_js
|
10 | */
|
11 | ;
|
12 |
|
13 | var getContentStateFragment = require("./getContentStateFragment");
|
14 |
|
15 | function getFragmentFromSelection(editorState) {
|
16 | var selectionState = editorState.getSelection();
|
17 |
|
18 | if (selectionState.isCollapsed()) {
|
19 | return null;
|
20 | }
|
21 |
|
22 | return getContentStateFragment(editorState.getCurrentContent(), selectionState);
|
23 | }
|
24 |
|
25 | module.exports = getFragmentFromSelection; |
\ | No newline at end of file |