diff -r 488665d49417 -r 57ce13805b6f includes/clientside/tinymce/tiny_mce_src.js --- a/includes/clientside/tinymce/tiny_mce_src.js Sun Dec 21 15:35:46 2008 -0500 +++ b/includes/clientside/tinymce/tiny_mce_src.js Sun Dec 21 16:28:00 2008 -0500 @@ -3,8 +3,8 @@ var tinymce = { majorVersion : '3', - minorVersion : '1.0.1', - releaseDate : '2008-06-18', + minorVersion : '2.1.1', + releaseDate : '2008-11-27', _init : function() { var t = this, d = document, w = window, na = navigator, ua = na.userAgent, i, nl, n, base, p, v; @@ -17,6 +17,7 @@ t.isIE6 = t.isIE && /MSIE [56]/.test(ua); t.isGecko = !t.isWebKit && /Gecko/.test(ua); t.isMac = ua.indexOf('Mac') != -1; + t.isAir = /adobeair/i.test(ua); // TinyMCE .NET webcontrol might be setting the values for TinyMCE if (w.tinyMCEPreInit) { @@ -511,7 +512,7 @@ u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u; // Relative path - if (u.indexOf('://') === -1 && u.indexOf('//') !== 0) + if (u.indexOf(':/') === -1 && u.indexOf('//') !== 0) u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u); // Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri) @@ -564,6 +565,9 @@ toRelative : function(u) { var t = this, o; + if (u === "./") + return u; + u = new tinymce.util.URI(u, {base_uri : t}); // Not on same domain/port or protocol @@ -590,7 +594,7 @@ }, toRelPath : function(base, path) { - var items, bp = 0, out = '', i; + var items, bp = 0, out = '', i, l; // Split the paths base = base.substring(0, base.lastIndexOf('/')); @@ -598,7 +602,7 @@ items = path.split('/'); if (base.length >= items.length) { - for (i = 0; i < base.length; i++) { + for (i = 0, l = base.length; i < l; i++) { if (i >= items.length || base[i] != items[i]) { bp = i + 1; break; @@ -607,7 +611,7 @@ } if (base.length < items.length) { - for (i = 0; i < items.length; i++) { + for (i = 0, l = items.length; i < l; i++) { if (i >= base.length || base[i] != items[i]) { bp = i + 1; break; @@ -618,10 +622,10 @@ if (bp == 1) return path; - for (i = 0; i < base.length - (bp - 1); i++) + for (i = 0, l = base.length - (bp - 1); i < l; i++) out += "../"; - for (i = bp - 1; i < items.length; i++) { + for (i = bp - 1, l = items.length; i < l; i++) { if (i != bp - 1) out += "/" + items[i]; else @@ -803,7 +807,7 @@ if (t == 'string') { v = '\bb\tt\nn\ff\rr\""\'\'\\\\'; - return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"\'])/g, function(a, b) { + return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) { i = v.indexOf(b); if (i + 1) @@ -977,6 +981,20 @@ idPattern : /^#[\w]+$/, elmPattern : /^[\w_*]+$/, elmClassPattern : /^([\w_]*)\.([\w_]+)$/, + props : { + "for" : "htmlFor", + "class" : "className", + className : "className", + checked : "checked", + disabled : "disabled", + maxlength : "maxLength", + readonly : "readOnly", + selected : "selected", + value : "value", + id : "id", + name : "name", + type : "type" + }, DOMUtils : function(d, s) { var t = this; @@ -1030,10 +1048,24 @@ }, getRect : function(e) { - var p, t = this, w, h; + var p, t = this, sr; e = t.get(e); p = t.getPos(e); + sr = t.getSize(e); + + return { + x : p.x, + y : p.y, + w : sr.w, + h : sr.h + }; + }, + + getSize : function(e) { + var t = this, w, h; + + e = t.get(e); w = t.getStyle(e, 'width'); h = t.getStyle(e, 'height'); @@ -1046,8 +1078,6 @@ h = 0; return { - x : p.x, - y : p.y, w : parseInt(w) || e.offsetWidth || e.clientWidth, h : parseInt(h) || e.offsetHeight || e.clientHeight }; @@ -1113,10 +1143,11 @@ return e; }, + // #if !jquery select : function(pa, s) { - var t = this, cs, c, pl, o = [], x, i, l, n; + var t = this, cs, c, pl, o = [], x, i, l, n, xp; s = t.get(s) || t.doc; @@ -1140,6 +1171,44 @@ return l; } + if (!t.selectorRe) + t.selectorRe = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i;; + + // Air doesn't support eval due to security sandboxing and querySelectorAll isn't supported yet + if (tinymce.isAir) { + each(tinymce.explode(pa), function(v) { + if (!(xp = t.cache[v])) { + xp = ''; + + each(v.split(' '), function(v) { + v = t.selectorRe.exec(v); + + xp += v[1] ? '//' + v[1] : '//*'; + + // Id + if (v[2]) + xp += "[@id='" + v[2] + "']"; + + // Class + if (v[3]) { + each(v[3].split('.'), function(n) { + xp += "[@class = '" + n + "' or contains(concat(' ', @class, ' '), ' " + n + " ')]"; + }); + } + }); + + t.cache[v] = xp; + } + + xp = t.doc.evaluate(xp, s, null, 4, null); + + while (n = xp.iterateNext()) + o.push(n); + }); + + return o; + } + if (t.settings.strict) { function get(s, n) { return s.getElementsByTagName(n.toLowerCase()); @@ -1226,7 +1295,7 @@ pl = v.split(' '); each(pl, function(v) { - var p = /^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i.exec(v); + var p = t.selectorRe.exec(v); // Find elements p[1] = p[1] || '*'; @@ -1284,19 +1353,7 @@ var e, k; e = is(n, 'string') ? t.doc.createElement(n) : n; - - if (a) { - for (k in a) { - if (a.hasOwnProperty(k) && !is(a[k], 'object')) - t.setAttrib(e, k, '' + a[k]); - } - - if (a.style && !is(a.style, 'string')) { - each(a.style, function(v, n) { - t.setStyle(e, n, v); - }); - } - } + t.setAttribs(e, a); if (h) { if (h.nodeType) @@ -1458,6 +1515,10 @@ setAttrib : function(e, n, v) { var t = this; + // Whats the point + if (!e || !n) + return; + // Strict XML mode if (t.settings.strict) n = n.toLowerCase(); @@ -1467,6 +1528,14 @@ switch (n) { case "style": + if (!is(v, 'string')) { + each(v, function(v, n) { + t.setStyle(e, n, v); + }); + + return; + } + // No mce_style for elements with these since they might get resized by the user if (s.keep_values) { if (v && !t._isRes(v)) @@ -1526,7 +1595,7 @@ return false; if (!is(dv)) - dv = ""; + dv = ''; // Try the mce variant for these if (/^(src|href|style|coords|shape)$/.test(n)) { @@ -1536,38 +1605,23 @@ return v; } - v = e.getAttribute(n, 2); - - if (!v) { - switch (n) { - case 'class': - v = e.className; - break; - - default: - // Fix for IE crash Bug: #1884376 probably due to invalid DOM structure - if (isIE && n === 'name' && e.nodeName === 'A') { - v = e.name; - break; - } - - v = e.attributes[n]; - v = v && is(v.nodeValue) ? v.nodeValue : v; - } - } - - switch (n) { - case 'style': - v = v || e.style.cssText; - - if (v) { - v = t.serializeStyle(t.parseStyle(v)); - - if (t.settings.keep_values && !t._isRes(v)) - e.setAttribute('mce_style', v); - } - - break; + if (isIE && t.props[n]) { + v = e[t.props[n]]; + v = v && v.nodeValue ? v.nodeValue : v; + } + + if (!v) + v = e.getAttribute(n, 2); + + if (n === 'style') { + v = v || e.style.cssText; + + if (v) { + v = t.serializeStyle(t.parseStyle(v)); + + if (t.settings.keep_values && !t._isRes(v)) + e.setAttribute('mce_style', v); + } } // Remove Apple and WebKit stuff @@ -1587,7 +1641,18 @@ case 'size': // IE returns +0 as default value for size - if (v === '+0') + if (v === '+0' || v === 20) + v = ''; + + break; + + case 'width': + case 'height': + case 'vspace': + case 'checked': + case 'disabled': + case 'readonly': + if (v === 0) v = ''; break; @@ -1599,19 +1664,21 @@ break; + case 'maxlength': case 'tabindex': // IE returns default value - if (v === 32768) + if (v === 32768 || v === 2147483647 || v === '32768') v = ''; break; - case 'maxlength': - // IE returns default value - if (v === 2147483647) - v = ''; - - break; + case 'compact': + case 'noshade': + case 'nowrap': + if (v === 65535) + return n; + + return dv; case 'shape': v = v.toLowerCase(); @@ -1624,7 +1691,7 @@ } } - return (v && v != '') ? '' + v : dv; + return (v !== undefined && v !== null && v !== '') ? '' + v : dv; }, getPos : function(n) { @@ -1860,7 +1927,7 @@ isHidden : function(e) { e = this.get(e); - return e.style.display == 'none' || this.getStyle(e, 'display') == 'none'; + return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none'; }, // #endif @@ -1934,7 +2001,7 @@ if (x) { // So if we replace the p elements with divs and mark them and then replace them back to paragraphs // after we use innerHTML we can fix the DOM tree - h = h.replace(/
]+)>|
/g, '
]+)>|
/g, '