1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-06-11 20:20:50 +02:00

provide settings for refreshing preview on resize. fixes

This commit is contained in:
Kushagra Gour
2017-04-25 01:34:57 +05:30
parent f13b3efbaf
commit 0c85f79bae
2 changed files with 14 additions and 6 deletions

@ -366,6 +366,9 @@
<input type="radio" name="keymap" value="vim" d-change="updateSetting" data-setting="keymap"> Vim
</label>
</div>
<label class="line">
<input type="checkbox" d-change="updateSetting" data-setting="refreshOnResize"> Refresh preview on resize
</label>
<label class="line">
<input type="checkbox" d-change="updateSetting" data-setting="preserveLastCode"> Preserve last written code
</label>

@ -158,11 +158,13 @@ onboardDontShowInTabOptionBtn, TextareaAutoComplete, savedItemCountEl, indentati
gutterSize: 6,
sizes: getMainSplitSizesToApply(),
onDragEnd: function () {
// Running preview updation in next call stack, so that error there
// doesn't affect this dragend listener.
setTimeout(function () {
scope.setPreviewContent(true);
}, 1);
if (prefs.refreshOnResize) {
// Running preview updation in next call stack, so that error there
// doesn't affect this dragend listener.
setTimeout(function () {
scope.setPreviewContent(true);
}, 1);
}
}
});
}
@ -1171,6 +1173,7 @@ onboardDontShowInTabOptionBtn, TextareaAutoComplete, savedItemCountEl, indentati
$('[data-setting=editorTheme]').value = prefs.editorTheme;
$('[data-setting=keymap][value=' + (prefs.keymap || 'sublime') + ']').checked = true;
$('[data-setting=fontSize]').value = prefs.fontSize || 16;
$('[data-setting=refreshOnResize]').checked = prefs.refreshOnResize;
}
/**
@ -1491,7 +1494,8 @@ onboardDontShowInTabOptionBtn, TextareaAutoComplete, savedItemCountEl, indentati
indentSize: 2,
editorTheme: 'monokai',
keymap: 'sublime',
fontSize: 16
fontSize: 16,
refreshOnResize: false
}, function syncGetCallback(result) {
if (result.preserveLastCode && lastCode) {
unsavedEditCount = 0;
@ -1520,6 +1524,7 @@ onboardDontShowInTabOptionBtn, TextareaAutoComplete, savedItemCountEl, indentati
prefs.editorTheme = result.editorTheme;
prefs.keymap = result.keymap;
prefs.fontSize = result.fontSize;
prefs.refreshOnResize = result.refreshOnResize;
updateSettingsInUi();
scope.updateSetting();