From 49768a31929b17d80533b2ec1388c65dde693e51 Mon Sep 17 00:00:00 2001 From: rob1n Date: Thu, 12 Apr 2007 17:04:03 +0000 Subject: [PATCH] Upgrade TinyMCE to 2.1.0. Props andy. fixes #3788 git-svn-id: https://develop.svn.wordpress.org/trunk@5256 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/wp-admin.css | 4 +- .../tinymce/plugins/autosave/editor_plugin.js | 4 +- .../plugins/directionality/editor_plugin.js | 4 +- .../plugins/inlinepopups/editor_plugin.js | 242 ++++++++++++++---- .../js/tinymce/plugins/paste/editor_plugin.js | 14 +- .../plugins/wordpress/editor_plugin.js | 2 +- .../tinymce/themes/advanced/css/editor_ui.css | 10 +- .../themes/advanced/editor_template.js | 76 ++++-- .../themes/advanced/jscripts/color_picker.js | 219 +++++++++++++--- .../tinymce/themes/advanced/jscripts/link.js | 5 +- .../js/tinymce/themes/advanced/langs/en.js | 11 +- wp-includes/js/tinymce/tiny_mce.js | 146 ++++++++--- 12 files changed, 579 insertions(+), 158 deletions(-) diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index b2225716ba..bf53e6ee1c 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -554,7 +554,7 @@ input.disabled, textarea.disabled { } #postdivrich #content { - padding: .7em; + padding: 5px; line-height: 140%; } @@ -629,7 +629,7 @@ input.delete:hover { #title { font-size: 1.7em; - padding: 4px; + padding: 4px 3px; } #postexcerpt div, #attachmentlinks div { diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js index 9d9533e154..2cdfb09bb4 100644 --- a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $ + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. @@ -14,7 +14,7 @@ var TinyMCE_AutoSavePlugin = { longname : 'Auto save', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion }; }, diff --git a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js index c385116e87..7864535d11 100644 --- a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $ + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. @@ -14,7 +14,7 @@ var TinyMCE_DirectionalityPlugin = { longname : 'Directionality', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion }; }, diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js index 2ecb0482b9..ffb6239572 100644 --- a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 172 2007-01-09 11:37:11Z spocke $ + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ * * Moxiecode DHTML Windows script. * @@ -15,7 +15,7 @@ var TinyMCE_InlinePopupsPlugin = { longname : 'Inline Popups', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion }; } @@ -26,6 +26,7 @@ tinyMCE.addPlugin("inlinepopups", TinyMCE_InlinePopupsPlugin); // Patch openWindow, closeWindow TinyMCE functions TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow; +TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow; TinyMCE_Engine.prototype.openWindow = function(template, args) { // Does the caller support inline @@ -52,6 +53,12 @@ TinyMCE_Engine.prototype.openWindow = function(template, args) { if (!(height = parseInt(template['height']))) height = 200; + if (!(minWidth = parseInt(template['minWidth']))) + minWidth = 100; + + if (!(minHeight = parseInt(template['minHeight']))) + minHeight = 100; + resizable = (args && args['resizable']) ? args['resizable'] : "no"; scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no"; @@ -78,16 +85,23 @@ TinyMCE_Engine.prototype.openWindow = function(template, args) { url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : ''; // WordPress cache buster - mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop); + mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop + ",minWidth=" + minWidth + ",minHeight=" + minHeight ); }; -TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow; - TinyMCE_Engine.prototype.closeWindow = function(win) { - if (mcWindows.selectedWindow != null) - mcWindows.selectedWindow.close(); - else + var gotit = false, n, w; + for (n in mcWindows.windows) { + w = mcWindows.windows[n]; + if (typeof(w) == 'function') continue; + if (win.name == w.id + '_iframe') { + w.close(); + gotit = true; + } + } + if (!gotit) this.orgCloseWindow(win); + + tinyMCE.selectedInstance.getWin().focus(); }; TinyMCE_Engine.prototype.setWindowTitle = function(win_ref, title) { @@ -135,9 +149,46 @@ TinyMCE_Windows.prototype.init = function(settings) { this.addEvent(document, "mouseup", mcWindows.eventDispatcher); + this.addEvent(window, "resize", mcWindows.eventDispatcher); + this.addEvent(document, "scroll", mcWindows.eventDispatcher); + this.doc = document; }; +TinyMCE_Windows.prototype.getBounds = function() { + if (!this.bounds) { + var vp = tinyMCE.getViewPort(window); + var top, left, bottom, right, docEl = this.doc.documentElement; + + top = vp.top; + left = vp.left; + bottom = vp.height + top - 2; + right = vp.width + left - 22; // TODO this number is platform dependant + // x1, y1, x2, y2 + this.bounds = [left, top, right, bottom]; + } + return this.bounds; +}; + +TinyMCE_Windows.prototype.clampBoxPosition = function(x, y, w, h, minW, minH) { + var bounds = this.getBounds(); + + x = Math.max(bounds[0], Math.min(bounds[2], x + w) - w); + y = Math.max(bounds[1], Math.min(bounds[3], y + h) - h); + + return this.clampBoxSize(x, y, w, h, minW, minH); +}; + +TinyMCE_Windows.prototype.clampBoxSize = function(x, y, w, h, minW, minH) { + var bounds = this.getBounds(); + + return [ + x, y, + Math.max(minW, Math.min(bounds[2], x + w) - x), + Math.max(minH, Math.min(bounds[3], y + h) - y) + ]; +}; + TinyMCE_Windows.prototype.getParam = function(name, default_value) { var value = null; @@ -186,6 +237,43 @@ TinyMCE_Windows.prototype.eventDispatcher = function(e) { case "focus": mcWindows.selectedWindow.onFocus(e); break; + case "scroll": + case "resize": + if (mcWindows.clampUpdateTimeout) + clearTimeout(mcWindows.clampUpdateTimeout); + mcWindows.clampEventType = e.type; + mcWindows.clampUpdateTimeout = + setTimeout(function () {mcWindows.updateClamping()}, 100); + break; + } +}; + +TinyMCE_Windows.prototype.updateClamping = function () { + var clamp, oversize, etype = mcWindows.clampEventType; + + this.bounds = null; // Recalc window bounds on resize/scroll + this.clampUpdateTimeout = null; + + for (var n in this.windows) { + win = this.windows[n]; + if (typeof(win) == 'function' || ! win.winElement) continue; + + clamp = mcWindows.clampBoxPosition( + win.left, win.top, + win.winElement.scrollWidth, + win.winElement.scrollHeight, + win.features.minWidth, + win.features.minHeight + ); + oversize = ( + clamp[2] != win.winElement.scrollWidth || + clamp[3] != win.winElement.scrollHeight + ) ? true : false; + + if (!oversize || win.features.resizable == "yes" || etype != "scroll") + win.moveTo(clamp[0], clamp[1]); + if (oversize && win.features.resizable == "yes") + win.resizeTo(clamp[2], clamp[3]); } }; @@ -193,7 +281,7 @@ TinyMCE_Windows.prototype.addEvent = function(obj, name, handler) { if (this.isMSIE) obj.attachEvent("on" + name, handler); else - obj.addEventListener(name, handler, true); + obj.addEventListener(name, handler, false); }; TinyMCE_Windows.prototype.cancelEvent = function(e) { @@ -217,6 +305,8 @@ TinyMCE_Windows.prototype.parseFeatures = function(opts) { options['top'] = "10"; options['width'] = "300"; options['height'] = "300"; + options['minwidth'] = "100"; + options['minheight'] = "100"; options['resizable'] = "yes"; options['minimizable'] = "yes"; options['maximizable'] = "yes"; @@ -240,6 +330,8 @@ TinyMCE_Windows.prototype.parseFeatures = function(opts) { options['top'] = parseInt(options['top']); options['width'] = parseInt(options['width']); options['height'] = parseInt(options['height']); + options['minWidth'] = parseInt(options['minwidth']); + options['minHeight'] = parseInt(options['minheight']); return options; }; @@ -253,6 +345,21 @@ TinyMCE_Windows.prototype.open = function(url, name, features) { features = this.parseFeatures(features); + // Clamp specified dimensions + var clamp = mcWindows.clampBoxPosition( + features['left'], features['top'], + features['width'], features['height'], + features['minWidth'], features['minHeight'] + ); + + features['left'] = clamp[0]; + features['top'] = clamp[1]; + + if (features['resizable'] == "yes") { + features['width'] = clamp[2]; + features['height'] = clamp[3]; + } + // Create div id = "mcWindow_" + name; win.deltaHeight = 18; @@ -285,9 +392,9 @@ TinyMCE_Windows.prototype.open = function(url, name, features) { html += ''; html += ''; html += 'Wrapper iframe'; + if (this.isMac) html += ''; html += ''; html += ''; - if ( this.isMac ) html += ''; html += ''; html += ''; @@ -297,8 +404,9 @@ TinyMCE_Windows.prototype.open = function(url, name, features) { html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;">'; html += '
'; html += ' '; -// html += ' '; -// html += ' '; + if (features['resizable'] == "yes" && features['maximizable'] == "yes") + html += ' '; + // html += ' '; html += '
'; html += '
'; html += '
'; @@ -447,6 +555,7 @@ TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, div.setAttribute("width", width); div.setAttribute("height", (height)); div.style.position = "absolute"; + div.style.left = left + "px"; div.style.top = top + "px"; div.style.width = width + "px"; @@ -473,7 +582,7 @@ TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, iframe.setAttribute("topMargin", "0"); iframe.setAttribute("width", iframeWidth); iframe.setAttribute("height", iframeHeight); -// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm"); + // iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm"); // iframe.setAttribute("allowtransparency", "false"); iframe.setAttribute("scrolling", "no"); iframe.style.width = iframeWidth + "px"; @@ -522,7 +631,24 @@ TinyMCE_Window.prototype.minimize = function() { }; TinyMCE_Window.prototype.maximize = function() { - + if (this.restoreSize) { + this.moveTo(this.restoreSize[0], this.restoreSize[1]); + this.resizeTo(this.restoreSize[2], this.restoreSize[3]); + this.updateClamping(); + this.restoreSize = null; + } else { + var bounds = mcWindows.getBounds(); + this.restoreSize = [ + this.left, this.top, + this.winElement.scrollWidth, + this.winElement.scrollHeight + ]; + this.moveTo(bounds[0], bounds[1]); + this.resizeTo( + bounds[2] - bounds[0], + bounds[3] - bounds[1] + ); + } }; TinyMCE_Window.prototype.startResize = function() { @@ -552,7 +678,7 @@ TinyMCE_Window.prototype.close = function() { mcWindows.windows = mcWindowsNew; -// alert(mcWindows.doc.getElementById(this.id + "_iframe")); + // alert(mcWindows.doc.getElementById(this.id + "_iframe")); var e = mcWindows.doc.getElementById(this.id + "_iframe"); e.parentNode.removeChild(e); @@ -561,42 +687,24 @@ TinyMCE_Window.prototype.close = function() { e.parentNode.removeChild(e); mcWindows.setDocumentLock(false); - - tinyMCE.selectedInstance.getWin().focus(); // WordPress: focus on the editor after closing a popup }; TinyMCE_Window.prototype.onMouseMove = function(e) { - var scrollX = 0;//this.doc.body.scrollLeft; - var scrollY = 0;//this.doc.body.scrollTop; - + var clamp; // Calculate real X, Y var dx = e.screenX - mcWindows.mouseDownScreenX; var dy = e.screenY - mcWindows.mouseDownScreenY; switch (mcWindows.action) { case "resize": - width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX); - height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY); + clamp = mcWindows.clampBoxSize( + this.left, this.top, + mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX), + mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY), + this.features.minWidth, this.features.minHeight + ); - width = width < 100 ? 100 : width; - height = height < 100 ? 100 : height; - - this.wrapperIFrameElement.style.width = (width+2) + 'px'; - this.wrapperIFrameElement.style.height = (height+2) + 'px'; - this.wrapperIFrameElement.width = width+2; - this.wrapperIFrameElement.height = height+2; - this.winElement.style.width = width + 'px'; - this.winElement.style.height = height + 'px'; - - height = height - this.deltaHeight; - - this.containerElement.style.width = width + 'px'; - this.iframeElement.style.width = width + 'px'; - this.iframeElement.style.height = height + 'px'; - this.bodyElement.style.width = width + 'px'; - this.bodyElement.style.height = height + 'px'; - this.headElement.style.width = width + 'px'; - //this.statusElement.style.width = width + 'px'; + this.resizeTo(clamp[2], clamp[3]); mcWindows.cancelEvent(e); break; @@ -604,14 +712,59 @@ TinyMCE_Window.prototype.onMouseMove = function(e) { case "move": this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX); this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY); - this.winElement.style.left = this.left + "px"; - this.winElement.style.top = this.top + "px"; + this.updateClamping(); mcWindows.cancelEvent(e); break; } }; +TinyMCE_Window.prototype.moveTo = function (x, y) { + this.left = x; + this.top = y; + + this.winElement.style.left = this.left + "px"; + this.winElement.style.top = this.top + "px"; +}; + +TinyMCE_Window.prototype.resizeTo = function (width, height) { + this.wrapperIFrameElement.style.width = (width+2) + 'px'; + this.wrapperIFrameElement.style.height = (height+2) + 'px'; + this.wrapperIFrameElement.width = width+2; + this.wrapperIFrameElement.height = height+2; + this.winElement.style.width = width + 'px'; + this.winElement.style.height = height + 'px'; + + height = height - this.deltaHeight; + + this.containerElement.style.width = width + 'px'; + this.iframeElement.style.width = width + 'px'; + this.iframeElement.style.height = height + 'px'; + this.bodyElement.style.width = width + 'px'; + this.bodyElement.style.height = height + 'px'; + this.headElement.style.width = width + 'px'; + //this.statusElement.style.width = width + 'px'; +}; + +TinyMCE_Window.prototype.updateClamping = function () { + var clamp, oversize; + + clamp = mcWindows.clampBoxPosition( + this.left, this.top, + this.winElement.scrollWidth, + this.winElement.scrollHeight, + this.features.minWidth, this.features.minHeight + ); + oversize = ( + clamp[2] != this.winElement.scrollWidth || + clamp[3] != this.winElement.scrollHeight + ) ? true : false; + + this.moveTo(clamp[0], clamp[1]); + if (this.features.resizable == "yes" && oversize) + this.resizeTo(clamp[2], clamp[3]); +}; + function debug(msg) { document.getElementById('debug').value += msg + "\n"; } @@ -639,9 +792,6 @@ TinyMCE_Window.prototype.onFocus = function(e) { TinyMCE_Window.prototype.onMouseDown = function(e) { var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target; - var scrollX = 0;//this.doc.body.scrollLeft; - var scrollY = 0;//this.doc.body.scrollTop; - mcWindows.mouseDownScreenX = e.screenX; mcWindows.mouseDownScreenY = e.screenY; mcWindows.mouseDownLayerX = this.left; diff --git a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js index 3ef1d7a40b..5e884cffa2 100644 --- a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js @@ -1,5 +1,5 @@ /** - * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $ + * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. @@ -14,7 +14,7 @@ var TinyMCE_PastePlugin = { longname : 'Paste text/word', author : 'Moxiecode Systems AB', authorurl : 'http://tinymce.moxiecode.com', - infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html', + infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion }; }, @@ -24,6 +24,16 @@ var TinyMCE_PastePlugin = { tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent); }, + handleEvent : function(e) { + // Force paste dialog if non IE browser + if (!tinyMCE.isRealIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false) && e.ctrlKey && e.keyCode == 86 && e.type == "keydown") { + window.setTimeout('tinyMCE.selectedInstance.execCommand("mcePasteText",true)', 1); + return tinyMCE.cancelEvent(e); + } + + return true; + }, + getControlHTML : function(cn) { switch (cn) { case "pastetext": diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js index ede6576185..f834e97a21 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js @@ -515,7 +515,7 @@ function switchEditors(id) { ta.style.height = (ta.clientHeight + y1 - y2) + 'px'; // Tweak the widths - ta.parentNode.style.paddingRight = '2px'; + ta.parentNode.style.paddingRight = '12px'; if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { } else { diff --git a/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css b/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css index 58e6b8edaa..851837d915 100644 --- a/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css +++ b/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css @@ -11,7 +11,7 @@ .mceToolbarTop, .mceToolbarBottom {background: #F0F0EE; line-height: 1px; font-size: 1px;} .mceToolbarTop {border-bottom: 1px solid #cccccc; padding-bottom: 1px;} .mceToolbarBottom {border-top: 1px solid #cccccc;} -.mceToolbarContainer {position: relative; left: 0; top: 0; display: block;} +.mceToolbarContainer {display: block; position: relative; left: 0; top: 0; width: 100%;} .mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {height: 20px;} .mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; padding: 2px; line-height: 16px; overflow: visible;} .mceStatusbarTop {border-bottom: 1px solid #cccccc;} @@ -49,7 +49,7 @@ span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {border: 1px solid #0A /* Menu */ -.mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 100; background-color: white; border: 1px solid gray; font-weight: normal;} +.mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 1000; background-color: white; border: 1px solid gray; font-weight: normal;} .mceMenu a, .mceMenuTitle, .mceMenuDisabled {display: block; width: 100%; text-decoration: none; background-color: white; font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 11px; line-height: 20px; color: black;} .mceMenu a:hover {background-color: #B6BDD2; color: black; text-decoration: none !important;} .mceMenu span {padding-left: 10px; padding-right: 10px; display: block; line-height: 20px;} @@ -61,7 +61,7 @@ span.mceMenuSelectedItem {background-image: url('../images/menu_check.gif'); bac span.mceMenuCheckItem {padding-left: 20px;} span.mceMenuLine {display: block; position: absolute; left: 0; top: -1px; background-color: #F5F4F2; width: 30px; height: 1px; overflow: hidden; padding-left: 0; padding-right: 0;} .mceColors table, .mceColors td {margin: 0; padding: 2px;} -a.mceMoreColors {width: 130px; margin: 0; padding: 0; margin-left: 3px; margin-bottom: 3px; text-align: center; border: 1px solid white;} +a.mceMoreColors {width: auto; padding: 0; margin: 0 3px 3px 3px; text-align: center; border: 1px solid white; text-decoration: none !important;} .mceColorPreview {position: absolute; overflow:hidden; left: 0; top: 0; margin-left: 3px; margin-top: 15px; width: 16px; height: 4px; background-color: red;} a.mceMoreColors:hover {border: 1px solid #0A246A;} .mceColors td a {width: 9px; height: 9px; overflow: hidden; border: 1px solid #808080;} @@ -77,7 +77,7 @@ a.mceMoreColors:hover {border: 1px solid #0A246A;} * html .mceSelectList {margin-top: 2px;} * html span.mceMenuButton, * html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;} * html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {position: relative; top: 1px;} -* html a.mceMoreColors {width: 132px;} +* html a.mceMoreColors {width: auto;} * html .mceColors td a {width: 10px; height: 10px;} * html .mceColorPreview {margin-left: 2px; margin-top: 14px;} @@ -92,6 +92,6 @@ a.mceMoreColors:hover {border: 1px solid #0A246A;} *:first-child+html .mceSelectList {margin-top: 2px;} *:first-child+html span.mceMenuButton, *:first-child+html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;} *:first-child+html span.mceMenuButton img, *:first-child+html span.mceMenuButtonSelected img, *:first-child+html span.mceMenuButtonFocus img {position: relative; top: 1px;} -*:first-child+html a.mceMoreColors {width: 132px;} +*:first-child+html a.mceMoreColors {width: 137px;} *:first-child+html .mceColors td a {width: 10px; height: 10px;} *:first-child+html .mceColorPreview {margin: 0; padding-left: 4px; margin-top: 14px; width: 14px;} diff --git a/wp-includes/js/tinymce/themes/advanced/editor_template.js b/wp-includes/js/tinymce/themes/advanced/editor_template.js index 3d918914b7..b8e3685238 100644 --- a/wp-includes/js/tinymce/themes/advanced/editor_template.js +++ b/wp-includes/js/tinymce/themes/advanced/editor_template.js @@ -1,5 +1,5 @@ /** - * $Id: editor_template_src.js 166 2007-01-05 10:31:50Z spocke $ + * $Id: editor_template_src.js 218 2007-02-13 11:08:01Z spocke $ * * @author Moxiecode * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. @@ -43,7 +43,9 @@ var TinyMCE_AdvancedTheme = { ['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'], ['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'], ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true], + ['forecolorpicker', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolorpicker', true], ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true], + ['backcolorpicker', 'backcolor.gif', 'lang_theme_backcolor_desc', 'backcolorpicker', true], ['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'], ['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'], ['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'], @@ -356,6 +358,10 @@ var TinyMCE_AdvancedTheme = { return false; + case "forecolorpicker": + this._pickColor(editor_id, 'forecolor'); + return true; + case "forecolorMenu": TinyMCE_AdvancedTheme._hideMenus(editor_id); @@ -420,15 +426,21 @@ var TinyMCE_AdvancedTheme = { ml.show(); return true; + + case "backcolorpicker": + this._pickColor(editor_id, 'HiliteColor'); + return true; case "mceColorPicker": if (user_interface) { - var template = new Array(); - var inputColor = value['document'].getElementById(value['element_id']).value; + var template = []; + + if (!value['callback'] && !value['color']) + value['color'] = value['document'].getElementById(value['element_id']).value; template['file'] = 'color_picker.htm'; - template['width'] = 220; - template['height'] = 190; + template['width'] = 380; + template['height'] = 250; template['close_previous'] = "no"; template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0); @@ -438,10 +450,16 @@ var TinyMCE_AdvancedTheme = { value['store_selection'] = true; tinyMCE.lastColorPickerValue = value; - tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : inputColor}); + tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : value['color']}); } else { - var savedVal = tinyMCE.lastColorPickerValue; - var elm = savedVal['document'].getElementById(savedVal['element_id']); + var savedVal = tinyMCE.lastColorPickerValue, elm; + + if (savedVal['callback']) { + savedVal['callback'](value); + return true; + } + + elm = savedVal['document'].getElementById(savedVal['element_id']); elm.value = value; if (elm.onchange != null && elm.onchange != '') @@ -599,9 +617,8 @@ var TinyMCE_AdvancedTheme = { // Setup template html template['html'] = ''; - if (toolbarLocation == "top") { - template['html'] += ''; - } + if (toolbarLocation == "top") + template['html'] += ''; if (statusbarLocation == "top") { template['html'] += ''; @@ -610,9 +627,8 @@ var TinyMCE_AdvancedTheme = { template['html'] += ''; - if (toolbarLocation == "bottom") { - template['html'] += ''; - } + if (toolbarLocation == "bottom") + template['html'] += ''; // External toolbar changes if (toolbarLocation == "external") { @@ -738,9 +754,12 @@ var TinyMCE_AdvancedTheme = { }, removeInstance : function(inst) { - var fcm = new TinyMCE_Layer(inst.editorId + '_fcMenu'); + new TinyMCE_Layer(inst.editorId + '_fcMenu').remove(); + new TinyMCE_Layer(inst.editorId + '_bcMenu').remove(); + }, - fcm.remove(); + hideInstance : function(inst) { + TinyMCE_AdvancedTheme._hideMenus(inst.editorId); }, _handleMenuEvent : function(e) { @@ -1224,6 +1243,7 @@ var TinyMCE_AdvancedTheme = { if (set_w) tableElm.style.width = w + "px"; + if ( !tinyMCE.isMSIE || tinyMCE.isMSIE7 || tinyMCE.isOpera ) // WordPress: do this later to avoid creeping toolbar bug in MSIE6 tableElm.style.height = h + "px"; iw = iframe.clientWidth + dx; @@ -1232,10 +1252,12 @@ var TinyMCE_AdvancedTheme = { iw = iw < 1 ? 30 : iw; ih = ih < 1 ? 30 : ih; +/* WordPress found that this led to a shrinking editor with every resize. (Gray background creeps in 1px at a time.) if (tinyMCE.isGecko) { iw -= 2; ih -= 2; } +*/ if (set_w) iframe.style.width = iw + "px"; @@ -1253,6 +1275,8 @@ var TinyMCE_AdvancedTheme = { } } + tableElm.style.height = h + "px"; // WordPress: see above + // Remove pesky table controls inst.useCSS = false; }, @@ -1378,13 +1402,27 @@ var TinyMCE_AdvancedTheme = { } h += '
' + toolbarHTML + '
' + toolbarHTML + '
' + statusbarHTML + '
' + toolbarHTML + '
' + toolbarHTML + '
'; - /* - h += 'More colors'; - */ + + if (tinyMCE.getParam("theme_advanced_more_colors", true)) + h += '' + tinyMCE.getLang('lang_more_colors') + ''; return h; }, + _pickColor : function(id, cm) { + var inputColor, inst = tinyMCE.selectedInstance; + + if (cm == 'forecolor' && inst) + inputColor = inst.foreColor; + + if ((cm == 'backcolor' || cm == 'HiliteColor') && inst) + inputColor = inst.backColor; + + tinyMCE.execCommand('mceColorPicker', true, {color : inputColor, callback : function(c) { + tinyMCE.execInstanceCommand(id, cm, false, c); + }}); + }, + _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) { tinyMCE.execCommand('mceBeginUndoLevel'); diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js b/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js index aa80714ad7..78425e48da 100644 --- a/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js +++ b/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js @@ -1,19 +1,4 @@ -function init() { - if (tinyMCE.isMSIE) - tinyMCEPopup.resizeToInnerSize(); -} - -function selectColor() { - var color = document.getElementById("selectedColorBox").value; - - tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color); - tinyMCEPopup.close(); -} - -function showColor(color) { - document.getElementById("selectedColor").style.backgroundColor = color; - document.getElementById("selectedColorBox").value = color; -} +var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; var colors = new Array( "#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033", @@ -45,9 +30,71 @@ var colors = new Array( "#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff" ); +var named = { + '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', + '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown', + '#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue', + '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod', + '#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen', + '#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue', + '#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue', + '#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen', + '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey', + '#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory', + '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue', + '#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen', + '#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey', + '#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', + '#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue', + '#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin', + '#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid', + '#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff', + '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue', + '#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver', + '#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen', + '#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', + '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen' +}; + +function init() { + var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color')); + + if (tinyMCE.isMSIE) + tinyMCEPopup.resizeToInnerSize(); + + generatePicker(); + + if (inputColor) { + changeFinalColor(inputColor); + + col = convertHexToRGB(inputColor); + + if (col) + updateLight(col.r, col.g, col.b); + } +} + +function insertAction() { + var color = document.getElementById("color").value; + + tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color); + tinyMCEPopup.close(); +} + +function showColor(color, name) { + if (name) + document.getElementById("colorname").innerHTML = name; + + document.getElementById("preview").style.backgroundColor = color; + document.getElementById("color").value = color; +} + function convertRGBToHex(col) { var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); + if (!col) + return col; + var rgb = col.replace(re, "$1,$2,$3").split(','); if (rgb.length == 3) { r = parseInt(rgb[0]).toString(16); @@ -72,37 +119,131 @@ function convertHexToRGB(col) { g = parseInt(col.substring(2, 4), 16); b = parseInt(col.substring(4, 6), 16); - return "rgb(" + r + "," + g + "," + b + ")"; + return {r : r, g : g, b : b}; } - return col; + return null; } -function renderColorMap() { - var html = ""; - var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color')); +function generatePicker() { + var el = document.getElementById('light'), h = '', i; - html += '' + for (i = 0; i < detail; i++){ + h += '
'; + } + + el.innerHTML = h; +} + +function generateWebColors() { + var el = document.getElementById('webcolors'), h = '', i; + + if (el.className == 'generated') + return; + + h += '
' + ''; - for (var i=0; i' + + for (i=0; i' + '' + '' + colors[i] +  ''; if ((i+1) % 18 == 0) - html += ''; + h += ''; } - html += '' - + '
' - + '' - + '' - + '
' - + '' - + '' - + '' - + '
' - + '
' - + '
' - + '
'; - document.write(html); -} \ No newline at end of file + h += ''; + + el.innerHTML = h; + el.className = 'generated'; +} + +function generateNamedColors() { + var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; + + if (el.className == 'generated') + return; + + for (n in named) { + v = named[n]; + h += '' + } + + el.innerHTML = h; + el.className = 'generated'; +} + +function selectColor() { + var color = document.getElementById("color").value; + + if(window.opener) + window.opener.tinyMCE.execInstanceCommand(tinyMCE.getWindowArg('editor_id'),tinyMCE.getWindowArg('command'),false,color); + + window.close(); +} + +function dechex(n) { + return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); +} + +function computeColor(e) { + var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; + + x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); + y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); + + partWidth = document.getElementById('colorpicker').width / 6; + partDetail = detail / 2; + imHeight = document.getElementById('colorpicker').height; + + r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; + g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); + b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); + + coef = (imHeight - y) / imHeight; + r = 128 + (r - 128) * coef; + g = 128 + (g - 128) * coef; + b = 128 + (b - 128) * coef; + + changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); + updateLight(r, g, b); +} + +function updateLight(r, g, b) { + var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; + + for (i=0; i=0) && (i'; + h += ''; else - h += ''; + h += ''; h += ''; h += ''; @@ -1693,7 +1718,7 @@ TinyMCE_Engine.prototype = { }, triggerNodeChange : function(focus, setup_content) { - var elm, inst, editorId, undoIndex = -1, undoLevels = -1, doc, anySelection = false; + var elm, inst, editorId, undoIndex = -1, undoLevels = -1, doc, anySelection = false, st; if (tinyMCE.selectedInstance) { inst = tinyMCE.selectedInstance; @@ -1705,7 +1730,7 @@ TinyMCE_Engine.prototype = { inst.lastTriggerEl = elm;*/ editorId = inst.editorId; - selectedText = inst.selection.getSelectedText(); + st = inst.selection.getSelectedText(); if (tinyMCE.settings.auto_resize) inst.resizeToContent(); @@ -1716,7 +1741,7 @@ TinyMCE_Engine.prototype = { inst.switchSettings(); if (tinyMCE.selectedElement) - anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (selectedText && selectedText.length > 0); + anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (st && st.length > 0); if (tinyMCE.settings['custom_undo_redo']) { undoIndex = inst.undoRedo.undoIndex; @@ -2180,11 +2205,11 @@ TinyMCE_Engine.prototype = { }, getCSSClasses : function(editor_id, doc) { - var output = new Array(); + var inst = tinyMCE.getInstanceById(editor_id); // Is cached, use that - if (typeof(tinyMCE.cssClasses) != "undefined") - return tinyMCE.cssClasses; + if (inst && inst.cssClasses.length > 0) + return inst.cssClasses; if (typeof(editor_id) == "undefined" && typeof(doc) == "undefined") { var instance; @@ -2242,13 +2267,13 @@ TinyMCE_Engine.prototype = { var cssClass = rule.substring(rule.indexOf('.') + 1); var addClass = true; - for (var p=0; p 0) - tinyMCE.cssClasses = output; - - return output; + return inst.cssClasses; }, regexpReplace : function(in_str, reg_exp, replace_str, opts) { @@ -2289,19 +2310,27 @@ TinyMCE_Engine.prototype = { }, getControlHTML : function(c) { - var i, l, n, o, v; + var i, l, n, o, v, rtl = tinyMCE.getLang('lang_dir') == 'rtl'; l = tinyMCE.plugins; for (n in l) { o = l[n]; - if (o.getControlHTML && (v = o.getControlHTML(c)) != '') + if (o.getControlHTML && (v = o.getControlHTML(c)) != '') { + if (rtl) + return '' + tinyMCE.replaceVar(v, "pluginurl", o.baseURL) + ''; + return tinyMCE.replaceVar(v, "pluginurl", o.baseURL); + } } o = tinyMCE.themes[tinyMCE.settings['theme']]; - if (o.getControlHTML && (v = o.getControlHTML(c)) != '') + if (o.getControlHTML && (v = o.getControlHTML(c)) != '') { + if (rtl) + return '' + v + ''; + return v; + } return ''; }, @@ -2433,6 +2462,7 @@ function TinyMCE_Control(settings) { this.hasMouseMoved = false; this.foreColor = this.backColor = "#999999"; this.data = {}; + this.cssClasses = []; this.cleanup.init({ valid_elements : s.valid_elements, @@ -2865,7 +2895,7 @@ TinyMCE_Control.prototype = { if (tinyMCE.isGecko && this.getSel().isCollapsed) { focusElm = tinyMCE.getParentElement(focusElm, 'A'); - if (focusElm && this.getRng(0).endOffset > 0 && this.getRng(0).endOffset != focusElm.innerHTML.length) // WordPress mod to prevent unlinking if caret at start/end of link + if (focusElm) this.selection.selectNode(focusElm, false); } @@ -3690,6 +3720,7 @@ TinyMCE_Control.prototype = { hc = ''; } else { hc = ''; + this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); this.oldTargetElement.style.display = "none"; } @@ -3715,8 +3746,10 @@ TinyMCE_Control.prototype = { // Just hide the textarea element this.oldTargetElement = replace_element; - if (!tinyMCE.settings['debug']) + if (!tinyMCE.settings['debug']) { + this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); this.oldTargetElement.style.display = "none"; + } // Output HTML and set editable if (tinyMCE.isGecko) { @@ -3790,6 +3823,10 @@ TinyMCE_Control.prototype = { if (tinyMCE.isIE) window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1); + // Setup element references + var parentElm = this.targetDoc.getElementById(this.editorId + '_parent'); + this.formElement = tinyMCE.isGecko ? parentElm.previousSibling : parentElm.nextSibling; + tinyMCE.setupContent(this.editorId, true); return true; @@ -4865,7 +4902,7 @@ TinyMCE_Cleanup.prototype = { if (r.forceAttribs && (t = r.forceAttribs[an])) av = t; - if (os && av.length != 0 && this.settings.url_converter.length != 0 && /^(src|href|longdesc)$/.test(an)) + if (os && av.length != 0 && /^(src|href|longdesc)$/.test(an)) av = this._urlConverter(this, n, av); if (av.length != 0 && r.validAttribValues && r.validAttribValues[an] && !r.validAttribValues[an].test(av)) @@ -5186,9 +5223,10 @@ TinyMCE_Engine.prototype.setInnerHTML = function(e, h) { // Convert all strong/em to b/i in Gecko if (tinyMCE.isGecko) { - h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)>/gi, ''); h = h.replace(/<\/strong>/gi, ''); h = h.replace(/<\/em>/gi, ''); } @@ -5503,6 +5541,32 @@ TinyMCE_Engine.prototype.getViewPort = function(w) { }; }; +TinyMCE_Engine.prototype.getStyle = function(n, na, d) { + if (!n) + return false; + + // Gecko + if (tinyMCE.isGecko && n.ownerDocument.defaultView) { + try { + return n.ownerDocument.defaultView.getComputedStyle(n, null).getPropertyValue(na); + } catch (n) { + // Old safari might fail + return null; + } + } + + // Camelcase it, if needed + na = na.replace(/-(\D)/g, function(a, b){ + return b.toUpperCase(); + }); + + // IE & Opera + if (n.currentStyle) + return n.currentStyle[na]; + + return false; +}; + /* file:jscripts/tiny_mce/classes/TinyMCE_URL.class.js */ TinyMCE_Engine.prototype.parseURL = function(url_str) { @@ -7132,13 +7196,21 @@ TinyMCE_Layer.prototype = { }, show : function() { - this.getElement().style.display = 'block'; - this.updateBlocker(); + var el = this.getElement(); + + if (el) { + el.style.display = 'block'; + this.updateBlocker(); + } }, hide : function() { - this.getElement().style.display = 'none'; - this.updateBlocker(); + var el = this.getElement(); + + if (el) { + el.style.display = 'none'; + this.updateBlocker(); + } }, isVisible : function() {