本文整理汇总了TypeScript中@ephox/sugar.SelectorFind类的典型用法代码示例。如果您正苦于以下问题:TypeScript SelectorFind类的具体用法?TypeScript SelectorFind怎么用?TypeScript SelectorFind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SelectorFind类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
Logger.t('Editor element properties', Step.sync(function () {
const body = Element.fromDom(document.body);
const editorElement = SelectorFind.descendant(body, '#' + editor.id + '_parent').getOrDie('No elm');
const iframeContainerElement = SelectorFind.descendant(body, '#' + editor.id + '_iframecontainer').getOrDie('No elm');
Assertions.assertDomEq('Should be expected editor container element', editorElement, Element.fromDom(editor.editorContainer));
Assertions.assertDomEq('Should be expected iframe container element element', iframeContainerElement, Element.fromDom(editor.contentAreaContainer));
}))
示例2:
Logger.t('Editor element properties', Step.sync(function () {
const body = Element.fromDom(document.body);
const targetElement = SelectorFind.descendant(body, '#' + editor.id).getOrDie('No elm');
const editorElement = SelectorFind.descendant(body, '#' + editor.id + '_parent').getOrDie('No elm');
Assertions.assertDomEq('Should be expected editor container element', editorElement, Element.fromDom(editor.editorContainer));
Assertions.assertDomEq('Should be expected editor body element', targetElement, Element.fromDom(editor.getBody()));
Assertions.assertDomEq('Should be expected editor target element', targetElement, Element.fromDom(editor.getElement()));
Assertions.assertEq('Should be undefined for inline mode', undefined, editor.contentAreaContainer);
}))
示例3: function
const removeContentEditableSelection = function () {
if (selectedContentEditableNode) {
selectedContentEditableNode.removeAttribute('data-mce-selected');
SelectorFind.descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).each(Remove.remove);
selectedContentEditableNode = null;
}
SelectorFind.descendant(SugarElement.fromDom(editor.getBody()), '#' + realSelectionId).each(Remove.remove);
selectedContentEditableNode = null;
};
示例4: createViewElement
return Step.sync(function () {
const elm = createViewElement(html);
const location = createLocation(elm, elementPath, offset);
Assertions.assertEq('Should be a valid location: ' + html, true, location.isSome());
Assertions.assertEq('Should be expected location', expectedLocationName, locationName(location.getOrDie()));
Assertions.assertDomEq('Should be expected element', SelectorFind.descendant(elm, expectedInline).getOrDie(), locationElement(location.getOrDie()));
});
示例5:
onReceive: (comp, data) => {
// Send the message to the iframe via postMessage
SelectorFind.descendant(comp.element(), 'iframe').each((iframeEle) => {
const iframeWin = iframeEle.dom().contentWindow;
iframeWin.postMessage(data, iframeDomain);
});
}
示例6: measureHeights
AlloyEvents.runOnAttached((comp) => {
SelectorFind.descendant(comp.element(), '[role="tabpanel"]').each((tabview) => {
Css.set(tabview, 'visibility', 'hidden');
// Determine the maximum heights of each tab
comp.getSystem().getByDom(tabview).toOption().each((tabviewComp) => {
const heights = measureHeights(allTabs, tabview, tabviewComp);
// Calculate the maximum tab height and store it
const maxTabHeightOpt = getMaxHeight(heights);
maxTabHeight.set(maxTabHeightOpt);
});
// Set an initial height, based on the current size
updateTabviewHeight(comp.element(), tabview, maxTabHeight);
// Show the tabs
Css.remove(tabview, 'visibility');
showTab(allTabs, comp);
// Use a delay here and recalculate the height, as we need all the components attached
// to be able to properly calculate the max height
Delay.requestAnimationFrame(() => {
updateTabviewHeight(comp.element(), tabview, maxTabHeight);
});
});
}),
示例7: function
const setupUiContainer = function (editor) {
if (editor.settings.ui_container) {
Env.container = SelectorFind.descendant(Element.fromDom(document.body), editor.settings.ui_container).fold(Fun.constant(null), function (elm) {
return elm.dom();
});
}
};
示例8:
const getButton = (selector: string) => {
return component.getSystem().getByDom(
SelectorFind.descendant(component.element(), selector).getOrDie(
`Could not find button defined by: ${selector}`
)
).getOrDie();
};
示例9:
setActive: (state) => {
// Toggle the pressed aria state component
Attr.set(comp.element(), 'aria-pressed', state);
// Toggle the inner button state, as that's the toggle component of the split button
SelectorFind.descendant(comp.element(), 'span').each((button) => {
comp.getSystem().getByDom(button).each((buttonComp) => Toggling.set(buttonComp, state));
});
},
示例10: Error
Chain.op((dialog) => {
if (Attr.has(dialog, 'aria-labelledby')) {
const labelledby = Attr.get(dialog, 'aria-labelledby');
const dialogLabel = SelectorFind.descendant(dialog, '#' + labelledby).getOrDie('Could not find labelledby');
Assertions.assertEq('Checking label text', ariaLabel, Html.get(dialogLabel));
} else {
throw new Error('Dialog did not have an aria-labelledby');
}
})