本文整理汇总了TypeScript中tinymce/core/api/dom/TreeWalker.current函数的典型用法代码示例。如果您正苦于以下问题:TypeScript current函数的具体用法?TypeScript current怎么用?TypeScript current使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了current函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
suite.test('next', function () {
const walker = new TreeWalker(nodes[0], viewBlock.get());
let actualNodes;
actualNodes = [walker.current()];
while ((walker.next())) {
actualNodes.push(walker.current());
}
LegacyUnit.equal(compareNodeLists(nodes, actualNodes), true, 'Should be the same');
});
示例2: TreeWalker
const isCollapsed = (start: Node, end: Node, root: HTMLElement) => {
const walker = new TreeWalker(start, root);
while (walker.next()) {
const node = walker.current();
if (isText(node) && node.data.length === 0) {
continue;
}
return node === end;
}
return false;
};
示例3: TreeWalker
const textBefore = (node: Node, offset: number, block: Node): Option<Spot> => {
if (isText(node) && offset > 0) {
return Option.some({node, offset});
}
let startNode: Node;
if (offset > 0) {
startNode = node.childNodes[offset - 1];
} else {
for (let current = node; current && current !== block && !startNode; current = current.parentNode) {
startNode = current.previousSibling;
}
}
const tw = new TreeWalker(startNode, block);
for (let current = tw.current(); current; current = tw.prev()) {
if (isText(current) && current.length > 0) {
return Option.some({node: current, offset: current.length});
}
}
return Option.none();
};