All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template.js.ckeditor.plugins.docprops.dialogs.docprops.js Maven / Gradle / Ivy

There is a newer version: 5.0.6
Show newest version
/*
 Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
 For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.dialog.add("docProps",function(g){function p(a,d){var e=function(){b(this);d(this,this._.parentDialog)},b=function(a){a.removeListener("ok",e);a.removeListener("cancel",b)},f=function(a){a.on("ok",e);a.on("cancel",b)};g.execCommand(a);if(g._.storedDialogs.colordialog)f(g._.storedDialogs.colordialog);else CKEDITOR.on("dialogDefinition",function(b){if(b.data.name==a){var d=b.data.definition;b.removeListener();d.onLoad=CKEDITOR.tools.override(d.onLoad,function(a){return function(){f(this);d.onLoad=
a;"function"==typeof a&&a.call(this)}})}})}function l(){var a=this.getDialog().getContentElement("general",this.id+"Other");a&&("other"==this.getValue()?(a.getInputElement().removeAttribute("readOnly"),a.focus(),a.getElement().removeClass("cke_disabled")):(a.getInputElement().setAttribute("readOnly",!0),a.getElement().addClass("cke_disabled")))}function i(a,d,e){return function(b,f,c){f=k;b="undefined"!=typeof e?e:this.getValue();!b&&a in f?f[a].remove():b&&a in f?f[a].setAttribute("content",b):b&&
(f=new CKEDITOR.dom.element("meta",g.document),f.setAttribute(d?"http-equiv":"name",a),f.setAttribute("content",b),c.append(f))}}function j(a,d){return function(){var e=k,e=a in e?e[a].getAttribute("content")||"":"";if(d)return e;this.setValue(e);return null}}function m(a){return function(d,e,b,f){f.removeAttribute("margin"+a);d=this.getValue();""!==d?f.setStyle("margin-"+a,CKEDITOR.tools.cssLength(d)):f.removeStyle("margin-"+a)}}function n(a,d,e){a.removeStyle(d);a.getComputedStyle(d)!=e&&a.setStyle(d,
e)}var c=g.lang.docprops,h=g.lang.common,k={},o=function(a,d,e){return{type:"hbox",padding:0,widths:["60%","40%"],children:[CKEDITOR.tools.extend({type:"text",id:a,label:c[d]},e||{},1),{type:"button",id:a+"Choose",label:c.chooseColor,className:"colorChooser",onClick:function(){var b=this;p("colordialog",function(d){var e=b.getDialog();e.getContentElement(e._.currentTabId,a).setValue(d.getContentElement("picker","selectedColor").getValue())})}}]}},q="javascript:void((function(){"+encodeURIComponent("document.open();"+
(CKEDITOR.env.isCustomDomain()?"document.domain='"+document.domain+"';":"")+'document.write( \''+c.previewHtml+"' );document.close();")+"})())";return{title:c.title,minHeight:330,minWidth:500,onShow:function(){for(var a=g.document,d=a.getElementsByTag("html").getItem(0),e=a.getHead(),b=a.getBody(),f={},c=a.getElementsByTag("meta"),h=c.count(),i=0;i'],["XHTML 1.0 Transitional",''],["XHTML 1.0 Strict",''],["XHTML 1.0 Frameset",''],
["HTML 5",""],["HTML 4.01 Transitional",''],["HTML 4.01 Strict",''],["HTML 4.01 Frameset",''],["HTML 3.2",''],["HTML 2.0",''],[c.other,
"other"]],onChange:l,setup:function(){if(g.docType&&(this.setValue(g.docType),!this.getValue())){this.setValue("other");var a=this.getDialog().getContentElement("general","docTypeOther");a&&a.setValue(g.docType)}l.call(this)},commit:function(a,d,c,b,f){f||(a=this.getValue(),d=this.getDialog().getContentElement("general","docTypeOther"),g.docType="other"==a?d?d.getValue():"":a)}},{type:"text",id:"docTypeOther",label:c.docTypeOther}]},{type:"checkbox",id:"xhtmlDec",label:c.xhtmlDec,setup:function(){this.setValue(!!g.xmlDeclaration)},
commit:function(a,d,c,b,f){f||(this.getValue()?(g.xmlDeclaration='',d.setAttribute("xmlns","http://www.w3.org/1999/xhtml")):(g.xmlDeclaration="",d.removeAttribute("xmlns")))}}]},{id:"design",label:c.design,elements:[{type:"hbox",widths:["60%","40%"],children:[{type:"vbox",children:[o("txtColor","txtColor",{setup:function(a,d,c,b){this.setValue(b.getComputedStyle("color"))},commit:function(a,d,c,b,f){if(this.isChanged()||
f)b.removeAttribute("text"),(a=this.getValue())?b.setStyle("color",a):b.removeStyle("color")}}),o("bgColor","bgColor",{setup:function(a,d,c,b){a=b.getComputedStyle("background-color")||"";this.setValue("transparent"==a?"":a)},commit:function(a,d,c,b,f){if(this.isChanged()||f)b.removeAttribute("bgcolor"),(a=this.getValue())?b.setStyle("background-color",a):n(b,"background-color","transparent")}}),{type:"hbox",widths:["60%","40%"],padding:1,children:[{type:"text",id:"bgImage",label:c.bgImage,setup:function(a,
d,c,b){a=b.getComputedStyle("background-image")||"";a="none"==a?"":a.replace(/url\(\s*(["']?)\s*([^\)]*)\s*\1\s*\)/i,function(a,b,d){return d});this.setValue(a)},commit:function(a,d,c,b){b.removeAttribute("background");(a=this.getValue())?b.setStyle("background-image","url("+a+")"):n(b,"background-image","none")}},{type:"button",id:"bgImageChoose",label:h.browseServer,style:"display:inline-block;margin-top:10px;",hidden:!0,filebrowser:"design:bgImage"}]},{type:"checkbox",id:"bgFixed",label:c.bgFixed,
setup:function(a,d,c,b){this.setValue("fixed"==b.getComputedStyle("background-attachment"))},commit:function(a,d,c,b){this.getValue()?b.setStyle("background-attachment","fixed"):n(b,"background-attachment","scroll")}}]},{type:"vbox",children:[{type:"html",id:"marginTitle",html:'
'+c.margin+"
"},{type:"text",id:"marginTop",label:c.marginTop,style:"width: 80px; text-align: center",align:"center",inputStyle:"text-align: center", setup:function(a,d,c,b){this.setValue(b.getStyle("margin-top")||b.getAttribute("margintop")||"")},commit:m("top")},{type:"hbox",children:[{type:"text",id:"marginLeft",label:c.marginLeft,style:"width: 80px; text-align: center",align:"center",inputStyle:"text-align: center",setup:function(a,d,c,b){this.setValue(b.getStyle("margin-left")||b.getAttribute("marginleft")||"")},commit:m("left")},{type:"text",id:"marginRight",label:c.marginRight,style:"width: 80px; text-align: center",align:"center",inputStyle:"text-align: center", setup:function(a,d,c,b){this.setValue(b.getStyle("margin-right")||b.getAttribute("marginright")||"")},commit:m("right")}]},{type:"text",id:"marginBottom",label:c.marginBottom,style:"width: 80px; text-align: center",align:"center",inputStyle:"text-align: center",setup:function(a,c,e,b){this.setValue(b.getStyle("margin-bottom")||b.getAttribute("marginbottom")||"")},commit:m("bottom")}]}]}]},{id:"meta",label:c.meta,elements:[{type:"textarea",id:"metaKeywords",label:c.metaKeywords,setup:j("keywords"), commit:i("keywords")},{type:"textarea",id:"metaDescription",label:c.metaDescription,setup:j("description"),commit:i("description")},{type:"text",id:"metaAuthor",label:c.metaAuthor,setup:j("author"),commit:i("author")},{type:"text",id:"metaCopyright",label:c.metaCopyright,setup:j("copyright"),commit:i("copyright")}]},{id:"preview",label:h.preview,elements:[{type:"html",id:"previewHtml",html:'', onLoad:function(){this.getDialog().on("selectPage",function(a){if("preview"==a.data.page){var c=this;setTimeout(function(){var a=CKEDITOR.document.getById("cke_docProps_preview_iframe").getFrameDocument(),b=a.getElementsByTag("html").getItem(0),f=a.getHead(),g=a.getBody();c.commitContent(a,b,f,g,1)},50)}});CKEDITOR.document.getById("cke_docProps_preview_iframe").getAscendant("table").setStyle("height","100%")}}]}]}});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy