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
26
dev.html
26
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,10 +2083,11 @@
|
|||
draggable: true
|
||||
});
|
||||
listdir('.');
|
||||
document.getElementById('savePrompt').checked = get_save_prompt();
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
$('.preloader-background').delay(800).fadeOut('slow');
|
||||
$('.preloader-wrapper').delay(800).fadeOut('slow');
|
||||
if (!localStorage.getItem("new_tab")) {
|
||||
|
@ -2692,7 +2697,12 @@
|
|||
function save_check() {
|
||||
var filepath = document.getElementById('currentfile').value;
|
||||
if (filepath.length > 0) {
|
||||
$('#modal_save').modal('open');
|
||||
if (get_save_prompt()) {
|
||||
$('#modal_save').modal('open');
|
||||
}
|
||||
else {
|
||||
save();
|
||||
}
|
||||
}
|
||||
else {
|
||||
Materialize.toast('Error: Please provide a filename', 5000);
|
||||
|
@ -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