本文整理汇总了TypeScript中tinymce/core/api/dom/RangeUtils.getNode函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getNode函数的具体用法?TypeScript getNode怎么用?TypeScript getNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getNode函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const getSelectedAnchors = function (editor) {
let startElm, endElm, rootElm, anchorElms, selection, dom, rng;
selection = editor.selection;
dom = editor.dom;
rng = selection.getRng();
startElm = getParentAnchorOrSelf(dom, RangeUtils.getNode(rng.startContainer, rng.startOffset));
endElm = RangeUtils.getNode(rng.endContainer, rng.endOffset);
rootElm = editor.getBody();
anchorElms = Tools.grep(getSelectedElements(rootElm, startElm, endElm), isLink);
return anchorElms;
};
示例2: if
const getNormalizedPoint = (container: Node, offset: number): Point => {
if (NodeType.isTextNode(container)) {
return { container, offset };
}
const node = RangeUtils.getNode(container, offset);
if (NodeType.isTextNode(node)) {
return {
container: node,
offset: offset >= container.childNodes.length ? node.data.length : 0
};
} else if (node.previousSibling && NodeType.isTextNode(node.previousSibling)) {
return {
container: node.previousSibling,
offset: node.previousSibling.data.length
};
} else if (node.nextSibling && NodeType.isTextNode(node.nextSibling)) {
return {
container: node.nextSibling,
offset: 0
};
}
return { container, offset };
};
示例3: function
const getNormalizedEndPoint = function (container, offset) {
const node = RangeUtils.getNode(container, offset);
if (NodeType.isListItemNode(container) && NodeType.isTextNode(node)) {
const textNodeOffset = offset >= container.childNodes.length ? node.data.length : 0;
return { container: node, offset: textNodeOffset };
}
return { container, offset };
};
示例4: function
const findNextCaretContainer = function (editor, rng, isForward, root) {
let node = rng.startContainer;
const offset = rng.startOffset;
let nonEmptyBlocks, walker;
if (node.nodeType === 3 && (isForward ? offset < node.data.length : offset > 0)) {
return node;
}
nonEmptyBlocks = editor.schema.getNonEmptyElements();
if (node.nodeType === 1) {
node = RangeUtils.getNode(node, offset);
}
walker = new TreeWalker(node, root);
// Delete at <li>|<br></li> then jump over the bogus br
if (isForward) {
if (NodeType.isBogusBr(editor.dom, node)) {
walker.next();
}
}
while ((node = walker[isForward ? 'next' : 'prev2']())) {
if (node.nodeName === 'LI' && !node.hasChildNodes()) {
return node;
}
if (nonEmptyBlocks[node.nodeName]) {
return node;
}
if (node.nodeType === 3 && node.data.length > 0) {
return node;
}
}
};