1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | var ContentBlockNode = require("./ContentBlockNode");
|
17 |
|
18 | var getNextDelimiterBlockKey = function getNextDelimiterBlockKey(block, blockMap) {
|
19 | var isExperimentalTreeBlock = block instanceof ContentBlockNode;
|
20 |
|
21 | if (!isExperimentalTreeBlock) {
|
22 | return null;
|
23 | }
|
24 |
|
25 | var nextSiblingKey = block.getNextSiblingKey();
|
26 |
|
27 | if (nextSiblingKey) {
|
28 | return nextSiblingKey;
|
29 | }
|
30 |
|
31 | var parent = block.getParentKey();
|
32 |
|
33 | if (!parent) {
|
34 | return null;
|
35 | }
|
36 |
|
37 | var nextNonDescendantBlock = blockMap.get(parent);
|
38 |
|
39 | while (nextNonDescendantBlock && !nextNonDescendantBlock.getNextSiblingKey()) {
|
40 | var parentKey = nextNonDescendantBlock.getParentKey();
|
41 | nextNonDescendantBlock = parentKey ? blockMap.get(parentKey) : null;
|
42 | }
|
43 |
|
44 | if (!nextNonDescendantBlock) {
|
45 | return null;
|
46 | }
|
47 |
|
48 | return nextNonDescendantBlock.getNextSiblingKey();
|
49 | };
|
50 |
|
51 | module.exports = getNextDelimiterBlockKey; |
\ | No newline at end of file |