2021-01-20 14:35:18 +01:00
|
|
|
window.wp=window.wp||{},function(g,u){u.editor=u.editor||{},window.switchEditors=new function(){var h,b,t={};function e(){!h&&window.tinymce&&(h=window.tinymce,(b=h.$)(document).on("click",function(e){e=b(e.target);e.hasClass("wp-switch-editor")&&n(e.attr("data-wp-editor-id"),e.hasClass("switch-tmce")?"tmce":"html")}))}function v(e){e=b(".mce-toolbar-grp",e.getContainer())[0],e=e&&e.clientHeight;return e&&10<e&&e<200?parseInt(e,10):30}function n(e,t){e=e||"content",t=t||"toggle";var n,r,i,a,o,c,p,s,d,l,g,u=h.get(e),w=b("#wp-"+e+"-wrap"),f=b("#"+e),m=f[0];if("tmce"===(t="toggle"===t?u&&!u.isHidden()?"html":"tmce":t)||"tinymce"===t){if(u&&!u.isHidden())return!1;void 0!==window.QTags&&window.QTags.closeAllTags(e),n=parseInt(m.style.height,10)||0;!(u?u.getParam("wp_keep_scroll_position"):window.tinyMCEPreInit.mceInit[e]&&window.tinyMCEPreInit.mceInit[e].wp_keep_scroll_position)||(o=f)&&o.length&&(c=o[0],p=function(e,t){var n=t.cursorStart,r=t.cursorEnd,t=x(e,n);t&&(n=-1!==["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"].indexOf(t.tagType)?t.ltPos:t.gtPos);t=x(e,r);t&&(r=t.gtPos);t=E(e,n);t&&!t.showAsPlainText&&(n=t.urlAtStartOfContent?t.endIndex:t.startIndex);e=E(e,r);e&&!e.showAsPlainText&&(r=e.urlAtEndOfContent?e.startIndex:e.endIndex);return{cursorStart:n,cursorEnd:r}}(c.value,{cursorStart:c.selectionStart,cursorEnd:c.selectionEnd}),s=p.cursorStart,d=p.cursorEnd,l=s!==d?"range":"single",g=null,o=y(b,"").attr("data-mce-type","bookmark"),"range"==l&&(p=c.value.slice(s,d),l=o.clone().addClass("mce_SELRES_end"),g=[p,l[0].outerHTML].join("")),c.value=[c.value.slice(0,s),o.clone().addClass("mce_SELRES_start")[0].outerHTML,g,c.value.slice(d)].join("")),u?(u.show(),!h.Env.iOS&&n&&50<(n=n-v(u)+14)&&n<5e3&&u.theme.resizeTo(null,n),u.getParam("wp_keep_scroll_position")&&S(u)):h.init(window.tinyMCEPreInit.mceInit[e]),w.removeClass("html-active").addClass("tmce-active"),f.attr("aria-hidden",!0),window.setUserSetting("editor","tinymce")}else if("html"===t){if(u&&u.isHidden())return!1;u?(h.Env.iOS||(n=(t=u.iframeElement)?parseInt(t.style.height,10):0)&&50<(n=n+v(u)-14)&&n<5e3&&(m.style.height=n+"px"),n=null,u.getParam("wp_keep_scroll_position")&&(n=function(e){var t=e.getWin().getSelection();if(!t||t.rangeCount<1)return;var n="SELRES_"+Math.random(),r=y(e.$,n),i=r.clone().addClass("mce_SELRES_start"),a=r.clone().addClass("mce_SELRES_end"),o=t.getRangeAt(0),c=o.startContainer,p=o.startOffset,r=o.cloneRange();0<e.$(c).parents(".mce-offscreen-selection").length?(c=e.$("[data-mce-selected]")[0],i.attr("data-mce-object-selection","true"),a.attr("data-mce-object-selection","true"),e.$(c).before(i[0]),e.$(c).after(a[0])):(r.collapse(!1),r.insertNode(a[0]),r.setStart(c,p),r.collapse(!0),r.insertNode(i[0]),o.setStartAfter(i[0]),o.setEndBefore(a[0]),t.removeAllRanges(),t.addRange(o));e.on("GetContent",_);o=$(e.getContent());e.off("GetContent",_),i.remove(),a.remove();e=new RegExp('<span[^>]*\\s*class="mce_SELRES_start"[^>]+>\\s*'+n+"[^<]*<\\/span>(\\s*)"),i=new RegExp('(\\s*)<span[^>]*\\s*class="mce_SELRES_end"[^>]+>\\s*'+n+"[^<]*<\\/span>"),a=o.match(e),n=o.match(i);if(!a)return null;e=a.index,o=a[0].length,i=null;n&&(-1!==a[0].indexOf("data-mce-object-selection")&&(o-=a[1].length),a=n.index,-1!==n[0].indexOf("data-mce-object-selection")&&(a-=n[1].length),i=a-o);return{start:e,end:i}}(u)),u.hide(),n&&(u=u,(n=n)&&(r=u.getElement(),i=n.start,a=n.end||n.start,r.focus&&setTimeout(function(){r.setSelectionRange(i,a),r.blur&&r.blur(),r.focus()},100)))):f.css({display:"",visibility:""}),w.removeClass("tmce-active").addClass("html-active"),f.attr("aria-hidden",!1),window.setUserSetting("editor","html")}}function x(e,t){var n=e.lastIndexOf("<",t-1);if(e.lastIndexOf(">",t)<n||">"===e.substr(t,1)){var r=e.substr(n),t=r.match(/<\s*(\/)?(\w+|\!-{2}.*-{2})/);if(!t)return null;e=t[2];return{ltPos:n,gtPos:n+r.indexOf(">")+1,tagType:e,isClosingTag:!!t[1]}}return null}function E(e,t){for(var n=function(e){var t,n=function(e){var t=e.match(/\[+([\w_-])+/g),n=[];if(t)for(var r=0;r<t.length;r++){var
|