mirror of
https://github.com/chinchang/web-maker.git
synced 2025-06-21 23:12:19 +02:00
add manual completion for html with Ctrl-space. fixes #52
This commit is contained in:
@ -765,16 +765,16 @@ TextareaAutoComplete */
|
|||||||
// cursorScrollMargin: '20', has issue with scrolling
|
// cursorScrollMargin: '20', has issue with scrolling
|
||||||
profile: options.profile || '',
|
profile: options.profile || '',
|
||||||
extraKeys: {
|
extraKeys: {
|
||||||
"Up": function (editor) {
|
'Up': function (editor) {
|
||||||
// Stop up/down keys default behavior when saveditempane is open
|
// Stop up/down keys default behavior when saveditempane is open
|
||||||
if (isSavedItemsPaneOpen) { return; }
|
if (isSavedItemsPaneOpen) { return; }
|
||||||
CodeMirror.commands.goLineUp(editor);
|
CodeMirror.commands.goLineUp(editor);
|
||||||
},
|
},
|
||||||
"Down": function (editor) {
|
'Down': function (editor) {
|
||||||
if (isSavedItemsPaneOpen) { return; }
|
if (isSavedItemsPaneOpen) { return; }
|
||||||
CodeMirror.commands.goLineDown(editor);
|
CodeMirror.commands.goLineDown(editor);
|
||||||
},
|
},
|
||||||
"Shift-Tab": function(editor) {
|
'Shift-Tab': function(editor) {
|
||||||
CodeMirror.commands.indentAuto(editor);
|
CodeMirror.commands.indentAuto(editor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -785,17 +785,24 @@ TextareaAutoComplete */
|
|||||||
scope.setPreviewContent();
|
scope.setPreviewContent();
|
||||||
}, updateDelay);
|
}, updateDelay);
|
||||||
});
|
});
|
||||||
|
if (options.noAutocomplete) {
|
||||||
|
cm.addKeyMap({
|
||||||
|
'Ctrl-Space': 'autocomplete'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
cm.on('inputRead', function onChange(editor, input) {
|
cm.on('inputRead', function onChange(editor, input) {
|
||||||
if (input.text[0] === ';' || input.text[0] === ' ') { return; }
|
if (input.text[0] === ';' || input.text[0] === ' ') { return; }
|
||||||
CodeMirror.commands.autocomplete(cm, null, { completeSingle: false })
|
CodeMirror.commands.autocomplete(cm, null, { completeSingle: false })
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return cm;
|
return cm;
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.cm.html = initEditor(htmlCode, {
|
scope.cm.html = initEditor(htmlCode, {
|
||||||
mode: 'htmlmixed',
|
mode: 'htmlmixed',
|
||||||
profile: 'xhtml',
|
profile: 'xhtml',
|
||||||
gutters: [ 'CodeMirror-linenumbers', 'CodeMirror-foldgutter' ]
|
gutters: [ 'CodeMirror-linenumbers', 'CodeMirror-foldgutter' ],
|
||||||
|
noAutocomplete: true
|
||||||
});
|
});
|
||||||
emmetCodeMirror(scope.cm.html);
|
emmetCodeMirror(scope.cm.html);
|
||||||
scope.cm.css = initEditor(cssCode, {
|
scope.cm.css = initEditor(cssCode, {
|
||||||
|
Reference in New Issue
Block a user