Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

createEntityInContentState.js.flow 892 B

3 лет назад
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
  9. * @emails oncall+draft_js
  10. */
  11. 'use strict';
  12. import type ContentState from "./ContentState";
  13. import type { DraftEntityMutability } from "./DraftEntityMutability";
  14. import type { DraftEntityType } from "./DraftEntityType";
  15. const DraftEntityInstance = require("./DraftEntityInstance");
  16. const addEntityToContentState = require("./addEntityToContentState");
  17. function createEntityInContentState(contentState: ContentState, type: DraftEntityType, mutability: DraftEntityMutability, data?: Object): ContentState {
  18. return addEntityToContentState(contentState, new DraftEntityInstance({
  19. type,
  20. mutability,
  21. data: data || {}
  22. }));
  23. }
  24. module.exports = createEntityInContentState;