/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.0.3 (2019-03-19) */ !function(m){"use strict";var o,i=function(t){var e=t,n=function(){return e};return{get:n,set:function(t){e=t},clone:function(){return i(n())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),g=tinymce.util.Tools.resolve("tinymce.util.Tools"),e=tinymce.util.Tools.resolve("tinymce.html.DomParser"),f=tinymce.util.Tools.resolve("tinymce.html.Node"),p=tinymce.util.Tools.resolve("tinymce.html.Serializer"),h=function(t){return t.getParam("fullpage_hide_in_source_view")},l=function(t){return t.getParam("fullpage_default_xml_pi")},a=function(t){return t.getParam("fullpage_default_encoding")},c=function(t){return t.getParam("fullpage_default_font_family")},s=function(t){return t.getParam("fullpage_default_font_size")},u=function(t){return t.getParam("fullpage_default_text_color")},d=function(t){return t.getParam("fullpage_default_title")},y=function(t){return t.getParam("fullpage_default_doctype","")},v=function(t){return e({validate:!1,root_name:"#document"}).parse(t)},_=v,n=function(t,e){var n,i,r=v(e),l={};function o(t,e){return t.attr(e)||""}return l.fontface=c(t),l.fontsize=s(t),7===(n=r.firstChild).type&&(l.xml_pi=!0,(i=/encoding="([^"]+)"/.exec(n.value))&&(l.docencoding=i[1])),(n=r.getAll("#doctype")[0])&&(l.doctype=""),(n=r.getAll("title")[0])&&n.firstChild&&(l.title=n.firstChild.value),g.each(r.getAll("meta"),function(t){var e,n=t.attr("name"),i=t.attr("http-equiv");n?l[n.toLowerCase()]=t.attr("content"):"Content-Type"===i&&(e=/charset\s*=\s*(.*)\s*/gi.exec(t.attr("content")))&&(l.docencoding=e[1])}),(n=r.getAll("html")[0])&&(l.langcode=o(n,"lang")||o(n,"xml:lang")),l.stylesheets=[],g.each(r.getAll("link"),function(t){"stylesheet"===t.attr("rel")&&l.stylesheets.push(t.attr("href"))}),(n=r.getAll("body")[0])&&(l.langdir=o(n,"dir"),l.style=o(n,"style"),l.visited_color=o(n,"vlink"),l.link_color=o(n,"link"),l.active_color=o(n,"alink")),l},b=function(t,l,e){var o,n,i,a,r,c=t.dom;function s(t,e,n){t.attr(e,n||undefined)}function u(t){n.firstChild?n.insert(t,n.firstChild):n.append(t)}o=v(e),(n=o.getAll("head")[0])||(a=o.getAll("html")[0],n=new f("head",1),a.firstChild?a.insert(n,a.firstChild,!0):a.append(n)),a=o.firstChild,l.xml_pi?(r='version="1.0"',l.docencoding&&(r+=' encoding="'+l.docencoding+'"'),7!==a.type&&(a=new f("xml",7),o.insert(a,o.firstChild,!0)),a.value=r):a&&7===a.type&&a.remove(),a=o.getAll("#doctype")[0],l.doctype?(a||(a=new f("#doctype",10),l.xml_pi?o.insert(a,o.firstChild):u(a)),a.value=l.doctype.substring(9,l.doctype.length-1)):a&&a.remove(),a=null,g.each(o.getAll("meta"),function(t){"Content-Type"===t.attr("http-equiv")&&(a=t)}),l.docencoding?(a||((a=new f("meta",1)).attr("http-equiv","Content-Type"),a.shortEnded=!0,u(a)),a.attr("content","text/html; charset="+l.docencoding)):a&&a.remove(),a=o.getAll("title")[0],l.title?(a?a.empty():u(a=new f("title",1)),a.append(new f("#text",3)).value=l.title):a&&a.remove(),g.each("keywords,description,author,copyright,robots".split(","),function(t){var e,n,i=o.getAll("meta"),r=l[t];for(e=0;e"))},x=Object.prototype.hasOwnProperty,C=(o=function(t,e){return e},function(){for(var t=new Array(arguments.length),e=0;e/g,function(t,e){return unescape(e)})},P=g.each,T=function(t){return t.replace(/<\/?[A-Z]+/g,function(t){return t.toLowerCase()})},O=function(t){var e,n="",i="";if(l(t)){var r=a(t);n+='\n'}return n+=y(t),n+="\n\n\n",(e=d(t))&&(n+=""+e+"\n"),(e=a(t))&&(n+='\n'),(e=c(t))&&(i+="font-family: "+e+";"),(e=s(t))&&(i+="font-size: "+e+";"),(e=u(t))&&(i+="color: "+e+";"),n+="\n\n"},D=function(l,o,a){l.on("BeforeSetContent",function(t){!function(t,e,n,i){var r,l,o,a,c="",s=t.dom;if(!(i.selection||(o=w(t.settings.protect,i.content),"raw"===i.format&&e.get()||i.source_view&&h(t)))){0!==o.length||i.source_view||(o=g.trim(e.get())+"\n"+g.trim(o)+"\n"+g.trim(n.get())),-1!==(r=(o=o.replace(/<(\/?)BODY/gi,"<$1body")).indexOf("",r),e.set(T(o.substring(0,r+1))),-1===(l=o.indexOf("\n")),a=_(e.get()),P(a.getAll("style"),function(t){t.firstChild&&(c+=t.firstChild.value)});var u=a.getAll("body")[0];u&&s.setAttribs(t.getBody(),{style:u.attr("style")||"",dir:u.attr("dir")||"",vLink:u.attr("vlink")||"",link:u.attr("link")||"",aLink:u.attr("alink")||""}),s.remove("fullpage_styles");var d=t.getDoc().getElementsByTagName("head")[0];c&&s.add(d,"style",{id:"fullpage_styles"}).appendChild(m.document.createTextNode(c));var f={};g.each(d.getElementsByTagName("link"),function(t){"stylesheet"===t.rel&&t.getAttribute("data-mce-fullpage")&&(f[t.href]=t)}),g.each(a.getAll("link"),function(t){var e=t.attr("href");if(!e)return!0;f[e]||"stylesheet"!==t.attr("rel")||s.add(d,"link",{rel:"stylesheet",text:"text/css",href:e,"data-mce-fullpage":"1"}),delete f[e]}),g.each(f,function(t){t.parentNode.removeChild(t)})}}(l,o,a,t)}),l.on("GetContent",function(t){var e,n,i,r;e=l,n=o.get(),i=a.get(),(r=t).selection||r.source_view&&h(e)||(r.content=A(g.trim(n)+"\n"+g.trim(r.content)+"\n"+g.trim(i)))})},E=function(t){t.ui.registry.addButton("fullpage",{tooltip:"Metadata and document properties",icon:"document-properties",onAction:function(){t.execCommand("mceFullPageProperties")}}),t.ui.registry.addMenuItem("fullpage",{text:"Metadata and document properties",icon:"document-properties",onAction:function(){t.execCommand("mceFullPageProperties")}})};t.add("fullpage",function(t){var e=i(""),n=i("");k(t,e),E(t),D(t,e,n)}),function z(){}}(window);