diff --git a/applications/admin/controllers/default.py b/applications/admin/controllers/default.py
index 5afec708..4c3c1ee1 100644
--- a/applications/admin/controllers/default.py
+++ b/applications/admin/controllers/default.py
@@ -562,7 +562,7 @@ def edit():
# Load json only if it is ajax edited...
app = get_app(request.vars.app)
app_path = apath(app, r=request)
- editor_defaults={'theme':'web2py'}
+ editor_defaults={'theme':'web2py', 'editor': 'default'}
config = Config(os.path.join(request.folder, 'settings.cfg'),
section='editor', default_values=editor_defaults)
preferences = config.read()
@@ -588,7 +588,7 @@ def edit():
response.headers["web2py-component-flash"] = T('Preferences saved correctly')
else:
response.headers["web2py-component-flash"] = T('Preferences saved on session only')
- response.headers["web2py-component-command"] = "update_theme('%s'); jQuery('a[href=#editor_settings] button.close').click();" % config.read()['theme']
+ response.headers["web2py-component-command"] = "update_theme('%s');update_editor('%s');jQuery('a[href=#editor_settings] button.close').click();" % (config.read()['theme'], config.read()['editor'])
return
else:
details = {'filename':'settings', 'id':'editor_settings', 'force': False}
@@ -604,7 +604,7 @@ def edit():
path = abspath(filename)
else:
path = apath(filename, r=request)
- # Try to discover the file type
+ # Try to discover the file type
if filename[-3:] == '.py':
filetype = 'python'
elif filename[-5:] == '.html':
@@ -700,7 +700,6 @@ def edit():
offset and ' ' +
T('at char %s', offset) or '',
PRE(str(e)))
-
if data_or_revert and request.args[1] == 'modules':
# Lets try to reload the modules
try:
diff --git a/applications/admin/static/js/ajax_editor.js b/applications/admin/static/js/ajax_editor.js
index e23b3481..38a47225 100644
--- a/applications/admin/static/js/ajax_editor.js
+++ b/applications/admin/static/js/ajax_editor.js
@@ -73,6 +73,12 @@ function doClickSave() {
var t = jQuery("input[name='save']");
t.attr('class', '');
t.attr('disabled', '');
+ var flash = xhr.getResponseHeader('web2py-component-flash');
+ if(flash) {
+ jQuery('.flash').html(decodeURIComponent(flash))
+ .append('×')
+ .slideDown();
+ } else jQuery('.flash').hide();
try {
if(json.error) {
window.location.href = json.redirect;
diff --git a/applications/admin/views/default/edit.html b/applications/admin/views/default/edit.html
index 35ff2865..68eebb8f 100644
--- a/applications/admin/views/default/edit.html
+++ b/applications/admin/views/default/edit.html
@@ -16,13 +16,12 @@
}}
{{cm=URL('static','codemirror')}}
-
+
-{{if TEXT_EDITOR_KEYBINDING == 'emacs':}}{{pass}}
-{{if TEXT_EDITOR_KEYBINDING == 'vi':}}{{pass}}
+{{if editor_settings['editor'] != 'default':}}{{pass}}
@@ -43,6 +42,7 @@