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