mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
Fixed description hiighlighting issue
This commit is contained in:
parent
fe6df8778f
commit
83e49da7f6
2 changed files with 3 additions and 5 deletions
|
@ -111,7 +111,7 @@ class HTMLOperation {
|
||||||
this.name = opName;
|
this.name = opName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.description && descIdxs.length) {
|
if (this.description && descIdxs.length && descIdxs[0][0] >= 0) {
|
||||||
// Find HTML tag offsets
|
// Find HTML tag offsets
|
||||||
const re = /<[^>]+>/g;
|
const re = /<[^>]+>/g;
|
||||||
let match;
|
let match;
|
||||||
|
|
|
@ -109,8 +109,6 @@ class OperationsWaiter {
|
||||||
const matchedOps = [];
|
const matchedOps = [];
|
||||||
const matchedDescs = [];
|
const matchedDescs = [];
|
||||||
|
|
||||||
const searchStr = inStr.toLowerCase();
|
|
||||||
|
|
||||||
for (const opName in this.app.operations) {
|
for (const opName in this.app.operations) {
|
||||||
const op = this.app.operations[opName];
|
const op = this.app.operations[opName];
|
||||||
|
|
||||||
|
@ -118,12 +116,12 @@ class OperationsWaiter {
|
||||||
const [nameMatch, score, idxs] = fuzzyMatch(inStr, opName);
|
const [nameMatch, score, idxs] = fuzzyMatch(inStr, opName);
|
||||||
|
|
||||||
// Match description based on exact match
|
// Match description based on exact match
|
||||||
const descPos = op.description.toLowerCase().indexOf(searchStr);
|
const descPos = op.description.toLowerCase().indexOf(inStr.toLowerCase());
|
||||||
|
|
||||||
if (nameMatch || descPos >= 0) {
|
if (nameMatch || descPos >= 0) {
|
||||||
const operation = new HTMLOperation(opName, this.app.operations[opName], this.app, this.manager);
|
const operation = new HTMLOperation(opName, this.app.operations[opName], this.app, this.manager);
|
||||||
if (highlight) {
|
if (highlight) {
|
||||||
operation.highlightSearchStrings(calcMatchRanges(idxs) || [], [[descPos, searchStr.length]]);
|
operation.highlightSearchStrings(calcMatchRanges(idxs) || [], [[descPos, inStr.length]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nameMatch) {
|
if (nameMatch) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue