@atlaskit/editor-plugin-quick-insert
Version:
Quick insert plugin for @atlaskit/editor-core
8 lines (7 loc) • 597 B
JavaScript
/** Whether a rendered result tile can't be selected. */
export const isOptionDisabled = option => option.hasAttribute('disabled') || option.getAttribute('aria-disabled') === 'true';
/** The first result tile in `container` that can be selected. */
export const getFirstEnabledOption = container => {
var _container$querySelec;
return Array.from((_container$querySelec = container === null || container === void 0 ? void 0 : container.querySelectorAll('[role="option"]')) !== null && _container$querySelec !== void 0 ? _container$querySelec : []).find(option => !isOptionDisabled(option));
};