summaryrefslogtreecommitdiff
path: root/program/js/editor.js
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-06-16 14:46:31 +0200
committerThomas Bruederli <thomas@roundcube.net>2014-06-16 14:46:31 +0200
commit23c00eee86f1a1af9fa74bc9daf30c8d33ba33f0 (patch)
tree5459eadcd758d3d7224515cc7ac8f6af709a8a4f /program/js/editor.js
parent109bcce470b789dac498d0fba8fb9673b988f867 (diff)
Fix tab navigation with TinyMCE editor (#1489946)
Diffstat (limited to 'program/js/editor.js')
-rw-r--r--program/js/editor.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/program/js/editor.js b/program/js/editor.js
index c5ceddd0f..3b0621f55 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -165,6 +165,24 @@ function rcube_text_editor(config, id)
node.tabIndex = textarea.tabIndex;
if (focus)
this.editor.getBody().focus();
+
+ // find :prev and :next elements to get focus when tabbing away
+ if (textarea.tabIndex > 0) {
+ var x = null,
+ editor = this.editor,
+ tabfocus_elements = [':prev',':next'],
+ el = tinymce.DOM.select('*[tabindex='+textarea.tabIndex+']:not(iframe)');
+ tinymce.each(el, function(e, i) { if (e.id == editor.id) { x = i; return false; } });
+ if (x !== null) {
+ if (el[x-1] && el[x-1].id) {
+ tabfocus_elements[0] = el[x-1].id;
+ }
+ if (el[x+1] && el[x+1].id) {
+ tabfocus_elements[1] = el[x+1].id;
+ }
+ editor.settings.tabfocus_elements = tabfocus_elements.join(',');
+ }
+ }
}
};