本文整理匯總了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);
};