Mercurial > public > sg101
comparison static/js/tiny_mce/utils/form_utils.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 |
---|---|
9 */ | 9 */ |
10 | 10 |
11 var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme")); | 11 var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme")); |
12 | 12 |
13 function getColorPickerHTML(id, target_form_element) { | 13 function getColorPickerHTML(id, target_form_element) { |
14 var h = ""; | 14 var h = "", dom = tinyMCEPopup.dom; |
15 | 15 |
16 h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">'; | 16 if (label = dom.select('label[for=' + target_form_element + ']')[0]) { |
17 h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> </span></a>'; | 17 label.id = label.id || dom.uniqueId(); |
18 } | |
19 | |
20 h += '<a role="button" aria-labelledby="' + id + '_label" id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">'; | |
21 h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '"> <span id="' + id + '_label" class="mceVoiceLabel mceIconOnly" style="display:none;">' + tinyMCEPopup.getLang('browse') + '</span></span></a>'; | |
18 | 22 |
19 return h; | 23 return h; |
20 } | 24 } |
21 | 25 |
22 function updateColor(img_id, form_element_id) { | 26 function updateColor(img_id, form_element_id) { |
65 | 69 |
66 function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { | 70 function selectByValue(form_obj, field_name, value, add_custom, ignore_case) { |
67 if (!form_obj || !form_obj.elements[field_name]) | 71 if (!form_obj || !form_obj.elements[field_name]) |
68 return; | 72 return; |
69 | 73 |
74 if (!value) | |
75 value = ""; | |
76 | |
70 var sel = form_obj.elements[field_name]; | 77 var sel = form_obj.elements[field_name]; |
71 | 78 |
72 var found = false; | 79 var found = false; |
73 for (var i=0; i<sel.options.length; i++) { | 80 for (var i=0; i<sel.options.length; i++) { |
74 var option = sel.options[i]; | 81 var option = sel.options[i]; |
169 | 176 |
170 return col; | 177 return col; |
171 } | 178 } |
172 | 179 |
173 function trimSize(size) { | 180 function trimSize(size) { |
174 return size.replace(/([0-9\.]+)px|(%|in|cm|mm|em|ex|pt|pc)/, '$1$2'); | 181 return size.replace(/([0-9\.]+)(px|%|in|cm|mm|em|ex|pt|pc)/i, '$1$2'); |
175 } | 182 } |
176 | 183 |
177 function getCSSSize(size) { | 184 function getCSSSize(size) { |
178 size = trimSize(size); | 185 size = trimSize(size); |
179 | 186 |
181 return ""; | 188 return ""; |
182 | 189 |
183 // Add px | 190 // Add px |
184 if (/^[0-9]+$/.test(size)) | 191 if (/^[0-9]+$/.test(size)) |
185 size += 'px'; | 192 size += 'px'; |
193 // Sanity check, IE doesn't like broken values | |
194 else if (!(/^[0-9\.]+(px|%|in|cm|mm|em|ex|pt|pc)$/i.test(size))) | |
195 return ""; | |
186 | 196 |
187 return size; | 197 return size; |
188 } | 198 } |
189 | 199 |
190 function getStyle(elm, attrib, style) { | 200 function getStyle(elm, attrib, style) { |