本文整理汇总了TypeScript中@ephox/sugar.Traverse.lastChild方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Traverse.lastChild方法的具体用法?TypeScript Traverse.lastChild怎么用?TypeScript Traverse.lastChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/sugar.Traverse
的用法示例。
在下文中一共展示了Traverse.lastChild方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createEntry
return Traverse.firstChild(item).filter(isList).fold(() => {
// Update selectionState (start)
itemSelection.each((selection) => {
if (Compare.eq(selection.start, item)) {
selectionState.set(true);
}
});
const currentItemEntry = createEntry(item, depth, selectionState.get());
// Update selectionState (end)
itemSelection.each((selection) => {
if (Compare.eq(selection.end, item)) {
selectionState.set(false);
}
});
const childListEntries: Entry[] = Traverse.lastChild(item)
.filter(isList)
.map((list) => parseList(depth, itemSelection, selectionState, list))
.getOr([]);
return currentItemEntry.toArray().concat(childListEntries);
}, (list) => parseList(depth, itemSelection, selectionState, list));
示例2: updateSelectionState
return Traverse.firstChild(item).filter(isList).fold(() => {
updateSelectionState(ItemRange.Start);
const fromCurrentItem: Entry = createEntry(item, depth, selectionState.get());
updateSelectionState(ItemRange.End);
const fromChildList: Entry[] = Traverse.lastChild(item).filter(isList).map(curriedParseList).getOr([]);
return [ fromCurrentItem, ...fromChildList ];
}, curriedParseList);
示例3: function
const trimBlockTrailingBr = function (elm) {
Traverse.lastChild(elm).each(function (lastChild) {
Traverse.prevSibling(lastChild).each(function (lastChildPrevSibling) {
if (ElementType.isBlock(elm) && ElementType.isBr(lastChild) && ElementType.isBlock(lastChildPrevSibling)) {
Remove.remove(lastChild);
}
});
});
};
示例4: function
const getLastChildren = function (node) {
return Traverse.lastChild(node).fold(
Fun.constant([node]),
function (child) {
if (Node.name(child) === 'br') {
return Traverse.prevSibling(child).map(function (sibling) {
return [node].concat(getLastChildren(sibling));
}).getOr([]);
} else {
return [node].concat(getLastChildren(child));
}
}
);
};
示例5: function
const getLast = function () {
const body = Element.fromDom(editor.getBody());
const lastChild = Traverse.lastChild(body);
const getPrevLast = function (last) {
return Traverse.prevSibling(last).bind(function (prevLast) {
return checkLast(prevLast) ? Option.some(prevLast) : getPrevLast(prevLast);
});
};
return lastChild.bind(function (last) {
return checkLast(last) ? Option.some(last) : getPrevLast(last);
});
};
示例6:
const hasLastChildList = (li: Element) => {
return Traverse.lastChild(li).map(isList).getOr(false);
};