Make WordPress Core

Ticket #27389: 27389.combined.diff

File 27389.combined.diff, 8.0 KB (added by wonderboymusic, 11 years ago)
  • src/wp-includes/js/mce-view.js

     
    4141                                        doc = editor.getDoc();
    4242                                        $( doc ).find( '[data-wpview-text="' + this.encodedText + '"]' ).each(function (i, elem) {
    4343                                                var node = $( elem );
    44                                                 node.html( html );
     44                                                node.html( html ).append( '<span data-wp-view-end class="wp-view-end"></span>' );
    4545                                                $( self ).trigger( 'ready', elem );
    4646                                        });
    4747                                }
     
    339339         * @mixin
    340340         */
    341341        wp.mce.media = {
     342                loaded: false,
    342343                /**
    343344                 * @global wp.shortcode
    344345                 *
     
    410411         */
    411412        wp.mce.media.View = wp.mce.View.extend({
    412413                initialize: function( options ) {
     414                        this.players = {};
    413415                        this.shortcode = options.shortcode;
     416                        this.parsing = 0;
    414417                        _.bindAll( this, 'setPlayer' );
    415418                        $(this).on( 'ready', this.setPlayer );
    416419                },
    417420
     421                countShortcodes: function () {
     422                        var size = 0, self = this;
     423                        _.each( tinymce.editors, function( editor ) {
     424                                var doc;
     425                                if ( editor.plugins.wpview ) {
     426                                        doc = editor.getDoc();
     427                                        size += $( doc ).find( '[data-wpview-text="' + self.encodedText + '"]' ).length;
     428                                }
     429                        } );
     430
     431                        return size;
     432                },
     433
    418434                /**
    419435                 * Creates the player instance for the current node
    420436                 *
     
    435451                                firefox = this.ua.is( 'ff' ),
    436452                                className = '.wp-' +  this.shortcode.tag + '-shortcode';
    437453
    438                         if ( this.player ) {
    439                                 this.unsetPlayer();
    440                         }
     454                        this.size = this.countShortcodes();
     455                        this.pauseAllPlayers();
    441456
    442457                        media = $( node ).find( className );
    443458
     
    459474
    460475                        media = wp.media.view.MediaDetails.prepareSrc( media.get(0) );
    461476
    462                         setTimeout( function() {
    463                                 self.player = new MediaElementPlayer( media, this.mejsSettings );
    464                         }, 75 );
     477                        setTimeout( function () {
     478                                var player = new MediaElementPlayer( media, this.mejsSettings );
     479                               
     480                                wp.mce.media.loaded = true;
     481                                if ( self.players[ self.parsing ] ) {
     482                                        self.removePlayer( self.players[ self.parsing ] );
     483                                }
     484                                self.players[ self.parsing ] = player;
     485                                self.parsing += 1;
     486                                if ( self.parsing === self.size ) {
     487                                        self.parsing = 0;
     488                                }
     489                        }, wp.mce.media.loaded ? 10 : 500 );
    465490                },
    466491
    467492                /**
  • src/wp-includes/js/media-audiovideo.js

     
    128128                 *      MediaElement tries to pull the audio/video tag out of
    129129                 *      its container and re-add it to the DOM.
    130130                 */
    131                 removePlayer: function() {
    132                         var t = this.player, featureIndex, feature;
     131                removePlayer: function(t) {
     132                        var featureIndex, feature;
    133133
    134134                        // invoke features cleanup
    135135                        for ( featureIndex in t.options.features ) {
     
    145145                                t.$node.remove();
    146146                        }
    147147
    148                         if ( 'native' !== t.media.pluginType ) {
    149                                 t.media.remove();
    150                         }
     148                        t.media.remove();
    151149
    152150                        delete window.mejs.players[t.id];
    153151
    154                         t.container.remove();
     152                        if (typeof t.container == 'object') {
     153                                t.container.remove();
     154                        }
    155155                        t.globalUnbind();
    156156                        delete t.node.player;
    157157                },
     
    165165                unsetPlayer : function() {
    166166                        if ( this.player ) {
    167167                                wp.media.mixin.pauseAllPlayers();
    168                                 wp.media.mixin.removePlayer.apply( this );
     168                                wp.media.mixin.removePlayer( this.player );
    169169                                this.player = false;
    170170                        }
    171171                }
  • src/wp-includes/js/mediaelement/wp-mediaelement.css

     
    7272        max-width: 100%;
    7373}
    7474
    75 .wp-playlist audio {
     75.wp-playlist audio, audio.wp-audio-shortcode {
    7676        display: none;
    7777        max-width: 100%;
    7878        width: 400px;
  • src/wp-includes/js/tinymce/plugins/wpview/plugin.js

     
    141141        }
    142142
    143143        editor.on( 'BeforeAddUndo', function( event ) {
    144                 if ( selected && ! toRemove ) {
    145                         event.preventDefault();
     144                var replace,
     145                        previousContent,
     146                        content;
     147
     148                replace = function( content ) {
     149                        return content.replace(/(<div[^>]+wpview-wrap[^>]+>)([\s\S]+)(<span[^>]+data-wp-view-end[^>]+><\/span><\/div>)/mg, '$`$1$3$\'' );
     150                };
     151
     152                if ( event.lastLevel ) {
     153                        previousContent = replace( event.lastLevel.content );
     154                        content = replace( event.level.content );
     155
     156                        if ( content === previousContent ) {
     157                                event.preventDefault();
     158                        }
    146159                }
    147160        });
    148161
     
    162175        editor.on( 'SetContent', function( event ) {
    163176                var body, padNode;
    164177
    165                 // don't (re-)render views if the format of the content is raw
    166                 // to avoid adding additional undo levels on undo/redo
    167                 if ( event.format !== 'raw' ) {
    168                         wp.mce.views.render();
    169                 }
     178                wp.mce.views.render();
    170179
    171180                // Add padding <p> if the noneditable node is last
    172181                if ( event.load || ! event.set ) {
  • src/wp-includes/js/tinymce/tinymce.js

     
    1716517165                                        return null;
    1716617166                                }
    1716717167
    17168                                 if (editor.fire('BeforeAddUndo', {level: level, originalEvent: event}).isDefaultPrevented()) {
     17168                                lastLevel = data[index];
     17169                                if (editor.fire('BeforeAddUndo', {level: level, lastLevel: lastLevel, originalEvent: event}).isDefaultPrevented()) {
    1716917170                                        return null;
    1717017171                                }
    1717117172
    1717217173                                // Add undo level if needed
    17173                                 lastLevel = data[index];
    1717417174                                if (lastLevel && lastLevel.content == level.content) {
    1717517175                                        return null;
    1717617176                                }
     
    3497734977});
    3497834978
    3497934979expose(["tinymce/dom/EventUtils","tinymce/dom/Sizzle","tinymce/dom/DomQuery","tinymce/html/Styles","tinymce/dom/TreeWalker","tinymce/util/Tools","tinymce/dom/Range","tinymce/html/Entities","tinymce/Env","tinymce/dom/StyleSheetLoader","tinymce/dom/DOMUtils","tinymce/dom/ScriptLoader","tinymce/AddOnManager","tinymce/html/Node","tinymce/html/Schema","tinymce/html/SaxParser","tinymce/html/DomParser","tinymce/html/Writer","tinymce/html/Serializer","tinymce/dom/Serializer","tinymce/dom/TridentSelection","tinymce/util/VK","tinymce/dom/ControlSelection","tinymce/dom/RangeUtils","tinymce/dom/Selection","tinymce/fmt/Preview","tinymce/Formatter","tinymce/UndoManager","tinymce/EnterKey","tinymce/ForceBlocks","tinymce/EditorCommands","tinymce/util/URI","tinymce/util/Class","tinymce/ui/Selector","tinymce/ui/Collection","tinymce/ui/DomUtils","tinymce/ui/Control","tinymce/ui/Factory","tinymce/ui/KeyboardNavigation","tinymce/ui/Container","tinymce/ui/DragHelper","tinymce/ui/Scrollable","tinymce/ui/Panel","tinymce/ui/Movable","tinymce/ui/Resizable","tinymce/ui/FloatPanel","tinymce/ui/Window","tinymce/ui/MessageBox","tinymce/WindowManager","tinymce/util/Quirks","tinymce/util/Observable","tinymce/Shortcuts","tinymce/Editor","tinymce/util/I18n","tinymce/FocusManager","tinymce/EditorManager","tinymce/LegacyInput","tinymce/util/XHR","tinymce/util/JSON","tinymce/util/JSONRequest","tinymce/util/JSONP","tinymce/util/LocalStorage","tinymce/Compat","tinymce/ui/Layout","tinymce/ui/AbsoluteLayout","tinymce/ui/Tooltip","tinymce/ui/Widget","tinymce/ui/Button","tinymce/ui/ButtonGroup","tinymce/ui/Checkbox","tinymce/ui/PanelButton","tinymce/ui/ColorButton","tinymce/ui/ComboBox","tinymce/ui/Path","tinymce/ui/ElementPath","tinymce/ui/FormItem","tinymce/ui/Form","tinymce/ui/FieldSet","tinymce/ui/FilePicker","tinymce/ui/FitLayout","tinymce/ui/FlexLayout","tinymce/ui/FlowLayout","tinymce/ui/FormatControls","tinymce/ui/GridLayout","tinymce/ui/Iframe","tinymce/ui/Label","tinymce/ui/Toolbar","tinymce/ui/MenuBar","tinymce/ui/MenuButton","tinymce/ui/ListBox","tinymce/ui/MenuItem","tinymce/ui/Menu","tinymce/ui/Radio","tinymce/ui/ResizeHandle","tinymce/ui/Spacer","tinymce/ui/SplitButton","tinymce/ui/StackLayout","tinymce/ui/TabPanel","tinymce/ui/TextBox","tinymce/ui/Throbber"]);
    34980 })(this);
    34981  No newline at end of file
     34980})(this);