Changeset 22602
- Timestamp:
- 11/15/2012 11:49:19 PM (13 years ago)
- Location:
- trunk/wp-includes/js/tinymce/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js
r22586 r22602 46 46 } 47 47 }); 48 49 // iOS6 doesn't show the buttons properly on click, show them on 'touchstart' 50 if ( 'ontouchstart' in window ) { 51 ed.dom.events.add(ed.getBody(), 'touchstart', function(e){ 52 t._showButtons(e); 53 }); 54 } 48 55 }); 49 56 … … 76 83 77 84 // show editimage buttons 78 ed.onMouseDown.add(function(ed, e) { 79 var target = e.target; 80 81 if ( target.nodeName != 'IMG' ) { 82 if ( target.firstChild && target.firstChild.nodeName == 'IMG' && target.childNodes.length == 1 ) 83 target = target.firstChild; 84 else 85 return; 86 } 87 88 if ( ed.dom.getAttrib(target, 'class').indexOf('mceItem') == -1 ) { 89 mouse = { 90 x: e.clientX, 91 y: e.clientY, 92 img_w: target.clientWidth, 93 img_h: target.clientHeight 94 }; 95 96 ed.plugins.wordpress._showButtons(target, 'wp_editbtns'); 97 } 85 ed.onMouseDown.add(function(ed, e){ 86 t._showButtons(e); 98 87 }); 99 88 … … 200 189 201 190 _createButtons : function() { 202 var t = this, ed = t inyMCE.activeEditor, DOM = tinymce.DOM, editButton, dellButton, isRetina;191 var t = this, ed = t.editor, DOM = tinymce.DOM, editButton, dellButton, isRetina; 203 192 204 193 isRetina = ( window.devicePixelRatio && window.devicePixelRatio > 1 ) || // WebKit, Opera … … 222 211 tinymce.dom.Event.add(editButton, 'mousedown', function(e) { 223 212 t._editImage(); 213 ed.plugins.wordpress._hideButtons(); 224 214 }); 225 215 … … 233 223 234 224 tinymce.dom.Event.add(dellButton, 'mousedown', function(e) { 235 var e d = tinyMCE.activeEditor, el = ed.selection.getNode(), p;225 var el = ed.selection.getNode(), p; 236 226 237 227 if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) { … … 246 236 return false; 247 237 } 238 ed.plugins.wordpress._hideButtons(); 248 239 }); 249 240 }, … … 265 256 inline: true 266 257 }); 258 }, 259 260 _showButtons : function(e) { 261 var ed = this.editor, target = e.target; 262 263 if ( target.nodeName != 'IMG' ) { 264 if ( target.firstChild && target.firstChild.nodeName == 'IMG' && target.childNodes.length == 1 ) { 265 target = target.firstChild; 266 } else { 267 ed.plugins.wordpress._hideButtons(); 268 return; 269 } 270 } 271 272 if ( ed.dom.getAttrib(target, 'class').indexOf('mceItem') == -1 ) { 273 mouse = { 274 x: e.clientX, 275 y: e.clientY, 276 img_w: target.clientWidth, 277 img_h: target.clientHeight 278 }; 279 280 if ( e.type == 'touchstart' ) { 281 ed.selection.select(target); 282 ed.dom.events.cancel(e); 283 } 284 285 ed.plugins.wordpress._hideButtons(); 286 ed.plugins.wordpress._showButtons(target, 'wp_editbtns'); 287 } 267 288 }, 268 289 -
trunk/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin_src.js
r22586 r22602 7 7 8 8 t.url = url; 9 t.editor = ed; 9 10 t._createButtons(); 10 11 … … 31 32 }); 32 33 34 ed.onInit.add(function(ed) { 35 // iOS6 doesn't show the buttons properly on click, show them on 'touchstart' 36 if ( 'ontouchstart' in window ) { 37 ed.dom.events.add(ed.getBody(), 'touchstart', function(e){ 38 var target = e.target; 39 40 if ( target.nodeName == 'IMG' && ed.dom.hasClass(target, 'wpGallery') ) { 41 ed.selection.select(target); 42 ed.dom.events.cancel(e); 43 ed.plugins.wordpress._hideButtons(); 44 ed.plugins.wordpress._showButtons(target, 'wp_gallerybtns'); 45 } 46 }); 47 } 48 }); 49 33 50 ed.onMouseDown.add(function(ed, e) { 34 if ( e.target.nodeName == 'IMG' && ed.dom.hasClass(e.target, 'wpGallery') ) 51 if ( e.target.nodeName == 'IMG' && ed.dom.hasClass(e.target, 'wpGallery') ) { 35 52 ed.plugins.wordpress._showButtons(e.target, 'wp_gallerybtns'); 53 } 36 54 }); 37 55 … … 70 88 71 89 _createButtons : function() { 72 var t = this, ed = t inyMCE.activeEditor, DOM = tinymce.DOM, editButton, dellButton, isRetina;90 var t = this, ed = t.editor, DOM = tinymce.DOM, editButton, dellButton, isRetina; 73 91 74 92 isRetina = ( window.devicePixelRatio && window.devicePixelRatio > 1 ) || // WebKit, Opera … … 91 109 92 110 tinymce.dom.Event.add(editButton, 'mousedown', function(e) { 93 var ed = tinyMCE.activeEditor;94 111 ed.windowManager.bookmark = ed.selection.getBookmark('simple'); 95 112 ed.execCommand("WP_Gallery"); 113 ed.plugins.wordpress._hideButtons(); 96 114 }); 97 115 … … 105 123 106 124 tinymce.dom.Event.add(dellButton, 'mousedown', function(e) { 107 var e d = tinyMCE.activeEditor, el = ed.selection.getNode();125 var el = ed.selection.getNode(); 108 126 109 127 if ( el.nodeName == 'IMG' && ed.dom.hasClass(el, 'wpGallery') ) { … … 111 129 112 130 ed.execCommand('mceRepaint'); 113 return false;131 ed.dom.events.cancel(e); 114 132 } 133 134 ed.plugins.wordpress._hideButtons(); 115 135 }); 116 136 },
Note: See TracChangeset
for help on using the changeset viewer.