UNPKG

724 BJavaScriptView Raw
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'use strict';
12
13var CharacterMetadata = require("./CharacterMetadata");
14
15function applyEntityToContentBlock(contentBlock, startArg, end, entityKey) {
16 var start = startArg;
17 var characterList = contentBlock.getCharacterList();
18
19 while (start < end) {
20 characterList = characterList.set(start, CharacterMetadata.applyEntity(characterList.get(start), entityKey));
21 start++;
22 }
23
24 return contentBlock.set('characterList', characterList);
25}
26
27module.exports = applyEntityToContentBlock;
\No newline at end of file