mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-14 02:26:20 +02:00
make autocompletion a configurable setting. fixes #163
This commit is contained in:
@ -437,6 +437,9 @@
|
|||||||
<label class="line">
|
<label class="line">
|
||||||
<input type="checkbox" d-change="updateSetting" data-setting="refreshOnResize"> Refresh preview on resize
|
<input type="checkbox" d-change="updateSetting" data-setting="refreshOnResize"> Refresh preview on resize
|
||||||
</label>
|
</label>
|
||||||
|
<label class="line">
|
||||||
|
<input type="checkbox" d-change="updateSetting" data-setting="autoComplete"> Auto-complete suggestions
|
||||||
|
</label>
|
||||||
<label class="line">
|
<label class="line">
|
||||||
<input type="checkbox" d-change="updateSetting" data-setting="autoPreview"> Auto-preview
|
<input type="checkbox" d-change="updateSetting" data-setting="autoPreview"> Auto-preview
|
||||||
</label>
|
</label>
|
||||||
|
@ -1203,13 +1203,13 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyl
|
|||||||
}
|
}
|
||||||
}, updateDelay);
|
}, updateDelay);
|
||||||
});
|
});
|
||||||
if (options.noAutocomplete) {
|
cm.addKeyMap({
|
||||||
cm.addKeyMap({
|
'Ctrl-Space': 'autocomplete'
|
||||||
'Ctrl-Space': 'autocomplete'
|
});
|
||||||
});
|
if (!options.noAutocomplete) {
|
||||||
} else {
|
|
||||||
cm.on('inputRead', function onChange(editor, input) {
|
cm.on('inputRead', function onChange(editor, input) {
|
||||||
if (
|
if (
|
||||||
|
!prefs.autoComplete ||
|
||||||
input.origin !== '+input' ||
|
input.origin !== '+input' ||
|
||||||
input.text[0] === ';' ||
|
input.text[0] === ';' ||
|
||||||
input.text[0] === ' '
|
input.text[0] === ' '
|
||||||
@ -1583,6 +1583,7 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyl
|
|||||||
$('[data-setting=autoPreview]').checked = prefs.autoPreview;
|
$('[data-setting=autoPreview]').checked = prefs.autoPreview;
|
||||||
$('[data-setting=editorFont]').value = prefs.editorFont;
|
$('[data-setting=editorFont]').value = prefs.editorFont;
|
||||||
$('[data-setting=autoSave]').checked = prefs.autoSave;
|
$('[data-setting=autoSave]').checked = prefs.autoSave;
|
||||||
|
$('[data-setting=autoComplete]').checked = prefs.autoComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2142,7 +2143,8 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyl
|
|||||||
refreshOnResize: false,
|
refreshOnResize: false,
|
||||||
autoPreview: true,
|
autoPreview: true,
|
||||||
editorFont: 'FiraCode',
|
editorFont: 'FiraCode',
|
||||||
autoSave: true
|
autoSave: true,
|
||||||
|
autoComplete: true
|
||||||
},
|
},
|
||||||
function syncGetCallback(result) {
|
function syncGetCallback(result) {
|
||||||
if (result.preserveLastCode && lastCode) {
|
if (result.preserveLastCode && lastCode) {
|
||||||
@ -2176,6 +2178,7 @@ runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyl
|
|||||||
prefs.autoPreview = result.autoPreview;
|
prefs.autoPreview = result.autoPreview;
|
||||||
prefs.editorFont = result.editorFont;
|
prefs.editorFont = result.editorFont;
|
||||||
prefs.autoSave = result.autoSave;
|
prefs.autoSave = result.autoSave;
|
||||||
|
prefs.autoComplete = result.autoComplete;
|
||||||
|
|
||||||
updateSettingsInUi();
|
updateSettingsInUi();
|
||||||
scope.updateSetting();
|
scope.updateSetting();
|
||||||
|
Reference in New Issue
Block a user