Skip to content
Snippets Groups Projects
Commit bf01809f authored by Seth Meranda's avatar Seth Meranda
Browse files

upgrade to TinyMCE 3.3.8

parent 0e53f022
Branches
No related tags found
No related merge requests found
Showing
with 590 additions and 234 deletions
(function(b){var c,a=[];function e(g,f,i){var h;h=b.fn[f];b.fn[f]=function(){var j;if(g!=="after"){j=i.apply(this,arguments);if(j!==undefined){return j}}j=h.apply(this,arguments);if(g!=="before"){i.apply(this,arguments)}return j}}b.fn.tinymce=function(i){var h=this,g,j="",f;if(!h.length){return}if(!i){return tinyMCE.get(this[0].id)}function k(){if(d){d();d=null}h.each(function(m,p){var l,o=p.id||tinymce.DOM.uniqueId();p.id=o;l=new tinymce.Editor(o,i);l.render()})}if(!window.tinymce&&!c&&(g=i.script_url)){c=1;if(/_(src|dev)\.js/g.test(g)){j="_src"}window.tinyMCEPreInit={base:g.substring(0,g.lastIndexOf("/")),suffix:j,query:""};b.getScript(g,function(){tinymce.dom.Event.domLoaded=1;c=2;k();b.each(a,function(l,m){m()})})}else{if(c===1){a.push(k)}else{k()}}};b.extend(b.expr[":"],{tinymce:function(f){return f.id&&!!tinyMCE.get(f.id)}});function d(){function f(){this.find("span.mceEditor,div.mceEditor").each(function(j,k){var h;if(h=tinyMCE.get(k.id.replace(/_parent$/,""))){h.remove()}})}function g(i){var h;if(i!==undefined){f.call(this);this.each(function(k,l){var j;if(j=tinyMCE.get(l.id)){j.setContent(i)}})}else{if(this.length>0){if(h=tinyMCE.get(this[0].id)){return h.getContent()}}}}e("both","text",function(h){if(h!==undefined){return g.call(this,h)}if(this.length>0){if(ed=tinyMCE.get(this[0].id)){return ed.getContent().replace(/<[^>]+>/g,"")}}});b.each(["val","html"],function(j,h){e("both",h,g)});b.each(["append","prepend"],function(j,h){e("before",h,function(i){if(i!==undefined){this.each(function(l,m){var k;if(k=tinyMCE.get(m.id)){if(h==="append"){k.setContent(k.getContent()+i)}else{k.setContent(i+k.getContent())}}})}})});e("both","attr",function(h,i){if(h&&h==="value"){return g.call(this,i)}});b.each(["remove","replaceWith","replaceAll","empty"],function(j,h){e("before",h,f)})}})(jQuery);
\ No newline at end of file
(function(b){var e,d,a=[],c=window;b.fn.tinymce=function(j){var p=this,g,k,h,m,i,l="",n="";if(!p.length){return p}if(!j){return tinyMCE.get(p[0].id)}function o(){var r=[],q=0;if(f){f();f=null}p.each(function(t,u){var s,w=u.id,v=j.oninit;if(!w){u.id=w=tinymce.DOM.uniqueId()}s=new tinymce.Editor(w,j);r.push(s);if(v){s.onInit.add(function(){var x,y=v;if(++q==r.length){if(tinymce.is(y,"string")){x=(y.indexOf(".")===-1)?null:tinymce.resolve(y.replace(/\.\w+$/,""));y=tinymce.resolve(y)}y.apply(x||tinymce,r)}})}});b.each(r,function(t,s){s.render()})}if(!c.tinymce&&!d&&(g=j.script_url)){d=1;h=g.substring(0,g.lastIndexOf("/"));if(/_(src|dev)\.js/g.test(g)){n="_src"}m=g.lastIndexOf("?");if(m!=-1){l=g.substring(m+1)}c.tinyMCEPreInit=c.tinyMCEPreInit||{base:h,suffix:n,query:l};if(g.indexOf("gzip")!=-1){i=j.language||"en";g=g+(/\?/.test(g)?"&":"?")+"js=true&core=true&suffix="+escape(n)+"&themes="+escape(j.theme)+"&plugins="+escape(j.plugins)+"&languages="+i;if(!c.tinyMCE_GZ){tinyMCE_GZ={start:function(){tinymce.suffix=n;function q(r){tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(r))}q("langs/"+i+".js");q("themes/"+j.theme+"/editor_template"+n+".js");q("themes/"+j.theme+"/langs/"+i+".js");b.each(j.plugins.split(","),function(s,r){if(r){q("plugins/"+r+"/editor_plugin"+n+".js");q("plugins/"+r+"/langs/"+i+".js")}})},end:function(){}}}}b.ajax({type:"GET",url:g,dataType:"script",cache:true,success:function(){tinymce.dom.Event.domLoaded=1;d=2;if(j.script_loaded){j.script_loaded()}o();b.each(a,function(q,r){r()})}})}else{if(d===1){a.push(o)}else{o()}}return p};b.extend(b.expr[":"],{tinymce:function(g){return g.id&&!!tinyMCE.get(g.id)}});function f(){function i(l){if(l==="remove"){this.each(function(n,o){var m=h(o);if(m){m.remove()}})}this.find("span.mceEditor,div.mceEditor").each(function(n,o){var m=tinyMCE.get(o.id.replace(/_parent$/,""));if(m){m.remove()}})}function k(n){var m=this,l;if(n!==e){i.call(m);m.each(function(p,q){var o;if(o=tinyMCE.get(q.id)){o.setContent(n)}})}else{if(m.length>0){if(l=tinyMCE.get(m[0].id)){return l.getContent()}}}}function h(m){var l=null;(m)&&(m.id)&&(c.tinymce)&&(l=tinyMCE.get(m.id));return l}function g(l){return !!((l)&&(l.length)&&(c.tinymce)&&(l.is(":tinymce")))}var j={};b.each(["text","html","val"],function(n,l){var o=j[l]=b.fn[l],m=(l==="text");b.fn[l]=function(s){var p=this;if(!g(p)){return o.apply(p,arguments)}if(s!==e){k.call(p.filter(":tinymce"),s);o.apply(p.not(":tinymce"),arguments);return p}else{var r="";var q=arguments;(m?p:p.eq(0)).each(function(u,v){var t=h(v);r+=t?(m?t.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):t.getContent()):o.apply(b(v),q)});return r}}});b.each(["append","prepend"],function(n,m){var o=j[m]=b.fn[m],l=(m==="prepend");b.fn[m]=function(q){var p=this;if(!g(p)){return o.apply(p,arguments)}if(q!==e){p.filter(":tinymce").each(function(s,t){var r=h(t);r&&r.setContent(l?q+r.getContent():r.getContent()+q)});o.apply(p.not(":tinymce"),arguments);return p}}});b.each(["remove","replaceWith","replaceAll","empty"],function(m,l){var n=j[l]=b.fn[l];b.fn[l]=function(){i.call(this,l);return n.apply(this,arguments)}});j.attr=b.fn.attr;b.fn.attr=function(n,q,o){var m=this;if((!n)||(n!=="value")||(!g(m))){return j.attr.call(m,n,q,o)}if(q!==e){k.call(m.filter(":tinymce"),q);j.attr.call(m.not(":tinymce"),n,q,o);return m}else{var p=m[0],l=h(p);return l?l.getContent():j.attr.call(b(p),n,q,o)}}}})(jQuery);
\ No newline at end of file
......@@ -90,7 +90,9 @@ desc:"Edit CSS Style"
paste:{
paste_text_desc:"Paste as Plain Text",
paste_word_desc:"Paste from Word",
selectall_desc:"Select All"
selectall_desc:"Select All",
plaintext_mode_sticky:"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.",
plaintext_mode:"Paste is now in plain text mode. Click again to toggle back to regular paste mode."
},
paste_dlg:{
text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
......@@ -120,7 +122,9 @@ col:"Column",
cell:"Cell"
},
autosave:{
unload_msg:"The changes you made will be lost if you navigate away from this page."
unload_msg:"The changes you made will be lost if you navigate away from this page.",
restore_content:"Restore auto-saved content.",
warning_message:"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?."
},
fullscreen:{
desc:"Toggle fullscreen mode"
......@@ -151,4 +155,16 @@ no_mpell:"No misspellings found."
},
pagebreak:{
desc:"Insert page break."
},
advlist:{
types:"Types",
def:"Default",
lower_alpha:"Lower alpha",
lower_greek:"Lower greek",
lower_roman:"Lower roman",
upper_alpha:"Upper alpha",
upper_roman:"Upper roman",
circle:"Circle",
disc:"Disc",
square:"Square"
}}});
\ No newline at end of file
(function(){var a=tinymce.each;tinymce.create("tinymce.plugins.AdvListPlugin",{init:function(b,c){var d=this;d.editor=b;function e(g){var f=[];a(g.split(/,/),function(h){f.push({title:"advlist."+(h=="default"?"def":h.replace(/-/g,"_")),styles:{listStyleType:h=="default"?"":h}})});return f}d.numlist=b.getParam("advlist_number_styles")||e("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");d.bullist=b.getParam("advlist_bullet_styles")||e("default,circle,disc,square")},createControl:function(d,b){var f=this,e,h;if(d=="numlist"||d=="bullist"){if(f[d][0].title=="advlist.def"){h=f[d][0]}function c(i,k){var j=true;a(k.styles,function(m,l){if(f.editor.dom.getStyle(i,l)!=m){j=false;return false}});return j}function g(){var k,i=f.editor,l=i.dom,j=i.selection;k=l.getParent(j.getNode(),"ol,ul");if(!k||k.nodeName==(d=="bullist"?"OL":"UL")||c(k,h)){i.execCommand(d=="bullist"?"InsertUnorderedList":"InsertOrderedList")}if(h){k=l.getParent(j.getNode(),"ol,ul");if(k){l.setStyles(k,h.styles);k.removeAttribute("_mce_style")}}}e=b.createSplitButton(d,{title:"advanced."+d+"_desc","class":"mce_"+d,onclick:function(){g()}});e.onRenderMenu.add(function(i,j){j.onShowMenu.add(function(){var m=f.editor.dom,l=m.getParent(f.editor.selection.getNode(),"ol,ul"),k;if(l||h){k=f[d];a(j.items,function(n){var o=true;n.setSelected(0);if(l&&!n.isDisabled()){a(k,function(p){if(p.id==n.id){if(!c(l,p)){o=false;return false}}});if(o){n.setSelected(1)}}});if(!l){j.items[h.id].setSelected(1)}}});j.add({id:f.editor.dom.uniqueId(),title:"advlist.types","class":"mceMenuItemTitle"}).setDisabled(1);a(f[d],function(k){k.id=f.editor.dom.uniqueId();j.add({id:k.id,title:k.title,onclick:function(){h=k;g()}})})});return e}},getInfo:function(){return{longname:"Advanced lists",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("advlist",tinymce.plugins.AdvListPlugin)})();
\ No newline at end of file
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
var each = tinymce.each;
tinymce.create('tinymce.plugins.AdvListPlugin', {
init : function(ed, url) {
var t = this;
t.editor = ed;
function buildFormats(str) {
var formats = [];
each(str.split(/,/), function(type) {
formats.push({
title : 'advlist.' + (type == 'default' ? 'def' : type.replace(/-/g, '_')),
styles : {
listStyleType : type == 'default' ? '' : type
}
});
});
return formats;
};
// Setup number formats from config or default
t.numlist = ed.getParam("advlist_number_styles") || buildFormats("default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman");
t.bullist = ed.getParam("advlist_bullet_styles") || buildFormats("default,circle,disc,square");
},
createControl: function(name, cm) {
var t = this, btn, format;
if (name == 'numlist' || name == 'bullist') {
// Default to first item if it's a default item
if (t[name][0].title == 'advlist.def')
format = t[name][0];
function hasFormat(node, format) {
var state = true;
each(format.styles, function(value, name) {
// Format doesn't match
if (t.editor.dom.getStyle(node, name) != value) {
state = false;
return false;
}
});
return state;
};
function applyListFormat() {
var list, ed = t.editor, dom = ed.dom, sel = ed.selection;
// Check for existing list element
list = dom.getParent(sel.getNode(), 'ol,ul');
// Switch/add list type if needed
if (!list || list.nodeName == (name == 'bullist' ? 'OL' : 'UL') || hasFormat(list, format))
ed.execCommand(name == 'bullist' ? 'InsertUnorderedList' : 'InsertOrderedList');
// Append styles to new list element
if (format) {
list = dom.getParent(sel.getNode(), 'ol,ul');
if (list) {
dom.setStyles(list, format.styles);
list.removeAttribute('_mce_style');
}
}
};
btn = cm.createSplitButton(name, {
title : 'advanced.' + name + '_desc',
'class' : 'mce_' + name,
onclick : function() {
applyListFormat();
}
});
btn.onRenderMenu.add(function(btn, menu) {
menu.onShowMenu.add(function() {
var dom = t.editor.dom, list = dom.getParent(t.editor.selection.getNode(), 'ol,ul'), fmtList;
if (list || format) {
fmtList = t[name];
// Unselect existing items
each(menu.items, function(item) {
var state = true;
item.setSelected(0);
if (list && !item.isDisabled()) {
each(fmtList, function(fmt) {
if (fmt.id == item.id) {
if (!hasFormat(list, fmt)) {
state = false;
return false;
}
}
});
if (state)
item.setSelected(1);
}
});
// Select the current format
if (!list)
menu.items[format.id].setSelected(1);
}
});
menu.add({id : t.editor.dom.uniqueId(), title : 'advlist.types', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
each(t[name], function(item) {
item.id = t.editor.dom.uniqueId();
menu.add({id : item.id, title : item.title, onclick : function() {
format = item;
applyListFormat();
}});
});
});
return btn;
}
},
getInfo : function() {
return {
longname : 'Advanced lists',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlist',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});
// Register plugin
tinymce.PluginManager.add('advlist', tinymce.plugins.AdvListPlugin);
})();
\ No newline at end of file
(function(a){a.onAddEditor.addToTop(function(c,b){b.settings.inline_styles=false});a.create("tinymce.plugins.LegacyOutput",{init:function(b){b.onInit.add(function(){var c="p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",e=a.explode(b.settings.font_size_style_values),d=b.serializer;b.formatter.register({alignleft:{selector:c,attributes:{align:"left"}},aligncenter:{selector:c,attributes:{align:"center"}},alignright:{selector:c,attributes:{align:"right"}},alignfull:{selector:c,attributes:{align:"full"}},bold:{inline:"b"},italic:{inline:"i"},underline:{inline:"u"},strikethrough:{inline:"strike"},fontname:{inline:"font",attributes:{face:"%value"}},fontsize:{inline:"font",attributes:{size:function(f){return a.inArray(e,f.value)+1}}},forecolor:{inline:"font",styles:{color:"%value"}},hilitecolor:{inline:"font",styles:{backgroundColor:"%value"}}});d._setup();a.each("b,i,u,strike".split(","),function(f){var g=d.rules[f];if(!g){d.addRules(f)}});if(!d.rules.font){d.addRules("font[face|size|color|style]")}a.each(c.split(","),function(f){var h=d.rules[f],g;if(h){a.each(h.attribs,function(j,i){if(i.name=="align"){g=true;return false}});if(!g){h.attribs.push({name:"align"})}}});b.onNodeChange.add(function(g,k){var j,f,h,i;f=g.dom.getParent(g.selection.getNode(),"font");if(f){h=f.face;i=f.size}if(j=k.get("fontselect")){j.select(function(l){return l==h})}if(j=k.get("fontsizeselect")){j.select(function(m){var l=a.inArray(e,m.fontSize);return l+1==i})}})})},getInfo:function(){return{longname:"LegacyOutput",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput",version:a.majorVersion+"."+a.minorVersion}}});a.PluginManager.add("legacyoutput",a.plugins.LegacyOutput)})(tinymce);
\ No newline at end of file
/**
* editor_plugin_src.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*
* This plugin will force TinyMCE to produce deprecated legacy output such as font elements, u elements, align
* attributes and so forth. There are a few cases where these old items might be needed for example in email applications or with Flash
*
* However you should NOT use this plugin if you are building some system that produces web contents such as a CMS. All these elements are
* not apart of the newer specifications for HTML and XHTML.
*/
(function(tinymce) {
// Override inline_styles setting to force TinyMCE to produce deprecated contents
tinymce.onAddEditor.addToTop(function(tinymce, editor) {
editor.settings.inline_styles = false;
});
// Create the legacy ouput plugin
tinymce.create('tinymce.plugins.LegacyOutput', {
init : function(editor) {
editor.onInit.add(function() {
var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',
fontSizes = tinymce.explode(editor.settings.font_size_style_values),
serializer = editor.serializer;
// Override some internal formats to produce legacy elements and attributes
editor.formatter.register({
// Change alignment formats to use the deprecated align attribute
alignleft : {selector : alignElements, attributes : {align : 'left'}},
aligncenter : {selector : alignElements, attributes : {align : 'center'}},
alignright : {selector : alignElements, attributes : {align : 'right'}},
alignfull : {selector : alignElements, attributes : {align : 'full'}},
// Change the basic formatting elements to use deprecated element types
bold : {inline : 'b'},
italic : {inline : 'i'},
underline : {inline : 'u'},
strikethrough : {inline : 'strike'},
// Change font size and font family to use the deprecated font element
fontname : {inline : 'font', attributes : {face : '%value'}},
fontsize : {
inline : 'font',
attributes : {
size : function(vars) {
return tinymce.inArray(fontSizes, vars.value) + 1;
}
}
},
// Setup font elements for colors as well
forecolor : {inline : 'font', styles : {color : '%value'}},
hilitecolor : {inline : 'font', styles : {backgroundColor : '%value'}}
});
// Force parsing of the serializer rules
serializer._setup();
// Check that deprecated elements are allowed if not add them
tinymce.each('b,i,u,strike'.split(','), function(name) {
var rule = serializer.rules[name];
if (!rule)
serializer.addRules(name);
});
// Add font element if it's missing
if (!serializer.rules["font"])
serializer.addRules("font[face|size|color|style]");
// Add the missing and depreacted align attribute for the serialization engine
tinymce.each(alignElements.split(','), function(name) {
var rule = serializer.rules[name], found;
if (rule) {
tinymce.each(rule.attribs, function(name, attr) {
if (attr.name == 'align') {
found = true;
return false;
}
});
if (!found)
rule.attribs.push({name : 'align'});
}
});
// Listen for the onNodeChange event so that we can do special logic for the font size and font name drop boxes
editor.onNodeChange.add(function(editor, control_manager) {
var control, fontElm, fontName, fontSize;
// Find font element get it's name and size
fontElm = editor.dom.getParent(editor.selection.getNode(), 'font');
if (fontElm) {
fontName = fontElm.face;
fontSize = fontElm.size;
}
// Select/unselect the font name in droplist
if (control = control_manager.get('fontselect')) {
control.select(function(value) {
return value == fontName;
});
}
// Select/unselect the font size in droplist
if (control = control_manager.get('fontsizeselect')) {
control.select(function(value) {
var index = tinymce.inArray(fontSizes, value.fontSize);
return index + 1 == fontSize;
});
}
});
});
},
getInfo : function() {
return {
longname : 'LegacyOutput',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/legacyoutput',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
}
});
// Register plugin
tinymce.PluginManager.add('legacyoutput', tinymce.plugins.LegacyOutput);
})(tinymce);
\ No newline at end of file
......@@ -48,9 +48,7 @@
</div>
<div class="mceActionPanel">
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</body>
</html>
......@@ -18,14 +18,9 @@
</table>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" id="insert" name="insert" value="{#update}" />
</div>
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
</body>
</html>
......@@ -2,7 +2,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{#advanced_dlg.charmap_title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/charmap.js"></script>
</head>
......
......@@ -60,9 +60,7 @@
</div>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" id="insert" name="insert" value="{#apply}" />
</div>
<div id="preview"></div>
......
This diff is collapsed.
/**
* $Id: editor_template_src.js 1045 2009-03-04 20:03:18Z spocke $
* editor_template_src.js
*
* @author Moxiecode
* @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved.
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function(tinymce) {
......@@ -97,12 +100,9 @@
if (k == v && v >= 1 && v <= 7) {
k = v + ' (' + t.sizes[v - 1] + 'pt)';
if (ed.settings.convert_fonts_to_spans) {
cl = s.font_size_classes[v - 1];
v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');
}
}
if (/^\s*\./.test(v))
cl = v.replace(/\./g, '');
......@@ -121,6 +121,7 @@
// Init editor
ed.onInit.add(function() {
if (!ed.settings.readonly)
ed.onNodeChange.add(t._nodeChanged, t);
if (ed.settings.content_css !== false)
......@@ -194,36 +195,93 @@
},
_importClasses : function(e) {
var ed = this.editor, c = ed.controlManager.get('styleselect');
var ed = this.editor, ctrl = ed.controlManager.get('styleselect');
if (ctrl.getLength() == 0) {
each(ed.dom.getClasses(), function(o, idx) {
var name = 'style_' + idx;
if (c.getLength() == 0) {
each(ed.dom.getClasses(), function(o) {
c.add(o['class'], o['class']);
ed.formatter.register(name, {
inline : 'span',
attributes : {'class' : o['class']},
selector : '*'
});
ctrl.add(o['class'], name);
});
}
},
_createStyleSelect : function(n) {
var t = this, ed = t.editor, cf = ed.controlManager, c = cf.createListBox('styleselect', {
var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;
// Setup style select box
ctrl = ctrlMan.createListBox('styleselect', {
title : 'advanced.style_select',
onselect : function(v) {
if (c.selectedValue === v) {
ed.execCommand('mceSetStyleInfo', 0, {command : 'removeformat'});
c.select();
return false;
} else
ed.execCommand('mceSetCSSClass', 0, v);
onselect : function(name) {
var matches, formatNames = [];
each(ctrl.items, function(item) {
formatNames.push(item.value);
});
ed.focus();
ed.undoManager.add();
// Toggle off the current format
matches = ed.formatter.matchAll(formatNames);
if (!name || matches[0] == name)
ed.formatter.remove(matches[0]);
else
ed.formatter.apply(name);
ed.undoManager.add();
ed.nodeChanged();
return false; // No auto select
}
});
if (c) {
each(ed.getParam('theme_advanced_styles', '', 'hash'), function(v, k) {
if (v)
c.add(t.editor.translate(k), v);
// Handle specified format
ed.onInit.add(function() {
var counter = 0, formats = ed.getParam('style_formats');
if (formats) {
each(formats, function(fmt) {
var name, keys = 0;
each(fmt, function() {keys++;});
if (keys > 1) {
name = fmt.name = fmt.name || 'style_' + (counter++);
ed.formatter.register(name, fmt);
ctrl.add(fmt.title, name);
} else
ctrl.add(fmt.title);
});
} else {
each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {
var name;
if (val) {
name = 'style_' + (counter++);
ed.formatter.register(name, {
inline : 'span',
classes : val,
selector : '*'
});
c.onPostRender.add(function(ed, n) {
if (!c.NativeListBox) {
ctrl.add(t.editor.translate(key), name);
}
});
}
});
// Auto import classes if the ctrl box is empty
if (ctrl.getLength() == 0) {
ctrl.onPostRender.add(function(ed, n) {
if (!ctrl.NativeListBox) {
Event.add(n.id + '_text', 'focus', t._importClasses, t);
Event.add(n.id + '_text', 'mousedown', t._importClasses, t);
Event.add(n.id + '_open', 'focus', t._importClasses, t);
......@@ -233,13 +291,33 @@
});
}
return c;
return ctrl;
},
_createFontSelect : function() {
var c, t = this, ed = t.editor;
c = ed.controlManager.createListBox('fontselect', {title : 'advanced.fontdefault', cmd : 'FontName'});
c = ed.controlManager.createListBox('fontselect', {
title : 'advanced.fontdefault',
onselect : function(v) {
var cur = c.items[c.selectedIndex];
if (!v && cur) {
ed.execCommand('FontName', false, cur.value);
return;
}
ed.execCommand('FontName', false, v);
// Fake selection, execCommand will fire a nodeChange and update the selection
c.select(function(sv) {
return v == sv;
});
return false; // No auto select
}
});
if (c) {
each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) {
c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''});
......@@ -253,16 +331,37 @@
var t = this, ed = t.editor, c, i = 0, cl = [];
c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
if (v.fontSize)
var cur = c.items[c.selectedIndex];
if (!v && cur) {
cur = cur.value;
if (cur['class']) {
ed.formatter.toggle('fontsize_class', {value : cur['class']});
ed.undoManager.add();
ed.nodeChanged();
} else {
ed.execCommand('FontSize', false, cur.fontSize);
}
return;
}
if (v['class']) {
ed.focus();
ed.undoManager.add();
ed.formatter.toggle('fontsize_class', {value : v['class']});
ed.undoManager.add();
ed.nodeChanged();
} else
ed.execCommand('FontSize', false, v.fontSize);
else {
each(t.settings.theme_advanced_font_sizes, function(v, k) {
if (v['class'])
cl.push(v['class']);
// Fake selection, execCommand will fire a nodeChange and update the selection
c.select(function(sv) {
return v == sv;
});
ed.editorCommands._applyInlineStyle('span', {'class' : v['class']}, {check_classes : cl});
}
return false; // No auto select
}});
if (c) {
......@@ -473,7 +572,7 @@
},
resizeTo : function(w, h) {
var ed = this.editor, s = ed.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr'), dh;
var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');
// Boundery fix box
w = Math.max(s.theme_advanced_resizing_min_width || 100, w);
......@@ -481,12 +580,18 @@
w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w);
h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h);
// Calc difference between iframe and container
dh = e.clientHeight - ifr.clientHeight;
// Resize iframe and container
DOM.setStyle(ifr, 'height', h - dh);
DOM.setStyles(e, {width : w, height : h});
DOM.setStyle(e, 'height', '');
DOM.setStyle(ifr, 'height', h);
if (s.theme_advanced_resize_horizontal) {
DOM.setStyle(e, 'width', '');
DOM.setStyle(ifr, 'width', w);
// Make sure that the size is never smaller than the over all ui
if (w < e.clientWidth)
DOM.setStyle(ifr, 'width', e.clientWidth);
}
},
destroy : function() {
......@@ -700,99 +805,53 @@
if (!o)
return;
if (s.theme_advanced_resize_horizontal)
c.style.width = Math.max(10, o.cw) + 'px';
c.style.height = Math.max(10, o.ch) + 'px';
DOM.get(ed.id + '_ifr').style.height = Math.max(10, parseInt(o.ch) + t.deltaHeight) + 'px';
t.resizeTo(o.cw, o.ch);
});
}
ed.onPostRender.add(function() {
Event.add(ed.id + '_resize', 'mousedown', function(e) {
var c, p, w, h, n, pa;
// Measure container
c = DOM.get(ed.id + '_tbl');
w = c.clientWidth;
h = c.clientHeight;
miw = s.theme_advanced_resizing_min_width || 100;
mih = s.theme_advanced_resizing_min_height || 100;
maw = s.theme_advanced_resizing_max_width || 0xFFFF;
mah = s.theme_advanced_resizing_max_height || 0xFFFF;
// Setup placeholder
p = DOM.add(DOM.get(ed.id + '_parent'), 'div', {'class' : 'mcePlaceHolder'});
DOM.setStyles(p, {width : w, height : h});
// Replace with placeholder
DOM.hide(c);
DOM.show(p);
// Create internal resize obj
r = {
x : e.screenX,
y : e.screenY,
w : w,
h : h,
dx : null,
dy : null
};
// Start listening
mf = Event.add(DOM.doc, 'mousemove', function(e) {
var w, h;
var mouseMoveHandler1, mouseMoveHandler2,
mouseUpHandler1, mouseUpHandler2,
startX, startY, startWidth, startHeight, width, height, ifrElm;
// Calc delta values
r.dx = e.screenX - r.x;
r.dy = e.screenY - r.y;
// Boundery fix box
w = Math.max(miw, r.w + r.dx);
h = Math.max(mih, r.h + r.dy);
w = Math.min(maw, w);
h = Math.min(mah, h);
function resizeOnMove(e) {
width = startWidth + (e.screenX - startX);
height = startHeight + (e.screenY - startY);
// Resize placeholder
if (s.theme_advanced_resize_horizontal)
p.style.width = w + 'px';
p.style.height = h + 'px';
return Event.cancel(e);
});
me = Event.add(DOM.doc, 'mouseup', function(e) {
var ifr;
t.resizeTo(width, height);
};
function endResize(e) {
// Stop listening
Event.remove(DOM.doc, 'mousemove', mf);
Event.remove(DOM.doc, 'mouseup', me);
c.style.display = '';
DOM.remove(p);
if (r.dx === null)
return;
ifr = DOM.get(ed.id + '_ifr');
if (s.theme_advanced_resize_horizontal)
c.style.width = Math.max(10, r.w + r.dx) + 'px';
c.style.height = Math.max(10, r.h + r.dy) + 'px';
ifr.style.height = Math.max(10, ifr.clientHeight + r.dy) + 'px';
Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);
Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);
Event.remove(DOM.doc, 'mouseup', mouseUpHandler1);
Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2);
// Store away the size
if (s.theme_advanced_resizing_use_cookie) {
Cookie.setHash("TinyMCE_" + ed.id + "_size", {
cw : r.w + r.dx,
ch : r.h + r.dy
cw : width,
ch : height
});
}
});
};
return Event.cancel(e);
e.preventDefault();
// Get the current rect size
startX = e.screenX;
startY = e.screenY;
ifrElm = DOM.get(t.editor.id + '_ifr');
startWidth = width = ifrElm.clientWidth;
startHeight = height = ifrElm.clientHeight;
// Register envent handlers
mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove);
mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove);
mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize);
mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize);
});
});
}
......@@ -801,22 +860,34 @@
n = tb = null;
},
_nodeChanged : function(ed, cm, n, co) {
var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn;
if (s.readonly)
return;
_nodeChanged : function(ed, cm, n, co, ob) {
var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, formatNames, matches;
tinymce.each(t.stateControls, function(c) {
cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
});
function getParent(name) {
var i, parents = ob.parents, func = name;
if (typeof(name) == 'string') {
func = function(node) {
return node.nodeName == name;
};
}
for (i = 0; i < parents.length; i++) {
if (func(parents[i]))
return parents[i];
}
};
cm.setActive('visualaid', ed.hasVisual);
cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
cm.setDisabled('redo', !ed.undoManager.hasRedo());
cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
p = DOM.getParent(n, 'A');
p = getParent('A');
if (c = cm.get('link')) {
if (!p || !p.name) {
c.setDisabled(!p && co);
......@@ -831,34 +902,33 @@
if (c = cm.get('anchor')) {
c.setActive(!!p && p.name);
if (tinymce.isWebKit) {
p = DOM.getParent(n, 'IMG');
c.setActive(!!p && DOM.getAttrib(p, 'mce_name') == 'a');
}
}
p = DOM.getParent(n, 'IMG');
p = getParent('IMG');
if (c = cm.get('image'))
c.setActive(!!p && n.className.indexOf('mceItem') == -1);
if (c = cm.get('styleselect')) {
if (n.className) {
t._importClasses();
c.select(n.className);
} else
c.select();
formatNames = [];
each(c.items, function(item) {
formatNames.push(item.value);
});
matches = ed.formatter.matchAll(formatNames);
c.select(matches[0]);
}
if (c = cm.get('formatselect')) {
p = DOM.getParent(n, DOM.isBlock);
p = getParent(DOM.isBlock);
if (p)
c.select(p.nodeName.toLowerCase());
}
if (ed.settings.convert_fonts_to_spans) {
ed.dom.getParent(n, function(n) {
// Find out current fontSize, fontFamily and fontClass
getParent(function(n) {
if (n.nodeName === 'SPAN') {
if (!cl && n.className)
cl = n.className;
......@@ -879,7 +949,12 @@
});
}
// Select font size
if (c = cm.get('fontsizeselect')) {
// Use computed style
if (s.theme_advanced_runtime_fontsize && !fz && !cl)
fz = ed.dom.getStyle(n, 'fontSize', true);
c.select(function(v) {
if (v.fontSize && v.fontSize === fz)
return true;
......@@ -888,25 +963,17 @@
return true;
});
}
} else {
if (c = cm.get('fontselect'))
c.select(ed.queryCommandValue('FontName'));
if (c = cm.get('fontsizeselect')) {
v = ed.queryCommandValue('FontSize');
c.select(function(iv) {
return iv.fontSize == v;
});
}
}
if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
DOM.setHTML(p, '');
ed.dom.getParent(n, function(n) {
getParent(function(n) {
var na = n.nodeName.toLowerCase(), u, pi, ti = '';
/*if (n.getAttribute('_mce_bogus'))
return;
*/
// Ignore non element and hidden elements
if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
return;
......@@ -950,9 +1017,6 @@
break;
case 'font':
if (s.convert_fonts_to_spans)
na = 'span';
if (v = DOM.getAttrib(n, 'face'))
ti += 'font: ' + v + ' ';
......@@ -975,9 +1039,9 @@
ti += 'id: ' + v + ' ';
if (v = n.className) {
v = v.replace(/(webkit-[\w\-]+|Apple-[\w\-]+|mceItem\w+|mceVisualAid)/g, '');
v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
if (v && v.indexOf('mceItem') == -1) {
if (v) {
ti += 'class: ' + v + ' ';
if (DOM.isBlock(n) || na == 'img' || na == 'span')
......
......@@ -72,14 +72,9 @@
</div>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" id="insert" name="insert" value="{#insert}" />
</div>
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
</body>
</html>
themes/advanced/img/icons.gif

11.2 KiB | W: | H:

themes/advanced/img/icons.gif

11.5 KiB | W: | H:

themes/advanced/img/icons.gif
themes/advanced/img/icons.gif
themes/advanced/img/icons.gif
themes/advanced/img/icons.gif
  • 2-up
  • Swipe
  • Onion skin
......@@ -5,7 +5,7 @@ var AnchorDialog = {
var action, elm, f = document.forms[0];
this.editor = ed;
elm = ed.dom.getParent(ed.selection.getNode(), 'A,IMG');
elm = ed.dom.getParent(ed.selection.getNode(), 'A');
v = ed.dom.getAttrib(elm, 'name');
if (v) {
......@@ -17,18 +17,18 @@ var AnchorDialog = {
},
update : function() {
var ed = this.editor;
var ed = this.editor, elm, name = document.forms[0].anchorName.value;
tinyMCEPopup.restoreSelection();
if (this.action != 'update')
ed.selection.collapse(1);
// Webkit acts weird if empty inline element is inserted so we need to use a image instead
if (tinymce.isWebKit)
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('img', {mce_name : 'a', name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}));
elm = ed.dom.getParent(ed.selection.getNode(), 'A');
if (elm)
elm.name = name;
else
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : document.forms[0].anchorName.value, 'class' : 'mceItemAnchor'}, ''));
ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, ''));
tinyMCEPopup.close();
}
......
/**
* charmap.js
*
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
tinyMCEPopup.requireLangPack();
var charmap = [
......
......@@ -151,8 +151,8 @@ var ImageDialog = {
}
// Merge
st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st));
this.styleVal = dom.serializeStyle(st);
st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st), 'img');
this.styleVal = dom.serializeStyle(st, 'img');
}
},
......
......@@ -50,14 +50,9 @@
</div>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" id="insert" name="insert" value="{#insert}" />
</div>
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{#advanced_dlg.code_title}</title>
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script type="text/javascript" src="js/source_editor.js"></script>
......@@ -18,14 +17,9 @@
<textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,monospace; font-size: 12px;" dir="ltr" wrap="off" class="mceFocus"></textarea>
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" name="insert" value="{#update}" id="insert" />
</div>
<div style="float: right">
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
</div>
</div>
</form>
</body>
</html>
/**
* $Id: editor_template_src.js 920 2008-09-09 14:05:33Z spocke $
* editor_template_src.js
*
* This file is meant to showcase how to create a simple theme. The advanced
* theme is more suitable for production use.
* Copyright 2009, Moxiecode Systems AB
* Released under LGPL License.
*
* @author Moxiecode
* @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved.
* License: http://tinymce.moxiecode.com/license
* Contributing: http://tinymce.moxiecode.com/contributing
*/
(function() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment