diff --git a/css/CodeEditorField.css b/css/CodeEditorField.css index c05dfc7..3e90f74 100644 --- a/css/CodeEditorField.css +++ b/css/CodeEditorField.css @@ -12,7 +12,7 @@ .codeeditor-button-bar { padding-top:5px; - width: 512px; + /*width: 512px;*/ } .codeeditor .ss-ui-button { @@ -26,6 +26,8 @@ text-transform: uppercase; color: #777777; font-style: italic; + + padding:4px 0; } .codeeditor .ss-ui-button.active { background: linear-gradient(#338dc1, #287099);) repeat scroll 0 0 transparent; diff --git a/javascript/CodeEditorField.js b/javascript/CodeEditorField.js index 82c2504..625902d 100644 --- a/javascript/CodeEditorField.js +++ b/javascript/CodeEditorField.js @@ -37,10 +37,15 @@ editor.getSession().setMode('ace/mode/' + this.data('mode')); // load a theme if one is set - if (this.data('theme')) { - editor.setTheme('ace/theme/' + this.data('theme')); - } - + + + if ($.cookie('codeeditorfield-theme')) { + editor.setTheme('ace/theme/' + $.cookie('codeeditorfield-theme')); + } else if (this.data('theme')) { + editor.setTheme('ace/theme/' + this.data('theme')); + } + + var lineHeight = (editor.renderer.lineHeight > 1 ? editor.renderer.lineHeight : 16) $div.css('min-height', lineHeight * textarea.attr('rows') + 35 + 'px'); @@ -95,11 +100,16 @@ onclick: function() { var editor = this.getEditor(); var data = this.closest('.middleColumn').find('textarea').first(); + var theme; if (editor.getTheme() === ('ace/theme/' + data.data('dark'))) { - editor.setTheme('ace/theme/' + data.data('light')); + theme = data.data('light'); } else { - editor.setTheme('ace/theme/' + data.data('dark')); + theme = data.data('dark'); } + editor.setTheme('ace/theme/' + theme); + $.cookie('codeeditorfield-theme', theme); + + return false; } });