本文整理汇总了TypeScript中@ephox/dom-globals.Element.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Element.default方法的具体用法?TypeScript Element.default怎么用?TypeScript Element.default使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/dom-globals.Element
的用法示例。
在下文中一共展示了Element.default方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getStart
const getSelectedBlocks = (dom: DOMUtils, rng: Range, startElm?: Element, endElm?: Element): Element[] => {
let node, root;
const selectedBlocks = [];
root = dom.getRoot();
startElm = dom.getParent(startElm || getStart(root, rng, rng.collapsed), dom.isBlock) as Element;
endElm = dom.getParent(endElm || getEnd(root, rng, rng.collapsed), dom.isBlock) as Element;
if (startElm && startElm !== root) {
selectedBlocks.push(startElm);
}
if (startElm && endElm && startElm !== endElm) {
node = startElm;
const walker = new TreeWalker(startElm, root);
while ((node = walker.next()) && node !== endElm) {
if (dom.isBlock(node)) {
selectedBlocks.push(node);
}
}
}
if (endElm && startElm !== endElm && endElm !== root) {
selectedBlocks.push(endElm);
}
return selectedBlocks;
};
示例2: function
const create = (editor: Editor, lastRngCell, pasteBinDefaultContent: string) => {
const dom = editor.dom, body = editor.getBody();
let pasteBinElm;
lastRngCell.set(editor.selection.getRng());
// Create a pastebin
pasteBinElm = editor.dom.add(getPasteBinParent(editor), 'div', {
'id': 'mcepastebin',
'class': 'mce-pastebin',
'contentEditable': true,
'data-mce-bogus': 'all',
'style': 'position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0'
}, pasteBinDefaultContent);
// Move paste bin out of sight since the controlSelection rect gets displayed otherwise on IE and Gecko
if (Env.ie || Env.gecko) {
dom.setStyle(pasteBinElm, 'left', dom.getStyle(body, 'direction', true) === 'rtl' ? 0xFFFF : -0xFFFF);
}
// Prevent focus events from bubbeling fixed FocusManager issues
dom.bind(pasteBinElm, 'beforedeactivate focusin focusout', function (e) {
e.stopPropagation();
});
delegatePasteEvents(editor, pasteBinElm, pasteBinDefaultContent);
pasteBinElm.focus();
editor.selection.select(pasteBinElm, true);
};
示例3: CaretWalker
const exitPreBlock = (editor, direction: HDirection, range: Range): void => {
let pre, caretPos, newBlock;
const caretWalker = CaretWalker(editor.getBody());
const getNextVisualCaretPosition = Fun.curry(getVisualCaretPosition, caretWalker.next);
const getPrevVisualCaretPosition = Fun.curry(getVisualCaretPosition, caretWalker.prev);
if (range.collapsed && editor.settings.forced_root_block) {
pre = editor.dom.getParent(range.startContainer, 'PRE');
if (!pre) {
return;
}
if (direction === 1) {
caretPos = getNextVisualCaretPosition(CaretPosition.fromRangeStart(range));
} else {
caretPos = getPrevVisualCaretPosition(CaretPosition.fromRangeStart(range));
}
if (!caretPos) {
newBlock = createTextBlock(editor);
if (direction === 1) {
editor.$(pre).after(newBlock);
} else {
editor.$(pre).before(newBlock);
}
editor.selection.select(newBlock, true);
editor.selection.collapse();
}
}
};
示例4: function
Delay.setEditorTimeout(self, function () {
const focusedEditor = editorManager.focusedEditor;
// Still the same editor the blur was outside any editor UI
if (!isUIElement(self, getActiveElement()) && focusedEditor === self) {
self.fire('blur', { focusedEditor: null });
editorManager.focusedEditor = null;
}
});
示例5:
const insertBlock = (blockName: string, node: Node, before: boolean): Node => {
let doc, blockNode, parentNode;
doc = node.ownerDocument;
blockNode = doc.createElement(blockName);
blockNode.setAttribute('data-mce-caret', before ? 'before' : 'after');
blockNode.setAttribute('data-mce-bogus', 'all');
blockNode.appendChild(createBogusBr());
parentNode = node.parentNode;
if (!before) {
if (node.nextSibling) {
parentNode.insertBefore(blockNode, node.nextSibling);
} else {
parentNode.appendChild(blockNode);
}
} else {
parentNode.insertBefore(blockNode, node);
}
return blockNode;
};
示例6: getPasteBinParent
const isExternalPasteBin = (editor: Editor) => getPasteBinParent(editor) !== editor.getBody();
示例7: findSibling
const findAdjacentContentEditableFalseElm = function (rng: Range) {
return findSibling(rng.startContainer, rng.startOffset) || findSibling(rng.endContainer, rng.endOffset);
};