diff --git a/src/web/Manager.mjs b/src/web/Manager.mjs index cb579721..e1e07dfd 100755 --- a/src/web/Manager.mjs +++ b/src/web/Manager.mjs @@ -197,6 +197,7 @@ class Manager { this.addMultiEventListener("#output-text", "mousedown dblclick select", this.highlighter.outputMousedown, this.highlighter); this.addMultiEventListener("#output-html", "mousedown dblclick select", this.highlighter.outputHtmlMousedown, this.highlighter); this.addDynamicListener("#output-file-download", "click", this.output.downloadFile, this.output); + this.addDynamicListener("#output-file-show-all", "click", this.output.showAllFile, this.output); this.addDynamicListener("#output-file-slice i", "click", this.output.displayFileSlice, this.output); document.getElementById("show-file-overlay").addEventListener("click", this.output.showFileOverlayClick.bind(this.output)); this.addDynamicListener(".extract-file,.extract-file i", "click", this.output.extractFileClick, this.output); diff --git a/src/web/html/index.html b/src/web/html/index.html index 81f5402b..2167c6b8 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -355,15 +355,17 @@
Size:
+
- - - +
to
- + +
KiB
diff --git a/src/web/index.js b/src/web/index.js index 736b512f..63591d89 100755 --- a/src/web/index.js +++ b/src/web/index.js @@ -49,7 +49,7 @@ function main() { attemptHighlight: true, theme: "classic", useMetaKey: false, - ioDisplayThreshold: 512, + ioDisplayThreshold: 2048, logLevel: "info", autoMagic: true, imagePreview: true, diff --git a/src/web/stylesheets/components/_pane.css b/src/web/stylesheets/components/_pane.css index 9ee8f46f..cf1b9342 100755 --- a/src/web/stylesheets/components/_pane.css +++ b/src/web/stylesheets/components/_pane.css @@ -98,6 +98,11 @@ .io-card.card input[type=number] { padding-right: 6px; padding-left: 6px; + height: unset; +} + +.io-card.card .input-group { + padding-top: 5px; } #files .card-header .float-right a:hover { diff --git a/src/web/waiters/InputWaiter.mjs b/src/web/waiters/InputWaiter.mjs index b9d78d5c..2efcb8a3 100644 --- a/src/web/waiters/InputWaiter.mjs +++ b/src/web/waiters/InputWaiter.mjs @@ -767,7 +767,9 @@ class InputWaiter { // and manually fire inputChange() inputText.value = val; inputText.setSelectionRange(selStart + pastedData.length, selStart + pastedData.length); - this.debounceInputChange(e); + // Don't debounce here otherwise the keyup event for the Ctrl key will cancel an autobake + // (at least for large inputs) + this.inputChange(e, true); } } diff --git a/src/web/waiters/OutputWaiter.mjs b/src/web/waiters/OutputWaiter.mjs index 11a78254..6ca6d526 100755 --- a/src/web/waiters/OutputWaiter.mjs +++ b/src/web/waiters/OutputWaiter.mjs @@ -1122,8 +1122,8 @@ class OutputWaiter { showFileOverlay = document.getElementById("show-file-overlay"), sliceFromEl = document.getElementById("output-file-slice-from"), sliceToEl = document.getElementById("output-file-slice-to"), - sliceFrom = parseInt(sliceFromEl.value, 10), - sliceTo = parseInt(sliceToEl.value, 10), + sliceFrom = parseInt(sliceFromEl.value, 10) * 1024, + sliceTo = parseInt(sliceToEl.value, 10) * 1024, output = this.outputs[this.manager.tabs.getActiveOutputTab()].data; let str; @@ -1137,6 +1137,39 @@ class OutputWaiter { showFileOverlay.style.display = "block"; outputText.value = Utils.printable(str, true); + outputText.style.display = "block"; + outputHtml.style.display = "none"; + outputFile.style.display = "none"; + outputHighlighter.display = "block"; + inputHighlighter.display = "block"; + + this.toggleLoader(false); + } + + /** + * Handler for showing an entire file at user's discretion (even if it's way too big) + */ + async showAllFile() { + document.querySelector("#output-loader .loading-msg").textContent = "Loading entire file at user instruction. This may cause a crash..."; + this.toggleLoader(true); + const outputText = document.getElementById("output-text"), + outputHtml = document.getElementById("output-html"), + outputFile = document.getElementById("output-file"), + outputHighlighter = document.getElementById("output-highlighter"), + inputHighlighter = document.getElementById("input-highlighter"), + showFileOverlay = document.getElementById("show-file-overlay"), + output = this.outputs[this.manager.tabs.getActiveOutputTab()].data; + + let str; + if (output.type === "ArrayBuffer") { + str = Utils.arrayBufferToStr(output.result); + } else { + str = Utils.arrayBufferToStr(await this.getDishBuffer(output.dish)); + } + + outputText.classList.remove("blur"); + showFileOverlay.style.display = "none"; + outputText.value = Utils.printable(str, true); outputText.style.display = "block"; outputHtml.style.display = "none";