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