TinyMCE: fix the 'wpgallery' plugin to use a placeholder for galleries when either the 'wpview' plugin or wp.mce is not loaded. Fixes #28756
git-svn-id: https://develop.svn.wordpress.org/trunk@29883 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9f8e03c390
commit
63634ff1bb
@ -61,25 +61,7 @@ tinymce.PluginManager.add('wpgallery', function( editor ) {
|
|||||||
editor.addCommand( 'WP_Gallery', function() {
|
editor.addCommand( 'WP_Gallery', function() {
|
||||||
editMedia( editor.selection.getNode() );
|
editMedia( editor.selection.getNode() );
|
||||||
});
|
});
|
||||||
/*
|
|
||||||
editor.on( 'init', function( e ) {
|
|
||||||
// _createButtons()
|
|
||||||
|
|
||||||
// iOS6 doesn't show the buttons properly on click, show them on 'touchstart'
|
|
||||||
if ( 'ontouchstart' in window ) {
|
|
||||||
editor.dom.events.bind( editor.getBody(), 'touchstart', function( e ) {
|
|
||||||
var target = e.target;
|
|
||||||
|
|
||||||
if ( target.nodeName == 'IMG' && editor.dom.hasClass( target, 'wp-gallery' ) ) {
|
|
||||||
editor.selection.select( target );
|
|
||||||
editor.dom.events.cancel( e );
|
|
||||||
editor.plugins.wordpress._hideButtons();
|
|
||||||
editor.plugins.wordpress._showButtons( target, 'wp_gallerybtns' );
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
editor.on( 'mouseup', function( event ) {
|
editor.on( 'mouseup', function( event ) {
|
||||||
var dom = editor.dom,
|
var dom = editor.dom,
|
||||||
node = event.target;
|
node = event.target;
|
||||||
@ -117,7 +99,7 @@ tinymce.PluginManager.add('wpgallery', function( editor ) {
|
|||||||
|
|
||||||
editor.on( 'BeforeSetContent', function( event ) {
|
editor.on( 'BeforeSetContent', function( event ) {
|
||||||
// 'wpview' handles the gallery shortcode when present
|
// 'wpview' handles the gallery shortcode when present
|
||||||
if ( ! editor.plugins.wpview ) {
|
if ( ! editor.plugins.wpview || typeof wp === 'undefined' || ! wp.mce ) {
|
||||||
event.content = replaceGalleryShortcodes( event.content );
|
event.content = replaceGalleryShortcodes( event.content );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user