[#181] fix search result data-name issues ( purging html only for data-name attribute, update op-list checkmarks accordingly )

This commit is contained in:
Robin Scholtes 2023-04-27 21:13:14 +12:00
parent bc93969d4b
commit c6cc998100
4 changed files with 7 additions and 6 deletions

View file

@ -46,8 +46,11 @@ class HTMLOperation {
* @returns {string} * @returns {string}
*/ */
toStubHtml(removeIcon) { toStubHtml(removeIcon) {
console.log("toStubHtml ==>",this.name); // this.name is pollute with HTML if it originates from search-results, so before
let html = `<li data-name="${this.name}" class="operation"`; // returning the HTML we purge this.name from any HTML for the data-name attribute
const name = this.name.replace(/(<([^>]+)>)/ig, "");
let html = `<li data-name="${name}" class="operation"`;
if (this.description) { if (this.description) {
const infoLink = this.infoURL ? `<hr>${titleFromWikiLink(this.infoURL)}` : ""; const infoLink = this.infoURL ? `<hr>${titleFromWikiLink(this.infoURL)}` : "";

View file

@ -5,7 +5,6 @@
#### Mobile UI ( on real device ): #### Mobile UI ( on real device ):
- How to add operations to favourites since drag and drop is now disabled on mobile ( maybe a star icon...? ) - How to add operations to favourites since drag and drop is now disabled on mobile ( maybe a star icon...? )
- 'name' in recipe waiter > addOperation is <b>what</b>ever instead of a plain data-name, updateSelectedOperations not working for search results because of that
- Recipe list on mobile panel is too small to comfortably scroll and change order of recipes - Recipe list on mobile panel is too small to comfortably scroll and change order of recipes
- test *thoroughly* with keyboard popping up because that messes with view-heights on mobile probably and might make it a very frustrating experience - test *thoroughly* with keyboard popping up because that messes with view-heights on mobile probably and might make it a very frustrating experience

View file

@ -108,6 +108,7 @@ class OperationsWaiter {
searchResultsEl.innerHTML = matchedOpsHtml; searchResultsEl.innerHTML = matchedOpsHtml;
searchResultsEl.dispatchEvent(this.manager.oplistcreate); searchResultsEl.dispatchEvent(this.manager.oplistcreate);
} }
this.manager.recipe.updateSelectedOperations();
} }
} }
@ -139,6 +140,7 @@ class OperationsWaiter {
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, inStr.length]]); operation.highlightSearchStrings(calcMatchRanges(idxs), [[descPos, inStr.length]]);
} }

View file

@ -147,7 +147,6 @@ class RecipeWaiter {
return; return;
} }
console.log("opSortEnd ==>", evt.item);
this.buildRecipeOperation(evt.item); this.buildRecipeOperation(evt.item);
evt.item.dispatchEvent(this.manager.operationadd); evt.item.dispatchEvent(this.manager.operationadd);
} }
@ -372,7 +371,6 @@ class RecipeWaiter {
* @param {element} el - The operation stub element from the operations pane * @param {element} el - The operation stub element from the operations pane
*/ */
buildRecipeOperation(el) { buildRecipeOperation(el) {
console.log("buildRecipeOperation ==>", el);
const opName = el.textContent; const opName = el.textContent;
const op = new HTMLOperation(opName, this.app.operations[opName], this.app, this.manager); const op = new HTMLOperation(opName, this.app.operations[opName], this.app, this.manager);
el.innerHTML = op.toFullHtml(); el.innerHTML = op.toFullHtml();
@ -398,7 +396,6 @@ class RecipeWaiter {
* @returns {element} * @returns {element}
*/ */
addOperation(name) { addOperation(name) {
console.log("addOperation ==>", name);
const item = document.createElement("li"); const item = document.createElement("li");
item.setAttribute("data-name", name); item.setAttribute("data-name", name);