Skip to content

Commit

Permalink
Merge pull request #1006 from UnschooledGamer/feat/useCurrentFileForP…
Browse files Browse the repository at this point in the history
…review

Feat: Use Current File for preview (Togglable)
bajrangCoder authored Aug 24, 2024
2 parents 470cb2a + ca852dc commit f7613d6
Showing 6 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/lang/en-us.json
Original file line number Diff line number Diff line change
@@ -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",
3 changes: 2 additions & 1 deletion src/lib/commands.js
Original file line number Diff line number Diff line change
@@ -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?.();
1 change: 1 addition & 0 deletions src/lib/settings.js
Original file line number Diff line number Diff line change
@@ -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',
6 changes: 6 additions & 0 deletions src/settings/previewSettings.js
Original file line number Diff line number Diff line change
@@ -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'],
4 changes: 2 additions & 2 deletions utils/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -42,5 +42,5 @@ $script2&&
echo \"${RED}$script3${NC}\";
$script3;
echo \"${RED}$script4${NC}\";
$script4
"
$script4;
"
7 changes: 7 additions & 0 deletions utils/setup.js
Original file line number Diff line number Diff line change
@@ -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' });

0 comments on commit f7613d6

Please sign in to comment.