code-editor: adjust editor styles

This commit is contained in:
Alexander Zobnin 2017-08-08 16:05:15 +03:00
parent eb944551c0
commit 59d1654df4
2 changed files with 16 additions and 4 deletions

View File

@ -24,21 +24,33 @@ function link(scope, elem, attrs) {
let langMode = attrs.mode || 'text';
let theme = "solarized_dark";
// Initialize editor
let aceElem = elem.get(0);
let codeEditor = ace.edit(aceElem);
let editorSession = codeEditor.getSession();
codeEditor.setHighlightActiveLine(false);
codeEditor.setShowPrintMargin(false);
let editorOptions = {
maxLines: 10,
showGutter: false,
highlightActiveLine: false,
showPrintMargin: false,
autoScrollEditorIntoView: true // this is needed if editor is inside scrollable page
};
// Set options
codeEditor.setOptions(editorOptions);
// disable depreacation warning
codeEditor.$blockScrolling = Infinity;
codeEditor.setAutoScrollEditorIntoView(true);
// Padding hacks
codeEditor.renderer.setScrollMargin(10, 10);
codeEditor.renderer.setPadding(10);
setThemeMode(theme);
setLangMode(langMode);
codeEditor.setValue(scope.content);
codeEditor.clearSelection();
// Add classes
elem.addClass("gf-code-editor");
let textarea = elem.find("textarea");
textarea.addClass('gf-form-input');

View File

@ -6,7 +6,7 @@
border: 1px solid #333333;
&.ace_editor {
min-height: 6rem;
min-height: 2.60rem;
font-family: monospace;
font-size: 1rem;
}