Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

3 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. "use strict";
  2. /**
  3. * Copyright (c) Facebook, Inc. and its affiliates.
  4. *
  5. * This source code is licensed under the MIT license found in the
  6. * LICENSE file in the root directory of this source tree.
  7. *
  8. * @format
  9. *
  10. * @emails oncall+draft_js
  11. *
  12. * This is unstable and not part of the public API and should not be used by
  13. * production systems. This file may be update/removed without notice.
  14. */
  15. var ContentBlockNode = require("./ContentBlockNode");
  16. var getNextDelimiterBlockKey = function getNextDelimiterBlockKey(block, blockMap) {
  17. var isExperimentalTreeBlock = block instanceof ContentBlockNode;
  18. if (!isExperimentalTreeBlock) {
  19. return null;
  20. }
  21. var nextSiblingKey = block.getNextSiblingKey();
  22. if (nextSiblingKey) {
  23. return nextSiblingKey;
  24. }
  25. var parent = block.getParentKey();
  26. if (!parent) {
  27. return null;
  28. }
  29. var nextNonDescendantBlock = blockMap.get(parent);
  30. while (nextNonDescendantBlock && !nextNonDescendantBlock.getNextSiblingKey()) {
  31. var parentKey = nextNonDescendantBlock.getParentKey();
  32. nextNonDescendantBlock = parentKey ? blockMap.get(parentKey) : null;
  33. }
  34. if (!nextNonDescendantBlock) {
  35. return null;
  36. }
  37. return nextNonDescendantBlock.getNextSiblingKey();
  38. };
  39. module.exports = getNextDelimiterBlockKey;