Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

39 rader
1.6 KiB

  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. var ComposedEntityMutability = require("./ComposedEntityMutability");
  13. /**
  14. * An enum representing the possible "mutability" options for an entity.
  15. * This refers to the behavior that should occur when inserting or removing
  16. * characters in a text range with an entity applied to it.
  17. *
  18. * `MUTABLE`:
  19. * The text range can be modified freely. Generally used in cases where
  20. * the text content and the entity do not necessarily have a direct
  21. * relationship. For instance, the text and URI for a link may be completely
  22. * different. The user is allowed to edit the text as needed, and the entity
  23. * is preserved and applied to any characters added within the range.
  24. *
  25. * `IMMUTABLE`:
  26. * Not to be confused with immutable data structures used to represent the
  27. * state of the editor. Immutable entity ranges cannot be modified in any
  28. * way. Adding characters within the range will remove the entity from the
  29. * entire range. Deleting characters will delete the entire range. Example:
  30. * Facebook Page mentions.
  31. *
  32. * `SEGMENTED`:
  33. * Segmented entities allow the removal of partial ranges of text, as
  34. * separated by a delimiter. Adding characters within the range will remove
  35. * the entity from the entire range. Deleting characters within a segmented
  36. * entity will delete only the segments affected by the deletion. Example:
  37. * Facebook User mentions.
  38. */