Input and Output character encodings are now stored in the URL, allowing for accuate deeplinking

This commit is contained in:
n1474335 2022-09-16 19:24:57 +01:00
parent a141873db8
commit a07b8f693b
5 changed files with 51 additions and 30 deletions

View file

@ -92,7 +92,7 @@ class OutputWaiter {
bakeStats: this.bakeStats,
eolHandler: this.eolChange.bind(this),
chrEncHandler: this.chrEncChange.bind(this),
initialChrEncVal: this.outputChrEnc
chrEncGetter: this.getChrEnc.bind(this)
}),
htmlPlugin(this.htmlOutput),
copyOverride(),
@ -145,9 +145,20 @@ class OutputWaiter {
* @param {number} chrEncVal
*/
chrEncChange(chrEncVal) {
if (typeof chrEncVal !== "number") return;
this.outputChrEnc = chrEncVal;
// Reset the output, forcing it to re-decode the data with the new character encoding
this.setOutput(this.currentOutputCache, true);
// Update the URL manually since we aren't firing a statechange event
this.app.updateURL(true);
}
/**
* Getter for the input character encoding
* @returns {number}
*/
getChrEnc() {
return this.outputChrEnc;
}
/**