mirror of
https://github.com/gchq/CyberChef.git
synced 2026-03-25 16:21:41 -07:00
[181] resolve undefined operation name on drag event to recipe list
This commit is contained in:
parent
fd15e76681
commit
85b1dee6fc
6 changed files with 10 additions and 12 deletions
|
|
@ -26,7 +26,7 @@ class App {
|
|||
* @param {CatConf[]} categories - The list of categories and operations to be populated.
|
||||
* @param {Object.<string, OpConf>} operations - The list of operation configuration objects.
|
||||
* @param {String[]} defaultFavourites - A list of default favourite operations.
|
||||
* @param {Object} options - Default setting for app options.
|
||||
* @param {Object} defaultOptions - Default setting for app options.
|
||||
*/
|
||||
constructor(categories, operations, defaultFavourites, defaultOptions) {
|
||||
this.categories = categories;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ export class CCategoryLi extends HTMLElement {
|
|||
a.innerText = this.label;
|
||||
|
||||
if (this.label === "Favourites") {
|
||||
const editFavouritesButton = this.buildEditFavouritesButton(a);
|
||||
const editFavouritesButton = this.buildEditFavouritesButton();
|
||||
|
||||
// Note: I'm leaving this here as it was in the code originally, but it's not doing anything and it didn't
|
||||
// do anything before my refactoring. I imagine we may want to fix that at some point though,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export class COperationLi extends HTMLElement {
|
|||
this.includeStarIcon = includeStarIcon;
|
||||
this.charIndicesToHighlight = charIndicesToHighlight;
|
||||
|
||||
this.config = this.app.operations[name];
|
||||
this.config = this.app.operations[this.operationName];
|
||||
|
||||
this.isFavourite = this.app.isLocalStorageAvailable() && JSON.parse(localStorage.favourites).indexOf(name) >= 0;
|
||||
|
||||
|
|
@ -60,14 +60,9 @@ export class COperationLi extends HTMLElement {
|
|||
|
||||
/**
|
||||
* Handle double click
|
||||
*
|
||||
* @param {Event} e
|
||||
*/
|
||||
handleDoubleClick(e) {
|
||||
// this span is element holding the operation title
|
||||
if (e.target === this.querySelector("li") || e.target === this.querySelector("span")) {
|
||||
this.app.manager.recipe.addOperation(this.operationName);
|
||||
}
|
||||
handleDoubleClick() {
|
||||
this.app.manager.recipe.addOperation(this.operationName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -208,6 +203,7 @@ export class COperationLi extends HTMLElement {
|
|||
li.setAttribute("data-boundary", "viewport");
|
||||
li.setAttribute("data-content", dataContent);
|
||||
}
|
||||
|
||||
return li;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ export class COperationList extends HTMLElement {
|
|||
},
|
||||
onEnd: ({item, to, newIndex }) => {
|
||||
if (item.parentNode.id === targetListId && dragOverRecList) {
|
||||
this.app.manager.recipe.addOperation(item.name, newIndex);
|
||||
this.app.manager.recipe.addOperation(item.querySelector("li").getAttribute("data-name"), newIndex);
|
||||
item.remove();
|
||||
} else if (!dragOverRecList && !to.classList.contains("op-list")) {
|
||||
item.remove();
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ export class CRecipeLi extends HTMLElement {
|
|||
}
|
||||
|
||||
if (this.manualBake && this.app.autoBake_) {
|
||||
this.manager.controls.setAutoBake(false);
|
||||
this.app.manager.controls.setAutoBake(false);
|
||||
this.app.alert("Auto-Bake is disabled by default when using this operation.", 5000);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ li.operation.favourite > .op-icon.star-icon {
|
|||
.op-icon.check-icon {
|
||||
display: none;
|
||||
color: var(--checkmark-color);
|
||||
position: relative;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.operation.selected {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue