/** * 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.4.2 (2020-08-17) */ !function(p){"use strict";var s=function(e){var t=e;return{get:function(){return t},set:function(e){t=e}}},e=tinymce.util.Tools.resolve("tinymce.PluginManager"),u=function(){return(u=Object.assign||function(e){for(var t,n=1,l=arguments.length;n"),(n=o.getAll("title")[0])&&n.firstChild&&(a.title=n.firstChild.value),y.each(o.getAll("meta"),function(e){var t,n=e.attr("name"),l=e.attr("http-equiv");n?a[n.toLowerCase()]=e.attr("content"):"Content-Type"===l&&(t=/charset\s*=\s*(.*)\s*/gi.exec(e.attr("content")))&&(a.docencoding=t[1])}),(n=o.getAll("html")[0])&&(a.langcode=s(n,"lang")||s(n,"xml:lang")),a.stylesheets=[],y.each(o.getAll("link"),function(e){"stylesheet"===e.attr("rel")&&a.stylesheets.push(e.attr("href"))}),(n=o.getAll("body")[0])&&(a.langdir=s(n,"dir"),a.style=s(n,"style"),a.visited_color=s(n,"vlink"),a.link_color=s(n,"link"),a.active_color=s(n,"alink")),a);function s(e,t){return e.attr(t)||""}var d=u(u({},{title:"",keywords:"",description:"",robots:"",author:"",docencoding:""}),c);l.windowManager.open({title:"Metadata and Document Properties",size:"normal",body:{type:"panel",items:[{name:"title",type:"input",label:"Title"},{name:"keywords",type:"input",label:"Keywords"},{name:"description",type:"input",label:"Description"},{name:"robots",type:"input",label:"Robots"},{name:"author",type:"input",label:"Author"},{name:"docencoding",type:"input",label:"Encoding"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:d,onSubmit:function(e){var t=e.getData(),n=function(e,r,t){var n,o,l,i=e.dom;function a(e,t,n){e.attr(t,n||undefined)}function c(e){n.firstChild?n.insert(e,n.firstChild):n.append(e)}var s=_(t);(n=s.getAll("head")[0])||(o=s.getAll("html")[0],n=new m("head",1),o.firstChild?o.insert(n,o.firstChild,!0):o.append(n)),o=s.firstChild,r.xml_pi?(l='version="1.0"',r.docencoding&&(l+=' encoding="'+r.docencoding+'"'),7!==o.type&&(o=new m("xml",7),s.insert(o,s.firstChild,!0)),o.value=l):o&&7===o.type&&o.remove(),o=s.getAll("#doctype")[0],r.doctype?(o||(o=new m("#doctype",10),r.xml_pi?s.insert(o,s.firstChild):c(o)),o.value=r.doctype.substring(9,r.doctype.length-1)):o&&o.remove(),o=null,y.each(s.getAll("meta"),function(e){"Content-Type"===e.attr("http-equiv")&&(o=e)}),r.docencoding?(o||((o=new m("meta",1)).attr("http-equiv","Content-Type"),o.shortEnded=!0,c(o)),o.attr("content","text/html; charset="+r.docencoding)):o&&o.remove(),o=s.getAll("title")[0],r.title?(o?o.empty():c(o=new m("title",1)),o.append(new m("#text",3)).value=r.title):o&&o.remove(),y.each("keywords,description,author,copyright,robots".split(","),function(e){var t,n,l=s.getAll("meta"),i=r[e];for(t=0;t"))}(l,y.extend(c,t),i.get());i.set(n),e.close()}})},b=y.each,x=function(e){return e.replace(/<\/?[A-Z]+/g,function(e){return e.toLowerCase()})},k=function(e,t,n,l){var i,r,o,a,c,s="",d=e.dom;if(!l.selection&&(a=e.getParam("protect"),c=l.content,y.each(a,function(e){c=c.replace(e,function(e){return"\x3c!--mce:protected "+escape(e)+"--\x3e"})}),o=c,!("raw"===l.format&&t.get()||l.source_view&&h(e)))){0!==o.length||l.source_view||(o=y.trim(t.get())+"\n"+y.trim(o)+"\n"+y.trim(n.get())),-1!==(i=(o=o.replace(/<(\/?)BODY/gi,"<$1body")).indexOf("",i),t.set(x(o.substring(0,i+1))),-1===(r=o.indexOf("\n"));var u=_(t.get());b(u.getAll("style"),function(e){e.firstChild&&(s+=e.firstChild.value)});var m=u.getAll("body")[0];m&&d.setAttribs(e.getBody(),{style:m.attr("style")||"",dir:m.attr("dir")||"",vLink:m.attr("vlink")||"",link:m.attr("link")||"",aLink:m.attr("alink")||""}),d.remove("fullpage_styles");var f=e.getDoc().getElementsByTagName("head")[0];if(s)d.add(f,"style",{id:"fullpage_styles"}).appendChild(p.document.createTextNode(s));var g={};y.each(f.getElementsByTagName("link"),function(e){"stylesheet"===e.rel&&e.getAttribute("data-mce-fullpage")&&(g[e.href]=e)}),y.each(u.getAll("link"),function(e){var t=e.attr("href");if(!t)return!0;g[t]||"stylesheet"!==e.attr("rel")||d.add(f,"link",{rel:"stylesheet",text:"text/css",href:t,"data-mce-fullpage":"1"}),delete g[t]}),y.each(g,function(e){e.parentNode.removeChild(e)})}},C=function(e){var t,n="",l="";if(e.getParam("fullpage_default_xml_pi")){var i=r(e);n+='\n'}return n+=e.getParam("fullpage_default_doctype",""),n+="\n\n\n",(t=e.getParam("fullpage_default_title"))&&(n+=""+t+"\n"),(t=r(e))&&(n+='\n'),(t=g(e))&&(l+="font-family: "+t+";"),(t=v(e))&&(l+="font-size: "+t+";"),(t=e.getParam("fullpage_default_text_color"))&&(l+="color: "+t+";"),n+="\n\n"},A=function(e,t,n,l){l.selection||l.source_view&&h(e)||(l.content=(y.trim(t)+"\n"+y.trim(l.content)+"\n"+y.trim(n)).replace(//g,function(e,t){return unescape(t)}))};!function n(){e.add("fullpage",function(e){var t,n,l,i,r,o,a=s(""),c=s("");n=a,(t=e).addCommand("mceFullPageProperties",function(){d(t,n)}),(l=e).ui.registry.addButton("fullpage",{tooltip:"Metadata and document properties",icon:"document-properties",onAction:function(){l.execCommand("mceFullPageProperties")}}),l.ui.registry.addMenuItem("fullpage",{text:"Metadata and document properties",icon:"document-properties",onAction:function(){l.execCommand("mceFullPageProperties")}}),r=a,o=c,(i=e).on("BeforeSetContent",function(e){k(i,r,o,e)}),i.on("GetContent",function(e){A(i,r.get(),o.get(),e)})})}()}(window);