mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-02 03:19:28 +00:00
This updates the 3.9 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy. Because older branches use (really) old versions of NodeJS, the local Docker environment cannot be backported since the needed dependencies will not run on these older versions (see #48301). This also blocks the ability to move automated testing over to GitHub Actions (see #50401). This change also introduces a `packager-lock.json` file to the branch. In addition to backporting the package updates that happened after branching 3.9, dependencies that were removed in future releases have also been updated to their latest versions. Props desrosj, dd32, netweb, jorbin. Merges [28695,28796,28821,29270,29505,29858-30059,30061-30063,30066-30067,31425,31504,31557,31648-31650,32356-32357,32988,33726,35363,35513,35521,35538-35541,35859,36861-36865,37017,37019,37020,37212,37612,38111,39110,39113,39115-39117,39478,41835,42460-42461,42463,42887,43320,43323,43977,44219,44233,45321,45765,46404,46408-46409,47404,47867,47872-47873,48705,49636,49933,49937,49939,50126,50176,50185] to the 3.9 branch. See #52341. Built from https://develop.svn.wordpress.org/branches/3.9@50220 git-svn-id: http://core.svn.wordpress.org/branches/3.9@49886 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
7.0 KiB
JavaScript
1 line
7.0 KiB
JavaScript
window.wp=window.wp||{},function(o){var i={},a={},d=wp.media,t=["encodedText"];wp.mce=wp.mce||{},wp.mce.View=function(e){e=e||{},_.extend(this,_.pick(e,t)),this.initialize.apply(this,arguments)},_.extend(wp.mce.View.prototype,{initialize:function(){},getHtml:function(){},render:function(){var n=this.getHtml();_.each(tinymce.editors,function(e){var i=this;e.plugins.wpview&&(e=e.getDoc(),o(e).find('[data-wpview-text="'+this.encodedText+'"]').each(function(e,t){o(t).html(n).append('<ins data-wpview-end="1"></ins>'),o(i).trigger("ready",t)}))},this)},unbind:function(){}}),wp.mce.View.extend=Backbone.View.extend,wp.mce.views={register:function(e,t){i[e]=t},get:function(e){return i[e]},unregister:function(e){delete i[e]},unbind:function(){_.each(a,function(e){e.unbind()})},toViews:function(e){var t,a=[{content:e}];return _.each(i,function(n,s){t=a.slice(),a=[],_.each(t,function(e){var t,i=e.content;if(e.processed)a.push(e);else{for(;i&&(t=n.toView(i));)t.index&&a.push({content:i.substring(0,t.index)}),a.push({content:wp.mce.views.toView(s,t.content,t.options),processed:!0}),i=i.slice(t.index+t.content.length);i&&a.push({content:i})}})}),_.pluck(a,"content").join("")},toView:function(e,t,i){var n=wp.mce.views.get(e),s=window.encodeURIComponent(t);return n?(wp.mce.views.getInstance(s)||((i=i).encodedText=s,i=new n.View(i),a[s]=i),wp.html.string({tag:"div",attrs:{"class":"wpview-wrap wpview-type-"+e,"data-wpview-text":s,"data-wpview-type":e,contenteditable:"false"},content:" "})):t},refreshView:function(e,t){var i=window.encodeURIComponent(t),n=wp.mce.views.getInstance(i);n||((t=e.toView(t).options).encodedText=i,n=new e.View(t),a[i]=n),wp.mce.views.render()},getInstance:function(e){return a[e]},render:function(){_.each(a,function(e){e.render()})},edit:function(e){var t=o(e).data("wpview-type"),t=wp.mce.views.get(t);t&&t.edit(e)}},wp.mce.gallery={shortcode:"gallery",toView:function(e){e=wp.shortcode.next(this.shortcode,e);if(e)return{index:e.index,content:e.content,options:{shortcode:e.shortcode}}},View:wp.mce.View.extend({className:"editor-gallery",template:d.template("editor-gallery"),postID:o("#post_ID").val(),initialize:function(e){this.shortcode=e.shortcode,this.fetch()},fetch:function(){this.attachments=wp.media.gallery.attachments(this.shortcode,this.postID),this.dfd=this.attachments.more().done(_.bind(this.render,this))},getHtml:function(){var e=this.shortcode.attrs.named,t=!1;if(!this.dfd||"pending"!==this.dfd.state()||this.attachments.length)return this.attachments.length&&(t=this.attachments.toJSON(),_.each(t,function(e){e.sizes&&(e.sizes.thumbnail?e.thumbnail=e.sizes.thumbnail:e.sizes.full&&(e.thumbnail=e.sizes.full))})),e={attachments:t,columns:e.columns?parseInt(e.columns,10):3},this.template(e)}}),edit:function(t){var i=wp.media.gallery,n=this,e=window.decodeURIComponent(o(t).attr("data-wpview-text")),s=i.edit(e);s.state("gallery-edit").on("update",function(e){e=i.shortcode(e).string();o(t).attr("data-wpview-text",window.encodeURIComponent(e)),wp.mce.views.refreshView(n,e),s.detach()})}},wp.mce.views.register("gallery",wp.mce.gallery),wp.mce.media={loaded:!1,toView:function(e){e=wp.shortcode.next(this.shortcode,e);if(e)return{index:e.index,content:e.content,options:{shortcode:e.shortcode}}},edit:function(t){var i,e,n,s=wp.media[this.shortcode],a=this;wp.media.mixin.pauseAllPlayers(),e=window.decodeURIComponent(o(t).attr("data-wpview-text")),(i=s.edit(e)).on("close",function(){i.detach()}),n=function(e){e=wp.media[a.shortcode].shortcode(e).string();o(t).attr("data-wpview-text",window.encodeURIComponent(e)),wp.mce.views.refreshView(a,e),i.detach()},_.isArray(a.state)?_.each(a.state,function(e){i.state(e).on("update",n)}):i.state(a.state).on("update",n),i.open()}},wp.mce.media.View=wp.mce.View.extend({initialize:function(e){this.players=[],this.shortcode=e.shortcode,_.bindAll(this,"setPlayer"),o(this).on("ready",this.setPlayer)},setPlayer:function(e,t){if(t){var i=this,n=this.ua.is("ff"),s=".wp-"+this.shortcode.tag+"-shortcode",a=o(t).find(s);if(!this.isCompatible(a))return a.closest(".wpview-wrap").addClass("wont-play"),a.parent().hasClass("wpview-wrap")||a.parent().replaceWith(a),void a.replaceWith("<p>"+a.find("source").eq(0).prop("src")+"</p>");a.closest(".wpview-wrap").removeClass("wont-play"),n?a.prop("preload","metadata"):a.prop("preload","none"),a=wp.media.view.MediaDetails.prepareSrc(a.get(0)),setTimeout(function(){wp.mce.media.loaded=!0,i.players.push(new MediaElementPlayer(a,i.mejsSettings))},wp.mce.media.loaded?10:500)}},getHtml:function(){var e=this.shortcode.attrs.named;return e.content=this.shortcode.content,this.template({model:_.defaults(e,wp.media[this.shortcode.tag].defaults)})},unbind:function(){this.unsetPlayers()}}),_.extend(wp.mce.media.View.prototype,wp.media.mixin),wp.mce.video=_.extend({},wp.mce.media,{shortcode:"video",state:"video-details",View:wp.mce.media.View.extend({className:"editor-video",template:d.template("editor-video")})}),wp.mce.views.register("video",wp.mce.video),wp.mce.audio=_.extend({},wp.mce.media,{shortcode:"audio",state:"audio-details",View:wp.mce.media.View.extend({className:"editor-audio",template:d.template("editor-audio")})}),wp.mce.views.register("audio",wp.mce.audio),wp.mce.media.PlaylistView=wp.mce.View.extend({className:"editor-playlist",template:d.template("editor-playlist"),initialize:function(e){this.players=[],this.data={},this.attachments=[],this.shortcode=e.shortcode,this.fetch()},fetch:function(){this.attachments=wp.media.playlist.attachments(this.shortcode),this.dfd=this.attachments.more().done(_.bind(this.render,this))},render:function(){var i=this.getHtml(),n=this;_.each(tinymce.editors,function(e){e.plugins.wpview&&(e=e.getDoc(),o(e).find('[data-wpview-text="'+this.encodedText+'"]').each(function(e,t){o(t).html(i).append('<ins data-wpview-end="1"></ins>'),n.data.tracks&&n.players.push(new WPPlaylistView({el:o(t).find(".wp-playlist").get(0),metadata:n.data}).player)}))},this)},getHtml:function(){var s,e,a=this.shortcode.attrs.named,i=wp.media.playlist,o=[];if(!this.dfd||"pending"!==this.dfd.state()||this.attachments.length)return _.each(i.defaults,function(e,t){a[t]=i.coerce(a,t)}),s={type:a.type,style:a.style,tracklist:a.tracklist,tracknumbers:a.tracknumbers,images:a.images,artists:a.artists},this.attachments.length&&(e=this.attachments.toJSON(),_.each(e,function(e){var t={},i={},n={src:e.url,type:e.mime,title:e.title,caption:e.caption,description:e.description,meta:e.meta};"video"===a.type?(t.width=e.width,t.height=e.height,d.view.settings.contentWidth?(i.width=d.view.settings.contentWidth-22,i.height=Math.ceil(t.height*i.width/t.width),s.width||(s.width=i.width,s.height=i.height)):s.width||(s.width=e.width,s.height=e.height),n.dimensions={original:t,resized:_.isEmpty(i)?t:i}):s.width=400,n.image=e.image,n.thumb=e.thumb,o.push(n)}),s.tracks=o,this.data=s),this.template(s)},unbind:function(){this.unsetPlayers()}}),_.extend(wp.mce.media.PlaylistView.prototype,wp.media.mixin),wp.mce.playlist=_.extend({},wp.mce.media,{shortcode:"playlist",state:["playlist-edit","video-playlist-edit"],View:wp.mce.media.PlaylistView}),wp.mce.views.register("playlist",wp.mce.playlist)}(jQuery); |