Changeset 974
- Timestamp:
- 02/07/08 20:54:32 (5 years ago)
- Files:
-
- 1 modified
-
trunk/plugins/SmartReplace/smart-replace.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/SmartReplace/smart-replace.js
r967 r974 68 68 69 69 var self = this; 70 Xinha._addEvent s(70 Xinha._addEvent( 71 71 self.editor._doc, 72 [ "keypress"],72 "keypress", 73 73 function (event) 74 74 { … … 103 103 104 104 SmartReplace.prototype.keyEvent = function(ev) 105 { 105 { 106 106 if ( !this.active) return true; 107 107 var editor = this.editor; 108 var charCode = Xinha.is_ie ? ev.keyCode : ev. charCode;108 var charCode = Xinha.is_ie ? ev.keyCode : ev.which; 109 109 110 110 var key = String.fromCharCode(charCode); … … 112 112 if (charCode == 32) //space bar 113 113 { 114 return this.smartDash( )114 return this.smartDash(ev) 115 115 } 116 116 if ( key == '"' || key == "'") … … 152 152 r.moveStart('character', +1); 153 153 r.text = closing; 154 154 155 } 155 156 else … … 181 182 editor.getSelection().collapseToEnd(); 182 183 } 183 } 184 185 SmartReplace.prototype.smartDash = function() 184 return false; 185 } 186 187 SmartReplace.prototype.smartDash = function(ev) 186 188 { 187 189 var editor = this.editor; … … 204 206 if(r.toString().match(/^ -/)) 205 207 { 206 this.editor.insertNodeAtSelection(document.createTextNode(String.fromCharCode(8211))); 208 r.deleteContents(); 209 this.editor.insertNodeAtSelection(document.createTextNode(' ' + String.fromCharCode(8211))); 207 210 } 208 211 editor.getSelection().collapseToEnd(); 209 212 } 213 return true; 210 214 } 211 215
