2017-11-14 19:22:42 -05: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(a,b){a=a||"content",b=b||"toggle";var c,e,f,g=x.get(a),h=y("#wp-"+a+"-wrap"),i=y("#"+a),j=i[0];if("toggle"===b&&(b=g&&!g.isHidden()?"html":"tmce"),"tmce"===b||"tinymce"===b){if(g&&!g.isHidden())return!1;"undefined"!=typeof window.QTags&&window.QTags.closeAllTags(a),c=parseInt(j.style.height,10)||0;var k=!1;k=g?g.getParam("wp_keep_scroll_position"):window.tinyMCEPreInit.mceInit[a]&&window.tinyMCEPreInit.mceInit[a].wp_keep_scroll_position,k&&m(i),g?(g.show(),!x.Env.iOS&&c&&(e=d(g),c=c-e+14,c>50&&c<5e3&&g.theme.resizeTo(null,c)),g.getParam("wp_keep_scroll_position")&&n(g)):x.init(window.tinyMCEPreInit.mceInit[a]),h.removeClass("html-active").addClass("tmce-active"),i.attr("aria-hidden",!0),window.setUserSetting("editor","tinymce")}else if("html"===b){if(g&&g.isHidden())return!1;if(g){x.Env.iOS||(f=g.iframeElement,c=f?parseInt(f.style.height,10):0,c&&(e=d(g),c=c+e-14,c>50&&c<5e3&&(j.style.height=c+"px")));var l=null;g.getParam("wp_keep_scroll_position")&&(l=r(g)),g.hide(),l&&s(g,l)}else i.css({display:"",visibility:""});h.removeClass("tmce-active").addClass("html-active"),i.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){for(var c=j(a),d=0;d<c.length;d++){var e=c[d];if(b>=e.startIndex&&b<=e.endIndex)return e}}function h(a){var b=a.match(/\[+([\w_-])+/g),c=[];if(b)for(var d=0;d<b.length;d++){var e=b[d].replace(/^\[+/g,"");c.indexOf(e)===-1&&c.push(e)}return c}function i(a){var c=["caption"];return c.indexOf(a)!==-1||void 0!==b.mce.views.get(a)}function j(a){var c,d=h(a);if(0===d.length)return[];for(var e,f=b.shortcode.regexp(d.join("|")),g=[];e=f.exec(a);){var j="["===e[1],k=!j&&i(e[2]);c={shortcodeName:e[2],showAsPlainText:j,startIndex:e.index,endIndex:e.index+e[0].length,length:e[0].length,isPreviewable:k},g.push(c)}for(var l=new RegExp('(^|[\\n\\r][\\n\\r]|<p>)(https?:\\/\\/[^s"]+?)(<\\/p>s*|[\\n\\r][\\n\\r]|$)',"gi");e=l.exec(a);)c={shortcodeName:"url",showAsPlainText:!1,startIndex:e.index,endIndex:e.index+e[0].length,length:e[0].length,isPreviewable:!0,urlAtStartOfContent:""===e[1],urlAtEndOfContent:""===e[3]},g.push(c);return g}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.urlAtStartOfContent?j.endIndex:j.startIndex);var k=g(a,e);return k&&k.isPreviewable&&(e=k.urlAtEndOfContent?k.startIndex: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,"").attr("data-mce-type","bookmark");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").attr("data-mce-bogus",1),c=a.$(".mce_SELRES_end").attr("data-mce-bogus",1);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]);a.getParam("wp_keep_scroll_positi
|