changeset 459 | 31c23016ab62 |
parent 395 | fa4c5ecb7c9a |
child 476 | f26a69c40431 |
458:c433348f3628 | 459:31c23016ab62 |
---|---|
1 |
1 |
2 /* file:jscripts/tiny_mce/classes/tinymce.js */ |
2 /* file:jscripts/tiny_mce/classes/tinymce.js */ |
3 |
3 |
4 var tinymce = { |
4 var tinymce = { |
5 majorVersion : '3', |
5 majorVersion : '3', |
6 minorVersion : '0', |
6 minorVersion : '0.1', |
7 releaseDate : '2008-01-30', |
7 releaseDate : '2008-02-21', |
8 |
8 |
9 _init : function() { |
9 _init : function() { |
10 var t = this, ua = navigator.userAgent, i, nl, n, base; |
10 var t = this, ua = navigator.userAgent, i, nl, n, base; |
11 |
11 |
12 // Browser checks |
12 // Browser checks |
14 t.isWebKit = /WebKit/.test(ua); |
14 t.isWebKit = /WebKit/.test(ua); |
15 t.isOldWebKit = t.isWebKit && !window.getSelection().getRangeAt; |
15 t.isOldWebKit = t.isWebKit && !window.getSelection().getRangeAt; |
16 t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(navigator.appName); |
16 t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(navigator.appName); |
17 t.isIE6 = t.isIE && /MSIE [56]/.test(ua); |
17 t.isIE6 = t.isIE && /MSIE [56]/.test(ua); |
18 t.isGecko = !t.isWebKit && /Gecko/.test(ua); |
18 t.isGecko = !t.isWebKit && /Gecko/.test(ua); |
19 // t.isGecko3 = t.isGecko && /(Firefox|Minefield)\/[3-9]/.test(ua); |
|
20 t.isMac = ua.indexOf('Mac') != -1; |
19 t.isMac = ua.indexOf('Mac') != -1; |
21 |
20 |
22 // TinyMCE .NET webcontrol might be setting the values for TinyMCE |
21 // TinyMCE .NET webcontrol might be setting the values for TinyMCE |
23 if (window.tinyMCEPreInit) { |
22 if (window.tinyMCEPreInit) { |
24 t.suffix = tinyMCEPreInit.suffix; |
23 t.suffix = tinyMCEPreInit.suffix; |
877 id : o.id || 'c' + (this.count++), |
876 id : o.id || 'c' + (this.count++), |
878 method : o.method, |
877 method : o.method, |
879 params : o.params |
878 params : o.params |
880 }); |
879 }); |
881 |
880 |
881 // JSON content type for Ruby on rails. Bug: #1883287 |
|
882 o.content_type = 'application/json'; |
|
883 |
|
882 XHR.send(o); |
884 XHR.send(o); |
883 }, |
885 }, |
884 |
886 |
885 'static' : { |
887 'static' : { |
886 sendRPC : function(o) { |
888 sendRPC : function(o) { |
1039 |
1041 |
1040 select : function(pa, s) { |
1042 select : function(pa, s) { |
1041 var t = this, cs, c, pl, o = [], x, i, l, n; |
1043 var t = this, cs, c, pl, o = [], x, i, l, n; |
1042 |
1044 |
1043 s = t.get(s) || t.doc; |
1045 s = t.get(s) || t.doc; |
1046 |
|
1047 // Look for native support and use that if it's found |
|
1048 if (s.querySelectorAll) { |
|
1049 // Element scope then use temp id |
|
1050 // We need to do this to be compatible with other implementations |
|
1051 // See bug report: http://bugs.webkit.org/show_bug.cgi?id=17461 |
|
1052 if (s != t.doc) { |
|
1053 i = s.id; |
|
1054 s.id = '_mc_tmp'; |
|
1055 pa = '#_mc_tmp ' + pa; |
|
1056 } |
|
1057 |
|
1058 // Select elements |
|
1059 l = tinymce.grep(s.querySelectorAll(pa)); |
|
1060 |
|
1061 // Restore old id |
|
1062 if (i) |
|
1063 s.id = i; |
|
1064 |
|
1065 return l; |
|
1066 } |
|
1044 |
1067 |
1045 if (t.settings.strict) { |
1068 if (t.settings.strict) { |
1046 function get(s, n) { |
1069 function get(s, n) { |
1047 return s.getElementsByTagName(n.toLowerCase()); |
1070 return s.getElementsByTagName(n.toLowerCase()); |
1048 }; |
1071 }; |
1278 if (!n.currentStyle || !n.currentStyle.hasLayout) |
1301 if (!n.currentStyle || !n.currentStyle.hasLayout) |
1279 s.display = 'inline-block'; |
1302 s.display = 'inline-block'; |
1280 } |
1303 } |
1281 |
1304 |
1282 // Fix for older browsers |
1305 // Fix for older browsers |
1283 s['-moz-opacity'] = s['-khtml-opacity'] = v; |
1306 s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || ''; |
1284 break; |
1307 break; |
1285 |
1308 |
1286 case 'float': |
1309 case 'float': |
1287 isIE ? s.styleFloat = v : s.cssFloat = v; |
1310 isIE ? s.styleFloat = v : s.cssFloat = v; |
1288 break; |
1311 break; |
1289 } |
1312 |
1290 |
1313 default: |
1291 s[na] = v || ''; |
1314 s[na] = v || ''; |
1315 } |
|
1292 |
1316 |
1293 // Force update of the style data |
1317 // Force update of the style data |
1294 if (t.settings.update_styles) |
1318 if (t.settings.update_styles) |
1295 t.setAttrib(e, 'mce_style'); |
1319 t.setAttrib(e, 'mce_style'); |
1296 }); |
1320 }); |
1431 case 'class': |
1455 case 'class': |
1432 v = e.className; |
1456 v = e.className; |
1433 break; |
1457 break; |
1434 |
1458 |
1435 default: |
1459 default: |
1460 // Fix for IE crash Bug: #1884376 probably due to invalid DOM structure |
|
1461 if (isIE && n === 'name' && e.nodeName === 'A') { |
|
1462 v = e.name; |
|
1463 break; |
|
1464 } |
|
1465 |
|
1436 v = e.attributes[n]; |
1466 v = e.attributes[n]; |
1437 v = v && is(v.nodeValue) ? v.nodeValue : v; |
1467 v = v && is(v.nodeValue) ? v.nodeValue : v; |
1438 } |
1468 } |
1439 } |
1469 } |
1440 |
1470 |
1526 r = r.offsetParent; |
1556 r = r.offsetParent; |
1527 } |
1557 } |
1528 |
1558 |
1529 r = n; |
1559 r = n; |
1530 while (r) { |
1560 while (r) { |
1531 x -= r.scrollLeft || 0; |
1561 // Opera 9.25 bug fix, fixed in 9.50 |
1532 y -= r.scrollTop || 0; |
1562 if (!tinymce.isOpera || r.nodeName != 'TR') { |
1563 x -= r.scrollLeft || 0; |
|
1564 y -= r.scrollTop || 0; |
|
1565 } |
|
1533 |
1566 |
1534 r = r.parentNode; |
1567 r = r.parentNode; |
1535 |
1568 |
1536 if (r == d.body) |
1569 if (r == d.body) |
1537 break; |
1570 break; |
1742 |
1775 |
1743 setHTML : function(e, h) { |
1776 setHTML : function(e, h) { |
1744 var t = this; |
1777 var t = this; |
1745 |
1778 |
1746 return this.run(e, function(e) { |
1779 return this.run(e, function(e) { |
1747 var x; |
1780 var x, i, nl, n, p, x; |
1748 |
1781 |
1749 h = t.processHTML(h); |
1782 h = t.processHTML(h); |
1750 |
1783 |
1751 if (isIE) { |
1784 if (isIE) { |
1752 try { |
1785 function set() { |
1753 // IE will remove comments from the beginning |
1786 try { |
1754 // unless you padd the contents with something |
1787 // IE will remove comments from the beginning |
1755 e.innerHTML = '<br />' + h; |
1788 // unless you padd the contents with something |
1756 e.removeChild(e.firstChild); |
1789 e.innerHTML = '<br />' + h; |
1757 } catch (ex) { |
1790 e.removeChild(e.firstChild); |
1758 // IE sometimes produces an unknown runtime error on innerHTML |
1791 } catch (ex) { |
1759 // This seems to fix this issue, don't know why. |
1792 // IE sometimes produces an unknown runtime error on innerHTML |
1760 x = t.create('div'); |
1793 // This seems to fix this issue, don't know why. |
1761 x.innerHTML = '<br />' + h; |
1794 x = t.create('div'); |
1762 |
1795 x.innerHTML = '<br />' + h; |
1763 each (x.childNodes, function(n, i) { |
1796 |
1764 // Skip the BR |
1797 each (x.childNodes, function(n, i) { |
1765 if (i > 1) |
1798 // Skip the BR |
1766 e.appendChild(n); |
1799 if (i > 1) |
1767 }); |
1800 e.appendChild(n); |
1801 }); |
|
1802 } |
|
1803 }; |
|
1804 |
|
1805 // IE has a serious bug when it comes to paragraphs it can produce an invalid |
|
1806 // DOM tree if contents like this <p><ul><li>Item 1</li></ul></p> is inserted |
|
1807 // It seems to be that IE doesn't like a root block element placed inside another root block element |
|
1808 if (t.settings.fix_ie_paragraphs) |
|
1809 h = h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi, '<p$1 mce_keep="true"> </p>'); |
|
1810 |
|
1811 set(); |
|
1812 |
|
1813 if (t.settings.fix_ie_paragraphs) { |
|
1814 // Check for odd paragraphs this is a sign of a broken DOM |
|
1815 nl = e.getElementsByTagName("p"); |
|
1816 for (i = nl.length - 1, x = 0; i >= 0; i--) { |
|
1817 n = nl[i]; |
|
1818 |
|
1819 if (!n.hasChildNodes()) { |
|
1820 if (!n.mce_keep) { |
|
1821 x = 1; // Is broken |
|
1822 break; |
|
1823 } |
|
1824 |
|
1825 n.removeAttribute('mce_keep'); |
|
1826 } |
|
1827 } |
|
1828 } |
|
1829 |
|
1830 // Time to fix the madness IE left us |
|
1831 if (x) { |
|
1832 // So if we replace the p elements with divs and mark them and then replace them back to paragraphs |
|
1833 // after we use innerHTML we can fix the DOM tree |
|
1834 h = h.replace(/<p([^>]+)>|<p>/g, '<div$1 mce_tmp="1">'); |
|
1835 h = h.replace(/<\/p>/g, '</div>'); |
|
1836 |
|
1837 // Set the new HTML with DIVs |
|
1838 set(); |
|
1839 |
|
1840 // Replace all DIV elements with he mce_tmp attibute back to paragraphs |
|
1841 // This is needed since IE has a annoying bug see above for details |
|
1842 // This is a slow process but it has to be done. :( |
|
1843 if (t.settings.fix_ie_paragraphs) { |
|
1844 nl = e.getElementsByTagName("DIV"); |
|
1845 for (i = nl.length - 1; i >= 0; i--) { |
|
1846 n = nl[i]; |
|
1847 |
|
1848 // Is it a temp div |
|
1849 if (n.mce_tmp) { |
|
1850 // Create new paragraph |
|
1851 p = t.doc.createElement('p'); |
|
1852 |
|
1853 // Copy all attributes |
|
1854 n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi, function(a, b) { |
|
1855 if (b !== 'mce_tmp') |
|
1856 p.setAttribute(b, n.getAttribute(b)); |
|
1857 }); |
|
1858 |
|
1859 // Append all children to new paragraph |
|
1860 for (x = 0; x<n.childNodes.length; x++) |
|
1861 p.appendChild(n.childNodes[x].cloneNode(true)); |
|
1862 |
|
1863 // Replace div with new paragraph |
|
1864 n.swapNode(p); |
|
1865 } |
|
1866 } |
|
1867 } |
|
1768 } |
1868 } |
1769 } else |
1869 } else |
1770 e.innerHTML = h; |
1870 e.innerHTML = h; |
1771 |
1871 |
1772 return h; |
1872 return h; |
1981 |
2081 |
1982 return s; |
2082 return s; |
1983 }, |
2083 }, |
1984 |
2084 |
1985 getClasses : function() { |
2085 getClasses : function() { |
1986 var t = this, cl = [], i, lo = {}, f = t.settings.class_filter; |
2086 var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov; |
1987 |
2087 |
1988 if (t.classes) |
2088 if (t.classes) |
1989 return t.classes; |
2089 return t.classes; |
1990 |
2090 |
1991 function addClasses(s) { |
2091 function addClasses(s) { |
2001 case 1: |
2101 case 1: |
2002 if (r.selectorText) { |
2102 if (r.selectorText) { |
2003 each(r.selectorText.split(','), function(v) { |
2103 each(r.selectorText.split(','), function(v) { |
2004 v = v.replace(/^\s*|\s*$|^\s\./g, ""); |
2104 v = v.replace(/^\s*|\s*$|^\s\./g, ""); |
2005 |
2105 |
2006 if (f && !(v = f(v))) |
2106 // Is internal or it doesn't contain a class |
2107 if (/\.mce/.test(v) || !/\.[\w\-]+$/.test(v)) |
|
2007 return; |
2108 return; |
2008 |
2109 |
2009 if (/^\.mce/.test(v) || !/^\.[\w\-]+$/.test(v)) |
2110 // Remove everything but class name |
2111 ov = v; |
|
2112 v = v.replace(/.*\.([a-z0-9_\-]+).*/i, '$1'); |
|
2113 |
|
2114 // Filter classes |
|
2115 if (f && !(v = f(v, ov))) |
|
2010 return; |
2116 return; |
2011 |
2117 |
2012 v = v.substring(1); |
|
2013 if (!lo[v]) { |
2118 if (!lo[v]) { |
2014 cl.push({'class' : v}); |
2119 cl.push({'class' : v}); |
2015 lo[v] = 1; |
2120 lo[v] = 1; |
2016 } |
2121 } |
2017 }); |
2122 }); |
2525 t.getRng().deleteContents(); |
2630 t.getRng().deleteContents(); |
2526 return; |
2631 return; |
2527 } |
2632 } |
2528 |
2633 |
2529 // Use insert HTML if it exists (places cursor after content) |
2634 // Use insert HTML if it exists (places cursor after content) |
2530 if (d.queryCommandEnabled('InsertHTML')) |
2635 try { |
2531 return d.execCommand('InsertHTML', false, h); |
2636 // This might fail with an exception see bug #1893736 |
2532 |
2637 if (d.queryCommandEnabled('InsertHTML')) |
2533 r.deleteContents(); |
2638 return d.execCommand('InsertHTML', false, h); |
2534 r.insertNode(t.getRng().createContextualFragment(h)); |
2639 } catch (ex) { |
2640 // Use old school method |
|
2641 r.deleteContents(); |
|
2642 r.insertNode(t.getRng().createContextualFragment(h)); |
|
2643 } |
|
2535 } else { |
2644 } else { |
2536 if (r.item) |
2645 if (r.item) |
2537 r.item(0).outerHTML = h; |
2646 r.item(0).outerHTML = h; |
2538 else |
2647 else |
2539 r.pasteHTML(h); |
2648 r.pasteHTML(h); |
2995 } else |
3104 } else |
2996 return i.createDocument('', '', null); |
3105 return i.createDocument('', '', null); |
2997 }; |
3106 }; |
2998 |
3107 |
2999 this.doc = getXML(); |
3108 this.doc = getXML(); |
3109 |
|
3110 // Since Opera and WebKit doesn't escape > into > we need to do it our self to normalize the output for all browsers |
|
3111 this.valid = tinymce.isOpera || tinymce.isWebKit; |
|
3112 |
|
3000 this.reset(); |
3113 this.reset(); |
3001 }, |
3114 }, |
3002 |
3115 |
3003 reset : function() { |
3116 reset : function() { |
3004 var t = this, d = t.doc; |
3117 var t = this, d = t.doc; |
3014 |
3127 |
3015 t.node = t.node.appendChild(t.doc.createElement(n)); |
3128 t.node = t.node.appendChild(t.doc.createElement(n)); |
3016 }, |
3129 }, |
3017 |
3130 |
3018 writeAttribute : function(n, v) { |
3131 writeAttribute : function(n, v) { |
3019 // Since Opera doesn't escape > into > we need to do it our self |
3132 if (this.valid) |
3020 if (tinymce.isOpera) |
3133 v = v.replace(/>/g, '%MCGT%'); |
3021 v = v.replace(/>/g, '|>'); |
|
3022 |
3134 |
3023 this.node.setAttribute(n, v); |
3135 this.node.setAttribute(n, v); |
3024 }, |
3136 }, |
3025 |
3137 |
3026 writeEndElement : function() { |
3138 writeEndElement : function() { |
3033 n.appendChild(t.doc.createTextNode("")); |
3145 n.appendChild(t.doc.createTextNode("")); |
3034 t.node = n.parentNode; |
3146 t.node = n.parentNode; |
3035 }, |
3147 }, |
3036 |
3148 |
3037 writeText : function(v) { |
3149 writeText : function(v) { |
3038 // Since Opera doesn't escape > into > we need to do it our self |
3150 if (this.valid) |
3039 if (tinymce.isOpera) |
3151 v = v.replace(/>/g, '%MCGT%'); |
3040 v = v.replace(/>/g, '|>'); |
|
3041 |
3152 |
3042 this.node.appendChild(this.doc.createTextNode(v)); |
3153 this.node.appendChild(this.doc.createTextNode(v)); |
3043 }, |
3154 }, |
3044 |
3155 |
3045 writeCDATA : function(v) { |
3156 writeCDATA : function(v) { |
3055 |
3166 |
3056 h = this.doc.xml || new XMLSerializer().serializeToString(this.doc); |
3167 h = this.doc.xml || new XMLSerializer().serializeToString(this.doc); |
3057 h = h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g, ''); |
3168 h = h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g, ''); |
3058 h = h.replace(/ ?\/>/g, ' />'); |
3169 h = h.replace(/ ?\/>/g, ' />'); |
3059 |
3170 |
3060 // Since Opera doesn't escape > into > we need to do it our self to normalize the output for all browsers |
3171 if (this.valid) |
3061 if (tinymce.isOpera) |
3172 h = h.replace(/\%MCGT%/g, '>'); |
3062 h = h.replace(/\|>/g, '>'); |
|
3063 |
3173 |
3064 return h; |
3174 return h; |
3175 } |
|
3176 |
|
3177 }); |
|
3178 })(); |
|
3179 |
|
3180 /* file:jscripts/tiny_mce/classes/dom/StringWriter.js */ |
|
3181 |
|
3182 (function() { |
|
3183 tinymce.create('tinymce.dom.StringWriter', { |
|
3184 str : null, |
|
3185 tags : null, |
|
3186 count : 0, |
|
3187 settings : null, |
|
3188 indent : null, |
|
3189 |
|
3190 StringWriter : function(s) { |
|
3191 this.settings = tinymce.extend({ |
|
3192 indent_char : ' ', |
|
3193 indentation : 1 |
|
3194 }, s); |
|
3195 |
|
3196 this.reset(); |
|
3197 }, |
|
3198 |
|
3199 reset : function() { |
|
3200 this.indent = ''; |
|
3201 this.str = ""; |
|
3202 this.tags = []; |
|
3203 this.count = 0; |
|
3204 }, |
|
3205 |
|
3206 writeStartElement : function(n) { |
|
3207 this._writeAttributesEnd(); |
|
3208 this.writeRaw('<' + n); |
|
3209 this.tags.push(n); |
|
3210 this.inAttr = true; |
|
3211 this.count++; |
|
3212 this.elementCount = this.count; |
|
3213 }, |
|
3214 |
|
3215 writeAttribute : function(n, v) { |
|
3216 var t = this; |
|
3217 |
|
3218 t.writeRaw(" " + t.encode(n) + '="' + t.encode(v) + '"'); |
|
3219 }, |
|
3220 |
|
3221 writeEndElement : function() { |
|
3222 var n; |
|
3223 |
|
3224 if (this.tags.length > 0) { |
|
3225 n = this.tags.pop(); |
|
3226 |
|
3227 if (this._writeAttributesEnd(1)) |
|
3228 this.writeRaw('</' + n + '>'); |
|
3229 |
|
3230 if (this.settings.indentation > 0) |
|
3231 this.writeRaw('\n'); |
|
3232 } |
|
3233 }, |
|
3234 |
|
3235 writeFullEndElement : function() { |
|
3236 if (this.tags.length > 0) { |
|
3237 this._writeAttributesEnd(); |
|
3238 this.writeRaw('</' + this.tags.pop() + '>'); |
|
3239 |
|
3240 if (this.settings.indentation > 0) |
|
3241 this.writeRaw('\n'); |
|
3242 } |
|
3243 }, |
|
3244 |
|
3245 writeText : function(v) { |
|
3246 this._writeAttributesEnd(); |
|
3247 this.writeRaw(this.encode(v)); |
|
3248 this.count++; |
|
3249 }, |
|
3250 |
|
3251 writeCDATA : function(v) { |
|
3252 this._writeAttributesEnd(); |
|
3253 this.writeRaw('<![CDATA[' + v + ']]>'); |
|
3254 this.count++; |
|
3255 }, |
|
3256 |
|
3257 writeComment : function(v) { |
|
3258 this._writeAttributesEnd(); |
|
3259 this.writeRaw('<!-- ' + v + '-->'); |
|
3260 this.count++; |
|
3261 }, |
|
3262 |
|
3263 writeRaw : function(v) { |
|
3264 this.str += v; |
|
3265 }, |
|
3266 |
|
3267 encode : function(s) { |
|
3268 return s.replace(/[<>&"]/g, function(v) { |
|
3269 switch (v) { |
|
3270 case '<': |
|
3271 return '<'; |
|
3272 |
|
3273 case '>': |
|
3274 return '>'; |
|
3275 |
|
3276 case '&': |
|
3277 return '&'; |
|
3278 |
|
3279 case '"': |
|
3280 return '"'; |
|
3281 } |
|
3282 |
|
3283 return v; |
|
3284 }); |
|
3285 }, |
|
3286 |
|
3287 getContent : function() { |
|
3288 return this.str; |
|
3289 }, |
|
3290 |
|
3291 _writeAttributesEnd : function(s) { |
|
3292 if (!this.inAttr) |
|
3293 return; |
|
3294 |
|
3295 this.inAttr = false; |
|
3296 |
|
3297 if (s && this.elementCount == this.count) { |
|
3298 this.writeRaw(' />'); |
|
3299 return false; |
|
3300 } |
|
3301 |
|
3302 this.writeRaw('>'); |
|
3303 |
|
3304 return true; |
|
3065 } |
3305 } |
3066 |
3306 |
3067 }); |
3307 }); |
3068 })(); |
3308 })(); |
3069 |
3309 |
3097 var t = this; |
3337 var t = this; |
3098 |
3338 |
3099 t.key = 0; |
3339 t.key = 0; |
3100 t.onPreProcess = new Dispatcher(t); |
3340 t.onPreProcess = new Dispatcher(t); |
3101 t.onPostProcess = new Dispatcher(t); |
3341 t.onPostProcess = new Dispatcher(t); |
3102 t.writer = new tinymce.dom.XMLWriter(); |
3342 t.writer = tinymce.relaxedDomain && tinymce.isGecko ? new tinymce.dom.StringWriter() : new tinymce.dom.XMLWriter(); |
3103 |
3343 |
3104 // Default settings |
3344 // Default settings |
3105 t.settings = s = extend({ |
3345 t.settings = s = extend({ |
3106 dom : tinymce.DOM, |
3346 dom : tinymce.DOM, |
3107 valid_nodes : 0, |
3347 valid_nodes : 0, |
3108 node_filter : 0, |
3348 node_filter : 0, |
3109 attr_filter : 0, |
3349 attr_filter : 0, |
3110 invalid_attrs : /^(mce_|_moz_$)/, |
3350 invalid_attrs : /^(mce_|_moz_)/, |
3111 closed : /(br|hr|input|meta|img|link|param)/, |
3351 closed : /(br|hr|input|meta|img|link|param)/, |
3112 entity_encoding : 'named', |
3352 entity_encoding : 'named', |
3113 entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro', |
3353 entities : '160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro', |
3114 valid_elements : '*[*]', |
3354 valid_elements : '*[*]', |
3115 extended_valid_elements : 0, |
3355 extended_valid_elements : 0, |
3170 }); |
3410 }); |
3171 } |
3411 } |
3172 |
3412 |
3173 if (s.fix_table_elements) { |
3413 if (s.fix_table_elements) { |
3174 t.onPreProcess.add(function(se, o) { |
3414 t.onPreProcess.add(function(se, o) { |
3175 var ta = [], d = t.dom.doc; |
|
3176 |
|
3177 // Build list of HTML chunks and replace tables with comment placeholders |
|
3178 each(t.dom.select('table', o.node), function(e) { |
3415 each(t.dom.select('table', o.node), function(e) { |
3179 var pa = t.dom.getParent(e, 'H1,H2,H3,H4,H5,H6,P'), p = [], i, h; |
3416 var pa = t.dom.getParent(e, 'H1,H2,H3,H4,H5,H6,P'), pa2, n, tm, pl = [], i, ns; |
3180 |
3417 |
3181 if (pa) { |
3418 if (pa) { |
3182 t.dom.getParent(e, function(n) { |
3419 pa2 = pa.cloneNode(false); |
3183 if (n != e) |
3420 |
3184 p.push(n.nodeName); |
3421 pl.push(e); |
3185 }); |
3422 for (n = e; n = n.parentNode;) { |
3186 |
3423 pl.push(n); |
3187 h = ''; |
3424 |
3188 |
3425 if (n == pa) |
3189 for (i = 0; i < p.length; i++) |
3426 break; |
3190 h += '</' + p[i]+ '>'; |
3427 } |
3191 |
3428 |
3192 h += t.dom.getOuterHTML(e); |
3429 tm = pa2; |
3193 |
3430 for (i = pl.length - 1; i >= 0; i--) { |
3194 for (i = p.length - 1; i >= 0; i--) |
3431 if (i == pl.length - 1) { |
3195 h += '<' + p[i]+ '>'; |
3432 while (ns = pl[i - 1].nextSibling) |
3196 |
3433 tm.appendChild(ns.parentNode.removeChild(ns)); |
3197 ta.push(h); |
3434 } else { |
3198 e.parentNode.replaceChild(d.createComment('mcetable:' + (ta.length - 1)), e); |
3435 n = pl[i].cloneNode(false); |
3436 |
|
3437 if (i != 0) { |
|
3438 while (ns = pl[i - 1].nextSibling) |
|
3439 n.appendChild(ns.parentNode.removeChild(ns)); |
|
3440 } |
|
3441 |
|
3442 tm = tm.appendChild(n); |
|
3443 } |
|
3444 } |
|
3445 |
|
3446 e = t.dom.insertAfter(e.parentNode.removeChild(e), pa); |
|
3447 t.dom.insertAfter(e, pa); |
|
3448 t.dom.insertAfter(pa2, e); |
|
3199 } |
3449 } |
3200 }); |
3450 }); |
3201 |
|
3202 // Replace table placeholders with end parents + table + start parents HTML code |
|
3203 t.dom.setHTML(o.node, o.node.innerHTML.replace(/<!--mcetable:([0-9]+)-->/g, function(a, b) { |
|
3204 return ta[parseInt(b)]; |
|
3205 })); |
|
3206 }); |
3451 }); |
3207 } |
3452 } |
3208 }, |
3453 }, |
3209 |
3454 |
3210 setEntities : function(s) { |
3455 setEntities : function(s) { |
4404 |
4649 |
4405 if (is(s.icons) && !s.icons) |
4650 if (is(s.icons) && !s.icons) |
4406 s['class'] += ' noIcons'; |
4651 s['class'] += ' noIcons'; |
4407 |
4652 |
4408 this.parent(id, s); |
4653 this.parent(id, s); |
4654 this.onShowMenu = new tinymce.util.Dispatcher(this); |
|
4409 this.onHideMenu = new tinymce.util.Dispatcher(this); |
4655 this.onHideMenu = new tinymce.util.Dispatcher(this); |
4410 this.classPrefix = 'mceMenu'; |
4656 this.classPrefix = 'mceMenu'; |
4411 }, |
4657 }, |
4412 |
4658 |
4413 createMenu : function(s) { |
4659 createMenu : function(s) { |
4465 |
4711 |
4466 t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container}); |
4712 t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container}); |
4467 } else |
4713 } else |
4468 co = DOM.get('menu_' + t.id); |
4714 co = DOM.get('menu_' + t.id); |
4469 |
4715 |
4470 DOM.setStyles(co, {left : -0xFFFF , top : -0xFFFF}); |
4716 // Move layer out of sight unless it's Opera since it scrolls to top of page due to an bug |
4717 if (!tinymce.isOpera) |
|
4718 DOM.setStyles(co, {left : -0xFFFF , top : -0xFFFF}); |
|
4719 |
|
4471 DOM.show(co); |
4720 DOM.show(co); |
4472 t.update(); |
4721 t.update(); |
4473 |
4722 |
4474 x += s.offset_x || 0; |
4723 x += s.offset_x || 0; |
4475 y += s.offset_y || 0; |
4724 y += s.offset_y || 0; |
4503 m = t.items[e.id]; |
4752 m = t.items[e.id]; |
4504 |
4753 |
4505 if (m.isDisabled()) |
4754 if (m.isDisabled()) |
4506 return; |
4755 return; |
4507 |
4756 |
4508 if (m.settings.onclick) |
|
4509 m.settings.onclick(e); |
|
4510 |
|
4511 dm = t; |
4757 dm = t; |
4512 |
4758 |
4513 while (dm) { |
4759 while (dm) { |
4514 if (dm.hideMenu) |
4760 if (dm.hideMenu) |
4515 dm.hideMenu(); |
4761 dm.hideMenu(); |
4516 |
4762 |
4517 dm = dm.settings.parent; |
4763 dm = dm.settings.parent; |
4518 } |
4764 } |
4765 |
|
4766 if (m.settings.onclick) |
|
4767 m.settings.onclick(e); |
|
4519 |
4768 |
4520 return Event.cancel(e); // Cancel to fix onbeforeunload problem |
4769 return Event.cancel(e); // Cancel to fix onbeforeunload problem |
4521 } |
4770 } |
4522 }); |
4771 }); |
4523 |
4772 |
4543 DOM.addClass(DOM.get(m.id).firstChild, 'mceMenuItemActive'); |
4792 DOM.addClass(DOM.get(m.id).firstChild, 'mceMenuItemActive'); |
4544 } |
4793 } |
4545 } |
4794 } |
4546 }); |
4795 }); |
4547 } |
4796 } |
4797 |
|
4798 t.onShowMenu.dispatch(t); |
|
4548 }, |
4799 }, |
4549 |
4800 |
4550 hideMenu : function(c) { |
4801 hideMenu : function(c) { |
4551 var t = this, co = DOM.get('menu_' + t.id), e; |
4802 var t = this, co = DOM.get('menu_' + t.id), e; |
4552 |
4803 |
5343 editors : {}, |
5594 editors : {}, |
5344 i18n : {}, |
5595 i18n : {}, |
5345 activeEditor : null, |
5596 activeEditor : null, |
5346 |
5597 |
5347 init : function(s) { |
5598 init : function(s) { |
5348 var t = this, pl, sl = tinymce.ScriptLoader; |
5599 var t = this, pl, sl = tinymce.ScriptLoader, c; |
5349 |
5600 |
5350 function execCallback(se, n, s) { |
5601 function execCallback(se, n, s) { |
5351 var f = se[n]; |
5602 var f = se[n]; |
5352 |
5603 |
5353 if (!f) |
5604 if (!f) |
5375 // Load language |
5626 // Load language |
5376 if (s.language) |
5627 if (s.language) |
5377 sl.add(tinymce.baseURL + '/langs/' + s.language + '.js'); |
5628 sl.add(tinymce.baseURL + '/langs/' + s.language + '.js'); |
5378 |
5629 |
5379 // Load theme |
5630 // Load theme |
5380 if (s.theme && s.theme.charAt(0) != '-') |
5631 if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme]) |
5381 ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js'); |
5632 ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js'); |
5382 |
5633 |
5383 // Load plugins |
5634 // Load plugins |
5384 if (s.plugins) { |
5635 if (s.plugins) { |
5385 pl = s.plugins.split(','); |
5636 pl = s.plugins.split(','); |
5388 if (tinymce.inArray(pl, 'compat2x') != -1) |
5639 if (tinymce.inArray(pl, 'compat2x') != -1) |
5389 PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js'); |
5640 PluginManager.load('compat2x', 'plugins/compat2x/editor_plugin' + tinymce.suffix + '.js'); |
5390 |
5641 |
5391 // Load rest if plugins |
5642 // Load rest if plugins |
5392 each(pl, function(v) { |
5643 each(pl, function(v) { |
5393 if (v && v.charAt(0) != '-') { |
5644 if (v && v.charAt(0) != '-' && !PluginManager.urls[v]) { |
5394 // Skip safari plugin for other browsers |
5645 // Skip safari plugin for other browsers |
5395 if (!tinymce.isWebKit && v == 'safari') |
5646 if (!tinymce.isWebKit && v == 'safari') |
5396 return; |
5647 return; |
5397 |
5648 |
5398 PluginManager.load(v, 'plugins/' + v + '/editor_plugin' + tinymce.suffix + '.js'); |
5649 PluginManager.load(v, 'plugins/' + v + '/editor_plugin' + tinymce.suffix + '.js'); |
5447 |
5698 |
5448 switch (s.mode) { |
5699 switch (s.mode) { |
5449 case "exact": |
5700 case "exact": |
5450 l = s.elements || ''; |
5701 l = s.elements || ''; |
5451 each(l.split(','), function(v) { |
5702 each(l.split(','), function(v) { |
5452 new tinymce.Editor(v, s).render(); |
5703 if (DOM.get(v)) |
5704 new tinymce.Editor(v, s).render(1); |
|
5705 else { |
|
5706 c = 0; |
|
5707 |
|
5708 each(document.forms, function(f) { |
|
5709 each(f.elements, function(e) { |
|
5710 if (e.name === v) { |
|
5711 v = 'mce_editor_' + c; |
|
5712 DOM.setAttrib(e, 'id', v); |
|
5713 new tinymce.Editor(v, s).render(1); |
|
5714 } |
|
5715 }); |
|
5716 }); |
|
5717 } |
|
5453 }); |
5718 }); |
5454 break; |
5719 break; |
5455 |
5720 |
5456 case "textareas": |
5721 case "textareas": |
5722 case "specific_textareas": |
|
5457 function hasClass(n, c) { |
5723 function hasClass(n, c) { |
5458 return new RegExp('\\b' + c + '\\b', 'g').test(n.className); |
5724 return new RegExp('\\b' + c + '\\b', 'g').test(n.className); |
5459 }; |
5725 }; |
5460 |
5726 |
5461 each(DOM.select('textarea'), function(v) { |
5727 each(DOM.select('textarea'), function(v) { |
5462 if (s.editor_deselector && hasClass(v, s.editor_deselector)) |
5728 if (s.editor_deselector && hasClass(v, s.editor_deselector)) |
5463 return; |
5729 return; |
5464 |
5730 |
5465 if (!s.editor_selector || hasClass(v, s.editor_selector)) |
5731 if (!s.editor_selector || hasClass(v, s.editor_selector)) |
5466 new tinymce.Editor(v.id = (v.id || v.name || (v.id = DOM.uniqueId())), s).render(); |
5732 new tinymce.Editor(v.id = (v.id || v.name || (v.id = DOM.uniqueId())), s).render(1); |
5467 }); |
5733 }); |
5468 break; |
5734 break; |
5469 } |
5735 } |
5470 |
5736 |
5471 // Call onInit when all editors are initialized |
5737 // Call onInit when all editors are initialized |
5625 if (!/[\/\\]$/.test(tinymce.documentBaseURL)) |
5891 if (!/[\/\\]$/.test(tinymce.documentBaseURL)) |
5626 tinymce.documentBaseURL += '/'; |
5892 tinymce.documentBaseURL += '/'; |
5627 |
5893 |
5628 tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL); |
5894 tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL); |
5629 tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL); |
5895 tinymce.EditorManager.baseURI = new tinymce.util.URI(tinymce.baseURL); |
5896 |
|
5897 if (tinymce.EditorManager.baseURI.host != document.domain) |
|
5898 document.domain = tinymce.relaxedDomain = document.domain.replace(/.*\.(.+\..+)$/, '$1'); |
|
5630 })(); |
5899 })(); |
5631 |
5900 |
5632 // Short for editor manager window.tinyMCE is needed when TinyMCE gets loaded though a XHR call |
5901 // Short for editor manager window.tinyMCE is needed when TinyMCE gets loaded though a XHR call |
5633 var tinyMCE = window.tinyMCE = tinymce.EditorManager; |
5902 var tinyMCE = window.tinyMCE = tinymce.EditorManager; |
5634 |
5903 |
5724 convert_fonts_to_spans : true, |
5993 convert_fonts_to_spans : true, |
5725 font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large', |
5994 font_size_style_values : 'xx-small,x-small,small,medium,large,x-large,xx-large', |
5726 apply_source_formatting : 1, |
5995 apply_source_formatting : 1, |
5727 directionality : 'ltr', |
5996 directionality : 'ltr', |
5728 forced_root_block : 'p', |
5997 forced_root_block : 'p', |
5729 valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width|height|src|*],script[type],map[name],area[shape|coords|href|alt|target]', |
5998 valid_elements : '@[id|class|style|title|dir<ltr?rtl|lang|xml::lang|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],a[rel|rev|charset|hreflang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur],strong/b,em/i,strike,u,#p[align],-ol[type|compact],-ul[type|compact],-li,br,img[longdesc|usemap|src|border|alt=|title|hspace|vspace|width|height|align],-sub,-sup,-blockquote,-table[border=0|cellspacing|cellpadding|width|frame|rules|height|align|summary|bgcolor|background|bordercolor],-tr[rowspan|width|height|align|valign|bgcolor|background|bordercolor],tbody,thead,tfoot,#td[colspan|rowspan|width|height|align|valign|bgcolor|background|bordercolor|scope],#th[colspan|rowspan|width|height|align|valign|scope],caption,-div,-span,-pre,address,-h1,-h2,-h3,-h4,-h5,-h6,hr[size|noshade],-font[face|size|color],dd,dl,dt,cite,abbr,acronym,del[datetime|cite],ins[datetime|cite],object[classid|width|height|codebase|*],param[name|value|_value],embed[type|width|height|src|*],script[src|type],map[name],area[shape|coords|href|alt|target]', |
5730 hidden_input : 1, |
5999 hidden_input : 1, |
5731 padd_empty_editor : 1, |
6000 padd_empty_editor : 1, |
5732 render_ui : 1, |
6001 render_ui : 1, |
5733 init_theme : 1, |
6002 init_theme : 1, |
5734 indentation : '30px' |
6003 indentation : '30px' |
5742 |
6011 |
5743 // Call setup |
6012 // Call setup |
5744 t.execCallback('setup', t); |
6013 t.execCallback('setup', t); |
5745 }, |
6014 }, |
5746 |
6015 |
5747 render : function() { |
6016 render : function(nst) { |
5748 var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader; |
6017 var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader; |
6018 |
|
6019 // Force strict loading mode if render us called by user and not internally |
|
6020 if (!nst) { |
|
6021 s.strict_loading_mode = 1; |
|
6022 tinyMCE.settings = s; |
|
6023 } |
|
5749 |
6024 |
5750 // Element not found, then skip initialization |
6025 // Element not found, then skip initialization |
5751 if (!t.getElement()) |
6026 if (!t.getElement()) |
5752 return; |
6027 return; |
5753 |
6028 |
5776 t.isNotDirty = 1; |
6051 t.isNotDirty = 1; |
5777 } |
6052 } |
5778 }); |
6053 }); |
5779 } |
6054 } |
5780 |
6055 |
5781 Event.add(document, 'unload', function() { |
6056 if (s.add_unload_trigger) { |
5782 if (t.initialized && !t.destroyed && s.add_unload_trigger) |
6057 Event.add(document, 'beforeunload', function() { |
5783 t.save({format : 'raw', no_events : true}); |
6058 if (t.initialized && !t.destroyed) |
5784 }); |
6059 t.save({format : 'raw', no_events : true}); |
6060 }); |
|
6061 } |
|
5785 |
6062 |
5786 tinymce.addUnload(t._destroy, t); |
6063 tinymce.addUnload(t._destroy, t); |
5787 |
6064 |
5788 if (s.submit_patch) { |
6065 if (s.submit_patch) { |
5789 t.onBeforeRenderUI.add(function() { |
6066 t.onBeforeRenderUI.add(function() { |
5795 // Already patched |
6072 // Already patched |
5796 if (n._mceOldSubmit) |
6073 if (n._mceOldSubmit) |
5797 return; |
6074 return; |
5798 |
6075 |
5799 // Check page uses id="submit" or name="submit" for it's submit button |
6076 // Check page uses id="submit" or name="submit" for it's submit button |
5800 if (!n.submit.nodeType) { |
6077 if (!n.submit.nodeType && !n.submit.length) { |
5801 t.formElement = n; |
6078 t.formElement = n; |
5802 n._mceOldSubmit = n.submit; |
6079 n._mceOldSubmit = n.submit; |
5803 n.submit = function() { |
6080 n.submit = function() { |
5804 // Save all instances |
6081 // Save all instances |
5805 EditorManager.triggerSave(); |
6082 EditorManager.triggerSave(); |
5813 }); |
6090 }); |
5814 } |
6091 } |
5815 |
6092 |
5816 // Load scripts |
6093 // Load scripts |
5817 function loadScripts() { |
6094 function loadScripts() { |
5818 sl.add(tinymce.baseURL + '/langs/' + s.language + '.js'); |
6095 if (s.language) |
5819 |
6096 sl.add(tinymce.baseURL + '/langs/' + s.language + '.js'); |
5820 if (s.theme.charAt(0) != '-') |
6097 |
6098 if (s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme]) |
|
5821 ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js'); |
6099 ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js'); |
5822 |
6100 |
5823 each(s.plugins.split(','), function(p) { |
6101 each(s.plugins.split(','), function(p) { |
5824 if (p && p.charAt(0) != '-') { |
6102 if (p && p.charAt(0) != '-' && !PluginManager.urls[p]) { |
5825 // Skip safari plugin for other browsers |
6103 // Skip safari plugin for other browsers |
5826 if (!isWebKit && p == 'safari') |
6104 if (!isWebKit && p == 'safari') |
5827 return; |
6105 return; |
5828 |
6106 |
5829 PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js'); |
6107 PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js'); |
5858 } else |
6136 } else |
5859 loadScripts(); |
6137 loadScripts(); |
5860 }, |
6138 }, |
5861 |
6139 |
5862 init : function() { |
6140 init : function() { |
5863 var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti; |
6141 var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u; |
5864 |
6142 |
5865 EditorManager.add(t); |
6143 EditorManager.add(t); |
5866 |
6144 |
5867 // Create theme |
6145 // Create theme |
5868 s.theme = s.theme.replace(/-/, ''); |
6146 s.theme = s.theme.replace(/-/, ''); |
5908 t.undoManager.onRedo.add(function(um, l) { |
6186 t.undoManager.onRedo.add(function(um, l) { |
5909 return t.onRedo.dispatch(t, l, um); |
6187 return t.onRedo.dispatch(t, l, um); |
5910 }); |
6188 }); |
5911 |
6189 |
5912 if (s.custom_undo_redo) { |
6190 if (s.custom_undo_redo) { |
5913 t.onExecCommand.add(function(ed, cmd) { |
6191 t.onExecCommand.add(function(ed, cmd, ui, val, a) { |
5914 if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint') |
6192 if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo)) |
5915 t.undoManager.add(); |
6193 t.undoManager.add(); |
5916 }); |
6194 }); |
5917 } |
6195 } |
5918 |
6196 |
5919 t.onExecCommand.add(function(ed, c) { |
6197 t.onExecCommand.add(function(ed, c) { |
5969 |
6247 |
5970 h = (o.iframeHeight || h) + ((h + '').indexOf('%') == -1 ? (o.deltaHeight || 0) : ''); |
6248 h = (o.iframeHeight || h) + ((h + '').indexOf('%') == -1 ? (o.deltaHeight || 0) : ''); |
5971 if (h < 100) |
6249 if (h < 100) |
5972 h = 100; |
6250 h = 100; |
5973 |
6251 |
6252 t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + t.documentBaseURI.getURI() + '" />'; |
|
6253 t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />'; |
|
6254 |
|
6255 if (tinymce.relaxedDomain) |
|
6256 t.iframeHTML += '<script type="text/javascript">document.domain = "' + tinymce.relaxedDomain + '";</script>'; |
|
6257 |
|
6258 t.iframeHTML += '</head><body id="tinymce" class="mceContentBody"></body></html>'; |
|
6259 |
|
6260 // Domain relaxing enabled, then set document domain |
|
6261 if (tinymce.relaxedDomain) { |
|
6262 // We need to write the contents here in IE since multiple writes messes up refresh button and back button |
|
6263 if (isIE) |
|
6264 u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";var ed = window.parent.tinyMCE.get("' + s.id + '");document.write(ed.iframeHTML);document.close();ed.setupIframe();})()'; |
|
6265 else if (tinymce.isOpera) |
|
6266 u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()'; |
|
6267 } |
|
6268 |
|
5974 // Create iframe |
6269 // Create iframe |
5975 n = DOM.add(o.iframeContainer, 'iframe', { |
6270 n = DOM.add(o.iframeContainer, 'iframe', { |
5976 id : s.id + "_ifr", |
6271 id : s.id + "_ifr", |
5977 src : 'javascript:""', // Workaround for HTTPS warning in IE6/7 |
6272 src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7 |
5978 frameBorder : '0', |
6273 frameBorder : '0', |
5979 style : { |
6274 style : { |
5980 width : '100%', |
6275 width : '100%', |
5981 height : h |
6276 height : h |
5982 } |
6277 } |
5989 // Safari 2.x requires us to wait for the load event and load a real HTML doc |
6284 // Safari 2.x requires us to wait for the load event and load a real HTML doc |
5990 if (tinymce.isOldWebKit) { |
6285 if (tinymce.isOldWebKit) { |
5991 Event.add(n, 'load', t.setupIframe, t); |
6286 Event.add(n, 'load', t.setupIframe, t); |
5992 n.src = tinymce.baseURL + '/plugins/safari/blank.htm'; |
6287 n.src = tinymce.baseURL + '/plugins/safari/blank.htm'; |
5993 } else { |
6288 } else { |
5994 t.setupIframe(); |
6289 if (!isIE || !tinymce.relaxedDomain) |
6290 t.setupIframe(); |
|
6291 |
|
5995 e = n = o = null; // Cleanup |
6292 e = n = o = null; // Cleanup |
5996 } |
6293 } |
5997 }, |
6294 }, |
5998 |
6295 |
5999 setupIframe : function() { |
6296 setupIframe : function() { |
6000 var t = this, s = t.settings, e = DOM.get(s.id), d = t.getDoc(); |
6297 var t = this, s = t.settings, e = DOM.get(s.id), d = t.getDoc(), h; |
6001 |
6298 |
6002 // Setup body |
6299 // Setup iframe body |
6003 d.open(); |
6300 if (!isIE || !tinymce.relaxedDomain) { |
6004 d.write(s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + t.documentBaseURI.getURI() + '" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body id="tinymce" class="mceContentBody"></body></html>'); |
6301 d.open(); |
6005 d.close(); |
6302 d.write(t.iframeHTML); |
6303 d.close(); |
|
6304 } |
|
6006 |
6305 |
6007 // Design mode needs to be added here Ctrl+A will fail otherwise |
6306 // Design mode needs to be added here Ctrl+A will fail otherwise |
6008 if (!isIE) { |
6307 if (!isIE) { |
6009 try { |
6308 try { |
6010 d.designMode = 'On'; |
6309 d.designMode = 'On'; |
6023 keep_values : true, |
6322 keep_values : true, |
6024 url_converter : t.convertURL, |
6323 url_converter : t.convertURL, |
6025 url_converter_scope : t, |
6324 url_converter_scope : t, |
6026 hex_colors : s.force_hex_style_colors, |
6325 hex_colors : s.force_hex_style_colors, |
6027 class_filter : s.class_filter, |
6326 class_filter : s.class_filter, |
6028 update_styles : 1 |
6327 update_styles : 1, |
6328 fix_ie_paragraphs : 1 |
|
6029 }); |
6329 }); |
6030 |
6330 |
6031 t.serializer = new tinymce.dom.Serializer({ |
6331 t.serializer = new tinymce.dom.Serializer({ |
6032 entity_encoding : s.entity_encoding, |
6332 entity_encoding : s.entity_encoding, |
6033 entities : s.entities, |
6333 entities : s.entities, |
6078 t.getBody().style.whiteSpace = "nowrap"; |
6378 t.getBody().style.whiteSpace = "nowrap"; |
6079 |
6379 |
6080 if (s.auto_resize) |
6380 if (s.auto_resize) |
6081 t.onNodeChange.add(t.resizeToContent, t); |
6381 t.onNodeChange.add(t.resizeToContent, t); |
6082 |
6382 |
6383 if (s.custom_elements) { |
|
6384 function handleCustom(ed, o) { |
|
6385 each(s.custom_elements.split(','), function(v) { |
|
6386 var n; |
|
6387 |
|
6388 if (v.indexOf('~') === 0) { |
|
6389 v = v.substring(1); |
|
6390 n = 'span'; |
|
6391 } else |
|
6392 n = 'div'; |
|
6393 |
|
6394 o.content = o.content.replace(new RegExp('<(' + v + ')([^>]*)>', 'g'), '<' + n + ' mce_name="$1"$2>'); |
|
6395 o.content = o.content.replace(new RegExp('</(' + v + ')>', 'g'), '</' + n + '>'); |
|
6396 }); |
|
6397 }; |
|
6398 |
|
6399 t.onBeforeSetContent.add(handleCustom); |
|
6400 t.onPostProcess.add(function(ed, o) { |
|
6401 if (o.set) |
|
6402 handleCustom(ed, o) |
|
6403 }); |
|
6404 } |
|
6405 |
|
6083 if (s.handle_node_change_callback) { |
6406 if (s.handle_node_change_callback) { |
6084 t.onNodeChange.add(function(ed, cm, n) { |
6407 t.onNodeChange.add(function(ed, cm, n) { |
6085 t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed()); |
6408 t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed()); |
6086 }); |
6409 }); |
6087 } |
6410 } |
6318 getParam : function(n, dv) { |
6641 getParam : function(n, dv) { |
6319 return is(this.settings[n]) ? this.settings[n] : dv; |
6642 return is(this.settings[n]) ? this.settings[n] : dv; |
6320 }, |
6643 }, |
6321 |
6644 |
6322 nodeChanged : function(o) { |
6645 nodeChanged : function(o) { |
6323 var t = this, s = t.selection, n = s.getNode() || this.getBody(); |
6646 var t = this, s = t.selection, n = s.getNode() || t.getBody(); |
6324 |
6647 |
6325 this.onNodeChange.dispatch( |
6648 // Fix for bug #1896577 it seems that this can not be fired while the editor is loading |
6326 t, |
6649 if (t.initialized) { |
6327 o ? o.controlManager || t.controlManager : t.controlManager, |
6650 t.onNodeChange.dispatch( |
6328 isIE && n.ownerDocument != t.getDoc() ? this.getBody() : n, // Fix for IE initial state |
6651 t, |
6329 s.isCollapsed(), |
6652 o ? o.controlManager || t.controlManager : t.controlManager, |
6330 o |
6653 isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n, // Fix for IE initial state |
6331 ); |
6654 s.isCollapsed(), |
6655 o |
|
6656 ); |
|
6657 } |
|
6332 }, |
6658 }, |
6333 |
6659 |
6334 addButton : function(n, s) { |
6660 addButton : function(n, s) { |
6335 var t = this; |
6661 var t = this; |
6336 |
6662 |
6415 if (o.terminate) |
6741 if (o.terminate) |
6416 return false; |
6742 return false; |
6417 |
6743 |
6418 // Comamnd callback |
6744 // Comamnd callback |
6419 if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) { |
6745 if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) { |
6420 t.onExecCommand.dispatch(t, cmd, ui, val); |
6746 t.onExecCommand.dispatch(t, cmd, ui, val, a); |
6421 return true; |
6747 return true; |
6422 } |
6748 } |
6423 |
6749 |
6424 // Registred commands |
6750 // Registred commands |
6425 if (o = t.execCommands[cmd]) { |
6751 if (o = t.execCommands[cmd]) { |
6426 s = o.func.call(o.scope, ui, val); |
6752 s = o.func.call(o.scope, ui, val); |
6427 t.onExecCommand.dispatch(t, cmd, ui, val); |
6753 t.onExecCommand.dispatch(t, cmd, ui, val, a); |
6428 return s; |
6754 return s; |
6429 } |
6755 } |
6430 |
6756 |
6431 // Plugin commands |
6757 // Plugin commands |
6432 each(t.plugins, function(p) { |
6758 each(t.plugins, function(p) { |
6433 if (p.execCommand && p.execCommand(cmd, ui, val)) { |
6759 if (p.execCommand && p.execCommand(cmd, ui, val)) { |
6434 t.onExecCommand.dispatch(t, cmd, ui, val); |
6760 t.onExecCommand.dispatch(t, cmd, ui, val, a); |
6435 s = 1; |
6761 s = 1; |
6436 return false; |
6762 return false; |
6437 } |
6763 } |
6438 }); |
6764 }); |
6439 |
6765 |
6440 if (s) |
6766 if (s) |
6441 return true; |
6767 return true; |
6442 |
6768 |
6443 // Theme commands |
6769 // Theme commands |
6444 if (t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) { |
6770 if (t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) { |
6445 t.onExecCommand.dispatch(t, cmd, ui, val); |
6771 t.onExecCommand.dispatch(t, cmd, ui, val, a); |
6446 return true; |
6772 return true; |
6447 } |
6773 } |
6448 |
6774 |
6449 // Editor commands |
6775 // Editor commands |
6450 if (t.editorCommands.execCommand(cmd, ui, val)) { |
6776 if (t.editorCommands.execCommand(cmd, ui, val)) { |
6451 t.onExecCommand.dispatch(t, cmd, ui, val); |
6777 t.onExecCommand.dispatch(t, cmd, ui, val, a); |
6452 return true; |
6778 return true; |
6453 } |
6779 } |
6454 |
6780 |
6455 // Browser commands |
6781 // Browser commands |
6456 t.getDoc().execCommand(cmd, ui, val); |
6782 t.getDoc().execCommand(cmd, ui, val); |
6457 t.onExecCommand.dispatch(t, cmd, ui, val); |
6783 t.onExecCommand.dispatch(t, cmd, ui, val, a); |
6458 }, |
6784 }, |
6459 |
6785 |
6460 queryCommandState : function(c) { |
6786 queryCommandState : function(c) { |
6461 var t = this, o; |
6787 var t = this, o; |
6462 |
6788 |
6692 |
7018 |
6693 getDoc : function() { |
7019 getDoc : function() { |
6694 var t = this, w; |
7020 var t = this, w; |
6695 |
7021 |
6696 if (!t.contentDocument) { |
7022 if (!t.contentDocument) { |
6697 w = this.getWin(); |
7023 w = t.getWin(); |
6698 |
7024 |
6699 if (w) |
7025 if (w) |
6700 t.contentDocument = w.document; |
7026 t.contentDocument = w.document; |
6701 } |
7027 } |
6702 |
7028 |
6931 if (e.keyCode === 9) |
7257 if (e.keyCode === 9) |
6932 return Event.cancel(e); |
7258 return Event.cancel(e); |
6933 }; |
7259 }; |
6934 |
7260 |
6935 function tabHandler(ed, e) { |
7261 function tabHandler(ed, e) { |
6936 var v, f, el; |
7262 var x, i, f, el, v; |
6937 |
7263 |
6938 function find(d) { |
7264 function find(d) { |
6939 f = DOM.getParent(ed.id, 'form'), el = f.elements; |
7265 f = DOM.getParent(ed.id, 'form'); |
7266 el = f.elements; |
|
6940 |
7267 |
6941 if (f) { |
7268 if (f) { |
6942 each(f.elements, function(e, i) { |
7269 each(el, function(e, i) { |
6943 if (e.id == ed.id) { |
7270 if (e.id == ed.id) { |
6944 i = i + d; |
7271 x = i; |
6945 |
7272 return false; |
6946 if (i < 0 || i > el.length) |
|
6947 return; |
|
6948 |
|
6949 el = el[i]; |
|
6950 } |
7273 } |
6951 }); |
7274 }); |
7275 |
|
7276 if (d > 0) { |
|
7277 for (i = x + 1; i < el.length; i++) { |
|
7278 if (el[i].type != 'hidden') |
|
7279 return el[i]; |
|
7280 } |
|
7281 } else { |
|
7282 for (i = x - 1; i >= 0; i--) { |
|
7283 if (el[i].type != 'hidden') |
|
7284 return el[i]; |
|
7285 } |
|
7286 } |
|
6952 } |
7287 } |
6953 |
7288 |
6954 return el; |
7289 return null; |
6955 }; |
7290 }; |
6956 |
7291 |
6957 if (e.keyCode === 9) { |
7292 if (e.keyCode === 9) { |
6958 v = ed.getParam('tab_focus').split(','); |
7293 v = ed.getParam('tab_focus').split(','); |
6959 |
7294 |
7195 |
7530 |
7196 t.destroyed = 1; |
7531 t.destroyed = 1; |
7197 }, |
7532 }, |
7198 |
7533 |
7199 _convertInlineElements : function() { |
7534 _convertInlineElements : function() { |
7200 var t = this, s = t.settings, dom = t.dom; |
7535 var t = this, s = t.settings, dom = t.dom, v; |
7201 |
7536 |
7202 function convert(ed, o) { |
7537 function convert(ed, o) { |
7203 if (!s.inline_styles) |
7538 if (!s.inline_styles) |
7204 return; |
7539 return; |
7205 |
7540 |
7246 }); |
7581 }); |
7247 } |
7582 } |
7248 }, |
7583 }, |
7249 |
7584 |
7250 _convertFonts : function() { |
7585 _convertFonts : function() { |
7251 var t = this, s = t.settings, dom = t.dom, sl, cl, fz, fzn, v, i; |
7586 var t = this, s = t.settings, dom = t.dom, sl, cl, fz, fzn, v, i, st; |
7587 |
|
7588 // No need |
|
7589 if (!s.inline_styles) |
|
7590 return; |
|
7252 |
7591 |
7253 // Font pt values and font size names |
7592 // Font pt values and font size names |
7254 fz = [8, 10, 12, 14, 18, 24, 36]; |
7593 fz = [8, 10, 12, 14, 18, 24, 36]; |
7255 fzn = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large']; |
7594 fzn = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large']; |
7256 |
7595 |
7258 sl = sl.split(','); |
7597 sl = sl.split(','); |
7259 |
7598 |
7260 if (cl = s.font_size_classes) |
7599 if (cl = s.font_size_classes) |
7261 cl = cl.split(','); |
7600 cl = cl.split(','); |
7262 |
7601 |
7602 function convertToFonts(no) { |
|
7603 // Convert spans to fonts on non WebKit browsers |
|
7604 if (tinymce.isWebKit || !s.inline_styles) |
|
7605 return; |
|
7606 |
|
7607 each(t.dom.select('span', no), function(n) { |
|
7608 var f = dom.create('font', { |
|
7609 color : dom.toHex(dom.getStyle(n, 'color')), |
|
7610 face : dom.getStyle(n, 'fontFamily'), |
|
7611 style : dom.getAttrib(n, 'style') |
|
7612 }); |
|
7613 |
|
7614 if (sl) { |
|
7615 i = inArray(sl, dom.getStyle(n, 'fontSize')); |
|
7616 |
|
7617 if (i != -1) { |
|
7618 dom.setAttrib(f, 'size', '' + (i + 1 || 1)); |
|
7619 f.style.fontSize = ''; |
|
7620 } |
|
7621 } else if (cl) { |
|
7622 i = inArray(cl, dom.getAttrib(n, 'class')); |
|
7623 v = dom.getStyle(n, 'fontSize'); |
|
7624 |
|
7625 if (i == -1 && v.indexOf('pt') > 0) |
|
7626 i = inArray(fz, parseInt(v)); |
|
7627 |
|
7628 if (i == -1) |
|
7629 i = inArray(fzn, v); |
|
7630 |
|
7631 if (i != -1) { |
|
7632 dom.setAttrib(f, 'size', '' + (i + 1 || 1)); |
|
7633 f.style.fontSize = ''; |
|
7634 } |
|
7635 } |
|
7636 |
|
7637 if (f.color || f.face || f.size) { |
|
7638 f.style.fontFamily = ''; |
|
7639 dom.setAttrib(f, 'mce_style', ''); |
|
7640 dom.replace(f, n, 1); |
|
7641 } |
|
7642 }); |
|
7643 }; |
|
7644 |
|
7645 // Run on setup |
|
7646 t.onSetContent.add(function(ed, o) { |
|
7647 if (o.initial) |
|
7648 convertToFonts(ed.getBody()); |
|
7649 }); |
|
7650 |
|
7651 // Run on cleanup |
|
7263 t.onPreProcess.add(function(ed, o) { |
7652 t.onPreProcess.add(function(ed, o) { |
7653 // Keep unit tests happy |
|
7264 if (!s.inline_styles) |
7654 if (!s.inline_styles) |
7265 return; |
7655 return; |
7266 |
7656 |
7267 if (o.set) { |
7657 if (o.get) { |
7268 // Convert spans to fonts on non WebKit browsers |
|
7269 if (tinymce.isWebKit) |
|
7270 return; |
|
7271 |
|
7272 each(t.dom.select('span', o.node), function(n) { |
|
7273 var f = dom.create('font', { |
|
7274 color : dom.toHex(dom.getStyle(n, 'color')), |
|
7275 face : dom.getStyle(n, 'fontFamily') |
|
7276 }); |
|
7277 |
|
7278 if (sl) { |
|
7279 i = inArray(sl, dom.getStyle(n, 'fontSize')); |
|
7280 |
|
7281 if (i != -1) |
|
7282 dom.setAttrib(f, 'size', '' + (i + 1 || 1)); |
|
7283 } else if (cl) { |
|
7284 i = inArray(cl, dom.getAttrib(n, 'class')); |
|
7285 |
|
7286 v = dom.getStyle(n, 'fontSize'); |
|
7287 |
|
7288 if (i == -1 && v.indexOf('pt') > 0) |
|
7289 i = inArray(fz, parseInt(v)); |
|
7290 |
|
7291 if (i == -1) |
|
7292 i = inArray(fzn, v); |
|
7293 |
|
7294 if (i != -1) |
|
7295 dom.setAttrib(f, 'size', '' + (i + 1 || 1)); |
|
7296 } |
|
7297 |
|
7298 if (f.color || f.face || f.size) |
|
7299 dom.replace(f, n, 1); |
|
7300 }); |
|
7301 } else if (o.get) { |
|
7302 each(t.dom.select('font', o.node), function(n) { |
7658 each(t.dom.select('font', o.node), function(n) { |
7303 var sp = dom.create('span', { |
7659 var sp = dom.create('span', { |
7304 style : { |
7660 style : dom.getAttrib(n, 'style') |
7305 fontFamily : dom.getAttrib(n, 'face'), |
7661 }); |
7306 color : dom.getAttrib(n, 'color'), |
7662 |
7307 backgroundColor : n.style.backgroundColor |
7663 dom.setStyles(sp, { |
7308 } |
7664 fontFamily : dom.getAttrib(n, 'face'), |
7665 color : dom.getAttrib(n, 'color'), |
|
7666 backgroundColor : n.style.backgroundColor |
|
7309 }); |
7667 }); |
7310 |
7668 |
7311 if (n.size) { |
7669 if (n.size) { |
7312 if (sl) |
7670 if (sl) |
7313 dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]); |
7671 dom.setStyle(sp, 'fontSize', sl[parseInt(n.size) - 1]); |
7314 else |
7672 else |
7315 dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]); |
7673 dom.setAttrib(sp, 'class', cl[parseInt(n.size) - 1]); |
7316 } |
7674 } |
7317 |
7675 |
7676 dom.setAttrib(sp, 'mce_style', ''); |
|
7318 dom.replace(sp, n, 1); |
7677 dom.replace(sp, n, 1); |
7319 }); |
7678 }); |
7320 } |
7679 } else if (o.set) |
7680 convertToFonts(o.node); |
|
7321 }); |
7681 }); |
7322 }, |
7682 }, |
7323 |
7683 |
7324 _isHidden : function() { |
7684 _isHidden : function() { |
7325 var s; |
7685 var s; |
7330 // Weird, wheres that cursor selection? |
7690 // Weird, wheres that cursor selection? |
7331 s = this.selection.getSel(); |
7691 s = this.selection.getSel(); |
7332 return (!s || !s.rangeCount || s.rangeCount == 0); |
7692 return (!s || !s.rangeCount || s.rangeCount == 0); |
7333 }, |
7693 }, |
7334 |
7694 |
7695 // Fix for bug #1867292 |
|
7335 _fixNesting : function(s) { |
7696 _fixNesting : function(s) { |
7336 var d = [], i; |
7697 var d = [], i; |
7337 |
7698 |
7338 s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) { |
7699 s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) { |
7339 var e; |
7700 var e; |
7634 if (nn == 'IMG') { |
7995 if (nn == 'IMG') { |
7635 if (v == 'full') |
7996 if (v == 'full') |
7636 return; |
7997 return; |
7637 |
7998 |
7638 if (rm) { |
7999 if (rm) { |
8000 if (v == 'center') |
|
8001 dom.setStyle(n.parentNode, 'textAlign', ''); |
|
8002 |
|
7639 dom.setStyle(n, 'float', ''); |
8003 dom.setStyle(n, 'float', ''); |
7640 this.mceRepaint(); |
8004 this.mceRepaint(); |
7641 return; |
8005 return; |
7642 } |
8006 } |
7643 |
8007 |
7644 if (v == 'center') { |
8008 if (v == 'center') { |
8009 // Do not change table elements |
|
8010 if (/^(TD|TH)$/.test(bl.nodeName)) |
|
8011 bl = 0; |
|
8012 |
|
7645 if (!bl || bl.childNodes.length > 1) { |
8013 if (!bl || bl.childNodes.length > 1) { |
7646 nb = dom.create('p'); |
8014 nb = dom.create('p'); |
7647 nb.appendChild(n.cloneNode(false)); |
8015 nb.appendChild(n.cloneNode(false)); |
7648 |
8016 |
7649 if (bl) |
8017 if (bl) |
7656 bl = nb; |
8024 bl = nb; |
7657 } |
8025 } |
7658 |
8026 |
7659 dom.setStyle(bl, 'textAlign', v); |
8027 dom.setStyle(bl, 'textAlign', v); |
7660 dom.setStyle(n, 'float', ''); |
8028 dom.setStyle(n, 'float', ''); |
7661 } else |
8029 } else { |
7662 dom.setStyle(n, 'float', v); |
8030 dom.setStyle(n, 'float', v); |
8031 dom.setStyle(n.parentNode, 'textAlign', ''); |
|
8032 } |
|
7663 |
8033 |
7664 this.mceRepaint(); |
8034 this.mceRepaint(); |
7665 return; |
8035 return; |
7666 } |
8036 } |
7667 |
8037 |
7912 }, |
8282 }, |
7913 |
8283 |
7914 queryStateJustify : function(c, v) { |
8284 queryStateJustify : function(c, v) { |
7915 var ed = this.editor, n = ed.selection.getNode(), dom = ed.dom; |
8285 var ed = this.editor, n = ed.selection.getNode(), dom = ed.dom; |
7916 |
8286 |
7917 if (n && n.nodeName == 'IMG') |
8287 if (n && n.nodeName == 'IMG') { |
7918 return dom.getStyle(n, 'float') == v; |
8288 if (dom.getStyle(n, 'float') == v) |
8289 return 1; |
|
8290 |
|
8291 return n.parentNode.style.textAlign == v; |
|
8292 } |
|
7919 |
8293 |
7920 n = dom.getParent(ed.selection.getStart(), function(n) { |
8294 n = dom.getParent(ed.selection.getStart(), function(n) { |
7921 return n.nodeType == 1 && n.style.textAlign; |
8295 return n.nodeType == 1 && n.style.textAlign; |
7922 }); |
8296 }); |
7923 |
8297 |
7976 |
8350 |
7977 FormatBlock : function(ui, val) { |
8351 FormatBlock : function(ui, val) { |
7978 var t = this, ed = t.editor; |
8352 var t = this, ed = t.editor; |
7979 |
8353 |
7980 val = ed.settings.forced_root_block ? (val || '<p>') : val; |
8354 val = ed.settings.forced_root_block ? (val || '<p>') : val; |
7981 t.mceRemoveNode(); |
8355 |
8356 if (/^(P|DIV|H[1-6]|ADDRESS|BLOCKQUOTE|PRE)$/.test(ed.selection.getNode().nodeName)) |
|
8357 t.mceRemoveNode(); |
|
7982 |
8358 |
7983 if (val.indexOf('<') == -1) |
8359 if (val.indexOf('<') == -1) |
7984 val = '<' + val + '>'; |
8360 val = '<' + val + '>'; |
7985 |
8361 |
7986 if (tinymce.isGecko) |
8362 if (tinymce.isGecko) |
8029 }, |
8405 }, |
8030 |
8406 |
8031 mceInsertRawHTML : function(ui, val) { |
8407 mceInsertRawHTML : function(ui, val) { |
8032 var ed = this.editor; |
8408 var ed = this.editor; |
8033 |
8409 |
8034 ed.execCommand('mceInsertContent', false, 'tiny_mce_marker'); |
8410 ed.selection.setContent('tiny_mce_marker'); |
8035 ed.setContent(ed.getContent().replace(/tiny_mce_marker/g, val)); |
8411 ed.setContent(ed.getContent().replace(/tiny_mce_marker/g, val)); |
8036 }, |
8412 }, |
8037 |
8413 |
8038 mceRepaint : function() { |
8414 mceRepaint : function() { |
8039 var s, b, e = this.editor; |
8415 var s, b, e = this.editor; |
8312 each = tinymce.each; |
8688 each = tinymce.each; |
8313 extend = tinymce.extend; |
8689 extend = tinymce.extend; |
8314 |
8690 |
8315 tinymce.create('tinymce.ForceBlocks', { |
8691 tinymce.create('tinymce.ForceBlocks', { |
8316 ForceBlocks : function(ed) { |
8692 ForceBlocks : function(ed) { |
8317 var t = this, s; |
8693 var t = this, s, elm; |
8318 |
8694 |
8319 t.editor = ed; |
8695 t.editor = ed; |
8320 t.dom = ed.dom; |
8696 t.dom = ed.dom; |
8321 |
8697 |
8322 // Default settings |
8698 // Default settings |
8323 t.settings = s = extend({ |
8699 t.settings = s = extend({ |
8324 element : 'P', |
|
8325 forced_root_block : 'p', |
8700 forced_root_block : 'p', |
8326 force_p_newlines : true |
8701 force_p_newlines : true |
8327 }, ed.settings); |
8702 }, ed.settings); |
8328 |
8703 |
8704 elm = (s.forced_root_block || 'p').toLowerCase(); |
|
8705 s.element = elm.toUpperCase(); |
|
8706 |
|
8329 ed.onPreInit.add(t.setup, t); |
8707 ed.onPreInit.add(t.setup, t); |
8708 |
|
8709 t.reOpera = new RegExp('(\u00a0| | )<\/' + elm + '>', 'gi'); |
|
8710 t.rePadd = new RegExp('<p( )([^>]+)><\/p>|<p( )([^>]+)\/>|<p( )([^>]+)>\s+<\/p>|<p><\/p>|<p\/>|<p>\s+<\/p>'.replace(/p/g, elm), 'gi'); |
|
8711 t.reNbsp2BR = new RegExp('<p( )([^>]+)>[\s\u00a0]+<\/p>|<p>[\s\u00a0]+<\/p>'.replace(/p/g, elm), 'gi'); |
|
8712 t.reBR2Nbsp = new RegExp('<p( )([^>]+)>\s*<br \/>\s*<\/p>|<p>\s*<br \/>\s*<\/p>'.replace(/p/g, elm), 'gi'); |
|
8713 t.reTrailBr = new RegExp('\s*<br \/>\s*<\/p>'.replace(/p/g, elm), 'gi'); |
|
8330 |
8714 |
8331 function padd(ed, o) { |
8715 function padd(ed, o) { |
8332 if (isOpera) |
8716 if (isOpera) |
8333 o.content = o.content.replace(/(\u00a0| | )<\/p>/gi, '</p>'); |
8717 o.content = o.content.replace(t.reOpera, '</' + elm + '>'); |
8334 |
8718 |
8335 o.content = o.content.replace(/<p( )([^>]+)><\/p>|<p( )([^>]+)\/>|<p( )([^>]+)>\s+<\/p>|<p><\/p>|<p\/>|<p>\s+<\/p>/gi, '<p$1$2$3$4$5$6>\u00a0</p>'); |
8719 o.content = o.content.replace(t.rePadd, '<' + elm + '$1$2$3$4$5$6>\u00a0</' + elm + '>'); |
8336 |
8720 |
8337 if (!isIE && o.set) { |
8721 if (!isIE && o.set) { |
8338 // Use instead of BR in padded paragraphs |
8722 // Use instead of BR in padded paragraphs |
8339 o.content = o.content.replace(/<p( )([^>]+)>[\s\u00a0]+<\/p>|<p>[\s\u00a0]+<\/p>/gi, '<p$1$2><br /></p>'); |
8723 o.content = o.content.replace(t.reNbsp2BR, '<' + elm + '$1$2><br /></' + elm + '>'); |
8340 } else { |
8724 } else { |
8341 o.content = o.content.replace(/<p( )([^>]+)>\s*<br \/>\s*<\/p>|<p>\s*<br \/>\s*<\/p>/gi, '<p$1$2>\u00a0</p>'); |
8725 o.content = o.content.replace(t.reBR2Nbsp, '<' + elm + '$1$2>\u00a0</' + elm + '>'); |
8342 o.content = o.content.replace(/\s*<br \/>\s*<\/p>/gi, '</p>'); |
8726 o.content = o.content.replace(t.reTrailBr, '</' + elm + '>'); |
8343 } |
8727 } |
8344 }; |
8728 }; |
8345 |
8729 |
8346 ed.onBeforeSetContent.add(padd); |
8730 ed.onBeforeSetContent.add(padd); |
8347 ed.onPostProcess.add(padd); |
8731 ed.onPostProcess.add(padd); |
8366 // Force IE to produce BRs on enter |
8750 // Force IE to produce BRs on enter |
8367 if (isIE) { |
8751 if (isIE) { |
8368 ed.onKeyPress.add(function(ed, e) { |
8752 ed.onKeyPress.add(function(ed, e) { |
8369 var n, s = ed.selection; |
8753 var n, s = ed.selection; |
8370 |
8754 |
8371 if (e.keyCode == 13) { |
8755 if (e.keyCode == 13 && s.getNode().nodeName != 'LI') { |
8372 s.setContent('<br id="__" /> ', {format : 'raw'}); |
8756 s.setContent('<br id="__" /> ', {format : 'raw'}); |
8373 n = ed.dom.get('__'); |
8757 n = ed.dom.get('__'); |
8374 n.removeAttribute('id'); |
8758 n.removeAttribute('id'); |
8375 s.select(n); |
8759 s.select(n); |
8376 s.collapse(); |
8760 s.collapse(); |
8381 |
8765 |
8382 return; |
8766 return; |
8383 } |
8767 } |
8384 |
8768 |
8385 if (!isIE && s.force_p_newlines) { |
8769 if (!isIE && s.force_p_newlines) { |
8386 ed.onPreProcess.add(function(ed, o) { |
8770 /* ed.onPreProcess.add(function(ed, o) { |
8387 each(ed.dom.select('br', o.node), function(n) { |
8771 each(ed.dom.select('br', o.node), function(n) { |
8388 var p = n.parentNode; |
8772 var p = n.parentNode; |
8389 |
8773 |
8390 // Replace <p><br /></p> with <p> </p> |
8774 // Replace <p><br /></p> with <p> </p> |
8391 if (p && p.nodeName == 'p' && (p.childNodes.length == 1 || p.lastChild == n)) |
8775 if (p && p.nodeName == 'p' && (p.childNodes.length == 1 || p.lastChild == n)) { |
8392 p.replaceChild(ed.getDoc().createTextNode('\u00a0'), n); |
8776 p.replaceChild(ed.getDoc().createTextNode('\u00a0'), n); |
8777 } |
|
8393 }); |
8778 }); |
8394 }); |
8779 });*/ |
8395 |
8780 |
8396 ed.onKeyPress.add(function(ed, e) { |
8781 ed.onKeyPress.add(function(ed, e) { |
8397 if (e.keyCode == 13 && !e.shiftKey) { |
8782 if (e.keyCode == 13 && !e.shiftKey) { |
8398 if (!t.insertPara(e)) |
8783 if (!t.insertPara(e)) |
8399 Event.cancel(e); |
8784 Event.cancel(e); |
8404 ed.onKeyDown.add(function(ed, e) { |
8789 ed.onKeyDown.add(function(ed, e) { |
8405 if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) |
8790 if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) |
8406 t.backspaceDelete(e, e.keyCode == 8); |
8791 t.backspaceDelete(e, e.keyCode == 8); |
8407 }); |
8792 }); |
8408 } |
8793 } |
8794 } |
|
8795 |
|
8796 function ren(rn, na) { |
|
8797 var ne = ed.dom.create(na); |
|
8798 |
|
8799 each(rn.attributes, function(a) { |
|
8800 if (a.specified && a.nodeValue) |
|
8801 ne.setAttribute(a.nodeName.toLowerCase(), a.nodeValue); |
|
8802 }); |
|
8803 |
|
8804 each(rn.childNodes, function(n) { |
|
8805 ne.appendChild(n.cloneNode(true)); |
|
8806 }); |
|
8807 |
|
8808 rn.parentNode.replaceChild(ne, rn); |
|
8809 |
|
8810 return ne; |
|
8811 }; |
|
8812 |
|
8813 // Replaces IE:s auto generated paragraphs with the specified element name |
|
8814 if (isIE && s.element != 'P') { |
|
8815 ed.onKeyPress.add(function(ed, e) { |
|
8816 t.lastElm = ed.selection.getNode().nodeName; |
|
8817 }); |
|
8818 |
|
8819 ed.onKeyUp.add(function(ed, e) { |
|
8820 var bl, sel = ed.selection, n = sel.getNode(), b = ed.getBody(); |
|
8821 |
|
8822 if (b.childNodes.length === 1 && n.nodeName == 'P') { |
|
8823 n = ren(n, s.element); |
|
8824 sel.select(n); |
|
8825 sel.collapse(); |
|
8826 ed.nodeChanged(); |
|
8827 } else if (e.keyCode == 13 && !e.shiftKey && t.lastElm != 'P') { |
|
8828 bl = ed.dom.getParent(n, 'P'); |
|
8829 |
|
8830 if (bl) { |
|
8831 ren(bl, s.element); |
|
8832 ed.nodeChanged(); |
|
8833 } |
|
8834 } |
|
8835 }); |
|
8409 } |
8836 } |
8410 }, |
8837 }, |
8411 |
8838 |
8412 find : function(n, t, s) { |
8839 find : function(n, t, s) { |
8413 var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, false), c = -1; |
8840 var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, false), c = -1; |
8574 ra = d.createRange(); |
9001 ra = d.createRange(); |
8575 ra.setStart(en, 0); |
9002 ra.setStart(en, 0); |
8576 } |
9003 } |
8577 |
9004 |
8578 // Never use body as start or end node |
9005 // Never use body as start or end node |
9006 sn = sn.nodeName == "HTML" ? d.body : sn; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes |
|
8579 sn = sn.nodeName == "BODY" ? sn.firstChild : sn; |
9007 sn = sn.nodeName == "BODY" ? sn.firstChild : sn; |
9008 en = en.nodeName == "HTML" ? d.body : en; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes |
|
8580 en = en.nodeName == "BODY" ? en.firstChild : en; |
9009 en = en.nodeName == "BODY" ? en.firstChild : en; |
8581 |
9010 |
8582 // Get start and end blocks |
9011 // Get start and end blocks |
8583 sb = t.getParentBlock(sn); |
9012 sb = t.getParentBlock(sn); |
8584 eb = t.getParentBlock(en); |
9013 eb = t.getParentBlock(en); |
8835 |
9264 |
8836 return t.add(c); |
9265 return t.add(c); |
8837 }, |
9266 }, |
8838 |
9267 |
8839 createDropMenu : function(id, s) { |
9268 createDropMenu : function(id, s) { |
8840 var t = this, ed = t.editor, c; |
9269 var t = this, ed = t.editor, c, bm; |
8841 |
9270 |
8842 s = extend({ |
9271 s = extend({ |
8843 'class' : 'mceDropDown' |
9272 'class' : 'mceDropDown' |
8844 }, s); |
9273 }, s); |
8845 |
9274 |
8852 |
9281 |
8853 s.title = ed.getLang(s.title, s.title); |
9282 s.title = ed.getLang(s.title, s.title); |
8854 |
9283 |
8855 if (!s.onclick) { |
9284 if (!s.onclick) { |
8856 s.onclick = function(v) { |
9285 s.onclick = function(v) { |
8857 ed.execCommand(s.cmd, s.ui || false, v || s.value); |
9286 ed.execCommand(s.cmd, s.ui || false, s.value); |
8858 }; |
9287 }; |
8859 } |
9288 } |
8860 }); |
9289 }); |
8861 |
9290 |
8862 ed.onRemove.add(function() { |
9291 ed.onRemove.add(function() { |
8863 c.destroy(); |
9292 c.destroy(); |
8864 }); |
9293 }); |
9294 |
|
9295 // Fix for bug #1897785, #1898007 |
|
9296 if (tinymce.isIE) { |
|
9297 c.onShowMenu.add(function() { |
|
9298 var s = ed.selection, n = s.getNode(); |
|
9299 |
|
9300 if (n.nodeName == 'IMG') |
|
9301 bm = s.getBookmark(); |
|
9302 else |
|
9303 bm = 0; |
|
9304 }); |
|
9305 |
|
9306 c.onHideMenu.add(function() { |
|
9307 if (bm) |
|
9308 ed.selection.moveToBookmark(bm); |
|
9309 }); |
|
9310 } |
|
8865 |
9311 |
8866 return t.add(c); |
9312 return t.add(c); |
8867 }, |
9313 }, |
8868 |
9314 |
8869 createListBox : function(id, s) { |
9315 createListBox : function(id, s) { |
9065 t.params = {}; |
9511 t.params = {}; |
9066 t.features = {}; |
9512 t.features = {}; |
9067 }, |
9513 }, |
9068 |
9514 |
9069 open : function(s, p) { |
9515 open : function(s, p) { |
9070 var t = this, f = '', x, y, mo = t.editor.settings.dialog_type == 'modal', w, sw, sh, vp = tinymce.DOM.getViewPort(); |
9516 var t = this, f = '', x, y, mo = t.editor.settings.dialog_type == 'modal', w, sw, sh, vp = tinymce.DOM.getViewPort(), u; |
9071 |
9517 |
9072 // Default some options |
9518 // Default some options |
9073 s = s || {}; |
9519 s = s || {}; |
9074 p = p || {}; |
9520 p = p || {}; |
9075 sw = isOpera ? vp.w : screen.width; // Opera uses windows inside the Opera window |
9521 sw = isOpera ? vp.w : screen.width; // Opera uses windows inside the Opera window |
9110 |
9556 |
9111 t.features = s; |
9557 t.features = s; |
9112 t.params = p; |
9558 t.params = p; |
9113 t.onOpen.dispatch(t, s, p); |
9559 t.onOpen.dispatch(t, s, p); |
9114 |
9560 |
9561 u = s.url || s.file; |
|
9562 if (tinymce.relaxedDomain) |
|
9563 u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain; |
|
9564 |
|
9115 try { |
9565 try { |
9116 if (isIE && mo) { |
9566 if (isIE && mo) { |
9117 w = 1; |
9567 w = 1; |
9118 window.showModalDialog(s.url || s.file, window, f); |
9568 window.showModalDialog(s.url || s.file, window, f); |
9119 } else |
9569 } else |
9120 w = window.open(s.url || s.file, s.name, f); |
9570 w = window.open(u, s.name, f); |
9121 } catch (ex) { |
9571 } catch (ex) { |
9122 // Ignore |
9572 // Ignore |
9123 } |
9573 } |
9124 |
9574 |
9125 if (!w) |
9575 if (!w) |
9129 close : function(w) { |
9579 close : function(w) { |
9130 w.close(); |
9580 w.close(); |
9131 this.onClose.dispatch(this); |
9581 this.onClose.dispatch(this); |
9132 }, |
9582 }, |
9133 |
9583 |
9134 createInstance : function(cl) { |
9584 createInstance : function(cl, a, b, c, d, e) { |
9135 var a = arguments, i, f = tinymce.resolve(cl), s = ''; |
9585 var f = tinymce.resolve(cl); |
9136 |
9586 |
9137 // Is there a better way to dynamically create |
9587 return new f(a, b, c, d, e); |
9138 // a class with a dynamic number of arguments |
|
9139 for (i=1; i<a.length; i++) |
|
9140 s += (i > 1 ? ',' : '') + 'a[' + i + ']'; |
|
9141 |
|
9142 return eval('(new f(' + s + '))'); |
|
9143 }, |
9588 }, |
9144 |
9589 |
9145 confirm : function(t, cb, s) { |
9590 confirm : function(t, cb, s) { |
9146 cb.call(s || this, confirm(this._decode(this.editor.getLang(t, t)))); |
9591 cb.call(s || this, confirm(this._decode(this.editor.getLang(t, t)))); |
9147 }, |
9592 }, |