18 o = new Option('(value)', '__mce_add_custom__'); |
18 o = new Option('(value)', '__mce_add_custom__'); |
19 |
19 |
20 o.className = 'mceAddSelectValue'; |
20 o.className = 'mceAddSelectValue'; |
21 |
21 |
22 nl[i].options[nl[i].options.length] = o; |
22 nl[i].options[nl[i].options.length] = o; |
23 nl[i].setAttribute('onchange', 'TinyMCE_EditableSelects.onChangeEditableSelect(this);'); |
23 nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect; |
24 } |
24 } |
25 } |
25 } |
26 }, |
26 }, |
27 |
27 |
28 onChangeEditableSelect : function(se) { |
28 onChangeEditableSelect : function(e) { |
29 var d = document, ne; |
29 var d = document, ne, se = window.event ? window.event.srcElement : e.target; |
30 |
30 |
31 if (se.options[se.selectedIndex].value == '__mce_add_custom__') { |
31 if (se.options[se.selectedIndex].value == '__mce_add_custom__') { |
32 ne = d.createElement("input"); |
32 ne = d.createElement("input"); |
33 ne.id = se.id + "_custom"; |
33 ne.id = se.id + "_custom"; |
34 ne.name = se.name + "_custom"; |
34 ne.name = se.name + "_custom"; |
35 ne.type = "text"; |
35 ne.type = "text"; |
36 |
36 |
37 ne.style.width = se.clientWidth; |
37 ne.style.width = se.offsetWidth + 'px'; |
38 se.parentNode.insertBefore(ne, se); |
38 se.parentNode.insertBefore(ne, se); |
39 se.style.display = 'none'; |
39 se.style.display = 'none'; |
40 ne.focus(); |
40 ne.focus(); |
41 ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput; |
41 ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput; |
42 TinyMCE_EditableSelects.editSelectElm = se; |
42 TinyMCE_EditableSelects.editSelectElm = se; |