diff --git a/src/lang/en-us.json b/src/lang/en-us.json index 70daded19..a44bcba3a 100644 --- a/src/lang/en-us.json +++ b/src/lang/en-us.json @@ -210,6 +210,7 @@ "normal": "Normal", "app settings": "App settings", "disable in-app-browser caching": "Disable in-app-browser caching", + "Should use Current File For preview instead of default (index.html)": "Should use Current File For preview instead of default (index.html)", "copied to clipboard": "Copied to clipboard", "remember opened files": "Remember opened files", "remember opened folders": "Remember opened folders", diff --git a/src/lib/commands.js b/src/lib/commands.js index de3367ff8..4697ad078 100644 --- a/src/lib/commands.js +++ b/src/lib/commands.js @@ -230,8 +230,9 @@ export default { "resize-editor"() { editorManager.editor.resize(true); }, + run() { - editorManager.activeFile.run(); + editorManager.activeFile[appSettings.value.useCurrentFileForPreview ? "runFile" : "run"]?.(); }, "run-file"() { editorManager.activeFile.runFile?.(); diff --git a/src/lib/settings.js b/src/lib/settings.js index 943a50a48..6d24bafe2 100644 --- a/src/lib/settings.js +++ b/src/lib/settings.js @@ -90,6 +90,7 @@ class Settings { showConsoleToggler: true, previewMode: this.PREVIEW_MODE_INAPP, disableCache: false, + useCurrentFileForPreview: false, host: 'localhost', search: this.#searchSettings, lang: 'en-us', diff --git a/src/settings/previewSettings.js b/src/settings/previewSettings.js index f6bdd0fb5..b4505a974 100644 --- a/src/settings/previewSettings.js +++ b/src/settings/previewSettings.js @@ -1,3 +1,4 @@ +import Checkbox from 'components/checkbox'; import settingsPage from 'components/settingsPage'; import appSettings from 'lib/settings'; @@ -61,6 +62,11 @@ export default function previewSettings() { text: strings['disable in-app-browser caching'], checkbox: values.disableCache, }, + { + key: 'useCurrentFileForPreview', + text: strings['Should use Current File For preview instead of default (index.html)'], + checkbox: !!values.useCurrentFileForPreview, + }, { key: 'showConsoleToggler', text: strings['show console toggler'], diff --git a/utils/scripts/build.sh b/utils/scripts/build.sh index 8fd108d1a..066bb3ab3 100644 --- a/utils/scripts/build.sh +++ b/utils/scripts/build.sh @@ -42,5 +42,5 @@ $script2&& echo \"${RED}$script3${NC}\"; $script3; echo \"${RED}$script4${NC}\"; -$script4 -" \ No newline at end of file +$script4; +" diff --git a/utils/setup.js b/utils/setup.js index 71ad84ddf..178e3f599 100644 --- a/utils/setup.js +++ b/utils/setup.js @@ -18,6 +18,13 @@ try { } catch (error) { // ignore } + +try { + execSync('mkdir -p www/css/build www/js/build', { stdio: 'inherit' }) +} catch (error) { + console.log("Failed to create www/css/build & www/js/build directories (You may Try after reading The Error)", error) +} + execSync('cordova plugin add cordova-plugin-buildinfo', { stdio: 'inherit' }); execSync('cordova plugin add cordova-plugin-device', { stdio: 'inherit' }); execSync('cordova plugin add cordova-plugin-file', { stdio: 'inherit' });