'dev mode' is now saved under settings. 'debug' panel is only shown if dev mode is active
This commit is contained in:
parent
bf128babcc
commit
b5e480a486
@ -183,7 +183,8 @@ interface SettingsInterface {
|
|||||||
offsetX: number, // fed to translateX(offsetX + '%'). Valid range [-100, 0]
|
offsetX: number, // fed to translateX(offsetX + '%'). Valid range [-100, 0]
|
||||||
offsetY: number // fed to translateY(offsetY + '%'). Valid range [-100, 100]
|
offsetY: number // fed to translateY(offsetY + '%'). Valid range [-100, 100]
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
devMode?: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
restrictions?: RestrictionsSettings;
|
restrictions?: RestrictionsSettings;
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
<div
|
<div
|
||||||
v-for="tab of tabs"
|
v-for="tab of tabs"
|
||||||
:key="tab.id"
|
:key="tab.id"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-if="!tab.hidden"
|
||||||
class="tab"
|
class="tab"
|
||||||
:class="{
|
:class="{
|
||||||
'active': tab.id === selectedTab,
|
'active': tab.id === selectedTab,
|
||||||
@ -49,6 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="content flex flex-col">
|
<div class="content flex flex-col">
|
||||||
<!-- autodetection warning -->
|
<!-- autodetection warning -->
|
||||||
|
|
||||||
@ -171,7 +175,7 @@ export default {
|
|||||||
// {id: 'advancedOptions', label: 'Advanced options', icon: 'cogs' },
|
// {id: 'advancedOptions', label: 'Advanced options', icon: 'cogs' },
|
||||||
{id: 'changelog', label: 'What\'s new', icon: 'alert-decagram' },
|
{id: 'changelog', label: 'What\'s new', icon: 'alert-decagram' },
|
||||||
{id: 'about', label: 'About', icon: 'information-outline'},
|
{id: 'about', label: 'About', icon: 'information-outline'},
|
||||||
{id: 'debugging', label: 'Debugging', icon: 'bug-outline' },
|
{id: 'debugging', label: 'Debugging', icon: 'bug-outline', hidden: true},
|
||||||
],
|
],
|
||||||
selectedTab: 'extensionSettings',
|
selectedTab: 'extensionSettings',
|
||||||
BrowserDetect: BrowserDetect,
|
BrowserDetect: BrowserDetect,
|
||||||
@ -196,6 +200,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.settings.listenAfterChange(this.setDebugTabVisibility);
|
||||||
|
|
||||||
if (this.defaultTab) {
|
if (this.defaultTab) {
|
||||||
this.selectedTab = this.defaultTab;
|
this.selectedTab = this.defaultTab;
|
||||||
}
|
}
|
||||||
@ -213,8 +219,10 @@ export default {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
this.setDebugTabVisibility();
|
||||||
},
|
},
|
||||||
destroyed() {
|
destroyed() {
|
||||||
|
this.settings.removeListenerAfterChange(this.setDebugTabVisibility);
|
||||||
this.eventBus.unsubscribeAll(this);
|
this.eventBus.unsubscribeAll(this);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -230,6 +238,12 @@ export default {
|
|||||||
setPreventClose(bool) {
|
setPreventClose(bool) {
|
||||||
this.preventClose = bool;
|
this.preventClose = bool;
|
||||||
this.$emit('preventClose', bool);
|
this.$emit('preventClose', bool);
|
||||||
|
},
|
||||||
|
setDebugTabVisibility() {
|
||||||
|
const debugTab = this.tabs.find( x => x.id === 'debugging');
|
||||||
|
if (debugTab) {
|
||||||
|
debugTab.hidden = !this.settings.active.ui.devMode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,11 +90,15 @@
|
|||||||
|
|
||||||
<div v-if="enableSettingsEditor" class="field">
|
<div v-if="enableSettingsEditor" class="field">
|
||||||
<div class="label">Show developer options</div>
|
<div class="label">Show developer options</div>
|
||||||
<input v-model="showSettingsEditor" type="checkbox">
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
v-model="settings.active.ui.devMode"
|
||||||
|
@change="settings.saveWithoutReload"
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="enableSettingsEditor && showSettingsEditor" class="h-full grow">
|
<div v-if="enableSettingsEditor && settings.active.ui.devMode" class="h-full grow">
|
||||||
<h2>Settings editor</h2>
|
<h2>Settings editor</h2>
|
||||||
<div class="flex flex-row w-full">
|
<div class="flex flex-row w-full">
|
||||||
<div class="flex flex-row">
|
<div class="flex flex-row">
|
||||||
@ -144,7 +148,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
tab: 'siteSettings',
|
tab: 'siteSettings',
|
||||||
importSettingDialogConfig: {visible: false},
|
importSettingDialogConfig: {visible: false},
|
||||||
showSettingsEditor: false,
|
|
||||||
allowSettingsEditing: false,
|
allowSettingsEditing: false,
|
||||||
editorSaveFinished: false,
|
editorSaveFinished: false,
|
||||||
settingsJson: {},
|
settingsJson: {},
|
||||||
|
@ -37,8 +37,8 @@ class Settings {
|
|||||||
onSettingsChanged: any;
|
onSettingsChanged: any;
|
||||||
afterSettingsSaved: any;
|
afterSettingsSaved: any;
|
||||||
|
|
||||||
onChangedCallbacks: any[] = [];
|
onChangedCallbacks: (() => void)[] = [];
|
||||||
afterSettingsChangedCallbacks: any[] = [];
|
afterSettingsChangedCallbacks: (() => void)[] = [];
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
@ -398,9 +398,15 @@ class Settings {
|
|||||||
listenOnChange(fn: () => void): void {
|
listenOnChange(fn: () => void): void {
|
||||||
this.onChangedCallbacks.push(fn);
|
this.onChangedCallbacks.push(fn);
|
||||||
}
|
}
|
||||||
|
removeOnChangeListener(fn: () => void): void {
|
||||||
|
this.onChangedCallbacks = this.afterSettingsChangedCallbacks.filter(x => x !== fn);
|
||||||
|
}
|
||||||
listenAfterChange(fn: () => void): void {
|
listenAfterChange(fn: () => void): void {
|
||||||
this.afterSettingsChangedCallbacks.push(fn);
|
this.afterSettingsChangedCallbacks.push(fn);
|
||||||
}
|
}
|
||||||
|
removeAfterChangeListener(fn: () => void): void {
|
||||||
|
this.afterSettingsChangedCallbacks = this.afterSettingsChangedCallbacks.filter(x => x !== fn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Settings;
|
export default Settings;
|
||||||
|
Loading…
Reference in New Issue
Block a user