Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

applyEntityToContentBlock.js.flow 862 B

há 3 anos
1234567891011121314151617181920212223242526272829
  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. * @flow strict-local
  9. * @emails oncall+draft_js
  10. */
  11. 'use strict';
  12. import type { BlockNodeRecord } from "./BlockNodeRecord";
  13. const CharacterMetadata = require("./CharacterMetadata");
  14. function applyEntityToContentBlock(contentBlock: BlockNodeRecord, startArg: number, end: number, entityKey: ?string): BlockNodeRecord {
  15. let start = startArg;
  16. let characterList = contentBlock.getCharacterList();
  17. while (start < end) {
  18. characterList = characterList.set(start, CharacterMetadata.applyEntity(characterList.get(start), entityKey));
  19. start++;
  20. }
  21. return contentBlock.set('characterList', characterList);
  22. }
  23. module.exports = applyEntityToContentBlock;