diff -r fbfdcea634a7 -r fa4c5ecb7c9a includes/clientside/tinymce/tiny_mce_src.js --- a/includes/clientside/tinymce/tiny_mce_src.js Thu Jan 31 22:29:07 2008 -0500 +++ b/includes/clientside/tinymce/tiny_mce_src.js Sat Feb 02 11:54:16 2008 -0500 @@ -3,8 +3,8 @@ var tinymce = { majorVersion : '3', - minorVersion : '0b3', - releaseDate : '2007-12-14', + minorVersion : '0', + releaseDate : '2008-01-30', _init : function() { var t = this, ua = navigator.userAgent, i, nl, n, base; @@ -453,9 +453,16 @@ 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) + u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u); each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) { - t[v] = u[i]; + var s = u[i]; + + // Zope 3 workaround, they use @@something + if (s) + s = s.replace(/\(mce_at\)/g, '@@'); + + t[v] = s; }); if (b = s.base_uri) { @@ -677,7 +684,13 @@ }, get : function(n) { - var c = document.cookie, e, p = n + "=", b = c.indexOf("; " + p); + var c = document.cookie, e, p = n + "=", b; + + // Strict mode + if (!c) + return; + + b = c.indexOf("; " + p); if (b == -1) { b = c.indexOf(p); @@ -906,7 +919,8 @@ this.settings = s = tinymce.extend({ keep_values : false, - hex_colors : 1 + hex_colors : 1, + process_html : 1 }, s); // Fix IE6SP2 flicker and check it failed for pre SP2 @@ -946,25 +960,35 @@ }, getRect : function(e) { - var p, t = this; + var p, t = this, w, h; e = t.get(e); p = t.getPos(e); + w = t.getStyle(e, 'width'); + h = t.getStyle(e, 'height'); + + // Non pixel value, then force offset/clientWidth + if (w.indexOf('px') === -1) + w = 0; + + // Non pixel value, then force offset/clientWidth + if (h.indexOf('px') === -1) + h = 0; return { x : p.x, y : p.y, - w : parseInt(t.getStyle(e, 'width')) || e.offsetWidth || e.clientWidth, - h : parseInt(t.getStyle(e, 'height')) || e.offsetHeight || e.clientHeight + w : parseInt(w) || e.offsetWidth || e.clientWidth, + h : parseInt(h) || e.offsetHeight || e.clientHeight }; }, getParent : function(n, f, r) { - var na; + var na, se = this.settings; n = this.get(n); - if (this.settings.strict_root) + if (se.strict_root) r = r || this.getRoot(); // Wrap node name as func @@ -981,7 +1005,7 @@ } each(na.split(','), function(v) { - if (n.nodeType == 1 && n.nodeName == v) { + if (n.nodeType == 1 && ((se.strict && n.nodeName.toUpperCase() == v) || n.nodeName == v)) { s = true; return false; // Break loop } @@ -1018,9 +1042,19 @@ s = t.get(s) || t.doc; + if (t.settings.strict) { + function get(s, n) { + return s.getElementsByTagName(n.toLowerCase()); + }; + } else { + function get(s, n) { + return s.getElementsByTagName(n); + }; + } + // Simple element pattern. For example: "p" or "*" if (t.elmPattern.test(pa)) { - x = s.getElementsByTagName(pa); + x = get(s, pa); for (i = 0, l = x.length; i 1) + e.appendChild(n); + }); + } } else e.innerHTML = h; @@ -1687,16 +1776,30 @@ processHTML : function(h) { var t = this, s = t.settings; + if (!s.process_html) + return h; + // Convert strong and em to b and i in FF since it can't handle them if (tinymce.isGecko) { h = h.replace(/<(\/?)strong>|]+)>/gi, '<$1b$2>'); h = h.replace(/<(\/?)em>|]+)>/gi, '<$1i$2>'); } + // Fix some issues + h = h.replace(/]+)\/>|/gi, ''); // Force open + // Store away src and href in mce_src and mce_href since browsers mess them up if (s.keep_values) { + // Wrap scripts in comments for serialization purposes + if (h.indexOf('/g, ''); + }; if (!tinymce.is(u, 'string')) { - o = []; - each(u, function(u) { - o.push({state : 0, url : u}); + loadScript(u); }); - this.loadScripts(o, cb, s); - } else - this.loadScripts([{state : 0, url : u}], cb, s); + if (cb) + cb.call(s || t); + } else { + loadScript(u); + + if (cb) + cb.call(s || t); + } }, loadQueue : function(cb, s) { @@ -4064,7 +4198,7 @@ }, renderTo : function(n) { - n.innerHTML = this.renderHTML(); + DOM.setHTML(n, this.renderHTML()); }, postRender : function() { @@ -4267,6 +4401,10 @@ s.offset_y = s.offset_y || 0; s.vp_offset_x = s.vp_offset_x || 0; s.vp_offset_y = s.vp_offset_y || 0; + + if (is(s.icons) && !s.icons) + s['class'] += ' noIcons'; + this.parent(id, s); this.onHideMenu = new tinymce.util.Dispatcher(this); this.classPrefix = 'mceMenu'; @@ -4361,7 +4499,7 @@ e = e.target; - if (e && (e = DOM.getParent(e, 'TR'))) { + if (e && (e = DOM.getParent(e, 'TR')) && !DOM.hasClass(e, 'mceMenuItemSub')) { m = t.items[e.id]; if (m.isDisabled()) @@ -4409,7 +4547,7 @@ } }, - hideMenu : function() { + hideMenu : function(c) { var t = this, co = DOM.get('menu_' + t.id), e; if (!t.isMenuVisible) @@ -4420,6 +4558,9 @@ DOM.hide(co); t.isMenuVisible = 0; + if (!c) + t.collapse(1); + if (t.element) t.element.hide(); @@ -4442,7 +4583,7 @@ collapse : function(d) { this.parent(d); - this.hideMenu(); + this.hideMenu(1); }, remove : function(o) { @@ -4849,15 +4990,14 @@ }); })(); -/* file:jscripts/tiny_mce/classes/ui/SplitButton.js */ +/* file:jscripts/tiny_mce/classes/ui/MenuButton.js */ (function() { var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each; - tinymce.create('tinymce.ui.SplitButton:tinymce.ui.Button', { - SplitButton : function(id, s) { + tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', { + MenuButton : function(id, s) { this.parent(id, s); - this.classPrefix = 'mceSplitButton'; this.onRenderMenu = new tinymce.util.Dispatcher(this); s.menu_container = s.menu_container || document.body; }, @@ -4884,7 +5024,7 @@ m.showMenu(0, e.clientHeight); Event.add(document, 'mousedown', t.hideMenu, t); - DOM.addClass(t.id, 'mceSplitButtonSelected'); + t.setState('Selected', 1); }, renderMenu : function() { @@ -4892,7 +5032,8 @@ m = t.settings.control_manager.createDropMenu(t.id + '_menu', { menu_line : 1, - 'class' : 'mceSplitButtonMenu' + 'class' : this.classPrefix + 'Menu', + icons : t.settings.icons }); m.onHideMenu.add(t.hideMenu, t); @@ -4905,13 +5046,40 @@ var t = this; if (!e || !DOM.getParent(e.target, function(n) {return DOM.hasClass(n, 'mceMenu');})) { - DOM.removeClass(t.id, 'mceSplitButtonSelected'); + t.setState('Selected', 0); Event.remove(document, 'mousedown', t.hideMenu, t); if (t.menu) t.menu.hideMenu(); } }, + postRender : function() { + var t = this, s = t.settings; + + Event.add(t.id, 'click', function() { + if (!t.isDisabled()) { + if (s.onclick) + s.onclick(t.value); + + t.showMenu(); + } + }); + } + + }); +})(); + +/* file:jscripts/tiny_mce/classes/ui/SplitButton.js */ + +(function() { + var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each; + + tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton', { + SplitButton : function(id, s) { + this.parent(id, s); + this.classPrefix = 'mceSplitButton'; + }, + renderHTML : function() { var h, t = this, s = t.settings, h1; @@ -5052,7 +5220,7 @@ if (s.more_colors_func) { n = DOM.add(tb, 'tr'); - n = DOM.add(n, 'td', {colSpan : s.grid_width, 'class' : 'morecolors'}); + n = DOM.add(n, 'td', {colspan : s.grid_width, 'class' : 'morecolors'}); n = DOM.add(n, 'a', {href : 'javascript:;', onclick : 'return false;', 'class' : 'morecolors'}, s.more_colors_title); Event.add(n, 'click', function(e) { @@ -5088,15 +5256,15 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', { renderHTML : function() { - var h = '', c = 'mceToolbarEnd', co, dom = tinymce.DOM; + var t = this, h = '', c = 'mceToolbarEnd', co, dom = tinymce.DOM, s = t.settings; h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, '')); - tinymce.each(this.controls, function(c) { + tinymce.each(t.controls, function(c) { h += '' + c.renderHTML() + ''; }); - co = this.controls[this.controls.length - 1].constructor; + co = t.controls[t.controls.length - 1].constructor; if (co === tinymce.ui.Button) c += ' mceToolbarEndButton'; @@ -5107,7 +5275,7 @@ h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '')); - return dom.createHTML('table', {'class' : 'mceToolbar', cellpadding : '0', cellspacing : '0', align : this.settings.align}, '' + h + ''); + return dom.createHTML('table', {id : t.id, 'class' : 'mceToolbar' + (s['class'] ? ' ' + s['class'] : ''), cellpadding : '0', cellspacing : '0', align : t.settings.align || ''}, '' + h + ''); } }); @@ -5196,7 +5364,8 @@ s = extend({ theme : "simple", - language : "en" + language : "en", + strict_loading_mode : document.contentType == 'application/xhtml+xml' }, s); t.settings = s; @@ -5452,7 +5621,7 @@ }); // Setup some URLs where the editor API is located and where the document is - tinymce.documentBaseURL = document.location.href.replace(/[\?#].*$/, '').replace(/[\/\\][\w.]+$/, ''); + tinymce.documentBaseURL = window.location.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, ''); if (!/[\/\\]$/.test(tinymce.documentBaseURL)) tinymce.documentBaseURL += '/'; @@ -5557,11 +5726,12 @@ apply_source_formatting : 1, directionality : 'ltr', forced_root_block : 'p', - valid_elements : '@[id|class|style|title|dir