Prompting before saving now opt-in in editor settings. Fixes Issue #77
This commit is contained in:
parent
373708f601
commit
2c4fa83cda
3 changed files with 49 additions and 4 deletions
|
@ -3,6 +3,7 @@ Version 0.2.6 (2018-)
|
|||
- Added menu item to open configurator in new tab (Issue #76) @danielperna84
|
||||
- Automatically load last viewed (and not closed) file via localStorage @danielperna84
|
||||
- CTRL+s / CMD+s can now be used to save a file @danielperna84
|
||||
- Prompting before saving now opt-in in editor settings @danielperna84
|
||||
|
||||
Version 0.2.5 (2018-01-27)
|
||||
- Added warning-logs for access failure @danielperna84
|
||||
|
|
|
@ -1757,6 +1757,10 @@ INDEX = Template(r"""<!DOCTYPE html>
|
|||
<li class="center s12 grey lighten-3 z-depth-1 subheader">Editor Settings</li>
|
||||
<div class="row col s12">
|
||||
<p class="col s12"> <a class="waves-effect waves-light btn light-blue modal-trigger" href="#modal_acekeyboard">Keyboard Shortcuts</a> </p>
|
||||
<p class="col s12">
|
||||
<input type="checkbox" class="blue_check" onclick="set_save_prompt(this.checked)" id="savePrompt" />
|
||||
<Label for="savePrompt">Prompt before save</label>
|
||||
</p>
|
||||
<p class="col s12">
|
||||
<input type="checkbox" class="blue_check" onclick="editor.setOption('animatedScroll', !editor.getOptions().animatedScroll)" id="animatedScroll" />
|
||||
<Label for="animatedScroll">Animated Scroll</label>
|
||||
|
@ -2163,6 +2167,7 @@ INDEX = Template(r"""<!DOCTYPE html>
|
|||
draggable: true
|
||||
});
|
||||
listdir('.');
|
||||
document.getElementById('savePrompt').checked = get_save_prompt();
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
|
@ -2776,8 +2781,13 @@ INDEX = Template(r"""<!DOCTYPE html>
|
|||
function save_check() {
|
||||
var filepath = document.getElementById('currentfile').value;
|
||||
if (filepath.length > 0) {
|
||||
if (get_save_prompt()) {
|
||||
$('#modal_save').modal('open');
|
||||
}
|
||||
else {
|
||||
save();
|
||||
}
|
||||
}
|
||||
else {
|
||||
Materialize.toast('Error: Please provide a filename', 5000);
|
||||
$(".pathtip").bind("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd", function(){
|
||||
|
@ -3083,6 +3093,18 @@ INDEX = Template(r"""<!DOCTYPE html>
|
|||
editor.$blockScrolling = Infinity;
|
||||
}
|
||||
|
||||
function set_save_prompt(checked) {
|
||||
localStorage.setItem('save_prompt', JSON.stringify({save_prompt: checked}));
|
||||
}
|
||||
|
||||
function get_save_prompt() {
|
||||
if (localStorage.getItem('save_prompt')) {
|
||||
var save_prompt = JSON.parse(localStorage.getItem('save_prompt'));
|
||||
return save_prompt.save_prompt;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function apply_settings() {
|
||||
var options = editor.getOptions();
|
||||
for (var key in options) {
|
||||
|
|
22
dev.html
22
dev.html
|
@ -1673,6 +1673,10 @@
|
|||
<li class="center s12 grey lighten-3 z-depth-1 subheader">Editor Settings</li>
|
||||
<div class="row col s12">
|
||||
<p class="col s12"> <a class="waves-effect waves-light btn light-blue modal-trigger" href="#modal_acekeyboard">Keyboard Shortcuts</a> </p>
|
||||
<p class="col s12">
|
||||
<input type="checkbox" class="blue_check" onclick="set_save_prompt(this.checked)" id="savePrompt" />
|
||||
<Label for="savePrompt">Prompt before save</label>
|
||||
</p>
|
||||
<p class="col s12">
|
||||
<input type="checkbox" class="blue_check" onclick="editor.setOption('animatedScroll', !editor.getOptions().animatedScroll)" id="animatedScroll" />
|
||||
<Label for="animatedScroll">Animated Scroll</label>
|
||||
|
@ -2079,6 +2083,7 @@
|
|||
draggable: true
|
||||
});
|
||||
listdir('.');
|
||||
document.getElementById('savePrompt').checked = get_save_prompt();
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
|
@ -2692,8 +2697,13 @@
|
|||
function save_check() {
|
||||
var filepath = document.getElementById('currentfile').value;
|
||||
if (filepath.length > 0) {
|
||||
if (get_save_prompt()) {
|
||||
$('#modal_save').modal('open');
|
||||
}
|
||||
else {
|
||||
save();
|
||||
}
|
||||
}
|
||||
else {
|
||||
Materialize.toast('Error: Please provide a filename', 5000);
|
||||
$(".pathtip").bind("animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd", function(){
|
||||
|
@ -2999,6 +3009,18 @@
|
|||
editor.$blockScrolling = Infinity;
|
||||
}
|
||||
|
||||
function set_save_prompt(checked) {
|
||||
localStorage.setItem('save_prompt', JSON.stringify({save_prompt: checked}));
|
||||
}
|
||||
|
||||
function get_save_prompt() {
|
||||
if (localStorage.getItem('save_prompt')) {
|
||||
var save_prompt = JSON.parse(localStorage.getItem('save_prompt'));
|
||||
return save_prompt.save_prompt;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function apply_settings() {
|
||||
var options = editor.getOptions();
|
||||
for (var key in options) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue