fix 'clear all

This commit is contained in:
Robin Scholtes 2023-08-15 13:02:33 +12:00
parent 4947f809a9
commit c110e5a59f
4 changed files with 8 additions and 4 deletions

View file

@ -154,6 +154,7 @@ class Manager {
this.addDynamicListener(".arg:not(select)", "input", this.recipe.ingChange, this.recipe);
this.addDynamicListener(".arg[type=checkbox], .arg[type=radio], select.arg", "change", this.recipe.ingChange, this.recipe);
this.addDynamicListener("#rec-list .dropdown-menu.toggle-dropdown a", "click", this.recipe.dropdownToggleClick, this.recipe);
this.addDynamicListener("#rec-list", "operationremove", this.recipe.clearRecipe.bind(this.recipe));
this.addDynamicListener("textarea.arg", "dragover", this.recipe.textArgDragover, this.recipe);
this.addDynamicListener("textarea.arg", "dragleave", this.recipe.textArgDragLeave, this.recipe);
this.addDynamicListener("textarea.arg", "drop", this.recipe.textArgDrop, this.recipe);

View file

@ -132,6 +132,10 @@ export class CRecipeLi extends HTMLElement {
const clearfixDiv = document.createElement("div");
if (this.app.operations[this.name].flowControl) {
li.classList.add("flow-control-op");
}
li.appendChild(icons);
li.appendChild(clearfixDiv);

View file

@ -280,6 +280,7 @@ class OperationsWaiter {
* @param {string} className - the className to update
*/
updateListItemsClasses(srcListSelector, className) {
console.log("li update");
const listItems = document.querySelectorAll(`${srcListSelector} li`);
const ops = document.querySelectorAll("c-operation-li > li.operation");

View file

@ -243,10 +243,6 @@ class RecipeWaiter {
buildRecipeOperation(name) {
const op = new CRecipeLi(this.app, name, this.app.operations[name].args);
if (this.app.operations[name].flowControl) {
op.classList.add("flow-control-op");
}
// Disable auto-bake if this is a manual op
if (op.manualBake && this.app.autoBake_) {
this.manager.controls.setAutoBake(false);
@ -289,6 +285,8 @@ class RecipeWaiter {
recList.removeChild(recList.firstChild);
}
recList.dispatchEvent(this.manager.operationremove);
window.dispatchEvent(this.app.manager.statechange);
this.app.manager.ops.updateListItemsClasses("#rec-list", "selected");
}