UNPKG

@atlaskit/editor-plugin-quick-insert

Version:

Quick insert plugin for @atlaskit/editor-core

18 lines (16 loc) • 878 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isOptionDisabled = exports.getFirstEnabledOption = void 0; /** Whether a rendered result tile can't be selected. */ var isOptionDisabled = exports.isOptionDisabled = function isOptionDisabled(option) { return option.hasAttribute('disabled') || option.getAttribute('aria-disabled') === 'true'; }; /** The first result tile in `container` that can be selected. */ var getFirstEnabledOption = exports.getFirstEnabledOption = function 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(function (option) { return !isOptionDisabled(option); }); };