145 | | body.on( 'mousedown', disableSave ); |
| 145 | body.on( 'mousedown', |
| 146 | function( evt ) |
| 147 | { |
| 148 | // IE with a standards mode doctype has a bug where |
| 149 | // you cannot click to the right of a control element |
| 150 | if( ! CKEDITOR.env.quirks ) |
| 151 | { |
| 152 | CKEDITOR.tools.setTimeout(function checkSelection( target, offsetX, offsetY ) |
| 153 | { |
| 154 | var range = editor.getSelection().getRanges()[0]; |
| 155 | var el = null; |
| 156 | |
| 157 | if(range.startContainer.type == CKEDITOR.NODE_TEXT) |
| 158 | { |
| 159 | el = range.startContainer; |
| 160 | } |
| 161 | else |
| 162 | { |
| 163 | el = range.startContainer.getChild( range.startOffset ); |
| 164 | } |
| 165 | |
| 166 | // Must be at the start of the block |
| 167 | if( el && el.$ != target.$ && ! range.checkStartOfBlock() ) |
| 168 | { |
| 169 | return; |
| 170 | } |
| 171 | |
| 172 | var block = new CKEDITOR.dom.elementPath( el ).block; |
| 173 | |
| 174 | // The target node must be the same as the block |
| 175 | if( !block || block.$ != target.$ ) |
| 176 | { |
| 177 | return; |
| 178 | } |
| 179 | |
| 180 | // The mouse position must not be close to the start |
| 181 | if( offsetX < 20 && offsetY < 20 ) |
| 182 | { |
| 183 | return; |
| 184 | } |
| 185 | |
| 186 | range.moveToPosition( block, CKEDITOR.POSITION_BEFORE_END ); |
| 187 | range.select(); |
| 188 | }, 0, null, [evt.data.getTarget(), evt.data.$.offsetX, evt.data.$.offsetY] ); |
| 189 | } |
| 190 | |
| 191 | disableSave(); |
| 192 | }); |
| 193 | |