本文整理汇总了TypeScript中@ephox/sugar.Element.dom方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Element.dom方法的具体用法?TypeScript Element.dom怎么用?TypeScript Element.dom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/sugar.Element
的用法示例。
在下文中一共展示了Element.dom方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
memContainer.getOpt(anyInSystem).each((panel) => {
const panelW = Width.get(panel.element());
const panelH = Height.get(panel.element());
const width = img.dom().naturalWidth;
const height = img.dom().naturalHeight;
const zoom = Math.min((panelW) / width, (panelH) / height);
if (zoom >= 1) {
zoomState.set(1);
} else {
zoomState.set(zoom);
}
});
示例2:
const getMaxTabviewHeight = (dialog: Element, dialogBody: Element) => {
const rootElm = SelectorFind.ancestor(dialog, '.tox-dialog-wrap').getOr(dialog);
const isFixed = Css.get(rootElm, 'position') === 'fixed';
// Get the document or window/viewport height
let maxHeight;
if (isFixed) {
maxHeight = Math.max(document.documentElement.clientHeight, window.innerHeight);
} else {
maxHeight = Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight);
}
// Determine the max dialog body height
const dialogChrome = dialog.dom().getBoundingClientRect().height - dialogBody.dom().getBoundingClientRect().height;
return maxHeight - dialogChrome;
};
示例3:
const removeEmpty = (text: Element): Option<Element> => {
if (text.dom().length === 0) {
Remove.remove(text);
return Option.none();
}
return Option.some(text);
};
示例4:
const trimBr = (first: boolean, block: Element) => {
CaretFinder.positionIn(first, block.dom())
.map((position) => position.getNode())
.map(Element.fromDom)
.filter(ElementType.isBr)
.each(Remove.remove);
};
示例5: removeEmptyRoot
const sidelongBlockMerge = (rootNode: Element, fromBlock: Element, toBlock: Element): Option<CaretPosition> => {
if (Empty.isEmpty(toBlock)) {
Remove.remove(toBlock);
if (Empty.isEmpty(fromBlock)) {
PaddingBr.fillWithPaddingBr(fromBlock);
}
return CaretFinder.firstPositionIn(fromBlock.dom());
}
const position = CaretFinder.lastPositionIn(toBlock.dom());
Arr.each(extractChildren(fromBlock), (child) => {
Insert.append(toBlock, child);
});
removeEmptyRoot(rootNode, fromBlock);
return position;
};
示例6: Event
const fireEvent = (elem: Element, event: string) => {
let evt;
if (Type.isFunction(Event)) {
evt = new Event(event, {
bubbles: true,
cancelable: true
});
} else { // support IE
evt = document.createEvent('Event');
evt.initEvent(event, true, true);
}
elem.dom().dispatchEvent(evt);
};
示例7: Event
Chain.op(function (elm: Element) {
const element: HTMLElement = elm.dom();
// NOTE we can't fake a paste event here.
let event;
if (Type.isFunction(Event)) {
event = new Event(name, {
bubbles: true,
cancelable: true
});
} else { // support IE
event = document.createEvent('Event');
event.initEvent(name, true, true);
}
element.dispatchEvent(event);
}),
示例8:
Chain.op(function (elm: Element) {
const evt = document.createEvent('HTMLEvents');
evt.initEvent(name, true, true);
elm.dom().dispatchEvent(evt);
}),