Skip to content

Commit

Permalink
Bugfix v8.2.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoudkooi committed Oct 29, 2024
1 parent fc1725c commit 6605dab
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# CHANGELOG.md
## 8.2.3.1 (2024-10-29)
Fixes / changes:
- Bugfix for new setting edittor

## 8.2.3.0 (2024-10-28)
Features:
- Moving the advanced slashcommand and slasswitches editing to Monaco editor in a new browser tab
Expand Down
42 changes: 27 additions & 15 deletions js/monaco/settingeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,27 +122,39 @@ function getFromChromeStorageGlobal(theName, callback) {

function saveSettings() {

const jsonSetting = JSON.parse(editor.getValue());
const minifiedSetting = JSON.stringify(jsonSetting);
let jsonSetting;
let minifiedSetting;

try {
jsonSetting = JSON.parse(editor.getValue());
minifiedSetting = JSON.stringify(jsonSetting);
} catch (e) {
document.querySelector('#response').innerHTML = `Error: Invalid JSON`;
document.querySelector('#response').title = `Error: ${e}`;
return;
}

getFromSyncStorageGlobal("snusettings", function (data) { //get the current settings in case it was edited in the popup
snusettingsSync = data;
snusettingsSync[setting] = minifiedSetting;

snusettings = {};

Object.keys(snusettingsSync).forEach(key => {
if (key.length >= 5000) { //overflow to local storage #204
snusettings[key] = '' + snusettingsSync[key];
delete snusettingsSync[key];
}
});

setToChromeSyncStorageGlobal("snusettings", snusettingsSync);
setToChromeStorageGlobal("snusettings", snusettings);

document.querySelector('#response').innerHTML = `Saved: ${new Date().toLocaleTimeString()}`;
versionid = getEditor().getModel().getAlternativeVersionId();
try {
Object.keys(snusettingsSync).forEach(key => {
if (snusettingsSync[key].length >= 5000) { //overflow to local storage #204
snusettings[key] = '' + snusettingsSync[key];
delete snusettingsSync[key];
}
});

setToChromeSyncStorageGlobal("snusettings", snusettingsSync);
setToChromeStorageGlobal("snusettings", snusettings);

document.querySelector('#response').innerHTML = `Saved: ${new Date().toLocaleTimeString()}`;
versionid = getEditor().getModel().getAlternativeVersionId();
} catch (e) {
document.querySelector('#response').innerHTML = `Error: ${e}`;
}

})

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"short_name": "SN Utils",
"description": "Productivity tools for ServiceNow. (Personal work, not affiliated to ServiceNow)",
"author": "Arnoud Kooi / arnoudkooi.com",
"version": "8.2.2.1",
"version": "8.2.3.1",
"manifest_version": 3,
"permissions": [
"activeTab",
Expand Down

0 comments on commit 6605dab

Please sign in to comment.