本文整理汇总了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;
}
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:LineReader.ts
示例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();
}
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:12,代码来源:TableNavigation.ts
示例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() };
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:36,代码来源:LineReader.ts
示例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);
});
开发者ID:abstask,项目名称:tinymce,代码行数:6,代码来源:NodeTypeTest.ts
注:本文中的tinymce/core/dom/NodeType.isBr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论