formatting

This commit is contained in:
e218736 2024-02-21 16:23:15 +00:00
parent 4c31c16eef
commit d79d412959
2 changed files with 11 additions and 10 deletions

View file

@ -11,6 +11,7 @@ import {CHR_ENC_SIMPLE_LOOKUP, CHR_ENC_SIMPLE_REVERSE_LOOKUP} from "../../core/l
* A Status bar extension for CodeMirror * A Status bar extension for CodeMirror
*/ */
class StatusBarPanel { class StatusBarPanel {
/** /**
* StatusBarPanel constructor * StatusBarPanel constructor
* @param {Object} opts * @param {Object} opts
@ -264,6 +265,7 @@ class StatusBarPanel {
this.eolVal = state.lineBreak; this.eolVal = state.lineBreak;
} }
/** /**
* Sets the current character encoding of the document * Sets the current character encoding of the document
*/ */
@ -446,8 +448,7 @@ function hideOnClickOutside(element, instantiatingEvent) {
const outsideClickListener = event => { const outsideClickListener = event => {
// Don't trigger if we're clicking inside the element, or if the element // Don't trigger if we're clicking inside the element, or if the element
// is not visible, or if this is the same click event that opened it. // is not visible, or if this is the same click event that opened it.
if ( if (!element.contains(event.target) &&
!element.contains(event.target) &&
event.timeStamp !== instantiatingEvent.timeStamp) { event.timeStamp !== instantiatingEvent.timeStamp) {
hideElement(element); hideElement(element);
} }

View file

@ -121,8 +121,8 @@ class ControlsWaiter {
recipeConfig = recipeConfig || this.app.getRecipeConfig(); recipeConfig = recipeConfig || this.app.getRecipeConfig();
const link = baseURL || window.location.protocol + "//" + const link = baseURL || window.location.protocol + "//" +
window.location.host + window.location.host +
window.location.pathname; window.location.pathname;
const recipeStr = Utils.generatePrettyRecipe(recipeConfig); const recipeStr = Utils.generatePrettyRecipe(recipeConfig);
includeRecipe = includeRecipe && (recipeConfig.length > 0); includeRecipe = includeRecipe && (recipeConfig.length > 0);
@ -185,7 +185,7 @@ class ControlsWaiter {
document.getElementById("save-text-chef").value = Utils.generatePrettyRecipe(recipeConfig, true); document.getElementById("save-text-chef").value = Utils.generatePrettyRecipe(recipeConfig, true);
document.getElementById("save-text-clean").value = JSON.stringify(recipeConfig, null, 2) document.getElementById("save-text-clean").value = JSON.stringify(recipeConfig, null, 2)
.replace(/{\n\s+"/g, '{ "') .replace(/{\n\s+"/g, "{ \"")
.replace(/\[\n\s{3,}/g, "[") .replace(/\[\n\s{3,}/g, "[")
.replace(/\n\s{3,}]/g, "]") .replace(/\n\s{3,}]/g, "]")
.replace(/\s*\n\s*}/g, " }") .replace(/\s*\n\s*}/g, " }")
@ -235,14 +235,14 @@ class ControlsWaiter {
} }
const recipeName = Utils.escapeHtml(document.getElementById("save-name").value); const recipeName = Utils.escapeHtml(document.getElementById("save-name").value);
const recipeStr = document.querySelector("#save-texts .tab-pane.active textarea").value; const recipeStr = document.querySelector("#save-texts .tab-pane.active textarea").value;
if (!recipeName) { if (!recipeName) {
this.app.alert("Please enter a recipe name", 3000); this.app.alert("Please enter a recipe name", 3000);
return; return;
} }
const savedRecipes = localStorage.savedRecipes ? const savedRecipes = localStorage.savedRecipes ?
JSON.parse(localStorage.savedRecipes) : []; JSON.parse(localStorage.savedRecipes) : [];
let recipeId = localStorage.recipeId || 0; let recipeId = localStorage.recipeId || 0;
@ -274,7 +274,7 @@ class ControlsWaiter {
} }
// Add recipes to select // Add recipes to select
const savedRecipes = localStorage.savedRecipes ? const savedRecipes = localStorage.savedRecipes ?
JSON.parse(localStorage.savedRecipes) : []; JSON.parse(localStorage.savedRecipes) : [];
for (i = 0; i < savedRecipes.length; i++) { for (i = 0; i < savedRecipes.length; i++) {
@ -318,7 +318,7 @@ class ControlsWaiter {
if (!this.app.isLocalStorageAvailable()) return false; if (!this.app.isLocalStorageAvailable()) return false;
const el = e.target; const el = e.target;
const savedRecipes = localStorage.savedRecipes ? const savedRecipes = localStorage.savedRecipes ?
JSON.parse(localStorage.savedRecipes) : []; JSON.parse(localStorage.savedRecipes) : [];
const id = parseInt(el.value, 10); const id = parseInt(el.value, 10);
@ -429,7 +429,7 @@ ${navigator.userAgent}
recList.style.bottom = controls.clientHeight + "px"; recList.style.bottom = controls.clientHeight + "px";
} }
} }
export default ControlsWaiter; export default ControlsWaiter;