2017-10-01 12:33:47 +02:00
|
|
|
window.wp=window.wp||{},function(a,b){function c(){function c(){!x&&window.tinymce&&(x=window.tinymce,y=x.$,y(document).on("click",function(a){var b,c,d=y(a.target);d.hasClass("wp-switch-editor")&&(b=d.attr("data-wp-editor-id"),c=d.hasClass("switch-tmce")?"tmce":"html",e(b,c))}))}function d(a){var b=y(".mce-toolbar-grp",a.getContainer())[0],c=b&&b.clientHeight;return c&&c>10&&c<200?parseInt(c,10):30}function e(b,c){b=b||"content",c=c||"toggle";var e,f,g,h=x.get(b),i=y("#wp-"+b+"-wrap"),j=y("#"+b),k=j[0];if("toggle"===c&&(c=h&&!h.isHidden()?"html":"tmce"),"tmce"===c||"tinymce"===c){if(h&&!h.isHidden())return!1;"undefined"!=typeof window.QTags&&window.QTags.closeAllTags(b),e=parseInt(k.style.height,10)||0,m(j,a),h?(h.show(),!x.Env.iOS&&e&&(f=d(h),e=e-f+14,e>50&&e<5e3&&h.theme.resizeTo(null,e)),n(h)):x.init(window.tinyMCEPreInit.mceInit[b]),i.removeClass("html-active").addClass("tmce-active"),j.attr("aria-hidden",!0),window.setUserSetting("editor","tinymce")}else if("html"===c){if(h&&h.isHidden())return!1;var l=null;h?(x.Env.iOS||(g=h.iframeElement,e=g?parseInt(g.style.height,10):0,e&&(f=d(h),e=e+f-14,e>50&&e<5e3&&(k.style.height=e+"px"))),l=r(h),h.hide(),l&&s(h,l)):j.css({display:"",visibility:""}),i.removeClass("tmce-active").addClass("html-active"),j.attr("aria-hidden",!1),window.setUserSetting("editor","html")}}function f(a,b){var c=a.lastIndexOf("<",b-1),d=a.lastIndexOf(">",b);if(c>d||">"===a.substr(b,1)){var e=a.substr(c),f=e.match(/<\s*(\/)?(\w+)/);if(!f)return null;var g=f[2],h=e.indexOf(">");return{ltPos:c,gtPos:c+h+1,tagType:g,isClosingTag:!!f[1]}}return null}function g(a,b){var c=j(a);return _.find(c,function(a){return b>=a.startIndex&&b<=a.endIndex})}function h(a){var b=a.match(/\[+([\w_-])+/g);return _.uniq(_.map(b,function(a){return a.replace(/^\[+/g,"")}))}function i(a){var c=["caption"];return c.indexOf(a)!==-1||void 0!==b.mce.views.get(a)}function j(a){var c=h(a);if(0===c.length)return[];for(var d,e=b.shortcode.regexp(c.join("|")),f=[];d=e.exec(a);){var g="["===d[1],j=!g&&i(d[2]),k={shortcodeName:d[2],showAsPlainText:g,startIndex:d.index,endIndex:d.index+d[0].length,length:d[0].length,isPreviewable:j};f.push(k)}return f}function k(a,b){return a("<span>").css({display:"inline-block",width:0,overflow:"hidden","line-height":0}).html(b?b:"")}function l(a,b){var c=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],d=b.cursorStart,e=b.cursorEnd,h=f(a,d);h&&(d=c.indexOf(h.tagType)!==-1?h.ltPos:h.gtPos);var i=f(a,e);i&&(e=i.gtPos);var j=g(a,d);j&&j.isPreviewable&&(d=j.startIndex);var k=g(a,e);return k&&k.isPreviewable&&(e=k.endIndex),{cursorStart:d,cursorEnd:e}}function m(a){if(a&&a.length){var b=a[0],c=b.value,d=l(c,{cursorStart:b.selectionStart,cursorEnd:b.selectionEnd}),e=d.cursorStart,f=d.cursorEnd,g=e!==f?"range":"single",h=null,i=k(y,"");if("range"===g){var j=b.value.slice(e,f),m=i.clone().addClass("mce_SELRES_end");h=[j,m[0].outerHTML].join("")}b.value=[b.value.slice(0,e),i.clone().addClass("mce_SELRES_start")[0].outerHTML,h,b.value.slice(f)].join("")}}function n(a){var b=a.$(".mce_SELRES_start"),c=a.$(".mce_SELRES_end");if(b.length)if(a.focus(),c.length){var d=a.getDoc().createRange();d.setStartAfter(b[0]),d.setEndBefore(c[0]),a.selection.setRng(d)}else a.selection.select(b[0]);p(a,b),o(b),o(c)}function o(a){var b=a.parent();a.remove(),!b.is("p")||b.children().length||b.text()||b.remove()}function p(b,c){var e=b.$(c).offset().top,f=b.$(b.getContentAreaContainer()).offset().top,g=a("#wp-content-editor-tools"),h=g.height(),i=g.offset().top,j=d(b),k=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,l=f+e,m=k-(h+j),n=Math.max(l-m/2,i-h);a("html,body").animate({scrollTop:parseInt(n,10)},100)}function q(a){a.content=a.content.replace(/<p>(?:<br ?\/?>|\u00a0|\uFEFF| )*<\/p>/g,"<p> </p>")}function r(a){var b=a.getWin(),c=b.getSelection();if(!(c.rangeCount<=0)){var d="SELRES_"+Math.random(),e=k(a.$,d),f=e.clone().addClass("mce_SELRES_start"),g=e.clone().addClass("mce_SELRES_end"),h=c.getRangeAt(0),i=h.startCont
|