Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let target = event.target as HTMLElement;
let cellFilter = (node: HTMLElement) =>
node.classList.contains(CONSOLE_CELL_CLASS);
let cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
if (cellIndex === -1) {
// `event.target` sometimes gives an orphaned node in
// Firefox 57, which can have `null` anywhere in its parent line. If we fail
// to find a cell using `event.target`, try again using a target
// reconstructed from the position of the click event.
target = document.elementFromPoint(
event.clientX,
event.clientY
) as HTMLElement;
cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
}
if (cellIndex === -1) {
return;
}
const cell = this._cells.get(cellIndex);
let targetArea: CellDragUtils.ICellTargetArea = CellDragUtils.detectTargetArea(
cell,
event.target as HTMLElement
);
if (targetArea === 'prompt') {
this._dragData = {
pressX: event.clientX,
private _evtMouseDown(event: MouseEvent): void {
const { button, shiftKey } = event;
// We only handle main or secondary button actions.
if (
!(button === 0 || button === 2) ||
// Shift right-click gives the browser default behavior.
(shiftKey && button === 2)
) {
return;
}
let target = event.target as HTMLElement;
let cellFilter = (node: HTMLElement) =>
node.classList.contains(CONSOLE_CELL_CLASS);
let cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
if (cellIndex === -1) {
// `event.target` sometimes gives an orphaned node in
// Firefox 57, which can have `null` anywhere in its parent line. If we fail
// to find a cell using `event.target`, try again using a target
// reconstructed from the position of the click event.
target = document.elementFromPoint(
event.clientX,
event.clientY
) as HTMLElement;
cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
}
if (cellIndex === -1) {
return;
}
private _evtMouseDown(event: MouseEvent): void {
const { button, shiftKey } = event;
// We only handle main or secondary button actions.
if (
!(button === 0 || button === 2) ||
// Shift right-click gives the browser default behavior.
(shiftKey && button === 2)
) {
return;
}
let target = event.target as HTMLElement;
let cellFilter = (node: HTMLElement) =>
node.classList.contains(CONSOLE_CELL_CLASS);
let cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
if (cellIndex === -1) {
// `event.target` sometimes gives an orphaned node in
// Firefox 57, which can have `null` anywhere in its parent line. If we fail
// to find a cell using `event.target`, try again using a target
// reconstructed from the position of the click event.
target = document.elementFromPoint(
event.clientX,
event.clientY
) as HTMLElement;
cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
}
if (cellIndex === -1) {
return;
}
let target = event.target as HTMLElement;
let cellFilter = (node: HTMLElement) =>
node.classList.contains(CONSOLE_CELL_CLASS);
let cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
if (cellIndex === -1) {
// `event.target` sometimes gives an orphaned node in
// Firefox 57, which can have `null` anywhere in its parent line. If we fail
// to find a cell using `event.target`, try again using a target
// reconstructed from the position of the click event.
target = document.elementFromPoint(
event.clientX,
event.clientY
) as HTMLElement;
cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
}
if (cellIndex === -1) {
return;
}
const cell = this._cells.get(cellIndex);
let targetArea: CellDragUtils.ICellTargetArea = CellDragUtils.detectTargetArea(
cell,
event.target as HTMLElement
);
if (targetArea === 'prompt') {
this._dragData = {
pressX: event.clientX,
let target = event.target as HTMLElement;
let cellFilter = (node: HTMLElement) =>
node.classList.contains(CONSOLE_CELL_CLASS);
let cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
if (cellIndex === -1) {
// `event.target` sometimes gives an orphaned node in
// Firefox 57, which can have `null` anywhere in its parent line. If we fail
// to find a cell using `event.target`, try again using a target
// reconstructed from the position of the click event.
target = document.elementFromPoint(
event.clientX,
event.clientY
) as HTMLElement;
cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
}
if (cellIndex === -1) {
return;
}
const cell = this._cells.get(cellIndex);
let targetArea: CellDragUtils.ICellTargetArea = CellDragUtils.detectTargetArea(
cell,
event.target as HTMLElement
);
if (targetArea === 'prompt') {
this._dragData = {
pressX: event.clientX,
private _evtMouseDown(event: MouseEvent): void {
const { button, shiftKey } = event;
// We only handle main or secondary button actions.
if (
!(button === 0 || button === 2) ||
// Shift right-click gives the browser default behavior.
(shiftKey && button === 2)
) {
return;
}
let target = event.target as HTMLElement;
let cellFilter = (node: HTMLElement) =>
node.classList.contains(CONSOLE_CELL_CLASS);
let cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
if (cellIndex === -1) {
// `event.target` sometimes gives an orphaned node in
// Firefox 57, which can have `null` anywhere in its parent line. If we fail
// to find a cell using `event.target`, try again using a target
// reconstructed from the position of the click event.
target = document.elementFromPoint(
event.clientX,
event.clientY
) as HTMLElement;
cellIndex = CellDragUtils.findCell(target, this._cells, cellFilter);
}
if (cellIndex === -1) {
return;
}