mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-10 16:25:01 -04:00
replace the checkbox bootstrap styles with bootstap material v4. Not entirely sure what the issue was, but something in that checkbox decorator code caused reordering / cloning of c-recipe-li to fail
This commit is contained in:
parent
bf27cbb641
commit
9ea785fc63
5 changed files with 52 additions and 28 deletions
|
@ -131,20 +131,21 @@ class HTMLIngredient {
|
||||||
</div>`;
|
</div>`;
|
||||||
break;
|
break;
|
||||||
case "boolean":
|
case "boolean":
|
||||||
html += `<div class="form-group inline boolean-arg ing-flexible">
|
html += `<div class="form-group boolean-arg ing-flexible custom-control custom-checkbox">
|
||||||
<div class="checkbox">
|
<input type="checkbox"
|
||||||
<label ${this.hint ? `data-toggle="tooltip" title="${this.hint}"` : ""}>
|
class="custom-control-input arg"
|
||||||
<input type="checkbox"
|
id="${this.id}"
|
||||||
class="arg"
|
tabindex="${this.tabIndex}"
|
||||||
id="${this.id}"
|
arg-name="${this.name}"
|
||||||
tabindex="${this.tabIndex}"
|
${this.value ? " checked" : ""}
|
||||||
arg-name="${this.name}"
|
${this.disabled ? " disabled" : ""}
|
||||||
${this.value ? " checked" : ""}
|
value="${this.name}"/>
|
||||||
${this.disabled ? " disabled" : ""}
|
<label class="custom-control-label"
|
||||||
value="${this.name}"> ${this.name}
|
${this.hint && `data-toggle="tooltip" title="${this.hint}"`}
|
||||||
|
for="${this.id}">
|
||||||
|
${this.name}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>`
|
||||||
</div>`;
|
|
||||||
break;
|
break;
|
||||||
case "option":
|
case "option":
|
||||||
html += `<div class="form-group ing-medium">
|
html += `<div class="form-group ing-medium">
|
||||||
|
|
|
@ -142,7 +142,7 @@ class Manager {
|
||||||
document.getElementById("support").addEventListener("click", this.controls.supportButtonClick.bind(this.controls));
|
document.getElementById("support").addEventListener("click", this.controls.supportButtonClick.bind(this.controls));
|
||||||
this.addMultiEventListeners("#save-texts textarea", "keyup paste", this.controls.saveTextChange, this.controls);
|
this.addMultiEventListeners("#save-texts textarea", "keyup paste", this.controls.saveTextChange, this.controls);
|
||||||
document.getElementById("rec-list").addEventListener("click", this.controls.onMaximisedRecipeClick.bind(this.controls));
|
document.getElementById("rec-list").addEventListener("click", this.controls.onMaximisedRecipeClick.bind(this.controls));
|
||||||
// A note for the Maximise Controls listeners below: click events via addDynamicListener don't properly bubble and the hit box to maximise is unacceptably tiny, hence this solution
|
// A note for the Maximise Controls listeners below: click events via addDynamicListener don't properly bubble and the hit-box is unacceptably tiny, hence this solution
|
||||||
document.getElementById("maximise-recipe").addEventListener("click", this.controls.onMaximiseButtonClick.bind(this.controls));
|
document.getElementById("maximise-recipe").addEventListener("click", this.controls.onMaximiseButtonClick.bind(this.controls));
|
||||||
document.getElementById("maximise-input").addEventListener("click", this.controls.onMaximiseButtonClick.bind(this.controls));
|
document.getElementById("maximise-input").addEventListener("click", this.controls.onMaximiseButtonClick.bind(this.controls));
|
||||||
document.getElementById("maximise-output").addEventListener("click", this.controls.onMaximiseButtonClick.bind(this.controls));
|
document.getElementById("maximise-output").addEventListener("click", this.controls.onMaximiseButtonClick.bind(this.controls));
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
operations:
|
operations:
|
||||||
- UI tests etc.
|
- UI tests etc.
|
||||||
|
|
||||||
manual testing issues
|
manual testing issues:
|
||||||
|
- some reordering in recipe is not super smooth ( when the recipe-li is very large for instance )
|
||||||
mobile:
|
|
||||||
- all ops with bootstrap checkboxes in recipe break ( due to the bootstrap checkbox func not being applied ). Need to replace / remove this
|
|
||||||
- on ingredient input change ( for instance 'to charcode' 'base' or whatever ) on backspace / removing the value, there is a popup at teh bottem [object Object]. Also happens on actual CC but still. Only happens when value = null
|
|
||||||
|
|
|
@ -22,19 +22,21 @@ export class CRecipeLi extends HTMLElement {
|
||||||
|
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.args = [];
|
this.args = args;
|
||||||
|
this.ingredients = [];
|
||||||
|
|
||||||
this.flowControl = this.app.operations[this.name].flowControl;
|
this.flowControl = this.app.operations[this.name].flowControl;
|
||||||
this.manualBake = this.app.operations[this.name].manualBake;
|
this.manualBake = this.app.operations[this.name].manualBake;
|
||||||
|
|
||||||
for (let i = 0; i < args.length; i++) {
|
for (let i = 0; i < args.length; i++) {
|
||||||
const ing = new HTMLIngredient(args[i], this.app, this.app.manager);
|
const ing = new HTMLIngredient(args[i], this.app, this.app.manager);
|
||||||
this.args.push(ing);
|
this.ingredients.push(ing);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.build();
|
this.build();
|
||||||
|
|
||||||
this.addEventListener("click", this.handleClick.bind(this));
|
// Use mousedown event instead of click to prevent accidentally firing the handler twice on mobile
|
||||||
|
this.addEventListener("mousedown", this.handleMousedown.bind(this));
|
||||||
this.addEventListener("dblclick", this.handleDoubleClick.bind(this));
|
this.addEventListener("dblclick", this.handleDoubleClick.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,16 +44,16 @@ export class CRecipeLi extends HTMLElement {
|
||||||
* Remove listeners on disconnectedCallback
|
* Remove listeners on disconnectedCallback
|
||||||
*/
|
*/
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
this.removeEventListener("click", this.handleClick.bind(this));
|
this.removeEventListener("mousedown", this.handleMousedown.bind(this));
|
||||||
this.removeEventListener("dblclick", this.handleDoubleClick.bind(this));
|
this.removeEventListener("dblclick", this.handleDoubleClick.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle click
|
* Handle mousedown
|
||||||
* @fires Manager#statechange
|
* @fires Manager#statechange
|
||||||
* @param {Event} e
|
* @param {Event} e
|
||||||
*/
|
*/
|
||||||
handleClick(e) {
|
handleMousedown(e) {
|
||||||
const disableIcon = this.querySelector("i.disable-icon");
|
const disableIcon = this.querySelector("i.disable-icon");
|
||||||
const breakpointIcon = this.querySelector("i.breakpoint-icon");
|
const breakpointIcon = this.querySelector("i.breakpoint-icon");
|
||||||
|
|
||||||
|
@ -91,7 +93,7 @@ export class CRecipeLi extends HTMLElement {
|
||||||
* @param {Event} e
|
* @param {Event} e
|
||||||
*/
|
*/
|
||||||
handleDoubleClick(e) {
|
handleDoubleClick(e) {
|
||||||
// do not remove if icons or form elements are double clicked
|
// do not remove if icons or form elements are double-clicked
|
||||||
if (e.target === this.querySelector("li") || e.target === this.querySelector("div.op-title")) {
|
if (e.target === this.querySelector("li") || e.target === this.querySelector("div.op-title")) {
|
||||||
this.removeOperation();
|
this.removeOperation();
|
||||||
}
|
}
|
||||||
|
@ -127,8 +129,8 @@ export class CRecipeLi extends HTMLElement {
|
||||||
li.appendChild(titleDiv);
|
li.appendChild(titleDiv);
|
||||||
li.appendChild(ingredientDiv);
|
li.appendChild(ingredientDiv);
|
||||||
|
|
||||||
for (let i = 0; i < this.args.length; i++) {
|
for (let i = 0; i < this.ingredients.length; i++) {
|
||||||
ingredientDiv.innerHTML += (this.args[i].toHtml());
|
ingredientDiv.innerHTML += (this.ingredients[i].toHtml());
|
||||||
}
|
}
|
||||||
|
|
||||||
const icons = this.buildIcons();
|
const icons = this.buildIcons();
|
||||||
|
|
|
@ -265,6 +265,30 @@ input.toggle-string {
|
||||||
top: 13px;
|
top: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.custom-control-label {
|
||||||
|
line-height: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-control-label:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-control-label::before {
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
border: 1px solid var(--input-border-colour);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-control-input:checked + .custom-control-label::before {
|
||||||
|
background-color: var(--input-highlight-colour);
|
||||||
|
border: 1px solid var(--input-highlight-colour);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-control-label::after {
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
.register-list {
|
.register-list {
|
||||||
background-color: var(--fc-operation-border-colour);
|
background-color: var(--fc-operation-border-colour);
|
||||||
font-family: var(--fixed-width-font-family);
|
font-family: var(--fixed-width-font-family);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue