aboutsummaryrefslogtreecommitdiff
path: root/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-06-07 22:46:47 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-06-07 22:46:47 +0000
commitceab24db2a7bf459684a650c287770b4ff090f54 (patch)
tree171760af3de53f07b77c12d8e7931241a8d0377e /mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage
parentd924a462f39ff922a4cc9f6635cfe5d0c0f14db3 (diff)
downloadelgg-ceab24db2a7bf459684a650c287770b4ff090f54.tar.gz
elgg-ceab24db2a7bf459684a650c287770b4ff090f54.tar.bz2
Refs #3510, #9113. Updated tinyMCE version in trunk.
git-svn-id: http://code.elgg.org/elgg/trunk@9140 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage')
-rw-r--r--mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/css/fullpage.css45
-rw-r--r--mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js2
-rw-r--r--mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin_src.js374
-rw-r--r--mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/fullpage.htm348
-rw-r--r--mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js637
5 files changed, 533 insertions, 873 deletions
diff --git a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/css/fullpage.css b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/css/fullpage.css
index 7a3334f08..2675cec15 100644
--- a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/css/fullpage.css
+++ b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/css/fullpage.css
@@ -35,53 +35,14 @@
width: 240px;
}
-/* Head list classes */
-
-.headlistwrapper {
- width: 100%;
-}
-
-.addbutton, .removebutton, .moveupbutton, .movedownbutton {
- border-top: 1px solid;
- border-left: 1px solid;
- border-bottom: 1px solid;
- border-right: 1px solid;
- border-color: #F0F0EE;
- cursor: default;
- display: block;
- width: 20px;
- height: 20px;
-}
-
#doctypes {
width: 200px;
}
-.addbutton:hover, .removebutton:hover, .moveupbutton:hover, .movedownbutton:hover {
- border: 1px solid #0A246A;
- background-color: #B6BDD2;
-}
-
-.addbutton {
- background-image: url('../images/add.gif');
- float: left;
- margin-right: 3px;
-}
-
-.removebutton {
- background-image: url('../images/remove.gif');
- float: left;
-}
-
-.moveupbutton {
- background-image: url('../images/move_up.gif');
- float: left;
- margin-right: 3px;
-}
+/* Head list classes */
-.movedownbutton {
- background-image: url('../images/move_down.gif');
- float: left;
+.headlistwrapper {
+ width: 100%;
}
.selected {
diff --git a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js
index 8e11bfc47..28ec92e20 100644
--- a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js
+++ b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin.js
@@ -1 +1 @@
-(function(){tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceFullPageProperties",function(){a.windowManager.open({file:b+"/fullpage.htm",width:430+parseInt(a.getLang("fullpage.delta_width",0)),height:495+parseInt(a.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:b,head_html:c.head})});a.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});a.onBeforeSetContent.add(c._setContent,c);a.onSetContent.add(c._setBodyAttribs,c);a.onGetContent.add(c._getContent,c)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_setBodyAttribs:function(d,a){var l,c,e,g,b,h,j,f=this.head.match(/body(.*?)>/i);if(f&&f[1]){l=f[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);if(l){for(c=0,e=l.length;c<e;c++){g=l[c].split("=");b=g[0].replace(/\s/,"");h=g[1];if(h){h=h.replace(/^\s+/,"").replace(/\s+$/,"");j=h.match(/^["'](.*)["']$/);if(j){h=j[1]}}else{h=b}d.dom.setAttrib(d.getBody(),"style",h)}}}},_createSerializer:function(){return new tinymce.dom.Serializer({dom:this.editor.dom,apply_source_formatting:true})},_setContent:function(d,b){var h=this,a,j,f=b.content,g,i="";if(b.source_view&&d.getParam("fullpage_hide_in_source_view")){return}f=f.replace(/<(\/?)BODY/gi,"<$1body");a=f.indexOf("<body");if(a!=-1){a=f.indexOf(">",a);h.head=f.substring(0,a+1);j=f.indexOf("</body",a);if(j==-1){j=f.indexOf("</body",j)}b.content=f.substring(a+1,j);h.foot=f.substring(j);function e(c){return c.replace(/<\/?[A-Z]+/g,function(k){return k.toLowerCase()})}h.head=e(h.head);h.foot=e(h.foot)}else{h.head="";if(d.getParam("fullpage_default_xml_pi")){h.head+='<?xml version="1.0" encoding="'+d.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}h.head+=d.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');h.head+="\n<html>\n<head>\n<title>"+d.getParam("fullpage_default_title","Untitled document")+"</title>\n";if(g=d.getParam("fullpage_default_encoding")){h.head+='<meta http-equiv="Content-Type" content="'+g+'" />\n'}if(g=d.getParam("fullpage_default_font_family")){i+="font-family: "+g+";"}if(g=d.getParam("fullpage_default_font_size")){i+="font-size: "+g+";"}if(g=d.getParam("fullpage_default_text_color")){i+="color: "+g+";"}h.head+="</head>\n<body"+(i?' style="'+i+'"':"")+">\n";h.foot="\n</body>\n</html>"}},_getContent:function(a,c){var b=this;if(!c.source_view||!a.getParam("fullpage_hide_in_source_view")){c.content=tinymce.trim(b.head)+"\n"+tinymce.trim(c.content)+"\n"+tinymce.trim(b.foot)}}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})(); \ No newline at end of file
+(function(){var b=tinymce.each,a=tinymce.html.Node;tinymce.create("tinymce.plugins.FullPagePlugin",{init:function(c,d){var e=this;e.editor=c;c.addCommand("mceFullPageProperties",function(){c.windowManager.open({file:d+"/fullpage.htm",width:430+parseInt(c.getLang("fullpage.delta_width",0)),height:495+parseInt(c.getLang("fullpage.delta_height",0)),inline:1},{plugin_url:d,data:e._htmlToData()})});c.addButton("fullpage",{title:"fullpage.desc",cmd:"mceFullPageProperties"});c.onBeforeSetContent.add(e._setContent,e);c.onGetContent.add(e._getContent,e)},getInfo:function(){return{longname:"Fullpage",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullpage",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_htmlToData:function(){var f=this._parseHeader(),h={},c,i,g,e=this.editor;function d(l,j){var k=l.attr(j);return k||""}h.fontface=e.getParam("fullpage_default_fontface","");h.fontsize=e.getParam("fullpage_default_fontsize","");i=f.firstChild;if(i.type==7){h.xml_pi=true;g=/encoding="([^"]+)"/.exec(i.value);if(g){h.docencoding=g[1]}}i=f.getAll("#doctype")[0];if(i){h.doctype="<!DOCTYPE"+i.value+">"}i=f.getAll("title")[0];if(i&&i.firstChild){h.metatitle=i.firstChild.value}b(f.getAll("meta"),function(m){var k=m.attr("name"),j=m.attr("http-equiv"),l;if(k){h["meta"+k.toLowerCase()]=m.attr("content")}else{if(j=="Content-Type"){l=/charset\s*=\s*(.*)\s*/gi.exec(m.attr("content"));if(l){h.docencoding=l[1]}}}});i=f.getAll("html")[0];if(i){h.langcode=d(i,"lang")||d(i,"xml:lang")}i=f.getAll("link")[0];if(i&&i.attr("rel")=="stylesheet"){h.stylesheet=i.attr("href")}i=f.getAll("body")[0];if(i){h.langdir=d(i,"dir");h.style=d(i,"style");h.visited_color=d(i,"vlink");h.link_color=d(i,"link");h.active_color=d(i,"alink")}return h},_dataToHtml:function(g){var f,d,h,j,k,e=this.editor.dom;function c(n,l,m){n.attr(l,m?m:undefined)}function i(l){if(d.firstChild){d.insert(l,d.firstChild)}else{d.append(l)}}f=this._parseHeader();d=f.getAll("head")[0];if(!d){j=f.getAll("html")[0];d=new a("head",1);if(j.firstChild){j.insert(d,j.firstChild,true)}else{j.append(d)}}j=f.firstChild;if(g.xml_pi){k='version="1.0"';if(g.docencoding){k+=' encoding="'+g.docencoding+'"'}if(j.type!=7){j=new a("xml",7);f.insert(j,f.firstChild,true)}j.value=k}else{if(j&&j.type==7){j.remove()}}j=f.getAll("#doctype")[0];if(g.doctype){if(!j){j=new a("#doctype",10);if(g.xml_pi){f.insert(j,f.firstChild)}else{i(j)}}j.value=g.doctype.substring(9,g.doctype.length-1)}else{if(j){j.remove()}}j=f.getAll("title")[0];if(g.metatitle){if(!j){j=new a("title",1);j.append(new a("#text",3)).value=g.metatitle;i(j)}}if(g.docencoding){j=null;b(f.getAll("meta"),function(l){if(l.attr("http-equiv")=="Content-Type"){j=l}});if(!j){j=new a("meta",1);j.attr("http-equiv","Content-Type");j.shortEnded=true;i(j)}j.attr("content","text/html; charset="+g.docencoding)}b("keywords,description,author,copyright,robots".split(","),function(m){var l=f.getAll("meta"),n,p,o=g["meta"+m];for(n=0;n<l.length;n++){p=l[n];if(p.attr("name")==m){if(o){p.attr("content",o)}else{p.remove()}return}}if(o){j=new a("meta",1);j.attr("name",m);j.attr("content",o);j.shortEnded=true;i(j)}});j=f.getAll("link")[0];if(j&&j.attr("rel")=="stylesheet"){if(g.stylesheet){j.attr("href",g.stylesheet)}else{j.remove()}}else{if(g.stylesheet){j=new a("link",1);j.attr({rel:"stylesheet",text:"text/css",href:g.stylesheet});j.shortEnded=true;i(j)}}j=f.getAll("body")[0];if(j){c(j,"dir",g.langdir);c(j,"style",g.style);c(j,"vlink",g.visited_color);c(j,"link",g.link_color);c(j,"alink",g.active_color);e.setAttribs(this.editor.getBody(),{style:g.style,dir:g.dir,vLink:g.visited_color,link:g.link_color,aLink:g.active_color})}j=f.getAll("html")[0];if(j){c(j,"lang",g.langcode);c(j,"xml:lang",g.langcode)}h=new tinymce.html.Serializer({validate:false,indent:true,apply_source_formatting:true,indent_before:"head,html,body,meta,title,script,link,style",indent_after:"head,html,body,meta,title,script,link,style"}).serialize(f);this.head=h.substring(0,h.indexOf("</body>"))},_parseHeader:function(){return new tinymce.html.DomParser({validate:false,root_name:"#document"}).parse(this.head)},_setContent:function(g,d){var m=this,i,c,h=d.content,f,l="",e=m.editor.dom,j;function k(n){return n.replace(/<\/?[A-Z]+/g,function(o){return o.toLowerCase()})}if(d.format=="raw"&&m.head){return}if(d.source_view&&g.getParam("fullpage_hide_in_source_view")){return}h=h.replace(/<(\/?)BODY/gi,"<$1body");i=h.indexOf("<body");if(i!=-1){i=h.indexOf(">",i);m.head=k(h.substring(0,i+1));c=h.indexOf("</body",i);if(c==-1){c=h.length}d.content=h.substring(i+1,c);m.foot=k(h.substring(c))}else{m.head=this._getDefaultHeader();m.foot="\n</body>\n</html>"}f=m._parseHeader();b(f.getAll("style"),function(n){if(n.firstChild){l+=n.firstChild.value}});j=f.getAll("body")[0];if(j){e.setAttribs(m.editor.getBody(),{style:j.attr("style")||"",dir:j.attr("dir")||"",vLink:j.attr("vlink")||"",link:j.attr("link")||"",aLink:j.attr("alink")||""})}if(l){e.add(m.editor.getDoc().getElementsByTagName("head")[0],"style",{id:"fullpage_styles"},l)}else{e.remove("fullpage_styles")}},_getDefaultHeader:function(){var f="",c=this.editor,e,d="";if(c.getParam("fullpage_default_xml_pi")){f+='<?xml version="1.0" encoding="'+c.getParam("fullpage_default_encoding","ISO-8859-1")+'" ?>\n'}f+=c.getParam("fullpage_default_doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');f+="\n<html>\n<head>\n";if(e=c.getParam("fullpage_default_title")){f+="<title>"+v+"</title>\n"}if(e=c.getParam("fullpage_default_encoding")){f+='<meta http-equiv="Content-Type" content="text/html; charset='+e+'" />\n'}if(e=c.getParam("fullpage_default_font_family")){d+="font-family: "+e+";"}if(e=c.getParam("fullpage_default_font_size")){d+="font-size: "+e+";"}if(e=c.getParam("fullpage_default_text_color")){d+="color: "+e+";"}f+="</head>\n<body"+(d?' style="'+d+'"':"")+">\n";return f},_getContent:function(d,e){var c=this;if(!e.source_view||!d.getParam("fullpage_hide_in_source_view")){e.content=tinymce.trim(c.head)+"\n"+tinymce.trim(e.content)+"\n"+tinymce.trim(c.foot)}}});tinymce.PluginManager.add("fullpage",tinymce.plugins.FullPagePlugin)})(); \ No newline at end of file
diff --git a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin_src.js b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin_src.js
index b7d51d58e..ad4d3c212 100644
--- a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin_src.js
+++ b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin_src.js
@@ -9,6 +9,8 @@
*/
(function() {
+ var each = tinymce.each, Node = tinymce.html.Node;
+
tinymce.create('tinymce.plugins.FullPagePlugin', {
init : function(ed, url) {
var t = this;
@@ -24,7 +26,7 @@
inline : 1
}, {
plugin_url : url,
- head_html : t.head
+ data : t._htmlToData()
});
});
@@ -32,7 +34,6 @@
ed.addButton('fullpage', {title : 'fullpage.desc', cmd : 'mceFullPageProperties'});
ed.onBeforeSetContent.add(t._setContent, t);
- ed.onSetContent.add(t._setBodyAttribs, t);
ed.onGetContent.add(t._getContent, t);
},
@@ -48,102 +49,351 @@
// Private plugin internal methods
- _setBodyAttribs : function(ed, o) {
- var bdattr, i, len, kv, k, v, t, attr = this.head.match(/body(.*?)>/i);
+ _htmlToData : function() {
+ var headerFragment = this._parseHeader(), data = {}, nodes, elm, matches, editor = this.editor;
- if (attr && attr[1]) {
- bdattr = attr[1].match(/\s*(\w+\s*=\s*".*?"|\w+\s*=\s*'.*?'|\w+\s*=\s*\w+|\w+)\s*/g);
+ function getAttr(elm, name) {
+ var value = elm.attr(name);
- if (bdattr) {
- for(i = 0, len = bdattr.length; i < len; i++) {
- kv = bdattr[i].split('=');
- k = kv[0].replace(/\s/,'');
- v = kv[1];
+ return value || '';
+ };
- if (v) {
- v = v.replace(/^\s+/,'').replace(/\s+$/,'');
- t = v.match(/^["'](.*)["']$/);
+ // Default some values
+ data.fontface = editor.getParam("fullpage_default_fontface", "");
+ data.fontsize = editor.getParam("fullpage_default_fontsize", "");
- if (t)
- v = t[1];
- } else
- v = k;
+ // Parse XML PI
+ elm = headerFragment.firstChild;
+ if (elm.type == 7) {
+ data.xml_pi = true;
+ matches = /encoding="([^"]+)"/.exec(elm.value);
+ if (matches)
+ data.docencoding = matches[1];
+ }
- ed.dom.setAttrib(ed.getBody(), 'style', v);
- }
+ // Parse doctype
+ elm = headerFragment.getAll('#doctype')[0];
+ if (elm)
+ data.doctype = '<!DOCTYPE' + elm.value + ">";
+
+ // Parse title element
+ elm = headerFragment.getAll('title')[0];
+ if (elm && elm.firstChild) {
+ data.metatitle = elm.firstChild.value;
+ }
+
+ // Parse meta elements
+ each(headerFragment.getAll('meta'), function(meta) {
+ var name = meta.attr('name'), httpEquiv = meta.attr('http-equiv'), matches;
+
+ if (name)
+ data['meta' + name.toLowerCase()] = meta.attr('content');
+ else if (httpEquiv == "Content-Type") {
+ matches = /charset\s*=\s*(.*)\s*/gi.exec(meta.attr('content'));
+
+ if (matches)
+ data.docencoding = matches[1];
}
+ });
+
+ // Parse html attribs
+ elm = headerFragment.getAll('html')[0];
+ if (elm)
+ data.langcode = getAttr(elm, 'lang') || getAttr(elm, 'xml:lang');
+
+ // Parse stylesheet
+ elm = headerFragment.getAll('link')[0];
+ if (elm && elm.attr('rel') == 'stylesheet')
+ data.stylesheet = elm.attr('href');
+
+ // Parse body parts
+ elm = headerFragment.getAll('body')[0];
+ if (elm) {
+ data.langdir = getAttr(elm, 'dir');
+ data.style = getAttr(elm, 'style');
+ data.visited_color = getAttr(elm, 'vlink');
+ data.link_color = getAttr(elm, 'link');
+ data.active_color = getAttr(elm, 'alink');
}
+
+ return data;
},
- _createSerializer : function() {
- return new tinymce.dom.Serializer({
- dom : this.editor.dom,
- apply_source_formatting : true
+ _dataToHtml : function(data) {
+ var headerFragment, headElement, html, elm, value, dom = this.editor.dom;
+
+ function setAttr(elm, name, value) {
+ elm.attr(name, value ? value : undefined);
+ };
+
+ function addHeadNode(node) {
+ if (headElement.firstChild)
+ headElement.insert(node, headElement.firstChild);
+ else
+ headElement.append(node);
+ };
+
+ headerFragment = this._parseHeader();
+ headElement = headerFragment.getAll('head')[0];
+ if (!headElement) {
+ elm = headerFragment.getAll('html')[0];
+ headElement = new Node('head', 1);
+
+ if (elm.firstChild)
+ elm.insert(headElement, elm.firstChild, true);
+ else
+ elm.append(headElement);
+ }
+
+ // Add/update/remove XML-PI
+ elm = headerFragment.firstChild;
+ if (data.xml_pi) {
+ value = 'version="1.0"';
+
+ if (data.docencoding)
+ value += ' encoding="' + data.docencoding + '"';
+
+ if (elm.type != 7) {
+ elm = new Node('xml', 7);
+ headerFragment.insert(elm, headerFragment.firstChild, true);
+ }
+
+ elm.value = value;
+ } else if (elm && elm.type == 7)
+ elm.remove();
+
+ // Add/update/remove doctype
+ elm = headerFragment.getAll('#doctype')[0];
+ if (data.doctype) {
+ if (!elm) {
+ elm = new Node('#doctype', 10);
+
+ if (data.xml_pi)
+ headerFragment.insert(elm, headerFragment.firstChild);
+ else
+ addHeadNode(elm);
+ }
+
+ elm.value = data.doctype.substring(9, data.doctype.length - 1);
+ } else if (elm)
+ elm.remove();
+
+ // Add/update/remove title
+ elm = headerFragment.getAll('title')[0];
+ if (data.metatitle) {
+ if (!elm) {
+ elm = new Node('title', 1);
+ elm.append(new Node('#text', 3)).value = data.metatitle;
+ addHeadNode(elm);
+ }
+ }
+
+ // Add meta encoding
+ if (data.docencoding) {
+ elm = null;
+ each(headerFragment.getAll('meta'), function(meta) {
+ if (meta.attr('http-equiv') == 'Content-Type')
+ elm = meta;
+ });
+
+ if (!elm) {
+ elm = new Node('meta', 1);
+ elm.attr('http-equiv', 'Content-Type');
+ elm.shortEnded = true;
+ addHeadNode(elm);
+ }
+
+ elm.attr('content', 'text/html; charset=' + data.docencoding);
+ }
+
+ // Add/update/remove meta
+ each('keywords,description,author,copyright,robots'.split(','), function(name) {
+ var nodes = headerFragment.getAll('meta'), i, meta, value = data['meta' + name];
+
+ for (i = 0; i < nodes.length; i++) {
+ meta = nodes[i];
+
+ if (meta.attr('name') == name) {
+ if (value)
+ meta.attr('content', value);
+ else
+ meta.remove();
+
+ return;
+ }
+ }
+
+ if (value) {
+ elm = new Node('meta', 1);
+ elm.attr('name', name);
+ elm.attr('content', value);
+ elm.shortEnded = true;
+
+ addHeadNode(elm);
+ }
});
+
+ // Add/update/delete link
+ elm = headerFragment.getAll('link')[0];
+ if (elm && elm.attr('rel') == 'stylesheet') {
+ if (data.stylesheet)
+ elm.attr('href', data.stylesheet);
+ else
+ elm.remove();
+ } else if (data.stylesheet) {
+ elm = new Node('link', 1);
+ elm.attr({
+ rel : 'stylesheet',
+ text : 'text/css',
+ href : data.stylesheet
+ });
+ elm.shortEnded = true;
+
+ addHeadNode(elm);
+ }
+
+ // Update body attributes
+ elm = headerFragment.getAll('body')[0];
+ if (elm) {
+ setAttr(elm, 'dir', data.langdir);
+ setAttr(elm, 'style', data.style);
+ setAttr(elm, 'vlink', data.visited_color);
+ setAttr(elm, 'link', data.link_color);
+ setAttr(elm, 'alink', data.active_color);
+
+ // Update iframe body as well
+ dom.setAttribs(this.editor.getBody(), {
+ style : data.style,
+ dir : data.dir,
+ vLink : data.visited_color,
+ link : data.link_color,
+ aLink : data.active_color
+ });
+ }
+
+ // Set html attributes
+ elm = headerFragment.getAll('html')[0];
+ if (elm) {
+ setAttr(elm, 'lang', data.langcode);
+ setAttr(elm, 'xml:lang', data.langcode);
+ }
+
+ // Serialize header fragment and crop away body part
+ html = new tinymce.html.Serializer({
+ validate: false,
+ indent: true,
+ apply_source_formatting : true,
+ indent_before: 'head,html,body,meta,title,script,link,style',
+ indent_after: 'head,html,body,meta,title,script,link,style'
+ }).serialize(headerFragment);
+
+ this.head = html.substring(0, html.indexOf('</body>'));
+ },
+
+ _parseHeader : function() {
+ // Parse the contents with a DOM parser
+ return new tinymce.html.DomParser({
+ validate: false,
+ root_name: '#document'
+ }).parse(this.head);
},
_setContent : function(ed, o) {
- var t = this, sp, ep, c = o.content, v, st = '';
+ var self = this, startPos, endPos, content = o.content, headerFragment, styles = '', dom = self.editor.dom, elm;
+
+ function low(s) {
+ return s.replace(/<\/?[A-Z]+/g, function(a) {
+ return a.toLowerCase();
+ })
+ };
+
+ // Ignore raw updated if we already have a head, this will fix issues with undo/redo keeping the head/foot separate
+ if (o.format == 'raw' && self.head)
+ return;
if (o.source_view && ed.getParam('fullpage_hide_in_source_view'))
return;
// Parse out head, body and footer
- c = c.replace(/<(\/?)BODY/gi, '<$1body');
- sp = c.indexOf('<body');
+ content = content.replace(/<(\/?)BODY/gi, '<$1body');
+ startPos = content.indexOf('<body');
- if (sp != -1) {
- sp = c.indexOf('>', sp);
- t.head = c.substring(0, sp + 1);
+ if (startPos != -1) {
+ startPos = content.indexOf('>', startPos);
+ self.head = low(content.substring(0, startPos + 1));
- ep = c.indexOf('</body', sp);
- if (ep == -1)
- ep = c.indexOf('</body', ep);
+ endPos = content.indexOf('</body', startPos);
+ if (endPos == -1)
+ endPos = content.length;
- o.content = c.substring(sp + 1, ep);
- t.foot = c.substring(ep);
+ o.content = content.substring(startPos + 1, endPos);
+ self.foot = low(content.substring(endPos));
+ } else {
+ self.head = this._getDefaultHeader();
+ self.foot = '\n</body>\n</html>';
+ }
- function low(s) {
- return s.replace(/<\/?[A-Z]+/g, function(a) {
- return a.toLowerCase();
- })
- };
+ // Parse header and update iframe
+ headerFragment = self._parseHeader();
+ each(headerFragment.getAll('style'), function(node) {
+ if (node.firstChild)
+ styles += node.firstChild.value;
+ });
- t.head = low(t.head);
- t.foot = low(t.foot);
- } else {
- t.head = '';
- if (ed.getParam('fullpage_default_xml_pi'))
- t.head += '<?xml version="1.0" encoding="' + ed.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';
+ elm = headerFragment.getAll('body')[0];
+ if (elm) {
+ dom.setAttribs(self.editor.getBody(), {
+ style : elm.attr('style') || '',
+ dir : elm.attr('dir') || '',
+ vLink : elm.attr('vlink') || '',
+ link : elm.attr('link') || '',
+ aLink : elm.attr('alink') || ''
+ });
+ }
- t.head += ed.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
- t.head += '\n<html>\n<head>\n<title>' + ed.getParam('fullpage_default_title', 'Untitled document') + '</title>\n';
+ if (styles)
+ dom.add(self.editor.getDoc().getElementsByTagName('head')[0], 'style', {id : 'fullpage_styles'}, styles);
+ else
+ dom.remove('fullpage_styles');
+ },
- if (v = ed.getParam('fullpage_default_encoding'))
- t.head += '<meta http-equiv="Content-Type" content="' + v + '" />\n';
+ _getDefaultHeader : function() {
+ var header = '', editor = this.editor, value, styles = '';
- if (v = ed.getParam('fullpage_default_font_family'))
- st += 'font-family: ' + v + ';';
+ if (editor.getParam('fullpage_default_xml_pi'))
+ header += '<?xml version="1.0" encoding="' + editor.getParam('fullpage_default_encoding', 'ISO-8859-1') + '" ?>\n';
- if (v = ed.getParam('fullpage_default_font_size'))
- st += 'font-size: ' + v + ';';
+ header += editor.getParam('fullpage_default_doctype', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
+ header += '\n<html>\n<head>\n';
- if (v = ed.getParam('fullpage_default_text_color'))
- st += 'color: ' + v + ';';
+ if (value = editor.getParam('fullpage_default_title'))
+ header += '<title>' + v + '</title>\n';
- t.head += '</head>\n<body' + (st ? ' style="' + st + '"' : '') + '>\n';
- t.foot = '\n</body>\n</html>';
- }
+ if (value = editor.getParam('fullpage_default_encoding'))
+ header += '<meta http-equiv="Content-Type" content="text/html; charset=' + value + '" />\n';
+
+ if (value = editor.getParam('fullpage_default_font_family'))
+ styles += 'font-family: ' + value + ';';
+
+ if (value = editor.getParam('fullpage_default_font_size'))
+ styles += 'font-size: ' + value + ';';
+
+ if (value = editor.getParam('fullpage_default_text_color'))
+ styles += 'color: ' + value + ';';
+
+ header += '</head>\n<body' + (styles ? ' style="' + styles + '"' : '') + '>\n';
+
+ return header;
},
_getContent : function(ed, o) {
- var t = this;
+ var self = this;
if (!o.source_view || !ed.getParam('fullpage_hide_in_source_view'))
- o.content = tinymce.trim(t.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(t.foot);
+ o.content = tinymce.trim(self.head) + '\n' + tinymce.trim(o.content) + '\n' + tinymce.trim(self.foot);
}
});
// Register plugin
tinymce.PluginManager.add('fullpage', tinymce.plugins.FullPagePlugin);
-})(); \ No newline at end of file
+})();
diff --git a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/fullpage.htm b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/fullpage.htm
index c32afaf2d..14ab8652e 100644
--- a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/fullpage.htm
+++ b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/fullpage.htm
@@ -8,13 +8,12 @@
<script type="text/javascript" src="js/fullpage.js"></script>
<link href="css/fullpage.css" rel="stylesheet" type="text/css" />
</head>
-<body id="advlink" style="display: none">
- <form onsubmit="updateAction();return false;" name="fullpage" action="#">
+<body id="fullpage" style="display: none">
+<form onsubmit="FullPageDialog.update();return false;" name="fullpage" action="#">
<div class="tabs">
<ul>
<li id="meta_tab" class="current"><span><a href="javascript:mcTabs.displayTab('meta_tab','meta_panel');" onmousedown="return false;">{#fullpage_dlg.meta_tab}</a></span></li>
<li id="appearance_tab"><span><a href="javascript:mcTabs.displayTab('appearance_tab','appearance_panel');" onmousedown="return false;">{#fullpage_dlg.appearance_tab}</a></span></li>
- <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#fullpage_dlg.advanced_tab}</a></span></li>
</ul>
</div>
@@ -72,9 +71,9 @@
</td>
</tr>
<tr>
- <td class="nowrap"><label for="doctypes">{#fullpage_dlg.doctypes}</label>&nbsp;</td>
+ <td class="nowrap"><label for="doctype">{#fullpage_dlg.doctypes}</label>&nbsp;</td>
<td>
- <select id="doctypes" name="doctypes">
+ <select id="doctype" name="doctype">
<option value="">{#not_set}</option>
</select>
</td>
@@ -109,7 +108,7 @@
<tr>
<td class="column1"><label for="fontface">{#fullpage_dlg.fontface}</label></td>
<td>
- <select id="fontface" name="fontface" onchange="changedStyleField(this);">
+ <select id="fontface" name="fontface" onchange="FullPageDialog.changedStyleProp();">
<option value="">{#not_set}</option>
</select>
</td>
@@ -118,7 +117,7 @@
<tr>
<td class="column1"><label for="fontsize">{#fullpage_dlg.fontsize}</label></td>
<td>
- <select id="fontsize" name="fontsize" onchange="changedStyleField(this);">
+ <select id="fontsize" name="fontsize" onchange="FullPageDialog.changedStyleProp();">
<option value="">{#not_set}</option>
</select>
</td>
@@ -129,7 +128,7 @@
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
- <td><input id="textcolor" name="textcolor" type="text" value="" size="9" onchange="updateColor('textcolor_pick','textcolor');changedStyleField(this);" /></td>
+ <td><input id="textcolor" name="textcolor" type="text" value="" size="9" onchange="updateColor('textcolor_pick','textcolor');FullPageDialog.changedStyleProp();" /></td>
<td id="textcolor_pickcontainer">&nbsp;</td>
</tr>
</table>
@@ -147,7 +146,7 @@
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
- <td><input id="bgimage" name="bgimage" type="text" value="" onchange="changedStyleField(this);" /></td>
+ <td><input id="bgimage" name="bgimage" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>
<td id="bgimage_pickcontainer">&nbsp;</td>
</tr>
</table>
@@ -158,7 +157,7 @@
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
- <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');changedStyleField(this);" /></td>
+ <td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');FullPageDialog.changedStyleProp();" /></td>
<td id="bgcolor_pickcontainer">&nbsp;</td>
</tr>
</table>
@@ -173,15 +172,15 @@
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td class="column1"><label for="leftmargin">{#fullpage_dlg.left_margin}</label></td>
- <td><input id="leftmargin" name="leftmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
+ <td><input id="leftmargin" name="leftmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>
<td class="column1"><label for="rightmargin">{#fullpage_dlg.right_margin}</label></td>
- <td><input id="rightmargin" name="rightmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
+ <td><input id="rightmargin" name="rightmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>
</tr>
<tr>
<td class="column1"><label for="topmargin">{#fullpage_dlg.top_margin}</label></td>
- <td><input id="topmargin" name="topmargin" type="text" value="" onchange="changedStyleField(this);" /></td>
+ <td><input id="topmargin" name="topmargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>
<td class="column1"><label for="bottommargin">{#fullpage_dlg.bottom_margin}</label></td>
- <td><input id="bottommargin" name="bottommargin" type="text" value="" onchange="changedStyleField(this);" /></td>
+ <td><input id="bottommargin" name="bottommargin" type="text" value="" onchange="FullPageDialog.changedStyleProp();" /></td>
</tr>
</table>
</fieldset>
@@ -195,7 +194,7 @@
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
- <td><input id="link_color" name="link_color" type="text" value="" size="9" onchange="updateColor('link_color_pick','link_color');changedStyleField(this);" /></td>
+ <td><input id="link_color" name="link_color" type="text" value="" size="9" onchange="updateColor('link_color_pick','link_color');FullPageDialog.changedStyleProp();" /></td>
<td id="link_color_pickcontainer">&nbsp;</td>
</tr>
</table>
@@ -205,7 +204,7 @@
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
- <td><input id="visited_color" name="visited_color" type="text" value="" size="9" onchange="updateColor('visited_color_pick','visited_color');changedStyleField(this);" /></td>
+ <td><input id="visited_color" name="visited_color" type="text" value="" size="9" onchange="updateColor('visited_color_pick','visited_color');FullPageDialog.changedStyleProp();" /></td>
<td id="visited_color_pickcontainer">&nbsp;</td>
</tr>
</table>
@@ -217,7 +216,7 @@
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
- <td><input id="active_color" name="active_color" type="text" value="" size="9" onchange="updateColor('active_color_pick','active_color');changedStyleField(this);" /></td>
+ <td><input id="active_color" name="active_color" type="text" value="" size="9" onchange="updateColor('active_color_pick','active_color');FullPageDialog.changedStyleProp();" /></td>
<td id="active_color_pickcontainer">&nbsp;</td>
</tr>
</table>
@@ -225,16 +224,6 @@
<td>&nbsp;</td>
<td>&nbsp;</td>
-
-<!-- <td class="column1"><label for="hover_color">{#fullpage_dlg.hover_color}</label></td>
- <td>
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td><input id="hover_color" name="hover_color" type="text" value="" size="9" onchange="changedStyleField(this);" /></td>
- <td id="hover_color_pickcontainer">&nbsp;</td>
- </tr>
- </table>
- </td> -->
</tr>
</table>
</fieldset>
@@ -254,310 +243,9 @@
</tr>
<tr>
<td class="column1"><label for="style">{#fullpage_dlg.style}</label></td>
- <td><input id="style" name="style" type="text" value="" onchange="changedStyleField(this);" /></td>
- </tr>
- </table>
- </fieldset>
- </div>
-
- <div id="advanced_panel" class="panel">
- <div id="addmenu">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><td><a href="javascript:addHeadElm('title');" onmousedown="return false;"><span>{#fullpage_dlg.add_title}</span></a></td></tr>
- <tr><td><a href="javascript:addHeadElm('meta');" onmousedown="return false;"><span>{#fullpage_dlg.add_meta}</span></a></td></tr>
- <tr><td><a href="javascript:addHeadElm('script');" onmousedown="return false;"><span>{#fullpage_dlg.add_script}</span></a></td></tr>
- <tr><td><a href="javascript:addHeadElm('style');" onmousedown="return false;"><span>{#fullpage_dlg.add_style}</span></a></td></tr>
- <tr><td><a href="javascript:addHeadElm('link');" onmousedown="return false;"><span>{#fullpage_dlg.add_link}</span></a></td></tr>
- <tr><td><a href="javascript:addHeadElm('base');" onmousedown="return false;"><span>{#fullpage_dlg.add_base}</span></a></td></tr>
- <tr><td><a href="javascript:addHeadElm('comment');" onmousedown="return false;"><span>{#fullpage_dlg.add_comment}</span></a></td></tr>
- </table>
- </div>
-
- <fieldset>
- <legend>{#fullpage_dlg.head_elements}</legend>
-
- <div class="headlistwrapper">
- <div class="toolbar">
- <div style="float: left">
- <a id="addbutton" href="javascript:showAddMenu();" onmousedown="return false;" class="addbutton" title="{#fullpage_dlg.add}"></a>
- <a href="#" onmousedown="return false;" class="removebutton" title="{#fullpage_dlg.remove}"></a>
- </div>
- <div style="float: right">
- <a href="#" onmousedown="return false;" class="moveupbutton" title="{#fullpage_dlg.moveup}"></a>
- <a href="#" onmousedown="return false;" class="movedownbutton" title="{#fullpage_dlg.movedown}"></a>
- </div>
- <br style="clear: both" />
- </div>
- <select id="headlist" size="26" onchange="updateHeadElm(this.options[this.selectedIndex].value);">
- <option value="title_0">&lt;title&gt;Some title bla bla bla&lt;/title&gt;</option>
- <option value="meta_1">&lt;meta name="keywords"&gt;Some bla bla bla&lt;/meta&gt;</option>
- <option value="meta_2">&lt;meta name="description"&gt;Some bla bla bla bla bla bla bla bla bla&lt;/meta&gt;</option>
- <option value="script_3">&lt;script language=&quot;javascript&quot;&gt;...&lt;/script&gt;</option>
- <option value="style_4">&lt;style&gt;...&lt;/style&gt;</option>
- <option value="base_5">&lt;base href="." /&gt;</option>
- <option value="comment_6">&lt;!-- ... --&gt;</option>
- <option value="link_7">&lt;link href="." /&gt;</option>
- </select>
- </div>
- </fieldset>
-
- <fieldset id="meta_element">
- <legend>{#fullpage_dlg.meta_element}</legend>
-
- <table border="0" cellpadding="4" cellspacing="0">
- <tr>
- <td class="column1"><label for="element_meta_type">{#fullpage_dlg.type}</label></td>
- <td><select id="element_meta_type">
- <option value="name">name</option>
- <option value="http-equiv">http-equiv</option>
- </select></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_meta_name">{#fullpage_dlg.name}</label></td>
- <td><input id="element_meta_name" name="element_meta_name" type="text" value="" /></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_meta_content">{#fullpage_dlg.content}</label></td>
- <td><input id="element_meta_content" name="element_meta_content" type="text" value="" /></td>
- </tr>
- </table>
-
- <input type="button" id="meta_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
- </fieldset>
-
- <fieldset id="title_element">
- <legend>{#fullpage_dlg.title_element}</legend>
-
- <table border="0" cellpadding="4" cellspacing="0">
- <tr>
- <td class="column1"><label for="element_title">{#fullpage_dlg.meta_title}</label></td>
- <td><input id="element_title" name="element_title" type="text" value="" /></td>
- </tr>
- </table>
-
- <input type="button" id="title_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
- </fieldset>
-
- <fieldset id="script_element">
- <legend>{#fullpage_dlg.script_element}</legend>
-
- <div class="tabs">
- <ul>
- <li id="script_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('script_props_tab','script_props_panel');" onmousedown="return false;">{#fullpage_dlg.properties}</a></span></li>
- <li id="script_value_tab"><span><a href="javascript:mcTabs.displayTab('script_value_tab','script_value_panel');" onmousedown="return false;">{#fullpage_dlg.value}</a></span></li>
- </ul>
- </div>
-
- <br style="clear: both" />
-
- <div class="panel_wrapper">
- <div id="script_props_panel" class="panel current">
- <table border="0" cellpadding="4" cellspacing="0">
- <tr>
- <td class="column1"><label for="element_script_type">{#fullpage_dlg.type}</label></td>
- <td><select id="element_script_type">
- <option value="text/javascript">text/javascript</option>
- <option value="text/jscript">text/jscript</option>
- <option value="text/vbscript">text/vbscript</option>
- <option value="text/vbs">text/vbs</option>
- <option value="text/ecmascript">text/ecmascript</option>
- <option value="text/xml">text/xml</option>
- </select></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_script_src">{#fullpage_dlg.src}</label></td>
- <td><table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td><input id="element_script_src" name="element_script_src" type="text" value="" /></td>
- <td id="script_src_pickcontainer">&nbsp;</td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_script_charset">{#fullpage_dlg.charset}</label></td>
- <td><select id="element_script_charset"><option value="">{#not_set}</option></select></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_script_defer">{#fullpage_dlg.defer}</label></td>
- <td><input type="checkbox" id="element_script_defer" name="element_script_defer" class="checkbox" /></td>
- </tr>
- </table>
- </div>
-
- <div id="script_value_panel" class="panel">
- <textarea id="element_script_value"></textarea>
- </div>
- </div>
-
- <input type="button" id="script_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
- </fieldset>
-
- <fieldset id="style_element">
- <legend>{#fullpage_dlg.style_element}</legend>
-
- <div class="tabs">
- <ul>
- <li id="style_props_tab" class="current"><span><a href="javascript:mcTabs.displayTab('style_props_tab','style_props_panel');" onmousedown="return false;">{#fullpage_dlg.properties}</a></span></li>
- <li id="style_value_tab"><span><a href="javascript:mcTabs.displayTab('style_value_tab','style_value_panel');" onmousedown="return false;">{#fullpage_dlg.value}</a></span></li>
- </ul>
- </div>
-
- <br style="clear: both" />
-
- <div class="panel_wrapper">
- <div id="style_props_panel" class="panel current">
- <table border="0" cellpadding="4" cellspacing="0">
- <tr>
- <td class="column1"><label for="element_style_type">{#fullpage_dlg.type}</label></td>
- <td><select id="element_style_type">
- <option value="text/css">text/css</option>
- </select></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_style_media">{#fullpage_dlg.media}</label></td>
- <td><select id="element_style_media"></select></td>
- </tr>
- </table>
- </div>
-
- <div id="style_value_panel" class="panel">
- <textarea id="element_style_value"></textarea>
- </div>
- </div>
-
- <input type="button" id="style_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
- </fieldset>
-
- <fieldset id="base_element">
- <legend>{#fullpage_dlg.base_element}</legend>
-
- <table border="0" cellpadding="4" cellspacing="0">
- <tr>
- <td class="column1"><label for="element_base_href">{#fullpage_dlg.href}</label></td>
- <td><input id="element_base_href" name="element_base_href" type="text" value="" /></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_base_target">{#fullpage_dlg.target}</label></td>
- <td><input id="element_base_target" name="element_base_target" type="text" value="" /></td>
+ <td><input id="style" name="style" type="text" value="" onchange="FullPageDialog.changedStyle();" /></td>
</tr>
</table>
-
- <input type="button" id="base_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
- </fieldset>
-
- <fieldset id="link_element">
- <legend>{#fullpage_dlg.link_element}</legend>
-
- <div class="tabs">
- <ul>
- <li id="link_general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('link_general_tab','link_general_panel');" onmousedown="return false;">{#fullpage_dlg.general_props}</a></span></li>
- <li id="link_advanced_tab"><span><a href="javascript:mcTabs.displayTab('link_advanced_tab','link_advanced_panel');" onmousedown="return false;">{#fullpage_dlg.advanced_props}</a></span></li>
- </ul>
- </div>
-
- <br style="clear: both" />
-
- <div class="panel_wrapper">
- <div id="link_general_panel" class="panel current">
- <table border="0" cellpadding="4" cellspacing="0">
- <tr>
- <td class="column1"><label for="element_link_href">{#fullpage_dlg.href}</label></td>
- <td><table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td><input id="element_link_href" name="element_link_href" type="text" value="" /></td>
- <td id="link_href_pickcontainer">&nbsp;</td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_link_title">{#fullpage_dlg.meta_title}</label></td>
- <td><input id="element_link_title" name="element_link_title" type="text" value="" /></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_link_type">{#fullpage_dlg.type}</label></td>
- <td><select id="element_link_type" name="element_link_type">
- <option value="text/css">text/css</option>
- <option value="text/javascript">text/javascript</option>
- </select></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_link_media">{#fullpage_dlg.media}</label></td>
- <td><select id="element_link_media" name="element_link_media"></select></td>
- </tr>
- <tr>
- <td><label for="element_style_rel">{#fullpage_dlg.rel}</label></td>
- <td><select id="element_style_rel" name="element_style_rel">
- <option value="">{#not_set}</option>
- <option value="stylesheet">Stylesheet</option>
- <option value="alternate">Alternate</option>
- <option value="designates">Designates</option>
- <option value="start">Start</option>
- <option value="next">Next</option>
- <option value="prev">Prev</option>
- <option value="contents">Contents</option>
- <option value="index">Index</option>
- <option value="glossary">Glossary</option>
- <option value="copyright">Copyright</option>
- <option value="chapter">Chapter</option>
- <option value="subsection">Subsection</option>
- <option value="appendix">Appendix</option>
- <option value="help">Help</option>
- <option value="bookmark">Bookmark</option>
- </select>
- </td>
- </tr>
- </table>
- </div>
-
- <div id="link_advanced_panel" class="panel">
- <table border="0" cellpadding="4" cellspacing="0">
- <tr>
- <td class="column1"><label for="element_link_charset">{#fullpage_dlg.charset}</label></td>
- <td><select id="element_link_charset"><option value="">{#not_set}</option></select></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_link_hreflang">{#fullpage_dlg.hreflang}</label></td>
- <td><input id="element_link_hreflang" name="element_link_hreflang" type="text" value="" /></td>
- </tr>
- <tr>
- <td class="column1"><label for="element_link_target">{#fullpage_dlg.target}</label></td>
- <td><input id="element_link_target" name="element_link_target" type="text" value="" /></td>
- </tr>
- <tr>
- <td><label for="element_style_rev">{#fullpage_dlg.rev}</label></td>
- <td><select id="element_style_rev" name="element_style_rev">
- <option value="">{#not_set}</option>
- <option value="alternate">Alternate</option>
- <option value="designates">Designates</option>
- <option value="stylesheet">Stylesheet</option>
- <option value="start">Start</option>
- <option value="next">Next</option>
- <option value="prev">Prev</option>
- <option value="contents">Contents</option>
- <option value="index">Index</option>
- <option value="glossary">Glossary</option>
- <option value="copyright">Copyright</option>
- <option value="chapter">Chapter</option>
- <option value="subsection">Subsection</option>
- <option value="appendix">Appendix</option>
- <option value="help">Help</option>
- <option value="bookmark">Bookmark</option>
- </select>
- </td>
- </tr>
- </table>
- </div>
- </div>
-
- <input type="button" id="link_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
- </fieldset>
-
- <fieldset id="comment_element">
- <legend>{#fullpage_dlg.comment_element}</legend>
-
- <textarea id="element_comment_value"></textarea>
-
- <input type="button" id="comment_updateelement" class="updateElementButton" name="update" value="{#update}" onclick="updateElement();" />
</fieldset>
</div>
</div>
@@ -566,6 +254,6 @@
<input type="submit" id="insert" name="update" value="{#update}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
- </form>
+</form>
</body>
</html>
diff --git a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js
index a1bb719a3..3f672ad3b 100644
--- a/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js
+++ b/mod/tinymce/vendor/tinymce/jscripts/tiny_mce/plugins/fullpage/js/fullpage.js
@@ -8,464 +8,225 @@
* Contributing: http://tinymce.moxiecode.com/contributing
*/
-tinyMCEPopup.requireLangPack();
-
-var doc;
-
-var defaultDocTypes =
- 'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' +
- 'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' +
- 'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' +
- 'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' +
- 'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' +
- 'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' +
- 'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';
-
-var defaultEncodings =
- 'Western european (iso-8859-1)=iso-8859-1,' +
- 'Central European (iso-8859-2)=iso-8859-2,' +
- 'Unicode (UTF-8)=utf-8,' +
- 'Chinese traditional (Big5)=big5,' +
- 'Cyrillic (iso-8859-5)=iso-8859-5,' +
- 'Japanese (iso-2022-jp)=iso-2022-jp,' +
- 'Greek (iso-8859-7)=iso-8859-7,' +
- 'Korean (iso-2022-kr)=iso-2022-kr,' +
- 'ASCII (us-ascii)=us-ascii';
-
-var defaultMediaTypes =
- 'all=all,' +
- 'screen=screen,' +
- 'print=print,' +
- 'tty=tty,' +
- 'tv=tv,' +
- 'projection=projection,' +
- 'handheld=handheld,' +
- 'braille=braille,' +
- 'aural=aural';
-
-var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
-var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';
-
-function init() {
- var f = document.forms['fullpage'], el = f.elements, e, i, p, doctypes, encodings, mediaTypes, fonts, ed = tinyMCEPopup.editor, dom = tinyMCEPopup.dom, style;
-
- // Setup doctype select box
- doctypes = ed.getParam("fullpage_doctypes", defaultDocTypes).split(',');
- for (i=0; i<doctypes.length; i++) {
- p = doctypes[i].split('=');
-
- if (p.length > 1)
- addSelectValue(f, 'doctypes', p[0], p[1]);
- }
-
- // Setup fonts select box
- fonts = ed.getParam("fullpage_fonts", defaultFontNames).split(';');
- for (i=0; i<fonts.length; i++) {
- p = fonts[i].split('=');
-
- if (p.length > 1)
- addSelectValue(f, 'fontface', p[0], p[1]);
- }
-
- // Setup fontsize select box
- fonts = ed.getParam("fullpage_fontsizes", defaultFontSizes).split(',');
- for (i=0; i<fonts.length; i++)
- addSelectValue(f, 'fontsize', fonts[i], fonts[i]);
-
- // Setup mediatype select boxs
- mediaTypes = ed.getParam("fullpage_media_types", defaultMediaTypes).split(',');
- for (i=0; i<mediaTypes.length; i++) {
- p = mediaTypes[i].split('=');
-
- if (p.length > 1) {
- addSelectValue(f, 'element_style_media', p[0], p[1]);
- addSelectValue(f, 'element_link_media', p[0], p[1]);
- }
- }
-
- // Setup encodings select box
- encodings = ed.getParam("fullpage_encodings", defaultEncodings).split(',');
- for (i=0; i<encodings.length; i++) {
- p = encodings[i].split('=');
-
- if (p.length > 1) {
- addSelectValue(f, 'docencoding', p[0], p[1]);
- addSelectValue(f, 'element_script_charset', p[0], p[1]);
- addSelectValue(f, 'element_link_charset', p[0], p[1]);
- }
- }
-
- document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
- document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color');
- //document.getElementById('hover_color_pickcontainer').innerHTML = getColorPickerHTML('hover_color_pick','hover_color');
- document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color');
- document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color');
- document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor');
- document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage');
- document.getElementById('link_href_pickcontainer').innerHTML = getBrowserHTML('link_href_browser','element_link_href','file','fullpage');
- document.getElementById('script_src_pickcontainer').innerHTML = getBrowserHTML('script_src_browser','element_script_src','file','fullpage');
- document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage');
-
- // Resize some elements
- if (isVisible('stylesheetbrowser'))
- document.getElementById('stylesheet').style.width = '220px';
-
- if (isVisible('link_href_browser'))
- document.getElementById('element_link_href').style.width = '230px';
-
- if (isVisible('bgimage_browser'))
- document.getElementById('bgimage').style.width = '210px';
-
- // Add iframe
- dom.add(document.body, 'iframe', {id : 'documentIframe', src : 'javascript:""', style : {display : 'none'}});
- doc = dom.get('documentIframe').contentWindow.document;
- h = tinyMCEPopup.getWindowArg('head_html');
-
- // Preprocess the HTML disable scripts and urls
- h = h.replace(/<script>/gi, '<script type="text/javascript">');
- h = h.replace(/type=([\"\'])?/gi, 'type=$1-mce-');
- h = h.replace(/(src=|href=)/g, '_mce_$1');
-
- // Write in the content in the iframe
- doc.write(h + '</body></html>');
- doc.close();
-
- // Parse xml and doctype
- xmlVer = getReItem(/<\?\s*?xml.*?version\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
- xmlEnc = getReItem(/<\?\s*?xml.*?encoding\s*?=\s*?"(.*?)".*?\?>/gi, h, 1);
- docType = getReItem(/<\!DOCTYPE.*?>/gi, h.replace(/\n/g, ''), 0).replace(/ +/g, ' ');
- f.langcode.value = getReItem(/lang="(.*?)"/gi, h, 1);
-
- // Parse title
- if (e = doc.getElementsByTagName('title')[0])
- el.metatitle.value = e.textContent || e.text;
-
- // Parse meta
- tinymce.each(doc.getElementsByTagName('meta'), function(n) {
- var na = (n.getAttribute('name', 2) || '').toLowerCase(), va = n.getAttribute('content', 2), eq = n.getAttribute('httpEquiv', 2) || '';
-
- e = el['meta' + na];
-
- if (na == 'robots') {
- selectByValue(f, 'metarobots', tinymce.trim(va), true, true);
- return;
- }
-
- switch (eq.toLowerCase()) {
- case "content-type":
- tmp = getReItem(/charset\s*=\s*(.*)\s*/gi, va, 1);
-
- // Override XML encoding
- if (tmp != "")
- xmlEnc = tmp;
-
- return;
- }
-
- if (e)
- e.value = va;
- });
-
- selectByValue(f, 'doctypes', docType, true, true);
- selectByValue(f, 'docencoding', xmlEnc, true, true);
- selectByValue(f, 'langdir', doc.body.getAttribute('dir', 2) || '', true, true);
-
- if (xmlVer != '')
- el.xml_pi.checked = true;
-
- // Parse appearance
-
- // Parse primary stylesheet
- tinymce.each(doc.getElementsByTagName("link"), function(l) {
- var m = l.getAttribute('media', 2) || '', t = l.getAttribute('type', 2) || '';
-
- if (t == "-mce-text/css" && (m == "" || m == "screen" || m == "all") && (l.getAttribute('rel', 2) || '') == "stylesheet") {
- f.stylesheet.value = l.getAttribute('_mce_href', 2) || '';
- return false;
- }
- });
-
- // Get from style elements
- tinymce.each(doc.getElementsByTagName("style"), function(st) {
- var tmp = parseStyleElement(st);
-
- for (x=0; x<tmp.length; x++) {
- if (tmp[x].rule.indexOf('a:visited') != -1 && tmp[x].data['color'])
- f.visited_color.value = tmp[x].data['color'];
-
- if (tmp[x].rule.indexOf('a:link') != -1 && tmp[x].data['color'])
- f.link_color.value = tmp[x].data['color'];
-
- if (tmp[x].rule.indexOf('a:active') != -1 && tmp[x].data['color'])
- f.active_color.value = tmp[x].data['color'];
- }
- });
-
- f.textcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "text");
- f.active_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "alink");
- f.link_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "link");
- f.visited_color.value = tinyMCEPopup.dom.getAttrib(doc.body, "vlink");
- f.bgcolor.value = tinyMCEPopup.dom.getAttrib(doc.body, "bgcolor");
- f.bgimage.value = tinyMCEPopup.dom.getAttrib(doc.body, "background");
-
- // Get from style info
- style = tinyMCEPopup.dom.parseStyle(tinyMCEPopup.dom.getAttrib(doc.body, 'style'));
-
- if (style['font-family'])
- selectByValue(f, 'fontface', style['font-family'], true, true);
- else
- selectByValue(f, 'fontface', ed.getParam("fullpage_default_fontface", ""), true, true);
-
- if (style['font-size'])
- selectByValue(f, 'fontsize', style['font-size'], true, true);
- else
- selectByValue(f, 'fontsize', ed.getParam("fullpage_default_fontsize", ""), true, true);
-
- if (style['color'])
- f.textcolor.value = convertRGBToHex(style['color']);
-
- if (style['background-image'])
- f.bgimage.value = style['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
-
- if (style['background-color'])
- f.bgcolor.value = style['background-color'];
-
- if (style['margin']) {
- tmp = style['margin'].replace(/[^0-9 ]/g, '');
- tmp = tmp.split(/ +/);
- f.topmargin.value = tmp.length > 0 ? tmp[0] : '';
- f.rightmargin.value = tmp.length > 1 ? tmp[1] : tmp[0];
- f.bottommargin.value = tmp.length > 2 ? tmp[2] : tmp[0];
- f.leftmargin.value = tmp.length > 3 ? tmp[3] : tmp[0];
- }
-
- if (style['margin-left'])
- f.leftmargin.value = style['margin-left'].replace(/[^0-9]/g, '');
-
- if (style['margin-right'])
- f.rightmargin.value = style['margin-right'].replace(/[^0-9]/g, '');
-
- if (style['margin-top'])
- f.topmargin.value = style['margin-top'].replace(/[^0-9]/g, '');
-
- if (style['margin-bottom'])
- f.bottommargin.value = style['margin-bottom'].replace(/[^0-9]/g, '');
-
- f.style.value = tinyMCEPopup.dom.serializeStyle(style);
-
- // Update colors
- updateColor('textcolor_pick', 'textcolor');
- updateColor('bgcolor_pick', 'bgcolor');
- updateColor('visited_color_pick', 'visited_color');
- updateColor('active_color_pick', 'active_color');
- updateColor('link_color_pick', 'link_color');
-}
-
-function getReItem(r, s, i) {
- var c = r.exec(s);
-
- if (c && c.length > i)
- return c[i];
-
- return '';
-}
-
-function updateAction() {
- var f = document.forms[0], nl, i, h, v, s, head, html, l, tmp, addlink = true, ser;
-
- head = doc.getElementsByTagName('head')[0];
-
- // Fix scripts without a type
- nl = doc.getElementsByTagName('script');
- for (i=0; i<nl.length; i++) {
- if (tinyMCEPopup.dom.getAttrib(nl[i], '_mce_type') == '')
- nl[i].setAttribute('_mce_type', 'text/javascript');
- }
-
- // Get primary stylesheet
- nl = doc.getElementsByTagName("link");
- for (i=0; i<nl.length; i++) {
- l = nl[i];
-
- tmp = tinyMCEPopup.dom.getAttrib(l, 'media');
-
- if (tinyMCEPopup.dom.getAttrib(l, '_mce_type') == "text/css" && (tmp == "" || tmp == "screen" || tmp == "all") && tinyMCEPopup.dom.getAttrib(l, 'rel') == "stylesheet") {
- addlink = false;
-
- if (f.stylesheet.value == '')
- l.parentNode.removeChild(l);
+(function() {
+ tinyMCEPopup.requireLangPack();
+
+ var defaultDocTypes =
+ 'XHTML 1.0 Transitional=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">,' +
+ 'XHTML 1.0 Frameset=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">,' +
+ 'XHTML 1.0 Strict=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">,' +
+ 'XHTML 1.1=<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">,' +
+ 'HTML 4.01 Transitional=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">,' +
+ 'HTML 4.01 Strict=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">,' +
+ 'HTML 4.01 Frameset=<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">';
+
+ var defaultEncodings =
+ 'Western european (iso-8859-1)=iso-8859-1,' +
+ 'Central European (iso-8859-2)=iso-8859-2,' +
+ 'Unicode (UTF-8)=utf-8,' +
+ 'Chinese traditional (Big5)=big5,' +
+ 'Cyrillic (iso-8859-5)=iso-8859-5,' +
+ 'Japanese (iso-2022-jp)=iso-2022-jp,' +
+ 'Greek (iso-8859-7)=iso-8859-7,' +
+ 'Korean (iso-2022-kr)=iso-2022-kr,' +
+ 'ASCII (us-ascii)=us-ascii';
+
+ var defaultFontNames = 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';
+ var defaultFontSizes = '10px,11px,12px,13px,14px,15px,16px';
+
+ function setVal(id, value) {
+ var elm = document.getElementById(id);
+
+ if (elm) {
+ value = value || '';
+
+ if (elm.nodeName == "SELECT")
+ selectByValue(document.forms[0], id, value);
+ else if (elm.type == "checkbox")
+ elm.checked = !!value;
else
- l.setAttribute('_mce_href', f.stylesheet.value);
-
- break;
+ elm.value = value;
}
- }
-
- // Add new link
- if (f.stylesheet.value != '') {
- l = doc.createElement('link');
-
- l.setAttribute('type', 'text/css');
- l.setAttribute('_mce_href', f.stylesheet.value);
- l.setAttribute('rel', 'stylesheet');
-
- head.appendChild(l);
- }
-
- setMeta(head, 'keywords', f.metakeywords.value);
- setMeta(head, 'description', f.metadescription.value);
- setMeta(head, 'author', f.metaauthor.value);
- setMeta(head, 'copyright', f.metacopyright.value);
- setMeta(head, 'robots', getSelectValue(f, 'metarobots'));
- setMeta(head, 'Content-Type', getSelectValue(f, 'docencoding'));
-
- doc.body.dir = getSelectValue(f, 'langdir');
- doc.body.style.cssText = f.style.value;
-
- doc.body.setAttribute('vLink', f.visited_color.value);
- doc.body.setAttribute('link', f.link_color.value);
- doc.body.setAttribute('text', f.textcolor.value);
- doc.body.setAttribute('aLink', f.active_color.value);
+ };
- doc.body.style.fontFamily = getSelectValue(f, 'fontface');
- doc.body.style.fontSize = getSelectValue(f, 'fontsize');
- doc.body.style.backgroundColor = f.bgcolor.value;
+ function getVal(id) {
+ var elm = document.getElementById(id);
- if (f.leftmargin.value != '')
- doc.body.style.marginLeft = f.leftmargin.value + 'px';
+ if (elm.nodeName == "SELECT")
+ return elm.options[elm.selectedIndex].value;
- if (f.rightmargin.value != '')
- doc.body.style.marginRight = f.rightmargin.value + 'px';
+ if (elm.type == "checkbox")
+ return elm.checked;
- if (f.bottommargin.value != '')
- doc.body.style.marginBottom = f.bottommargin.value + 'px';
+ return elm.value;
+ };
- if (f.topmargin.value != '')
- doc.body.style.marginTop = f.topmargin.value + 'px';
+ window.FullPageDialog = {
+ changedStyle : function() {
+ var val, styles = tinyMCEPopup.editor.dom.parseStyle(getVal('style'));
- html = doc.getElementsByTagName('html')[0];
- html.setAttribute('lang', f.langcode.value);
- html.setAttribute('xml:lang', f.langcode.value);
+ setVal('fontface', styles['font-face']);
+ setVal('fontsize', styles['font-size']);
+ setVal('textcolor', styles['color']);
- if (f.bgimage.value != '')
- doc.body.style.backgroundImage = "url('" + f.bgimage.value + "')";
- else
- doc.body.style.backgroundImage = '';
-
- ser = tinyMCEPopup.editor.plugins.fullpage._createSerializer();
- ser.setRules('-title,meta[http-equiv|name|content],base[href|target],link[href|rel|type|title|media],style[type],script[type|language|src],html[lang|xml::lang|xmlns],body[style|dir|vlink|link|text|alink],head');
-
- h = ser.serialize(doc.documentElement);
- h = h.substring(0, h.lastIndexOf('</body>'));
-
- if (h.indexOf('<title>') == -1)
- h = h.replace(/<head.*?>/, '$&\n' + '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');
- else
- h = h.replace(/<title>(.*?)<\/title>/, '<title>' + tinyMCEPopup.dom.encode(f.metatitle.value) + '</title>');
-
- if ((v = getSelectValue(f, 'doctypes')) != '')
- h = v + '\n' + h;
-
- if (f.xml_pi.checked) {
- s = '<?xml version="1.0"';
-
- if ((v = getSelectValue(f, 'docencoding')) != '')
- s += ' encoding="' + v + '"';
-
- s += '?>\n';
- h = s + h;
- }
-
- h = h.replace(/type=\"\-mce\-/gi, 'type="');
-
- tinyMCEPopup.editor.plugins.fullpage.head = h;
- tinyMCEPopup.editor.plugins.fullpage._setBodyAttribs(tinyMCEPopup.editor, {});
- tinyMCEPopup.close();
-}
+ if (val = styles['background-image'])
+ setVal('bgimage', val.replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1"));
+ else
+ setVal('bgimage', '');
+
+ setVal('bgcolor', styles['background-color']);
+
+ // Reset margin form elements
+ setVal('topmargin', '');
+ setVal('rightmargin', '');
+ setVal('bottommargin', '');
+ setVal('leftmargin', '');
+
+ // Expand margin
+ if (val = styles['margin']) {
+ val = val.split(' ');
+ styles['margin-top'] = val[0] || '';
+ styles['margin-right'] = val[1] || val[0] || '';
+ styles['margin-bottom'] = val[2] || val[0] || '';
+ styles['margin-left'] = val[3] || val[0] || '';
+ }
+
+ if (val = styles['margin-top'])
+ setVal('topmargin', val.replace(/px/, ''));
+
+ if (val = styles['margin-right'])
+ setVal('rightmargin', val.replace(/px/, ''));
+
+ if (val = styles['margin-bottom'])
+ setVal('bottommargin', val.replace(/px/, ''));
+
+ if (val = styles['margin-left'])
+ setVal('leftmargin', val.replace(/px/, ''));
+
+ updateColor('bgcolor_pick', 'bgcolor');
+ updateColor('textcolor_pick', 'textcolor');
+ },
+
+ changedStyleProp : function() {
+ var val, dom = tinyMCEPopup.editor.dom, styles = dom.parseStyle(getVal('style'));
+
+ styles['font-face'] = getVal('fontface');
+ styles['font-size'] = getVal('fontsize');
+ styles['color'] = getVal('textcolor');
+ styles['background-color'] = getVal('bgcolor');
+
+ if (val = getVal('bgimage'))
+ styles['background-image'] = "url('" + val + "')";
+ else
+ styles['background-image'] = '';
-function changedStyleField(field) {
-}
+ delete styles['margin'];
-function setMeta(he, k, v) {
- var nl, i, m;
+ if (val = getVal('topmargin'))
+ styles['margin-top'] = val + "px";
+ else
+ styles['margin-top'] = '';
- nl = he.getElementsByTagName('meta');
- for (i=0; i<nl.length; i++) {
- if (k == 'Content-Type' && tinyMCEPopup.dom.getAttrib(nl[i], 'http-equiv') == k) {
- if (v == '')
- nl[i].parentNode.removeChild(nl[i]);
+ if (val = getVal('rightmargin'))
+ styles['margin-right'] = val + "px";
else
- nl[i].setAttribute('content', "text/html; charset=" + v);
+ styles['margin-right'] = '';
- return;
- }
+ if (val = getVal('bottommargin'))
+ styles['margin-bottom'] = val + "px";
+ else
+ styles['margin-bottom'] = '';
- if (tinyMCEPopup.dom.getAttrib(nl[i], 'name') == k) {
- if (v == '')
- nl[i].parentNode.removeChild(nl[i]);
+ if (val = getVal('leftmargin'))
+ styles['margin-left'] = val + "px";
else
- nl[i].setAttribute('content', v);
- return;
+ styles['margin-left'] = '';
+
+ // Serialize, parse and reserialize this will compress redundant styles
+ setVal('style', dom.serializeStyle(dom.parseStyle(dom.serializeStyle(styles))));
+ this.changedStyle();
+ },
+
+ update : function() {
+ var data = {};
+
+ tinymce.each(tinyMCEPopup.dom.select('select,input,textarea'), function(node) {
+ data[node.id] = getVal(node.id);
+ });
+
+ tinyMCEPopup.editor.plugins.fullpage._dataToHtml(data);
+ tinyMCEPopup.close();
+ }
+ };
+
+ function init() {
+ var form = document.forms[0], i, item, list, editor = tinyMCEPopup.editor;
+
+ // Setup doctype select box
+ list = editor.getParam("fullpage_doctypes", defaultDocTypes).split(',');
+ for (i = 0; i < list.length; i++) {
+ item = list[i].split('=');
+
+ if (item.length > 1)
+ addSelectValue(form, 'doctype', item[0], item[1]);
}
- }
-
- if (v == '')
- return;
-
- m = doc.createElement('meta');
-
- if (k == 'Content-Type')
- m.httpEquiv = k;
- else
- m.setAttribute('name', k);
-
- m.setAttribute('content', v);
- he.appendChild(m);
-}
-
-function parseStyleElement(e) {
- var v = e.innerHTML;
- var p, i, r;
-
- v = v.replace(/<!--/gi, '');
- v = v.replace(/-->/gi, '');
- v = v.replace(/[\n\r]/gi, '');
- v = v.replace(/\s+/gi, ' ');
-
- r = [];
- p = v.split(/{|}/);
-
- for (i=0; i<p.length; i+=2) {
- if (p[i] != "")
- r[r.length] = {rule : tinymce.trim(p[i]), data : tinyMCEPopup.dom.parseStyle(p[i+1])};
- }
-
- return r;
-}
-
-function serializeStyleElement(d) {
- var i, s, st;
-
- s = '<!--\n';
-
- for (i=0; i<d.length; i++) {
- s += d[i].rule + ' {\n';
-
- st = tinyMCE.serializeStyle(d[i].data);
- if (st != '')
- st += ';';
+ // Setup fonts select box
+ list = editor.getParam("fullpage_fonts", defaultFontNames).split(';');
+ for (i = 0; i < list.length; i++) {
+ item = list[i].split('=');
- s += st.replace(/;/g, ';\n');
- s += '}\n';
+ if (item.length > 1)
+ addSelectValue(form, 'fontface', item[0], item[1]);
+ }
- if (i != d.length - 1)
- s += '\n';
- }
+ // Setup fontsize select box
+ list = editor.getParam("fullpage_fontsizes", defaultFontSizes).split(',');
+ for (i = 0; i < list.length; i++)
+ addSelectValue(form, 'fontsize', list[i], list[i]);
- s += '\n-->';
+ // Setup encodings select box
+ list = editor.getParam("fullpage_encodings", defaultEncodings).split(',');
+ for (i = 0; i < list.length; i++) {
+ item = list[i].split('=');
- return s;
-}
+ if (item.length > 1)
+ addSelectValue(form, 'docencoding', item[0], item[1]);
+ }
-tinyMCEPopup.onInit.add(init);
+ // Setup color pickers
+ document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
+ document.getElementById('link_color_pickcontainer').innerHTML = getColorPickerHTML('link_color_pick','link_color');
+ document.getElementById('visited_color_pickcontainer').innerHTML = getColorPickerHTML('visited_color_pick','visited_color');
+ document.getElementById('active_color_pickcontainer').innerHTML = getColorPickerHTML('active_color_pick','active_color');
+ document.getElementById('textcolor_pickcontainer').innerHTML = getColorPickerHTML('textcolor_pick','textcolor');
+ document.getElementById('stylesheet_browsercontainer').innerHTML = getBrowserHTML('stylesheetbrowser','stylesheet','file','fullpage');
+ document.getElementById('bgimage_pickcontainer').innerHTML = getBrowserHTML('bgimage_browser','bgimage','image','fullpage');
+
+ // Resize some elements
+ if (isVisible('stylesheetbrowser'))
+ document.getElementById('stylesheet').style.width = '220px';
+
+ if (isVisible('link_href_browser'))
+ document.getElementById('element_link_href').style.width = '230px';
+
+ if (isVisible('bgimage_browser'))
+ document.getElementById('bgimage').style.width = '210px';
+
+ // Update form
+ tinymce.each(tinyMCEPopup.getWindowArg('data'), function(value, key) {
+ setVal(key, value);
+ });
+
+ FullPageDialog.changedStyle();
+
+ // Update colors
+ updateColor('textcolor_pick', 'textcolor');
+ updateColor('bgcolor_pick', 'bgcolor');
+ updateColor('visited_color_pick', 'visited_color');
+ updateColor('active_color_pick', 'active_color');
+ updateColor('link_color_pick', 'link_color');
+ };
+
+ tinyMCEPopup.onInit.add(init);
+})();