Skip to content

Commit

Permalink
fixes share button
Browse files Browse the repository at this point in the history
  • Loading branch information
joaovictor3g committed Apr 18, 2024
1 parent 1b43521 commit b4d1dc9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions web/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ function run() {
function share() {
const values = getRunValues();

const str = JSON.stringify(values);
const str = JSON.stringify({
...values,
mode: localStorage.getItem(localStorageModeKey) ?? "cel",
});
var compressed_uint8array = pako.gzip(str);
var b64encoded_string = btoa(
String.fromCharCode.apply(null, compressed_uint8array)
Expand Down Expand Up @@ -104,8 +107,14 @@ if (urlParams.has("content")) {
throw new Error("Invalid content parameter");
}
const obj = JSON.parse(decompressedData);
celEditor.setValue(obj.expression, -1);
dataEditor.setValue(obj.data, -1);
localStorage.setItem(localStorageModeKey, obj.mode);
new AceEditor(obj.mode).setValue(obj.expression, -1);
document
.querySelectorAll(".editor__input.data__input")
.forEach((editor) => {
const containerId = editor.id;
new AceEditor(containerId).setValue(obj[containerId], -1);
});
} catch (error) {
console.error(error);
}
Expand Down

0 comments on commit b4d1dc9

Please sign in to comment.