本文整理汇总了TypeScript中tinymce/core/caret/CaretPosition.CaretPosition.container方法的典型用法代码示例。如果您正苦于以下问题:TypeScript CaretPosition.container方法的具体用法?TypeScript CaretPosition.container怎么用?TypeScript CaretPosition.container使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinymce/core/caret/CaretPosition.CaretPosition
的用法示例。
在下文中一共展示了CaretPosition.container方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: isCaretContainerInline
const isAfterInline = (pos: CaretPosition): boolean => {
const container = pos.container();
if (!pos || !NodeType.isText(container)) {
return false;
}
// The text nodes may not be normalized, so check the current node and the next one
return container.data.charAt(pos.offset() - 1) === Zwsp.ZWSP || pos.isAtEnd() && isCaretContainerInline(container.nextSibling);
};
示例2:
const getChildNodeAtRelativeOffset = (relativeOffset: number, caretPosition: CaretPosition): Node => {
let container, offset;
if (!caretPosition) {
return null;
}
container = caretPosition.container();
offset = caretPosition.offset();
if (!isElement(container)) {
return null;
}
return container.childNodes[offset + relativeOffset];
};
示例3:
const isAfterInline = (pos: CaretPosition): boolean => {
const container = pos.container();
return pos && NodeType.isText(container) && container.data.charAt(pos.offset() - 1) === Zwsp.ZWSP;
};
示例4: getParentBlock
const isInSameBlock = (caretPosition1: CaretPosition, caretPosition2: CaretPosition, rootNode?: Node): boolean => {
return getParentBlock(caretPosition1.container(), rootNode) === getParentBlock(caretPosition2.container(), rootNode);
};
示例5: predicate
const isChar = (forward: boolean, predicate: (chr: string) => boolean, pos: CaretPosition) => {
return Option.from(pos.container()).filter(NodeType.isText).exists((text: Text) => {
const delta = forward ? 0 : -1;
return predicate(text.data.charAt(pos.offset() + delta));
});
};
示例6: getEditingHost
const isInSameEditingHost = (caretPosition1: CaretPosition, caretPosition2: CaretPosition, rootNode?: Node): boolean => {
return getEditingHost(caretPosition1.container(), rootNode) === getEditingHost(caretPosition2.container(), rootNode);
};