equal
deleted
inserted
replaced
1 /** |
1 /** |
2 * $Id: editable_selects.js 520 2008-01-07 16:30:32Z spocke $ |
2 * $Id: editable_selects.js 867 2008-06-09 20:33:40Z spocke $ |
3 * |
3 * |
4 * Makes select boxes editable. |
4 * Makes select boxes editable. |
5 * |
5 * |
6 * @author Moxiecode |
6 * @author Moxiecode |
7 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
7 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
37 ne.style.width = se.offsetWidth + 'px'; |
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 ne.onkeydown = TinyMCE_EditableSelects.onKeyDown; |
42 TinyMCE_EditableSelects.editSelectElm = se; |
43 TinyMCE_EditableSelects.editSelectElm = se; |
43 } |
44 } |
44 }, |
45 }, |
45 |
46 |
46 onBlurEditableSelectInput : function() { |
47 onBlurEditableSelectInput : function() { |
55 |
56 |
56 se.style.display = 'inline'; |
57 se.style.display = 'inline'; |
57 se.parentNode.removeChild(se.previousSibling); |
58 se.parentNode.removeChild(se.previousSibling); |
58 TinyMCE_EditableSelects.editSelectElm = null; |
59 TinyMCE_EditableSelects.editSelectElm = null; |
59 } |
60 } |
|
61 }, |
|
62 |
|
63 onKeyDown : function(e) { |
|
64 e = e || window.event; |
|
65 |
|
66 if (e.keyCode == 13) |
|
67 TinyMCE_EditableSelects.onBlurEditableSelectInput(); |
60 } |
68 } |
61 }; |
69 }; |