Ticket #656: selectNodeContents.patch
| File selectNodeContents.patch, 1.5 kB (added by mokhet, 6 years ago) |
|---|
-
htmlarea.js
3174 3174 }; 3175 3175 3176 3176 // Selects the contents inside the given node 3177 HTMLArea.prototype.selectNodeContents = function(node, pos) {3178 this.focusEditor();3179 this.forceRedraw();3180 var range;3181 var collapsed = typeof pos == "undefined" ? true : false;3182 if (HTMLArea.is_ie) {3177 if (HTMLArea.is_ie) { 3178 HTMLArea.prototype.selectNodeContents = function(node, pos) { 3179 this.focusEditor(); 3180 this.forceRedraw(); 3181 var range; 3182 var collapsed = typeof pos == "undefined" ? true : false; 3183 3183 // Tables and Images get selected as "objects" rather than the text contents 3184 3184 if(collapsed && node.tagName && node.tagName.toLowerCase().match(/table|img|input|select|textarea/)) 3185 3185 { … … 3193 3193 //(collapsed) && range.collapse(pos); 3194 3194 } 3195 3195 range.select(); 3196 } else { 3196 }; 3197 } else { 3198 HTMLArea.prototype.selectNodeContents = function(node, pos) { 3199 this.focusEditor(); 3200 this.forceRedraw(); 3201 var range; 3202 var collapsed = typeof pos == "undefined" ? true : false; 3197 3203 var sel = this._getSelection(); 3198 3204 range = this._doc.createRange(); 3199 3205 // Tables and Images get selected as "objects" rather than the text contents … … 3208 3214 } 3209 3215 sel.removeAllRanges(); 3210 3216 sel.addRange(range); 3211 } 3212 } ;3217 }; 3218 } 3213 3219 3214 3220 /** Call this function to insert HTML code at the current position. It deletes 3215 3221 * the selection, if any.
