本文整理汇总了TypeScript中tinymce/core/caret/CaretFinder.lastPositionIn函数的典型用法代码示例。如果您正苦于以下问题:TypeScript lastPositionIn函数的具体用法?TypeScript lastPositionIn怎么用?TypeScript lastPositionIn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lastPositionIn函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const tryFindRangePosition = (node: Element, rng: Range) => {
return CaretFinder.lastPositionIn(node).fold(
() => false,
(pos) => {
rng.setStart(pos.container(), pos.offset());
rng.setEnd(pos.container(), pos.offset());
return true;
}
);
};
示例2:
const normalizeSelection = (editor: Editor) => {
const rng = editor.selection.getRng();
const startPos = CaretPosition.fromRangeStart(rng);
const endPos = CaretPosition.fromRangeEnd(rng);
if (CaretPosition.isElementPosition(startPos)) {
const container = startPos.container();
if (isTextBlockNode(container)) {
CaretFinder.firstPositionIn(container).each((pos) => rng.setStart(pos.container(), pos.offset()));
}
}
if (CaretPosition.isElementPosition(endPos)) {
const container = startPos.container();
if (isTextBlockNode(container)) {
CaretFinder.lastPositionIn(container).each((pos) => rng.setEnd(pos.container(), pos.offset()));
}
}
editor.selection.setRng(RangeNormalizer.normalize(rng));
};
示例3: getPositionsUntilPreviousLine
const getLastLinePositions = (scope: HTMLElement) => CaretFinder.lastPositionIn(scope).map((pos) => {
return getPositionsUntilPreviousLine(scope, pos).positions.concat(pos);
}).getOr([]);
示例4:
(element) => CaretFinder.lastPositionIn(element),