Sha256: 6239be46b05d51a43d9a90523e0b251e4b4d99c5f23138283ce3425f2d37f958
Contents?: true
Size: 1.84 KB
Versions: 26
Compression:
Stored size: 1.84 KB
Contents
import { getUIValue, getUISelection } from '../../document/UI.js'; import '../../utils/click/isClickableInput.js'; import '../../utils/dataTransfer/Clipboard.js'; import { getContentEditable } from '../../utils/edit/isContentEditable.js'; import '../../utils/edit/isEditable.js'; import '../../utils/edit/maxLength.js'; import { hasOwnSelection } from '../../utils/focus/selection.js'; import '../../utils/keyDef/readNextDescriptor.js'; import '../../utils/misc/level.js'; import '../../options.js'; import { setSelection } from './setSelection.js'; /** * Expand a selection like the browser does when pressing Ctrl+A. */ function selectAll(target) { if (hasOwnSelection(target)) { return setSelection({ focusNode: target, anchorOffset: 0, focusOffset: getUIValue(target).length }); } var _getContentEditable; const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body; setSelection({ focusNode, anchorOffset: 0, focusOffset: focusNode.childNodes.length }); } function isAllSelected(target) { if (hasOwnSelection(target)) { return getUISelection(target).startOffset === 0 && getUISelection(target).endOffset === getUIValue(target).length; } var _getContentEditable; const focusNode = (_getContentEditable = getContentEditable(target)) !== null && _getContentEditable !== void 0 ? _getContentEditable : target.ownerDocument.body; const selection = target.ownerDocument.getSelection(); return (selection === null || selection === void 0 ? void 0 : selection.anchorNode) === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length; } export { isAllSelected, selectAll };
Version data entries
26 entries across 26 versions & 1 rubygems