(searchInput: HTMLInputElement, e: KeyboardEvent, onlyVisible: boolean)
| 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()); |
no test coverage detected