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