diff --git a/src/renderer/config-blocks/ActionBlockInformation.ts b/src/renderer/config-blocks/ActionBlockInformation.ts index f335ecb37..60d31dee6 100644 --- a/src/renderer/config-blocks/ActionBlockInformation.ts +++ b/src/renderer/config-blocks/ActionBlockInformation.ts @@ -35,4 +35,5 @@ interface Information { hideIcon: boolean; rounding?: "top" | "bottom"; compositeLua?: LuaScript[]; + syntaxPreprocessor?: string; } diff --git a/src/renderer/main/panels/configuration/Configuration.store.js b/src/renderer/main/panels/configuration/Configuration.store.js index 9e9c5edf3..f90bad8ba 100644 --- a/src/renderer/main/panels/configuration/Configuration.store.js +++ b/src/renderer/main/panels/configuration/Configuration.store.js @@ -48,9 +48,10 @@ const luaminOptions = { }; export class ConfigObject { - constructor({ short, script }) { + constructor({ short, script, scriptForSyntaxCheck }) { this.short = short; this.script = script; + this.scriptForSyntaxCheck = scriptForSyntaxCheck ?? script; this.id = uuidv4(); let res = getComponentInformation({ short: short }); @@ -100,6 +101,7 @@ export class ConfigObject { //TODO: Rework composite blocks in a way, so this exception //does not occure. let code = this.script; + /* if (this.short !== "cb" && !this.short.startsWith("x")) { if (code.startsWith("elseif")) { code = code.replace("elseif", "if"); @@ -117,7 +119,7 @@ export class ConfigObject { if (this.short === "raw") { return true; } - } + }*/ try { //Is this necessary? diff --git a/src/renderer/main/panels/configuration/Configuration.svelte b/src/renderer/main/panels/configuration/Configuration.svelte index 45df8135d..e920fdb91 100644 --- a/src/renderer/main/panels/configuration/Configuration.svelte +++ b/src/renderer/main/panels/configuration/Configuration.svelte @@ -198,8 +198,8 @@ } function handleConfigUpdate(e) { - const { index, short, script } = e.detail; - updateAction(index, short, script); + const { index, config } = e.detail; + updateAction(index, config); sendCurrentConfigurationToGrid(); const target = ConfigTarget.getCurrent(); diff --git a/src/renderer/main/panels/configuration/components/DynamicWrapper.svelte b/src/renderer/main/panels/configuration/components/DynamicWrapper.svelte index 1b390cb2e..5a95ae83a 100644 --- a/src/renderer/main/panels/configuration/components/DynamicWrapper.svelte +++ b/src/renderer/main/panels/configuration/components/DynamicWrapper.svelte @@ -60,10 +60,14 @@ } function handleOutput(e) { + const { short, script, scriptForSyntaxCheck } = e.detail; dispatch("update", { index: index, - short: e.detail.short, - script: e.detail.script, + config: new ConfigObject({ + short: short, + script: script, + scriptForSyntaxCheck: scriptForSyntaxCheck, + }), }); } diff --git a/src/renderer/main/panels/configuration/configuration-actions.ts b/src/renderer/main/panels/configuration/configuration-actions.ts index d3cf21d64..9284c3463 100644 --- a/src/renderer/main/panels/configuration/configuration-actions.ts +++ b/src/renderer/main/panels/configuration/configuration-actions.ts @@ -296,12 +296,14 @@ export function insertAction( } } -export function updateAction(index: number, short: string, script: string) { +export function updateAction(index: number, newConfig: ConfigObject) { + const { short, script, scriptForSyntaxCheck } = newConfig; configManager.update((s: ConfigList) => { const config = s[index]; if (typeof config !== "undefined") { config.short = short; config.script = script; + config.scriptForSyntaxCheck = scriptForSyntaxCheck; } return s; });