[181] resolve undefined operation name on drag event to recipe list
This commit is contained in:
parent
fd15e76681
commit
85b1dee6fc
@ -26,7 +26,7 @@ class App {
|
|||||||
* @param {CatConf[]} categories - The list of categories and operations to be populated.
|
* @param {CatConf[]} categories - The list of categories and operations to be populated.
|
||||||
* @param {Object.<string, OpConf>} operations - The list of operation configuration objects.
|
* @param {Object.<string, OpConf>} operations - The list of operation configuration objects.
|
||||||
* @param {String[]} defaultFavourites - A list of default favourite operations.
|
* @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) {
|
constructor(categories, operations, defaultFavourites, defaultOptions) {
|
||||||
this.categories = categories;
|
this.categories = categories;
|
||||||
|
|||||||
@ -106,7 +106,7 @@ export class CCategoryLi extends HTMLElement {
|
|||||||
a.innerText = this.label;
|
a.innerText = this.label;
|
||||||
|
|
||||||
if (this.label === "Favourites") {
|
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
|
// 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,
|
// 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.includeStarIcon = includeStarIcon;
|
||||||
this.charIndicesToHighlight = charIndicesToHighlight;
|
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;
|
this.isFavourite = this.app.isLocalStorageAvailable() && JSON.parse(localStorage.favourites).indexOf(name) >= 0;
|
||||||
|
|
||||||
@ -60,15 +60,10 @@ export class COperationLi extends HTMLElement {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle double click
|
* Handle double click
|
||||||
*
|
|
||||||
* @param {Event} e
|
|
||||||
*/
|
*/
|
||||||
handleDoubleClick(e) {
|
handleDoubleClick() {
|
||||||
// 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);
|
this.app.manager.recipe.addOperation(this.operationName);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle mousedown
|
* Handle mousedown
|
||||||
@ -208,6 +203,7 @@ export class COperationLi extends HTMLElement {
|
|||||||
li.setAttribute("data-boundary", "viewport");
|
li.setAttribute("data-boundary", "viewport");
|
||||||
li.setAttribute("data-content", dataContent);
|
li.setAttribute("data-content", dataContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return li;
|
return li;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -160,7 +160,7 @@ export class COperationList extends HTMLElement {
|
|||||||
},
|
},
|
||||||
onEnd: ({item, to, newIndex }) => {
|
onEnd: ({item, to, newIndex }) => {
|
||||||
if (item.parentNode.id === targetListId && dragOverRecList) {
|
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();
|
item.remove();
|
||||||
} else if (!dragOverRecList && !to.classList.contains("op-list")) {
|
} else if (!dragOverRecList && !to.classList.contains("op-list")) {
|
||||||
item.remove();
|
item.remove();
|
||||||
|
|||||||
@ -144,7 +144,7 @@ export class CRecipeLi extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.manualBake && this.app.autoBake_) {
|
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);
|
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 {
|
.op-icon.check-icon {
|
||||||
display: none;
|
display: none;
|
||||||
color: var(--checkmark-color);
|
color: var(--checkmark-color);
|
||||||
|
position: relative;
|
||||||
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.operation.selected {
|
.operation.selected {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user