diff --git a/wp-admin/js/editor-expand.js b/wp-admin/js/editor-expand.js index 43ef3b12aa..25f86c2847 100644 --- a/wp-admin/js/editor-expand.js +++ b/wp-admin/js/editor-expand.js @@ -600,7 +600,7 @@ // Adjust when collapsing the menu, changing the columns, changing the body class. $document.on( 'wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand', adjust ) - .on( 'postbox-toggled.editor-expand', function() { + .on( 'postbox-toggled.editor-expand postbox-moved.editor-expand', function() { if ( ! fixedSideTop && ! fixedSideBottom && window.pageYOffset > pinnedToolsTop ) { fixedSideBottom = true; window.scrollBy( 0, -1 ); diff --git a/wp-admin/js/editor-expand.min.js b/wp-admin/js/editor-expand.min.js index eaf9151d33..32200c7cc3 100644 --- a/wp-admin/js/editor-expand.min.js +++ b/wp-admin/js/editor-expand.min.js @@ -1 +1 @@ -!function(a,b,c){"use strict";var d=b(a),e=b(document),f=b("#wpadminbar"),g=b("#wpfooter");b(function(){function c(){var a=d.width();T={windowHeight:d.height(),windowWidth:a,adminBarHeight:a>600?f.outerHeight():0,toolsHeight:s.outerHeight()||0,menuBarHeight:A.outerHeight()||0,visualTopHeight:t.outerHeight()||0,textTopHeight:v.outerHeight()||0,bottomHeight:z.outerHeight()||0,statusBarHeight:B.outerHeight()||0,sideSortablesHeight:C.height()||0},T.menuBarHeight<3&&(T.menuBarHeight=0)}function h(){if((!o||o.isHidden())&&(o||"tinymce"!==R)){var a=x.value.length,b=parseInt(x.style.height,10);y>a?(x.style.height="auto",x.scrollHeight>=Q?x.style.height=x.scrollHeight+"px":x.style.height=Q+"px",x.scrollHeightl+5,l?((!I||G)&&x>=m-T.toolsHeight-T.adminBarHeight&&x<=m-T.toolsHeight-T.adminBarHeight+q-N?(I=!0,s.css({position:"fixed",top:T.adminBarHeight,width:V}),H&&A.length&&A.css({position:"fixed",top:T.adminBarHeight+T.toolsHeight,width:V-2*U-(H?0:f.outerWidth()-f.width())}),f.css({position:"fixed",top:T.adminBarHeight+T.toolsHeight+T.menuBarHeight,width:V-2*U-(H?0:f.outerWidth()-f.width())})):(I||G)&&(x<=m-T.toolsHeight-T.adminBarHeight?(I=!1,s.css({position:"absolute",top:0,width:V}),H&&A.length&&A.css({position:"absolute",top:0,width:V-2*U}),f.css({position:"absolute",top:T.menuBarHeight,width:V-2*U-(H?0:f.outerWidth()-f.width())})):x>=m-T.toolsHeight-T.adminBarHeight+q-N&&(I=!1,s.css({position:"absolute",top:q-N,width:V}),H&&A.length&&A.css({position:"absolute",top:q-N,width:V-2*U}),f.css({position:"absolute",top:q-N+T.menuBarHeight,width:V-2*U-(H?0:f.outerWidth()-f.width())}))),(!J||G&&S)&&x+T.windowHeight<=p+q+T.bottomHeight+T.statusBarHeight+U?b&&b.deltaHeight>0&&b.deltaHeight<100?a.scrollBy(0,b.deltaHeight):H&&S&&(J=!0,B.css({position:"fixed",bottom:T.bottomHeight,visibility:"",width:V-2*U}),z.css({position:"fixed",bottom:0,width:V})):(!S&&J||(J||G)&&x+T.windowHeight>p+q+T.bottomHeight+T.statusBarHeight-U)&&(J=!1,B.attr("style",S?"":"visibility: hidden;"),z.attr("style",""))):G&&(s.css({position:"absolute",top:0,width:V}),H&&A.length&&A.css({position:"absolute",top:0,width:V-2*U}),f.css({position:"absolute",top:T.menuBarHeight,width:V-2*U-(H?0:f.outerWidth()-f.width())}),B.attr("style",S?"":"visibility: hidden;"),z.attr("style","")),D.width()<300&&T.windowWidth>600&&e.height()>C.height()+R+120&&T.windowHeightT.windowHeight||K||L?R>=x+O?(C.attr("style",""),K=L=!1):x>M?K?(K=!1,j=C.offset().top-T.adminBarHeight,k=g.offset().top,kx&&(L?(L=!1,j=C.offset().top-P,k=g.offset().top,k=x+O&&(K=!0,C.css({position:"fixed",top:O,bottom:""}))):(x>=R-O?C.css({position:"fixed",top:O}):C.attr("style",""),K=L=!1),M=x):(C.attr("style",""),K=L=!1),G&&(r.css({paddingTop:T.toolsHeight}),H?u.css({paddingTop:T.visualTopHeight+T.menuBarHeight}):w.css({marginTop:T.textTopHeight})))}}function j(){h(),i()}function k(a){for(var b=1;6>b;b++)setTimeout(a,500*b)}function l(){clearTimeout(p),p=setTimeout(i,100)}function m(){a.pageYOffset&&a.pageYOffset>N&&a.scrollTo(a.pageXOffset,0),q.addClass("wp-editor-expand"),d.on("scroll.editor-expand resize.editor-expand",function(a){i(a.type),l()}),e.on("wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand",i).on("postbox-toggled.editor-expand",function(){!K&&!L&&a.pageYOffset>O&&(L=!0,a.scrollBy(0,-1),i(),a.scrollBy(0,1)),i()}).on("wp-window-resized.editor-expand",function(){o&&!o.isHidden()?o.execCommand("wpAutoResize"):h()}),w.on("focus.editor-expand input.editor-expand propertychange.editor-expand",h),G(),F&&F.pubsub.subscribe("hidden",j),o&&(o.settings.wp_autoresize_on=!0,o.execCommand("wpAutoResizeOn"),o.isHidden()||o.execCommand("wpAutoResize")),o&&!o.isHidden()||h(),i(),e.trigger("editor-expand-on")}function n(){var c=parseInt(a.getUserSetting("ed_size",300),10);50>c?c=50:c>5e3&&(c=5e3),a.pageYOffset&&a.pageYOffset>N&&a.scrollTo(a.pageXOffset,0),q.removeClass("wp-editor-expand"),d.off(".editor-expand"),e.off(".editor-expand"),w.off(".editor-expand"),H(),F&&F.pubsub.unsubscribe("hidden",j),b.each([t,v,s,A,z,B,r,u,w,C],function(a,b){b&&b.attr("style","")}),I=J=K=L=!1,o&&(o.settings.wp_autoresize_on=!1,o.execCommand("wpAutoResizeOff"),o.isHidden()||(w.hide(),c&&o.theme.resizeTo(null,c))),c&&w.height(c),e.trigger("editor-expand-off")}var o,p,q=b("#postdivrich"),r=b("#wp-content-wrap"),s=b("#wp-content-editor-tools"),t=b(),u=b(),v=b("#ed_toolbar"),w=b("#content"),x=w[0],y=0,z=b("#post-status-info"),A=b(),B=b(),C=b("#side-sortables"),D=b("#postbox-container-1"),E=b("#post-body"),F=a.wp.editor&&a.wp.editor.fullscreen,G=function(){},H=function(){},I=!1,J=!1,K=!1,L=!1,M=0,N=130,O=56,P=20,Q=300,R=r.hasClass("tmce-active")?"tinymce":"html",S=!!parseInt(a.getUserSetting("hidetb"),10),T={windowHeight:0,windowWidth:0,adminBarHeight:0,toolsHeight:0,menuBarHeight:0,visualTopHeight:0,textTopHeight:0,bottomHeight:0,statusBarHeight:0,sideSortablesHeight:0};e.on("tinymce-editor-init.editor-expand",function(c,e){function f(){var a,b,c,d=e.selection.getNode();if(e.wp&&e.wp.getView&&(b=e.wp.getView(d)))c=b.getBoundingClientRect();else{a=e.selection.getRng();try{c=a.getClientRects()[0]}catch(f){}c||(c=d.getBoundingClientRect())}return c.height?c:!1}function g(a){var b=a.keyCode;47>=b&&b!==s.SPACEBAR&&b!==s.ENTER&&b!==s.DELETE&&b!==s.BACKSPACE&&b!==s.UP&&b!==s.LEFT&&b!==s.DOWN&&b!==s.UP||b>=91&&93>=b||b>=112&&123>=b||144===b||145===b||j(b)}function j(b){var c,d,g,h,i=f(),j=50;i&&(c=i.top+e.iframeElement.getBoundingClientRect().top,d=c+i.height,c-=j,d+=j,g=T.adminBarHeight+T.toolsHeight+T.menuBarHeight+T.visualTopHeight,h=T.windowHeight-(S?T.bottomHeight+T.statusBarHeight:0),h-gc&&(b===s.UP||b===s.LEFT||b===s.BACKSPACE)?a.scrollTo(a.pageXOffset,c+a.pageYOffset-g):d>h&&a.scrollTo(a.pageXOffset,d+a.pageYOffset-h)))}function l(a){a.state||i()}function m(){d.on("scroll.mce-float-panels",v),setTimeout(function(){e.execCommand("wpAutoResize"),i()},300)}function n(){d.off("scroll.mce-float-panels"),setTimeout(function(){var b=r.offset().top;a.pageYOffset>b&&a.scrollTo(a.pageXOffset,b-T.adminBarHeight),h(),i()},100),i()}function p(){S=!S}var s=a.tinymce.util.VK,v=_.debounce(function(){!b(".mce-floatpanel:hover").length&&a.tinymce.ui.FloatPanel.hideAll(),b(".mce-tooltip").hide()},1e3,!0);"content"===e.id&&(o=e,e.settings.autoresize_min_height=Q,t=r.find(".mce-toolbar-grp"),u=r.find(".mce-edit-area"),B=r.find(".mce-statusbar"),A=r.find(".mce-menubar"),G=function(){e.on("keyup",g),e.on("show",m),e.on("hide",n),e.on("wp-toolbar-toggle",p),e.on("setcontent wp-autoresize wp-toolbar-toggle",i),e.on("undo redo",j),e.on("FullscreenStateChanged",l),d.off("scroll.mce-float-panels").on("scroll.mce-float-panels",v)},H=function(){e.off("keyup",g),e.off("show",m),e.off("hide",n),e.off("wp-toolbar-toggle",p),e.off("setcontent wp-autoresize wp-toolbar-toggle",i),e.off("undo redo",j),e.off("FullscreenStateChanged",l),d.off("scroll.mce-float-panels")},q.hasClass("wp-editor-expand")&&(G(),k(i)))}),q.hasClass("wp-editor-expand")&&(m(),r.hasClass("html-active")&&k(function(){i(),h()})),b("#adv-settings .editor-expand").show(),b("#editor-expand-toggle").on("change.editor-expand",function(){b(this).prop("checked")?(m(),a.setUserSetting("editor_expand","on")):(n(),a.setUserSetting("editor_expand","off"))}),a.editorExpand={on:m,off:n}}),b(function(){function c(){z=J.offset(),z.right=z.left+J.outerWidth(),z.bottom=z.top+J.outerHeight()}function h(){S||(S=!0,e.trigger("dfw-activate"),L.on("keydown.focus-shortcut",v))}function i(){S&&(l(),S=!1,e.trigger("dfw-deactivate"),L.off("keydown.focus-shortcut"))}function j(){return S}function k(){!T&&S&&(T=!0,L.on("keydown.focus",o),K.add(L).on("blur.focus",q),o(),a.setUserSetting("post_dfw","on"),e.trigger("dfw-on"))}function l(){T&&(T=!1,K.add(L).off(".focus"),p(),J.off(".focus"),a.setUserSetting("post_dfw","off"),e.trigger("dfw-off"))}function m(){T?l():k()}function n(){return T}function o(b){var e,f=b&&b.keyCode;return a.navigator.platform&&(e=a.navigator.platform.indexOf("Mac")>-1),27===f||87===f&&b.altKey&&(!e&&b.shiftKey||e&&b.ctrlKey)?void p(b):void(b&&(b.metaKey||b.ctrlKey&&!b.altKey||b.altKey&&b.shiftKey||f&&(47>=f&&8!==f&&13!==f&&32!==f&&46!==f||f>=91&&93>=f||f>=112&&135>=f||f>=144&&150>=f||f>=224))||(w||(w=!0,clearTimeout(F),F=setTimeout(function(){M.show()},600),J.css("z-index",9998),M.on("mouseenter.focus",function(){c(),d.on("scroll.focus",function(){var b=a.pageYOffset;D&&C&&D!==b&&(Cz.bottom+W)&&p(),D=b})}).on("mouseleave.focus",function(){A=B=null,U=V=0,d.off("scroll.focus")}).on("mousemove.focus",function(b){var c=b.clientX,d=b.clientY,e=a.pageYOffset,f=a.pageXOffset;if(A&&B&&(c!==A||d!==B))if(B>=d&&d=B&&d>z.bottom-e||A>=c&&c=A&&c>z.right-f){if(U+=Math.abs(A-c),V+=Math.abs(B-d),(d<=z.top-W-e||d>=z.bottom+W-e||c<=z.left-W-f||c>=z.right+W-f)&&(U>10||V>10))return p(),A=B=null,void(U=V=0)}else U=V=0;A=c,B=d}).on("touchstart.focus",function(a){a.preventDefault(),p()}),J.off("mouseenter.focus"),E&&(clearTimeout(E),E=null),H.addClass("focus-on").removeClass("focus-off")),r(),t()))}function p(a){w&&(w=!1,clearTimeout(F),F=setTimeout(function(){M.hide()},200),J.css("z-index",""),M.off("mouseenter.focus mouseleave.focus mousemove.focus touchstart.focus"),"undefined"==typeof a&&J.on("mouseenter.focus",function(){(b.contains(J.get(0),document.activeElement)||G)&&o()}),E=setTimeout(function(){E=null,J.off("mouseenter.focus")},1e3),H.addClass("focus-off").removeClass("focus-on")),s(),u()}function q(){setTimeout(function(){function a(a){return b.contains(a.get(0),document.activeElement)}var c=document.activeElement.compareDocumentPosition(J.get(0));2!==c&&4!==c||!(a(P)||a(I)||a(g))||p()},0)}function r(){!x&&w&&(x=!0,f.on("mouseenter.focus",function(){f.addClass("focus-off")}).on("mouseleave.focus",function(){f.removeClass("focus-off")}))}function s(){x&&(x=!1,f.off(".focus"))}function t(){y||!w||N.find(":focus").length||(y=!0,N.stop().fadeTo("fast",.3).on("mouseenter.focus",u).off("mouseleave.focus"),O.on("focus.focus",u).off("blur.focus"))}function u(){y&&(y=!1,N.stop().fadeTo("fast",1).on("mouseleave.focus",t).off("mouseenter.focus"),O.on("blur.focus",t).off("focus.focus"))}function v(a){a.altKey&&a.shiftKey&&87===a.keyCode&&m()}var w,x,y,z,A,B,C,D,E,F,G,H=b(document.body),I=b("#wpcontent"),J=b("#post-body-content"),K=b("#title"),L=b("#content"),M=b(document.createElement("DIV")),N=b("#edit-slug-box"),O=N.find("a").add(N.find("button")).add(N.find("input")),P=b("#adminmenuwrap"),Q=b(),R=b(),S="on"===a.getUserSetting("editor_expand","on"),T=S?"on"===a.getUserSetting("post_dfw"):!1,U=0,V=0,W=20;H.append(M),M.css({display:"none",position:"fixed",top:f.height(),right:0,bottom:0,left:0,"z-index":9997}),J.css({position:"relative"}),d.on("mousemove.focus",function(a){C=a.pageY}),b("#postdivrich").hasClass("wp-editor-expand")&&L.on("keydown.focus-shortcut",v),e.on("tinymce-editor-setup.focus",function(a,b){b.addButton("dfw",{active:T,classes:"wp-dfw btn widget",disabled:!S,onclick:m,onPostRender:function(){var a=this;e.on("dfw-activate.focus",function(){a.disabled(!1)}).on("dfw-deactivate.focus",function(){a.disabled(!0)}).on("dfw-on.focus",function(){a.active(!0)}).on("dfw-off.focus",function(){a.active(!1)})},tooltip:"Distraction-free writing mode",shortcut:"Alt+Shift+W"}),b.addCommand("wpToggleDFW",m),b.addShortcut("access+w","","wpToggleDFW")}),e.on("tinymce-editor-init.focus",function(a,d){function f(){G=!0}function g(){G=!1}var h,i;"content"===d.id&&(Q=b(d.getWin()),R=b(d.getContentAreaContainer()).find("iframe"),h=function(){d.on("keydown",o),d.on("blur",q),d.on("focus",f),d.on("blur",g),d.on("wp-autoresize",c)},i=function(){d.off("keydown",o),d.off("blur",q),d.off("focus",f),d.off("blur",g),d.off("wp-autoresize",c)},T&&h(),e.on("dfw-on.focus",h).on("dfw-off.focus",i),d.on("click",function(a){a.target===d.getDoc().documentElement&&d.focus()}))}),e.on("quicktags-init",function(a,c){var d;c.settings.buttons&&-1!==(","+c.settings.buttons+",").indexOf(",dfw,")&&(d=b("#"+c.name+"_dfw"),b(document).on("dfw-activate",function(){d.prop("disabled",!1)}).on("dfw-deactivate",function(){d.prop("disabled",!0)}).on("dfw-on",function(){d.addClass("active")}).on("dfw-off",function(){d.removeClass("active")}))}),e.on("editor-expand-on.focus",h).on("editor-expand-off.focus",i),T&&(L.on("keydown.focus",o),K.add(L).on("blur.focus",q)),a.wp=a.wp||{},a.wp.editor=a.wp.editor||{},a.wp.editor.dfw={activate:h,deactivate:i,isActive:j,on:k,off:l,toggle:m,isOn:n}})}(window,window.jQuery); \ No newline at end of file +!function(a,b,c){"use strict";var d=b(a),e=b(document),f=b("#wpadminbar"),g=b("#wpfooter");b(function(){function c(){var a=d.width();T={windowHeight:d.height(),windowWidth:a,adminBarHeight:a>600?f.outerHeight():0,toolsHeight:s.outerHeight()||0,menuBarHeight:A.outerHeight()||0,visualTopHeight:t.outerHeight()||0,textTopHeight:v.outerHeight()||0,bottomHeight:z.outerHeight()||0,statusBarHeight:B.outerHeight()||0,sideSortablesHeight:C.height()||0},T.menuBarHeight<3&&(T.menuBarHeight=0)}function h(){if((!o||o.isHidden())&&(o||"tinymce"!==R)){var a=x.value.length,b=parseInt(x.style.height,10);y>a?(x.style.height="auto",x.scrollHeight>=Q?x.style.height=x.scrollHeight+"px":x.style.height=Q+"px",x.scrollHeightl+5,l?((!I||G)&&x>=m-T.toolsHeight-T.adminBarHeight&&x<=m-T.toolsHeight-T.adminBarHeight+q-N?(I=!0,s.css({position:"fixed",top:T.adminBarHeight,width:V}),H&&A.length&&A.css({position:"fixed",top:T.adminBarHeight+T.toolsHeight,width:V-2*U-(H?0:f.outerWidth()-f.width())}),f.css({position:"fixed",top:T.adminBarHeight+T.toolsHeight+T.menuBarHeight,width:V-2*U-(H?0:f.outerWidth()-f.width())})):(I||G)&&(x<=m-T.toolsHeight-T.adminBarHeight?(I=!1,s.css({position:"absolute",top:0,width:V}),H&&A.length&&A.css({position:"absolute",top:0,width:V-2*U}),f.css({position:"absolute",top:T.menuBarHeight,width:V-2*U-(H?0:f.outerWidth()-f.width())})):x>=m-T.toolsHeight-T.adminBarHeight+q-N&&(I=!1,s.css({position:"absolute",top:q-N,width:V}),H&&A.length&&A.css({position:"absolute",top:q-N,width:V-2*U}),f.css({position:"absolute",top:q-N+T.menuBarHeight,width:V-2*U-(H?0:f.outerWidth()-f.width())}))),(!J||G&&S)&&x+T.windowHeight<=p+q+T.bottomHeight+T.statusBarHeight+U?b&&b.deltaHeight>0&&b.deltaHeight<100?a.scrollBy(0,b.deltaHeight):H&&S&&(J=!0,B.css({position:"fixed",bottom:T.bottomHeight,visibility:"",width:V-2*U}),z.css({position:"fixed",bottom:0,width:V})):(!S&&J||(J||G)&&x+T.windowHeight>p+q+T.bottomHeight+T.statusBarHeight-U)&&(J=!1,B.attr("style",S?"":"visibility: hidden;"),z.attr("style",""))):G&&(s.css({position:"absolute",top:0,width:V}),H&&A.length&&A.css({position:"absolute",top:0,width:V-2*U}),f.css({position:"absolute",top:T.menuBarHeight,width:V-2*U-(H?0:f.outerWidth()-f.width())}),B.attr("style",S?"":"visibility: hidden;"),z.attr("style","")),D.width()<300&&T.windowWidth>600&&e.height()>C.height()+R+120&&T.windowHeightT.windowHeight||K||L?R>=x+O?(C.attr("style",""),K=L=!1):x>M?K?(K=!1,j=C.offset().top-T.adminBarHeight,k=g.offset().top,kx&&(L?(L=!1,j=C.offset().top-P,k=g.offset().top,k=x+O&&(K=!0,C.css({position:"fixed",top:O,bottom:""}))):(x>=R-O?C.css({position:"fixed",top:O}):C.attr("style",""),K=L=!1),M=x):(C.attr("style",""),K=L=!1),G&&(r.css({paddingTop:T.toolsHeight}),H?u.css({paddingTop:T.visualTopHeight+T.menuBarHeight}):w.css({marginTop:T.textTopHeight})))}}function j(){h(),i()}function k(a){for(var b=1;6>b;b++)setTimeout(a,500*b)}function l(){clearTimeout(p),p=setTimeout(i,100)}function m(){a.pageYOffset&&a.pageYOffset>N&&a.scrollTo(a.pageXOffset,0),q.addClass("wp-editor-expand"),d.on("scroll.editor-expand resize.editor-expand",function(a){i(a.type),l()}),e.on("wp-collapse-menu.editor-expand postboxes-columnchange.editor-expand editor-classchange.editor-expand",i).on("postbox-toggled.editor-expand postbox-moved.editor-expand",function(){!K&&!L&&a.pageYOffset>O&&(L=!0,a.scrollBy(0,-1),i(),a.scrollBy(0,1)),i()}).on("wp-window-resized.editor-expand",function(){o&&!o.isHidden()?o.execCommand("wpAutoResize"):h()}),w.on("focus.editor-expand input.editor-expand propertychange.editor-expand",h),G(),F&&F.pubsub.subscribe("hidden",j),o&&(o.settings.wp_autoresize_on=!0,o.execCommand("wpAutoResizeOn"),o.isHidden()||o.execCommand("wpAutoResize")),o&&!o.isHidden()||h(),i(),e.trigger("editor-expand-on")}function n(){var c=parseInt(a.getUserSetting("ed_size",300),10);50>c?c=50:c>5e3&&(c=5e3),a.pageYOffset&&a.pageYOffset>N&&a.scrollTo(a.pageXOffset,0),q.removeClass("wp-editor-expand"),d.off(".editor-expand"),e.off(".editor-expand"),w.off(".editor-expand"),H(),F&&F.pubsub.unsubscribe("hidden",j),b.each([t,v,s,A,z,B,r,u,w,C],function(a,b){b&&b.attr("style","")}),I=J=K=L=!1,o&&(o.settings.wp_autoresize_on=!1,o.execCommand("wpAutoResizeOff"),o.isHidden()||(w.hide(),c&&o.theme.resizeTo(null,c))),c&&w.height(c),e.trigger("editor-expand-off")}var o,p,q=b("#postdivrich"),r=b("#wp-content-wrap"),s=b("#wp-content-editor-tools"),t=b(),u=b(),v=b("#ed_toolbar"),w=b("#content"),x=w[0],y=0,z=b("#post-status-info"),A=b(),B=b(),C=b("#side-sortables"),D=b("#postbox-container-1"),E=b("#post-body"),F=a.wp.editor&&a.wp.editor.fullscreen,G=function(){},H=function(){},I=!1,J=!1,K=!1,L=!1,M=0,N=130,O=56,P=20,Q=300,R=r.hasClass("tmce-active")?"tinymce":"html",S=!!parseInt(a.getUserSetting("hidetb"),10),T={windowHeight:0,windowWidth:0,adminBarHeight:0,toolsHeight:0,menuBarHeight:0,visualTopHeight:0,textTopHeight:0,bottomHeight:0,statusBarHeight:0,sideSortablesHeight:0};e.on("tinymce-editor-init.editor-expand",function(c,e){function f(){var a,b,c,d=e.selection.getNode();if(e.wp&&e.wp.getView&&(b=e.wp.getView(d)))c=b.getBoundingClientRect();else{a=e.selection.getRng();try{c=a.getClientRects()[0]}catch(f){}c||(c=d.getBoundingClientRect())}return c.height?c:!1}function g(a){var b=a.keyCode;47>=b&&b!==s.SPACEBAR&&b!==s.ENTER&&b!==s.DELETE&&b!==s.BACKSPACE&&b!==s.UP&&b!==s.LEFT&&b!==s.DOWN&&b!==s.UP||b>=91&&93>=b||b>=112&&123>=b||144===b||145===b||j(b)}function j(b){var c,d,g,h,i=f(),j=50;i&&(c=i.top+e.iframeElement.getBoundingClientRect().top,d=c+i.height,c-=j,d+=j,g=T.adminBarHeight+T.toolsHeight+T.menuBarHeight+T.visualTopHeight,h=T.windowHeight-(S?T.bottomHeight+T.statusBarHeight:0),h-gc&&(b===s.UP||b===s.LEFT||b===s.BACKSPACE)?a.scrollTo(a.pageXOffset,c+a.pageYOffset-g):d>h&&a.scrollTo(a.pageXOffset,d+a.pageYOffset-h)))}function l(a){a.state||i()}function m(){d.on("scroll.mce-float-panels",v),setTimeout(function(){e.execCommand("wpAutoResize"),i()},300)}function n(){d.off("scroll.mce-float-panels"),setTimeout(function(){var b=r.offset().top;a.pageYOffset>b&&a.scrollTo(a.pageXOffset,b-T.adminBarHeight),h(),i()},100),i()}function p(){S=!S}var s=a.tinymce.util.VK,v=_.debounce(function(){!b(".mce-floatpanel:hover").length&&a.tinymce.ui.FloatPanel.hideAll(),b(".mce-tooltip").hide()},1e3,!0);"content"===e.id&&(o=e,e.settings.autoresize_min_height=Q,t=r.find(".mce-toolbar-grp"),u=r.find(".mce-edit-area"),B=r.find(".mce-statusbar"),A=r.find(".mce-menubar"),G=function(){e.on("keyup",g),e.on("show",m),e.on("hide",n),e.on("wp-toolbar-toggle",p),e.on("setcontent wp-autoresize wp-toolbar-toggle",i),e.on("undo redo",j),e.on("FullscreenStateChanged",l),d.off("scroll.mce-float-panels").on("scroll.mce-float-panels",v)},H=function(){e.off("keyup",g),e.off("show",m),e.off("hide",n),e.off("wp-toolbar-toggle",p),e.off("setcontent wp-autoresize wp-toolbar-toggle",i),e.off("undo redo",j),e.off("FullscreenStateChanged",l),d.off("scroll.mce-float-panels")},q.hasClass("wp-editor-expand")&&(G(),k(i)))}),q.hasClass("wp-editor-expand")&&(m(),r.hasClass("html-active")&&k(function(){i(),h()})),b("#adv-settings .editor-expand").show(),b("#editor-expand-toggle").on("change.editor-expand",function(){b(this).prop("checked")?(m(),a.setUserSetting("editor_expand","on")):(n(),a.setUserSetting("editor_expand","off"))}),a.editorExpand={on:m,off:n}}),b(function(){function c(){z=J.offset(),z.right=z.left+J.outerWidth(),z.bottom=z.top+J.outerHeight()}function h(){S||(S=!0,e.trigger("dfw-activate"),L.on("keydown.focus-shortcut",v))}function i(){S&&(l(),S=!1,e.trigger("dfw-deactivate"),L.off("keydown.focus-shortcut"))}function j(){return S}function k(){!T&&S&&(T=!0,L.on("keydown.focus",o),K.add(L).on("blur.focus",q),o(),a.setUserSetting("post_dfw","on"),e.trigger("dfw-on"))}function l(){T&&(T=!1,K.add(L).off(".focus"),p(),J.off(".focus"),a.setUserSetting("post_dfw","off"),e.trigger("dfw-off"))}function m(){T?l():k()}function n(){return T}function o(b){var e,f=b&&b.keyCode;return a.navigator.platform&&(e=a.navigator.platform.indexOf("Mac")>-1),27===f||87===f&&b.altKey&&(!e&&b.shiftKey||e&&b.ctrlKey)?void p(b):void(b&&(b.metaKey||b.ctrlKey&&!b.altKey||b.altKey&&b.shiftKey||f&&(47>=f&&8!==f&&13!==f&&32!==f&&46!==f||f>=91&&93>=f||f>=112&&135>=f||f>=144&&150>=f||f>=224))||(w||(w=!0,clearTimeout(F),F=setTimeout(function(){M.show()},600),J.css("z-index",9998),M.on("mouseenter.focus",function(){c(),d.on("scroll.focus",function(){var b=a.pageYOffset;D&&C&&D!==b&&(Cz.bottom+W)&&p(),D=b})}).on("mouseleave.focus",function(){A=B=null,U=V=0,d.off("scroll.focus")}).on("mousemove.focus",function(b){var c=b.clientX,d=b.clientY,e=a.pageYOffset,f=a.pageXOffset;if(A&&B&&(c!==A||d!==B))if(B>=d&&d=B&&d>z.bottom-e||A>=c&&c=A&&c>z.right-f){if(U+=Math.abs(A-c),V+=Math.abs(B-d),(d<=z.top-W-e||d>=z.bottom+W-e||c<=z.left-W-f||c>=z.right+W-f)&&(U>10||V>10))return p(),A=B=null,void(U=V=0)}else U=V=0;A=c,B=d}).on("touchstart.focus",function(a){a.preventDefault(),p()}),J.off("mouseenter.focus"),E&&(clearTimeout(E),E=null),H.addClass("focus-on").removeClass("focus-off")),r(),t()))}function p(a){w&&(w=!1,clearTimeout(F),F=setTimeout(function(){M.hide()},200),J.css("z-index",""),M.off("mouseenter.focus mouseleave.focus mousemove.focus touchstart.focus"),"undefined"==typeof a&&J.on("mouseenter.focus",function(){(b.contains(J.get(0),document.activeElement)||G)&&o()}),E=setTimeout(function(){E=null,J.off("mouseenter.focus")},1e3),H.addClass("focus-off").removeClass("focus-on")),s(),u()}function q(){setTimeout(function(){function a(a){return b.contains(a.get(0),document.activeElement)}var c=document.activeElement.compareDocumentPosition(J.get(0));2!==c&&4!==c||!(a(P)||a(I)||a(g))||p()},0)}function r(){!x&&w&&(x=!0,f.on("mouseenter.focus",function(){f.addClass("focus-off")}).on("mouseleave.focus",function(){f.removeClass("focus-off")}))}function s(){x&&(x=!1,f.off(".focus"))}function t(){y||!w||N.find(":focus").length||(y=!0,N.stop().fadeTo("fast",.3).on("mouseenter.focus",u).off("mouseleave.focus"),O.on("focus.focus",u).off("blur.focus"))}function u(){y&&(y=!1,N.stop().fadeTo("fast",1).on("mouseleave.focus",t).off("mouseenter.focus"),O.on("blur.focus",t).off("focus.focus"))}function v(a){a.altKey&&a.shiftKey&&87===a.keyCode&&m()}var w,x,y,z,A,B,C,D,E,F,G,H=b(document.body),I=b("#wpcontent"),J=b("#post-body-content"),K=b("#title"),L=b("#content"),M=b(document.createElement("DIV")),N=b("#edit-slug-box"),O=N.find("a").add(N.find("button")).add(N.find("input")),P=b("#adminmenuwrap"),Q=b(),R=b(),S="on"===a.getUserSetting("editor_expand","on"),T=S?"on"===a.getUserSetting("post_dfw"):!1,U=0,V=0,W=20;H.append(M),M.css({display:"none",position:"fixed",top:f.height(),right:0,bottom:0,left:0,"z-index":9997}),J.css({position:"relative"}),d.on("mousemove.focus",function(a){C=a.pageY}),b("#postdivrich").hasClass("wp-editor-expand")&&L.on("keydown.focus-shortcut",v),e.on("tinymce-editor-setup.focus",function(a,b){b.addButton("dfw",{active:T,classes:"wp-dfw btn widget",disabled:!S,onclick:m,onPostRender:function(){var a=this;e.on("dfw-activate.focus",function(){a.disabled(!1)}).on("dfw-deactivate.focus",function(){a.disabled(!0)}).on("dfw-on.focus",function(){a.active(!0)}).on("dfw-off.focus",function(){a.active(!1)})},tooltip:"Distraction-free writing mode",shortcut:"Alt+Shift+W"}),b.addCommand("wpToggleDFW",m),b.addShortcut("access+w","","wpToggleDFW")}),e.on("tinymce-editor-init.focus",function(a,d){function f(){G=!0}function g(){G=!1}var h,i;"content"===d.id&&(Q=b(d.getWin()),R=b(d.getContentAreaContainer()).find("iframe"),h=function(){d.on("keydown",o),d.on("blur",q),d.on("focus",f),d.on("blur",g),d.on("wp-autoresize",c)},i=function(){d.off("keydown",o),d.off("blur",q),d.off("focus",f),d.off("blur",g),d.off("wp-autoresize",c)},T&&h(),e.on("dfw-on.focus",h).on("dfw-off.focus",i),d.on("click",function(a){a.target===d.getDoc().documentElement&&d.focus()}))}),e.on("quicktags-init",function(a,c){var d;c.settings.buttons&&-1!==(","+c.settings.buttons+",").indexOf(",dfw,")&&(d=b("#"+c.name+"_dfw"),b(document).on("dfw-activate",function(){d.prop("disabled",!1)}).on("dfw-deactivate",function(){d.prop("disabled",!0)}).on("dfw-on",function(){d.addClass("active")}).on("dfw-off",function(){d.removeClass("active")}))}),e.on("editor-expand-on.focus",h).on("editor-expand-off.focus",i),T&&(L.on("keydown.focus",o),K.add(L).on("blur.focus",q)),a.wp=a.wp||{},a.wp.editor=a.wp.editor||{},a.wp.editor.dfw={activate:h,deactivate:i,isActive:j,on:k,off:l,toggle:m,isOn:n}})}(window,window.jQuery); \ No newline at end of file diff --git a/wp-admin/js/postbox.js b/wp-admin/js/postbox.js index 15cdecc923..a8222ee296 100644 --- a/wp-admin/js/postbox.js +++ b/wp-admin/js/postbox.js @@ -139,6 +139,7 @@ var postboxes; $(ui.sender).sortable('cancel'); postboxes._mark_area(); + $document.trigger( 'postbox-moved', ui.item ); } }); diff --git a/wp-admin/js/postbox.min.js b/wp-admin/js/postbox.min.js index 0170123c1a..9814badf4b 100644 --- a/wp-admin/js/postbox.min.js +++ b/wp-admin/js/postbox.min.js @@ -1 +1 @@ -var postboxes;!function(a){var b=a(document);postboxes={handle_click:function(){var c,d=a(this),e=d.parent(".postbox"),f=e.attr("id");"dashboard_browser_nag"!==f&&(e.toggleClass("closed"),c=!e.hasClass("closed"),d.hasClass("handlediv")?d.attr("aria-expanded",c):d.closest(".postbox").find("button.handlediv").attr("aria-expanded",c),"press-this"!==postboxes.page&&postboxes.save_state(postboxes.page),f&&(!e.hasClass("closed")&&a.isFunction(postboxes.pbshow)?postboxes.pbshow(f):e.hasClass("closed")&&a.isFunction(postboxes.pbhide)&&postboxes.pbhide(f)),b.trigger("postbox-toggled",e))},add_postbox_toggles:function(c,d){var e=a(".postbox .hndle, .postbox .handlediv");this.page=c,this.init(c,d),e.on("click.postboxes",this.handle_click),a(".postbox .hndle a").click(function(a){a.stopPropagation()}),a(".postbox a.dismiss").on("click.postboxes",function(b){var c=a(this).parents(".postbox").attr("id")+"-hide";b.preventDefault(),a("#"+c).prop("checked",!1).triggerHandler("click")}),a(".hide-postbox-tog").bind("click.postboxes",function(){var d=a(this),e=d.val(),f=a("#"+e);d.prop("checked")?(f.show(),a.isFunction(postboxes.pbshow)&&postboxes.pbshow(e)):(f.hide(),a.isFunction(postboxes.pbhide)&&postboxes.pbhide(e)),postboxes.save_state(c),postboxes._mark_area(),b.trigger("postbox-toggled",f)}),a('.columns-prefs input[type="radio"]').bind("click.postboxes",function(){var b=parseInt(a(this).val(),10);b&&(postboxes._pb_edit(b),postboxes.save_order(c))})},init:function(b,c){var d=a(document.body).hasClass("mobile"),e=a(".postbox .handlediv");a.extend(this,c||{}),a("#wpbody-content").css("overflow","hidden"),a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",delay:d?200:0,distance:2,tolerance:"pointer",forcePlaceholderSize:!0,helper:function(a,b){return b.clone().find(":input").attr("name",function(a,b){return"sort_"+parseInt(1e5*Math.random(),10).toString()+"_"+b}).end()},opacity:.65,stop:function(){var c=a(this);return c.find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id?void c.sortable("cancel"):void postboxes.save_order(b)},receive:function(b,c){"dashboard_browser_nag"==c.item[0].id&&a(c.sender).sortable("cancel"),postboxes._mark_area()}}),d&&(a(document.body).bind("orientationchange.postboxes",function(){postboxes._pb_change()}),this._pb_change()),this._mark_area(),e.each(function(){var b=a(this);b.attr("aria-expanded",!b.parent(".postbox").hasClass("closed"))})},save_state:function(b){var c,d;"nav-menus"!==b&&(c=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),d=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(","),a.post(ajaxurl,{action:"closed-postboxes",closed:c,hidden:d,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:b}))},save_order:function(b){var c,d=a(".columns-prefs input:checked").val()||0;c={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:b},a(".meta-box-sortables").each(function(){c["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")}),a.post(ajaxurl,c)},_mark_area:function(){var b=a("div.postbox:visible").length,c=a("#post-body #side-sortables");a("#dashboard-widgets .meta-box-sortables:visible").each(function(){var c=a(this);1==b||c.children(".postbox:visible").length?c.removeClass("empty-container"):(c.addClass("empty-container"),c.attr("data-emptyString",postBoxL10n.postBoxEmptyString))}),c.length&&(c.children(".postbox:visible").length?c.removeClass("empty-container"):"280px"==a("#postbox-container-1").css("width")&&c.addClass("empty-container"))},_pb_edit:function(b){var c=a(".metabox-holder").get(0);c&&(c.className=c.className.replace(/columns-\d+/,"columns-"+b)),a(document).trigger("postboxes-columnchange")},_pb_change:function(){var b=a('label.columns-prefs-1 input[type="radio"]');switch(window.orientation){case 90:case-90:b.length&&b.is(":checked")||this._pb_edit(2);break;case 0:case 180:a("#poststuff").length?this._pb_edit(1):b.length&&b.is(":checked")||this._pb_edit(2)}},pbshow:!1,pbhide:!1}}(jQuery); \ No newline at end of file +var postboxes;!function(a){var b=a(document);postboxes={handle_click:function(){var c,d=a(this),e=d.parent(".postbox"),f=e.attr("id");"dashboard_browser_nag"!==f&&(e.toggleClass("closed"),c=!e.hasClass("closed"),d.hasClass("handlediv")?d.attr("aria-expanded",c):d.closest(".postbox").find("button.handlediv").attr("aria-expanded",c),"press-this"!==postboxes.page&&postboxes.save_state(postboxes.page),f&&(!e.hasClass("closed")&&a.isFunction(postboxes.pbshow)?postboxes.pbshow(f):e.hasClass("closed")&&a.isFunction(postboxes.pbhide)&&postboxes.pbhide(f)),b.trigger("postbox-toggled",e))},add_postbox_toggles:function(c,d){var e=a(".postbox .hndle, .postbox .handlediv");this.page=c,this.init(c,d),e.on("click.postboxes",this.handle_click),a(".postbox .hndle a").click(function(a){a.stopPropagation()}),a(".postbox a.dismiss").on("click.postboxes",function(b){var c=a(this).parents(".postbox").attr("id")+"-hide";b.preventDefault(),a("#"+c).prop("checked",!1).triggerHandler("click")}),a(".hide-postbox-tog").bind("click.postboxes",function(){var d=a(this),e=d.val(),f=a("#"+e);d.prop("checked")?(f.show(),a.isFunction(postboxes.pbshow)&&postboxes.pbshow(e)):(f.hide(),a.isFunction(postboxes.pbhide)&&postboxes.pbhide(e)),postboxes.save_state(c),postboxes._mark_area(),b.trigger("postbox-toggled",f)}),a('.columns-prefs input[type="radio"]').bind("click.postboxes",function(){var b=parseInt(a(this).val(),10);b&&(postboxes._pb_edit(b),postboxes.save_order(c))})},init:function(c,d){var e=a(document.body).hasClass("mobile"),f=a(".postbox .handlediv");a.extend(this,d||{}),a("#wpbody-content").css("overflow","hidden"),a(".meta-box-sortables").sortable({placeholder:"sortable-placeholder",connectWith:".meta-box-sortables",items:".postbox",handle:".hndle",cursor:"move",delay:e?200:0,distance:2,tolerance:"pointer",forcePlaceholderSize:!0,helper:function(a,b){return b.clone().find(":input").attr("name",function(a,b){return"sort_"+parseInt(1e5*Math.random(),10).toString()+"_"+b}).end()},opacity:.65,stop:function(){var b=a(this);return b.find("#dashboard_browser_nag").is(":visible")&&"dashboard_browser_nag"!=this.firstChild.id?void b.sortable("cancel"):void postboxes.save_order(c)},receive:function(c,d){"dashboard_browser_nag"==d.item[0].id&&a(d.sender).sortable("cancel"),postboxes._mark_area(),b.trigger("postbox-moved",d.item)}}),e&&(a(document.body).bind("orientationchange.postboxes",function(){postboxes._pb_change()}),this._pb_change()),this._mark_area(),f.each(function(){var b=a(this);b.attr("aria-expanded",!b.parent(".postbox").hasClass("closed"))})},save_state:function(b){var c,d;"nav-menus"!==b&&(c=a(".postbox").filter(".closed").map(function(){return this.id}).get().join(","),d=a(".postbox").filter(":hidden").map(function(){return this.id}).get().join(","),a.post(ajaxurl,{action:"closed-postboxes",closed:c,hidden:d,closedpostboxesnonce:jQuery("#closedpostboxesnonce").val(),page:b}))},save_order:function(b){var c,d=a(".columns-prefs input:checked").val()||0;c={action:"meta-box-order",_ajax_nonce:a("#meta-box-order-nonce").val(),page_columns:d,page:b},a(".meta-box-sortables").each(function(){c["order["+this.id.split("-")[0]+"]"]=a(this).sortable("toArray").join(",")}),a.post(ajaxurl,c)},_mark_area:function(){var b=a("div.postbox:visible").length,c=a("#post-body #side-sortables");a("#dashboard-widgets .meta-box-sortables:visible").each(function(){var c=a(this);1==b||c.children(".postbox:visible").length?c.removeClass("empty-container"):(c.addClass("empty-container"),c.attr("data-emptyString",postBoxL10n.postBoxEmptyString))}),c.length&&(c.children(".postbox:visible").length?c.removeClass("empty-container"):"280px"==a("#postbox-container-1").css("width")&&c.addClass("empty-container"))},_pb_edit:function(b){var c=a(".metabox-holder").get(0);c&&(c.className=c.className.replace(/columns-\d+/,"columns-"+b)),a(document).trigger("postboxes-columnchange")},_pb_change:function(){var b=a('label.columns-prefs-1 input[type="radio"]');switch(window.orientation){case 90:case-90:b.length&&b.is(":checked")||this._pb_edit(2);break;case 0:case 180:a("#poststuff").length?this._pb_edit(1):b.length&&b.is(":checked")||this._pb_edit(2)}},pbshow:!1,pbhide:!1}}(jQuery); \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index 7d7d92a0e9..385f54ad3e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37658'; +$wp_version = '4.6-alpha-37659'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.