WordPress/wp-admin/js/editor-expand.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

!function(L,V){"use strict";var j=V(L),I=V(document),M=V("#wpadminbar"),N=V("#wpfooter");V(function(){var g,e,u=V("#postdivrich"),h=V("#wp-content-wrap"),m=V("#wp-content-editor-tools"),w=V(),H=V(),b=V("#ed_toolbar"),v=V("#content"),x=V('<div id="content-textarea-clone" class="wp-exclude-emoji"></div>'),y=V("#post-status-info"),C=V(),T=V(),B=V("#side-sortables"),O=V("#postbox-container-1"),S=V("#post-body"),z=L.wp.editor&&L.wp.editor.fullscreen,r=function(){},l=function(){},E=!1,k=!1,A=!1,R=!1,K=0,W=56,Y=20,U=300,o=h.hasClass("tmce-active")?"tinymce":"html",P=!!parseInt(L.getUserSetting("hidetb"),10),D={windowHeight:0,windowWidth:0,adminBarHeight:0,toolsHeight:0,menuBarHeight:0,visualTopHeight:0,textTopHeight:0,bottomHeight:0,statusBarHeight:0,sideSortablesHeight:0};function t(t){var e,o,i,n=jQuery.ui.keyCode,s=t.keyCode,f=document.createRange(),a=v[0].selectionStart,d=v[0].selectionEnd,c=x[0].firstChild;if(!a||!d||a===d){try{f.setStart(c,a),f.setEnd(c,d+1)}catch(t){}(i=f.getBoundingClientRect()).height&&(o=(e=i.top-10)+i.height+10,t=D.adminBarHeight+D.toolsHeight+D.textTopHeight,i=D.windowHeight-D.bottomHeight,e<t&&(s===n.UP||s===n.LEFT||s===n.BACKSPACE)?L.scrollTo(L.pageXOffset,e+L.pageYOffset-t):i<o&&L.scrollTo(L.pageXOffset,o+L.pageYOffset-i))}}function X(){var t,e;g&&!g.isHidden()||!g&&"tinymce"===o||(t=v.height(),x.width(v.width()-22),x.text(v.val()+"&nbsp;"),(e=(e=x.height())<U?U:e)!==t&&(v.height(e),p()))}function p(t){var e,o,i,n,s,f,a,d,c,u,r,l,p;z&&z.settings.visible||(e=j.scrollTop(),o="scroll"!==(r=t&&t.type),i=g&&!g.isHidden(),n=U,s=S.offset().top,f=h.width(),!o&&D.windowHeight||(p=j.width(),(D={windowHeight:j.height(),windowWidth:p,adminBarHeight:600<p?M.outerHeight():0,toolsHeight:m.outerHeight()||0,menuBarHeight:C.outerHeight()||0,visualTopHeight:w.outerHeight()||0,textTopHeight:b.outerHeight()||0,bottomHeight:y.outerHeight()||0,statusBarHeight:T.outerHeight()||0,sideSortablesHeight:B.height()||0}).menuBarHeight<3&&(D.menuBarHeight=0)),i||"resize"!==r||X(),u=i?(a=w,l=H,D.visualTopHeight):(a=b,l=v,D.textTopHeight),(i||a.length)&&(p=a.parent().offset().top,r=l.offset().top,l=l.outerHeight(),(i?U+u:U+20)+5<l?((!E||o)&&e>=p-D.toolsHeight-D.adminBarHeight&&e<=p-D.toolsHeight-D.adminBarHeight+l-n?(E=!0,m.css({position:"fixed",top:D.adminBarHeight,width:f}),i&&C.length&&C.css({position:"fixed",top:D.adminBarHeight+D.toolsHeight,width:f-2-(i?0:a.outerWidth()-a.width())}),a.css({position:"fixed",top:D.adminBarHeight+D.toolsHeight+D.menuBarHeight,width:f-2-(i?0:a.outerWidth()-a.width())})):(E||o)&&(e<=p-D.toolsHeight-D.adminBarHeight?(E=!1,m.css({position:"absolute",top:0,width:f}),i&&C.length&&C.css({position:"absolute",top:0,width:f-2}),a.css({position:"absolute",top:D.menuBarHeight,width:f-2-(i?0:a.outerWidth()-a.width())})):e>=p-D.toolsHeight-D.adminBarHeight+l-n&&(E=!1,m.css({position:"absolute",top:l-n,width:f}),i&&C.length&&C.css({position:"absolute",top:l-n,width:f-2}),a.css({position:"absolute",top:l-n+D.menuBarHeight,width:f-2-(i?0:a.outerWidth()-a.width())}))),(!k||o&&P)&&e+D.windowHeight<=r+l+D.bottomHeight+D.statusBarHeight+1?t&&0<t.deltaHeight&&t.deltaHeight<100?L.scrollBy(0,t.deltaHeight):P&&(k=!0,T.css({position:"fixed",bottom:D.bottomHeight,visibility:"",width:f-2}),y.css({position:"fixed",bottom:0,width:f})):(!P&&k||(k||o)&&e+D.windowHeight>r+l+D.bottomHeight+D.statusBarHeight-1)&&(k=!1,T.attr("style",P?"":"visibility: hidden;"),y.attr("style",""))):o&&(m.css({position:"absolute",top:0,width:f}),i&&C.length&&C.css({position:"absolute",top:0,width:f-2}),a.css({position:"absolute",top:D.menuBarHeight,width:f-2-(i?0:a.outerWidth()-a.width())}),T.attr("style",P?"":"visibility: hidden;"),y.attr("style","")),O.width()<300&&600<D.windowWidth&&I.height()>B.height()+s+120&&D.windowHeight<l?(D.sideSortablesHeight+W+Y>D.windowHeight||A||R?e+W<=s?(B.attr("style",""),A=R=!1):K<e?A?(A=!1,d=B.offset().top-D.adminBarHeight,(c=N.offset().top)<d+D.sideSortablesHeight+Y&&(d=c-D.sideSortablesHeight-12),B.css({position:"absolute",top:d,bottom:""})):!R&&D.sideSortablesHeight+B.offset().top+Y<e+D.windowHeight&&(R=!0,B