MCPcopy Create free account
hub / github.com/nodejs/node / searchInputAction

Method searchInputAction

deps/v8/tools/turbolizer/src/views/graph-view.ts:336–362  ·  view source on GitHub ↗
(searchInput: HTMLInputElement, e: KeyboardEvent, onlyVisible: boolean)

Source from the content-addressed store, hash-verified

334 }
335
336 public searchInputAction(searchInput: HTMLInputElement, e: KeyboardEvent, onlyVisible: boolean):
337 void {
338 if (e.keyCode == 13) {
339 this.nodeSelectionHandler.clear();
340 const query = searchInput.value;
341 storageSetItem("lastSearch", query);
342 if (query.length == 0) return;
343
344 const reg = new RegExp(query);
345 const filterFunction = (node: GraphNode) => {
346 return (reg.exec(node.getDisplayLabel()) !== null ||
347 (this.state.showTypes && reg.exec(node.getDisplayType())) ||
348 (reg.exec(node.getTitle())) ||
349 reg.exec(node.nodeLabel.opcode) !== null);
350 };
351
352 const selection = this.searchNodes(filterFunction, e, onlyVisible);
353
354 this.nodeSelectionHandler.select(selection, true, false);
355 this.connectVisibleSelectedElements(this.state.selection);
356 this.updateGraphVisibility();
357 searchInput.blur();
358 this.viewSelection();
359 this.focusOnSvg();
360 }
361 e.stopPropagation();
362 }
363
364 public detachSelection(): SelectionStorage {
365 return new SelectionStorage(this.state.selection.detachSelection());

Callers 1

constructorMethod · 0.45

Calls 6

updateGraphVisibilityMethod · 0.95
viewSelectionMethod · 0.95
storageSetItemFunction · 0.90
stopPropagationMethod · 0.80
clearMethod · 0.65
selectMethod · 0.65

Tested by

no test coverage detected