]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/plugins/wpgallery/plugin.js
WordPress 4.7.2-scripts
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / wpgallery / plugin.js
index 7f82e3575f04acb4b8a6e742df0b1ed60218d37a..d9723f2db5996e2429c86053da3bc2b8e7567fbd 100644 (file)
@@ -10,7 +10,7 @@ tinymce.PluginManager.add('wpgallery', function( editor ) {
        function html( cls, data ) {
                data = window.encodeURIComponent( data );
                return '<img src="' + tinymce.Env.transparentSrc + '" class="wp-media mceItem ' + cls + '" ' +
-                       'data-wp-media="' + data + '" data-mce-resize="false" data-mce-placeholder="1" />';
+                       'data-wp-media="' + data + '" data-mce-resize="false" data-mce-placeholder="1" alt="" />';
        }
 
        function restoreMediaShortcodes( content ) {
@@ -61,25 +61,7 @@ tinymce.PluginManager.add('wpgallery', function( editor ) {
        editor.addCommand( 'WP_Gallery', function() {
                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 ) {
                var dom = editor.dom,
                        node = event.target;
@@ -117,7 +99,7 @@ tinymce.PluginManager.add('wpgallery', function( editor ) {
 
        editor.on( 'BeforeSetContent', function( event ) {
                // '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 );
                }
        });