MCPcopy Create free account
hub / github.com/handsontable/handsontable / isTextSelectionAllowed

Method isTextSelectionAllowed

handsontable/src/tableView.ts:1384–1406  ·  view source on GitHub ↗

* Checks if it's possible to create text selection in element. * * @private * @param {HTMLElement} el The element to check. * @returns {boolean}

(el: HTMLElement)

Source from the content-addressed store, hash-verified

1382 * @returns {boolean}
1383 */
1384 isTextSelectionAllowed(el: HTMLElement) {
1385 if (isInput(el)) {
1386 return true;
1387 }
1388
1389 const isChildOfTableBody = isChildOf(el, this._wt.wtTable.spreader);
1390
1391 if (this.settings.fragmentSelection === true && isChildOfTableBody) {
1392 return true;
1393 }
1394
1395 const isSingleCell = this.hot.getSelectedRangeActive()?.isSingleCell() ?? false;
1396
1397 if (this.settings.fragmentSelection === 'cell' && isSingleCell && isChildOfTableBody) {
1398 return true;
1399 }
1400
1401 if (!this.settings.fragmentSelection && this.isCellEdited() && isSingleCell) {
1402 return true;
1403 }
1404
1405 return false;
1406 }
1407
1408 /**
1409 * Checks if user's been called mousedown.

Callers 1

registerEventsMethod · 0.95

Calls 5

isCellEditedMethod · 0.95
isInputFunction · 0.90
isChildOfFunction · 0.90
isSingleCellMethod · 0.45

Tested by

no test coverage detected