mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-21 01:13:37 +08:00
Add factory reset button on error screen
This commit is contained in:
parent
a56fe01a51
commit
f7f7c00205
@ -49,6 +49,7 @@
|
||||
<div>An error occurred while loading Blockbench</div>
|
||||
<div id="loading_error_detail" style="color: var(--color-subtle_text);"></div>
|
||||
<button onclick="isApp ? Blockbench.reload() : window.location.reload(true)" class="large" style="margin-right: auto; margin-left: auto;">Reload</button>
|
||||
<button onclick="factoryResetAndReload()" class="large" style="margin-right: auto; margin-left: auto;">Factory Reset</button>
|
||||
<button onclick="window.close()" class="large" style="margin-right: auto; margin-left: auto;">Quit</button>
|
||||
</div>
|
||||
<script>
|
||||
|
@ -489,12 +489,7 @@ const MenuBar = {
|
||||
}},
|
||||
'reset_layout',
|
||||
{name: 'menu.help.developer.reset_storage', icon: 'fas.fa-hdd', click: () => {
|
||||
if (confirm(tl('menu.help.developer.reset_storage.confirm'))) {
|
||||
localStorage.clear()
|
||||
Blockbench.addFlag('no_localstorage_saving')
|
||||
console.log('Cleared Local Storage')
|
||||
window.location.reload(true)
|
||||
}
|
||||
factoryResetAndReload();
|
||||
}},
|
||||
{name: 'menu.help.developer.unlock_projects', id: 'unlock_projects', icon: 'vpn_key', condition: () => ModelProject.all.find(project => project.locked), click() {
|
||||
ModelProject.all.forEach(project => project.locked = false);
|
||||
|
11
js/misc.js
11
js/misc.js
@ -279,6 +279,17 @@ const TickUpdates = {
|
||||
}
|
||||
}
|
||||
|
||||
function factoryResetAndReload() {
|
||||
let lang_key = 'menu.help.developer.reset_storage.confirm';
|
||||
let result = window.confirm((window.tl && tl(lang_key) != lang_key) ? tl(lang_key) : 'Are you sure you want to reset Blockbench to factory settings? This will delete all custom settings, keybindings and installed plugins.');
|
||||
if (result) {
|
||||
localStorage.clear();
|
||||
Blockbench.addFlag('no_localstorage_saving');
|
||||
console.log('Cleared Local Storage');
|
||||
window.location.reload(true);
|
||||
}
|
||||
}
|
||||
|
||||
const documentReady = new Promise((resolve, reject) => {
|
||||
$(document).ready(function() {
|
||||
resolve()
|
||||
|
Loading…
Reference in New Issue
Block a user