- Timestamp:
- 02/15/05 03:54:50 (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/core.html
r1 r12 13 13 </script> 14 14 <script type="text/javascript" src="../htmlarea.js"></script> 15 <script type="text/javascript" src="../htmlarea_css.js"></script>16 15 17 16 <style type="text/css"> -
trunk/htmlarea.js
r11 r12 2147 2147 // Insert a space in certain locations, this is just to make editing a little 2148 2148 // easier (to "get out of" tags), it's not essential. 2149 // TODO: Make this work for IE? 2150 // TODO: Perhaps should use a plain space character, I'm not sure. 2149 2151 if(HTMLArea.is_gecko) 2150 2152 { 2151 2153 var s = this._getSelection(); 2152 if(s && s.isCollapsed && s.anchorNode && s.anchorNode.nodeType == 3) 2153 { 2154 if(s.anchorOffset == s.anchorNode.length) 2155 { 2156 if(HTMLArea.isBlockElement(s.anchorNode.parentNode)) 2157 { 2158 if(s.anchorNode.data != '\xA0' && !s.anchorNode.nextSibling) 2159 { 2160 s.anchorNode.parentNode.insertBefore(this._doc.createTextNode('\xA0'), s.anchorNode.nextSibling); 2161 } 2162 } 2163 else 2164 { 2165 if(!s.anchorNode.parentNode.nextSibling) 2166 { 2167 s.anchorNode.parentNode.parentNode.insertBefore(this._doc.createTextNode('\xA0'), s.anchorNode.parentNode.nextSibling); 2168 } 2169 } 2154 // If the last character in the last text node of the parent tag 2155 if(s && s.isCollapsed && s.anchorNode 2156 && s.anchorNode.parentNode.tagName.toLowerCase() != 'body' 2157 && s.anchorNode.nodeType == 3 && s.anchorOffset == s.anchorNode.length 2158 && ! 2159 ( s.anchorNode.parentNode.nextSibling 2160 && s.anchorNode.parentNode.nextSibling.nodeType == 3 2161 ) 2162 ) 2163 { 2164 // Insert hair-width-space after the close tag if there isn't another text node on the other side 2165 // It could also work with zero-width-space (\u200B) but I don't like it so much. 2166 // Perhaps this won't work well in various character sets and we should use plain space (20)? 2167 try 2168 { 2169 s.anchorNode.parentNode.parentNode.insertBefore 2170 (this._doc.createTextNode('\u200A'), s.anchorNode.parentNode.nextSibling); 2171 } 2172 catch(e) 2173 { 2174 // Disregard 2170 2175 } 2171 2176 } … … 2179 2184 } 2180 2185 2181 } ;2186 } 2182 2187 2183 2188 /** Returns a node after which we can insert other nodes, in the current … … 2968 2973 catch(e) { if (this.config.debug) { alert(e + "\n\nby execCommand(" + cmdID + ");"); } } 2969 2974 } 2975 2970 2976 this.updateToolbar(); 2971 2977 return false;
Note: See TracChangeset
for help on using the changeset viewer.