comparison static/js/tiny_mce/plugins/tabfocus/editor_plugin_src.js @ 442:6c182ceb7147

Fixing #217; upgrade TinyMCE to 3.4.2 and enable the paste plugin.
author Brian Neal <bgneal@gmail.com>
date Thu, 26 May 2011 00:43:49 +0000
parents 88b2b9cb8c1f
children
comparison
equal deleted inserted replaced
441:33d0c55e57a9 442:6c182ceb7147
20 20
21 function tabHandler(ed, e) { 21 function tabHandler(ed, e) {
22 var x, i, f, el, v; 22 var x, i, f, el, v;
23 23
24 function find(d) { 24 function find(d) {
25 f = DOM.getParent(ed.id, 'form'); 25 el = DOM.select(':input:enabled,*[tabindex]');
26 el = f.elements; 26 function canSelect(e) {
27 return e.type != 'hidden' &&
28 e.tabIndex != '-1' &&
29 !(el[i].style.display == "none") &&
30 !(el[i].style.visibility == "hidden");
31 }
27 32
28 if (f) { 33 each(el, function(e, i) {
29 each(el, function(e, i) { 34 if (e.id == ed.id) {
30 if (e.id == ed.id) { 35 x = i;
31 x = i; 36 return false;
32 return false; 37 }
33 } 38 });
34 });
35 39
36 if (d > 0) { 40 if (d > 0) {
37 for (i = x + 1; i < el.length; i++) { 41 for (i = x + 1; i < el.length; i++) {
38 if (el[i].type != 'hidden') 42 if (canSelect(el[i]))
39 return el[i]; 43 return el[i];
40 } 44 }
41 } else { 45 } else {
42 for (i = x - 1; i >= 0; i--) { 46 for (i = x - 1; i >= 0; i--) {
43 if (el[i].type != 'hidden') 47 if (canSelect(el[i]))
44 return el[i]; 48 return el[i];
45 }
46 } 49 }
47 } 50 }
48 51
49 return null; 52 return null;
50 }; 53 };
69 else 72 else
70 el = DOM.get(v[1]); 73 el = DOM.get(v[1]);
71 } 74 }
72 75
73 if (el) { 76 if (el) {
74 if (ed = tinymce.get(el.id || el.name)) 77 if (el.id && (ed = tinymce.get(el.id || el.name)))
75 ed.focus(); 78 ed.focus();
76 else 79 else
77 window.setTimeout(function() {window.focus();el.focus();}, 10); 80 window.setTimeout(function() {
81 if (!tinymce.isWebKit)
82 window.focus();
83 el.focus();
84 }, 10);
78 85
79 return Event.cancel(e); 86 return Event.cancel(e);
80 } 87 }
81 } 88 }
82 }; 89 };
87 ed.onKeyPress.add(tabHandler); 94 ed.onKeyPress.add(tabHandler);
88 ed.onKeyDown.add(tabCancel); 95 ed.onKeyDown.add(tabCancel);
89 } else 96 } else
90 ed.onKeyDown.add(tabHandler); 97 ed.onKeyDown.add(tabHandler);
91 98
92 ed.onInit.add(function() {
93 each(DOM.select('a:first,a:last', ed.getContainer()), function(n) {
94 Event.add(n, 'focus', function() {ed.focus();});
95 });
96 });
97 }, 99 },
98 100
99 getInfo : function() { 101 getInfo : function() {
100 return { 102 return {
101 longname : 'Tabfocus', 103 longname : 'Tabfocus',