本文整理汇总了TypeScript中tinymce/core/dom/NodeType.isBr函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isBr函数的具体用法?TypeScript isBr怎么用?TypeScript isBr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isBr函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: if
const getBreakType = (scope: HTMLElement, direction: HDirection, currentPos: CaretPosition, nextPos: CaretPosition): BreakType => {
if (NodeType.isBr(nextPos.getNode(direction === HDirection.Forwards))) {
return BreakType.Br;
} else if (isInSameBlock(currentPos, nextPos) === false) {
return BreakType.Block;
} else {
return BreakType.Wrap;
}
};
示例2: getPositionsUntil
const isAtTableCellLine = (getPositionsUntil, scope: HTMLElement, pos: CaretPosition) => {
const lineInfo = getPositionsUntil(scope, pos);
// Since we can't determine if the caret is on the above or below line in a word wrap break we asume it's always
// on the below/above line based on direction. This will make the caret jump one line if you are at the end of the last
// line and moving down or at the beginning of the second line moving up.
if (startsWithWrapBreak(lineInfo) || (!NodeType.isBr(pos.getNode()) && startsWithBrBreak(lineInfo))) {
return !hasNextBreak(getPositionsUntil, scope, lineInfo);
} else {
return lineInfo.breakAt.isNone();
}
};
示例3: CaretWalker
const getPositionsUntil = (predicate: CheckerPredicate, direction: HDirection, scope: HTMLElement, start: CaretPosition): LineInfo => {
const caretWalker = CaretWalker(scope);
let currentPos = start, nextPos: CaretPosition;
const positions: CaretPosition[] = [];
while (currentPos) {
nextPos = walk(direction, caretWalker, currentPos);
if (!nextPos) {
break;
}
if (NodeType.isBr(nextPos.getNode(false))) {
if (direction === HDirection.Forwards) {
return { positions: flip(direction, positions).concat([nextPos]), breakType: BreakType.Br, breakAt: Option.some(nextPos) };
} else {
return { positions: flip(direction, positions), breakType: BreakType.Br, breakAt: Option.some(nextPos) };
}
}
if (!nextPos.isVisible()) {
currentPos = nextPos;
continue;
}
if (predicate(currentPos, nextPos)) {
const breakType = getBreakType(scope, direction, currentPos, nextPos);
return { positions: flip(direction, positions), breakType, breakAt: Option.some(nextPos) };
}
positions.push(nextPos);
currentPos = nextPos;
}
return { positions: flip(direction, positions), breakType: BreakType.Eol, breakAt: Option.none() };
};
示例4: function
suite.test('isBr', function () {
LegacyUnit.strictEqual(NodeType.isBr(null), false);
LegacyUnit.strictEqual(NodeType.isBr(document.createTextNode('x')), false);
LegacyUnit.strictEqual(NodeType.isBr(document.createElement('br')), true);
LegacyUnit.strictEqual(NodeType.isBr(document.createComment('x')), false);
});