Skip to content

Commit

Permalink
Settings working again
Browse files Browse the repository at this point in the history
  • Loading branch information
bomberstudios committed Oct 22, 2019
1 parent 512ce5e commit eab1925
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 1 addition & 4 deletions resources/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ let allInputs = []
allInputs.push(document.getElementById(id))
})

const populateSettings = () => {
if (window.settings === undefined) populateSettings()
window.populateSettings = () => {
allInputs.forEach(input => {
if (input.type === "checkbox") {
input.checked = window.settings[input.id]
Expand All @@ -43,8 +42,6 @@ const generateSettings = () => {
return obj
}

populateSettings()

document.getElementById("submit").addEventListener("click", function() {
window.postMessage('updateSettings', generateSettings())
})
9 changes: 4 additions & 5 deletions src/artboard-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function ArtboardSettings(context) {
width: 350,
height: 292,
show: false,
resizable: true,
resizable: false,
title: "Artboard Manager — Settings",
minimizable: false,
maximizable: false,
Expand All @@ -39,9 +39,8 @@ export function ArtboardSettings(context) {

// Get Settings
webContents.on("did-start-loading", () => {
webContents.executeJavaScript(
`window.settings=${JSON.stringify(getDefaultSettings())};`
)
let defaultSettings = getDefaultSettings()
webContents.executeJavaScript(`window.settings=${JSON.stringify(defaultSettings)}; populateSettings()`)
})

// add a handler for a call from web content's javascript
Expand Down Expand Up @@ -90,7 +89,7 @@ export function getDefaultSettings() {
obj[settingsKeys.ARRANGESYMBOLS] = true
obj[settingsKeys.ARRANGESYMBOLSPAGE] = false
obj[settingsKeys.EXCLUDEPATTERN] = "--"
obj[settingsKeys.ARTBOARDBASENAMES] = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
obj[settingsKeys.ARTBOARDBASENAMES] = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
obj[settingsKeys.MINIMUMINTEGERDIGITS] = 2
setSettings(obj)
return obj
Expand Down

0 comments on commit eab1925

Please sign in to comment.