From 8f58b134c28977a51f27c05b17e096ce4588e128 Mon Sep 17 00:00:00 2001 From: ryan <ryan@1a063a9b-81f0-0310-95a4-ce76da25c4cd> Date: Thu, 25 Jan 2007 01:20:47 +0000 Subject: [PATCH] TinyMCE 2.0.9. fixes #3564 git-svn-id: http://svn.automattic.com/wordpress/trunk@4799 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../tinymce/plugins/autosave/editor_plugin.js | 4 +- .../plugins/directionality/editor_plugin.js | 4 +- .../plugins/inlinepopups/editor_plugin.js | 46 +-- .../js/tinymce/plugins/paste/editor_plugin.js | 4 +- .../js/tinymce/themes/advanced/about.htm | 2 +- .../tinymce/themes/advanced/css/editor_ui.css | 108 +++--- .../themes/advanced/editor_template.js | 47 +-- .../themes/advanced/jscripts/source_editor.js | 9 +- wp-includes/js/tinymce/tiny_mce.js | 308 +++++++++++++----- .../js/tinymce/utils/editable_selects.js | 61 ++++ wp-includes/js/tinymce/utils/form_utils.js | 4 +- wp-includes/js/tinymce/utils/mclayer.js | 4 +- wp-includes/js/tinymce/utils/mctabs.js | 4 +- wp-includes/js/tinymce/utils/validate.js | 4 +- wp-includes/js/tinymce/wp-mce-help.php | 2 +- wp-includes/script-loader.php | 4 +- 16 files changed, 410 insertions(+), 205 deletions(-) create mode 100644 wp-includes/js/tinymce/utils/editable_selects.js diff --git a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js index ab0e3ad4df..9d9533e154 100644 --- a/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js @@ -1,8 +1,8 @@ /** - * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $ + * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $ * * @author Moxiecode - * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. */ /* Import plugin specific language pack */ diff --git a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js index 51eea48d93..c385116e87 100644 --- a/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js @@ -1,8 +1,8 @@ /** - * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $ + * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $ * * @author Moxiecode - * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. */ /* Import plugin specific language pack */ diff --git a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js index 782d0c7d18..2ecb0482b9 100644 --- a/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js @@ -1,10 +1,10 @@ /** - * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $ + * $Id: editor_plugin_src.js 172 2007-01-09 11:37:11Z spocke $ * * Moxiecode DHTML Windows script. * * @author Moxiecode - * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. */ // Patch openWindow, closeWindow TinyMCE functions @@ -66,13 +66,17 @@ TinyMCE_Engine.prototype.openWindow = function(template, args) { } var elm = document.getElementById(this.selectedInstance.editorId + '_parent'); - var pos = tinyMCE.getAbsPosition(elm); + + if (tinyMCE.hasPlugin('fullscreen') && this.selectedInstance.getData('fullscreen').enabled) + pos = { absLeft: 0, absTop: 0 }; + else + pos = tinyMCE.getAbsPosition(elm); // Center div in editor area pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2)); pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2)); - url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : ''; + 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); }; @@ -111,7 +115,7 @@ function TinyMCE_Windows() { this.action = "none"; this.selectedWindow = null; this.lastSelectedWindow = null; - this.zindex = 100; + this.zindex = 1001; this.mouseDownScreenX = 0; this.mouseDownScreenY = 0; this.mouseDownLayerX = 0; @@ -323,8 +327,9 @@ TinyMCE_Windows.prototype.open = function(url, name, features) { // Blocks the document events by placing a image over the whole document TinyMCE_Windows.prototype.setDocumentLock = function(state) { + var elm = document.getElementById('mcWindowEventBlocker'); + if (state) { - var elm = document.getElementById('mcWindowEventBlocker'); if (elm == null) { elm = document.createElement("div"); @@ -348,9 +353,7 @@ TinyMCE_Windows.prototype.setDocumentLock = function(state) { elm.style.zIndex = mcWindows.zindex-1; elm.style.display = "block"; - } else { - var elm = document.getElementById('mcWindowEventBlocker'); - + } else if (elm != null) { if (mcWindows.windows.length == 0) elm.parentNode.removeChild(elm); else @@ -559,7 +562,7 @@ TinyMCE_Window.prototype.close = function() { mcWindows.setDocumentLock(false); - tinyMCE.selectedInstance.getWin().focus(); + tinyMCE.selectedInstance.getWin().focus(); // WordPress: focus on the editor after closing a popup }; TinyMCE_Window.prototype.onMouseMove = function(e) { @@ -578,23 +581,22 @@ TinyMCE_Window.prototype.onMouseMove = function(e) { width = width < 100 ? 100 : width; height = height < 100 ? 100 : height; - this.wrapperIFrameElement.style.width = width+2; - this.wrapperIFrameElement.style.height = height+2; + 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; - this.winElement.style.height = height; + this.winElement.style.width = width + 'px'; + this.winElement.style.height = height + 'px'; height = height - this.deltaHeight; - this.containerElement.style.width = width; - - this.iframeElement.style.width = width; - this.iframeElement.style.height = height; - this.bodyElement.style.width = width; - this.bodyElement.style.height = height; - this.headElement.style.width = width; - //this.statusElement.style.width = width; + 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'; mcWindows.cancelEvent(e); break; diff --git a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js index 1306c0bd7d..3ef1d7a40b 100644 --- a/wp-includes/js/tinymce/plugins/paste/editor_plugin.js +++ b/wp-includes/js/tinymce/plugins/paste/editor_plugin.js @@ -1,8 +1,8 @@ /** - * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $ + * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $ * * @author Moxiecode - * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. */ /* Import plugin specific language pack */ diff --git a/wp-includes/js/tinymce/themes/advanced/about.htm b/wp-includes/js/tinymce/themes/advanced/about.htm index 2a86227fbd..bb275f0a9a 100644 --- a/wp-includes/js/tinymce/themes/advanced/about.htm +++ b/wp-includes/js/tinymce/themes/advanced/about.htm @@ -21,7 +21,7 @@ <p>Version: {$tinymce_version} ({$tinymce_releasedate})</p> <p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a> by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p> - <p>Copyright © 2003-2006, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p> + <p>Copyright © 2003-2007, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p> <p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p> <div id="buttoncontainer"></div> 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 e70405db16..58e6b8edaa 100644 --- a/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css +++ b/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css @@ -1,97 +1,97 @@ /* This file contains the CSS data for the editor UI of TinyMCE instances */ -.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {border: 0; margin: 0; padding: 0; background: transparent;} +.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {border: 0; margin: 0; padding: 0; background: transparent;} .mceSeparatorLine {border: 0; padding: 0; margin-left: 4px; margin-right: 2px;} .mceSelectList {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 7pt !important; font-weight: normal; margin-top: 3px; padding: 0; display: inline; vertical-align: top; background-color: #F0F0EE;} .mceLabel, .mceLabelDisabled {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt;} .mceLabel {color: #000000;} -.mceLabelDisabled {cursor: text; color: #999999;} -.mceEditor {background: #F0F0EE; border: 1px solid #cccccc; padding: 0; margin: 0;} -.mceEditorArea { font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; background: #FFFFFF; padding: 0; margin: 0; } -.mceToolbarTop, .mceToolbarBottom {background: #F0F0EE; line-height: 1px; font-size: 1px;} +.mceLabelDisabled {cursor: text; color: #999999;} +.mceEditor {background: #F0F0EE; border: 1px solid #cccccc; padding: 0; margin: 0;} +.mceEditorArea { font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; background: #FFFFFF; padding: 0; margin: 0; } +.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 {position: relative; left: 0; top: 0; display: block;} .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 .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;} .mceStatusbarBottom {border-top: 1px solid #cccccc;} .mceStatusbar {border-bottom: 1px solid #cccccc;} -.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {text-decoration: none; font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; color: #000000;} +.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {text-decoration: none; font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; color: #000000;} .mcePathItem:hover {text-decoration: underline;} .mceStatusbarPathText {float: left;} -.mceStatusbarResize {float: right; background-image: url('../images/statusbar_resize.gif'); background-repeat: no-repeat; width: 11px; height: 20px; cursor: se-resize;} -.mceResizeBox {width: 10px; height: 10px; display: none; border: 1px dotted gray; margin: 0; padding: 0;} +.mceStatusbarResize {float: right; background-image: url('../images/statusbar_resize.gif'); background-repeat: no-repeat; width: 11px; height: 20px; cursor: se-resize;} +.mceResizeBox {width: 10px; height: 10px; display: none; border: 1px dotted gray; margin: 0; padding: 0;} .mceEditorIframe {border: 0;} /* Button CSS rules */ -a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {width: 20px; height: 20px; cursor: default; margin-top: 1px; margin-left: 1px;} +a.mceButtonDisabled img, a.mceButtonNormal img, a.mceButtonSelected img {width: 20px; height: 20px; cursor: default; margin-top: 1px; margin-left: 1px;} a.mceButtonDisabled img {border: 0 !important;} a.mceButtonNormal img, a.mceButtonSelected img {border: 1px solid #F0F0EE !important;} -a.mceButtonSelected img {border: 1px solid #6779AA !important; background-color: #D4D5D8;} -a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {border: 1px solid #0A246A !important; cursor: default; background-color: #B6BDD2;} -a.mceButtonDisabled img {-moz-opacity:0.3; opacity: 0.3; border: 1px solid #F0F0EE !important; cursor: default;} -a.mceTiledButton img {background-image: url('../images/buttons.gif'); background-repeat: no-repeat;} +a.mceButtonSelected img {border: 1px solid #6779AA !important; background-color: #D4D5D8;} +a.mceButtonNormal img:hover, a.mceButtonSelected img:hover {border: 1px solid #0A246A !important; cursor: default; background-color: #B6BDD2;} +a.mceButtonDisabled img {-moz-opacity:0.3; opacity: 0.3; border: 1px solid #F0F0EE !important; cursor: default;} +a.mceTiledButton img {background-image: url('../images/buttons.gif'); background-repeat: no-repeat;} /* Menu button CSS rules */ -span.mceMenuButton img, span.mceMenuButtonSelected img {border: 1px solid #F0F0EE; margin-left: 1px;} -span.mceMenuButtonSelected img {border: 1px solid #6779AA; background-color: #B6BDD2;} -span.mceMenuButtonSelected img.mceMenuButton {border: 1px solid #F0F0EE; background-color: transparent;} -span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {border-left: 0; margin-left: 0;} -span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {border: 1px solid #0A246A; background-color: #B6BDD2;} +span.mceMenuButton img, span.mceMenuButtonSelected img {border: 1px solid #F0F0EE; margin-left: 1px;} +span.mceMenuButtonSelected img {border: 1px solid #6779AA; background-color: #B6BDD2;} +span.mceMenuButtonSelected img.mceMenuButton {border: 1px solid #F0F0EE; background-color: transparent;} +span.mceMenuButton img.mceMenuButton, span.mceMenuButtonSelected img.mceMenuButton {border-left: 0; margin-left: 0;} +span.mceMenuButton:hover img, span.mceMenuButtonSelected:hover img {border: 1px solid #0A246A; background-color: #B6BDD2;} span.mceMenuButton:hover img.mceMenuButton, span.mceMenuButtonSelected:hover img.mceMenuButton {border-left: 0;} -span.mceMenuButtonFocus img {border: 1px solid gray; border-right: 0; margin-left: 1px; background-color: #F5F4F2;} -span.mceMenuButtonFocus img.mceMenuButton {border: 1px solid gray; border-left: 1px solid #F5F4F2; margin-left: 0;} -span.mceMenuHover img {border: 1px solid #0A246A; background-color: #B6BDD2;} -span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {border: 1px solid #0A246A; background-color: #B6BDD2; border-left: 0;} +span.mceMenuButtonFocus img {border: 1px solid gray; border-right: 0; margin-left: 1px; background-color: #F5F4F2;} +span.mceMenuButtonFocus img.mceMenuButton {border: 1px solid gray; border-left: 1px solid #F5F4F2; margin-left: 0;} +span.mceMenuHover img {border: 1px solid #0A246A; background-color: #B6BDD2;} +span.mceMenuButtonSelected.mceMenuHover img.mceMenuButton {border: 1px solid #0A246A; background-color: #B6BDD2; border-left: 0;} /* Menu */ -.mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 100; 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;} -.mceMenuSeparator {border-bottom: 1px solid gray; background-color: gray; height: 1px;} +.mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 100; 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;} +.mceMenuSeparator {border-bottom: 1px solid gray; background-color: gray; height: 1px;} .mceMenuTitle span {padding-left: 5px;} -.mceMenuTitle {background-color: #DDDDDD; font-weight: bold;} +.mceMenuTitle {background-color: #DDDDDD; font-weight: bold;} .mceMenuDisabled {color: gray;} -span.mceMenuSelectedItem {background-image: url('../images/menu_check.gif'); background-repeat: no-repeat; background-position: 5px 8px; padding-left: 20px;} +span.mceMenuSelectedItem {background-image: url('../images/menu_check.gif'); background-repeat: no-repeat; background-position: 5px 8px; padding-left: 20px;} 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;} -.mceColorPreview {position: absolute; left: 0; top: 0; margin-left: 3px; margin-top: 15px; width: 16px; height: 4px; background-color: red;} +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;} +.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;} +.mceColors td a {width: 9px; height: 9px; overflow: hidden; border: 1px solid #808080;} /* MSIE 6 specific rules */ -* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;} -* html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;} +* html a.mceButtonNormal img, * html a.mceButtonSelected img, * html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;} +* html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;} * html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;} -* html a.mceButtonNormal, * html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;} -* html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;} -* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;} +* html a.mceButtonNormal, * html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;} +* html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;} +* html a.mceButtonNormal:hover, * html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;} * 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 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 .mceColors td a {width: 10px; height: 10px;} -* html .mceColorPreview {margin-left: 2px; margin-top: 14px;} +* html .mceColors td a {width: 10px; height: 10px;} +* html .mceColorPreview {margin-left: 2px; margin-top: 14px;} /* MSIE 7 specific rules */ -*:first-child+html a.mceButtonNormal img, *:first-child+html a.mceButtonSelected img, *:first-child+html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;} -*:first-child+html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;} +*:first-child+html a.mceButtonNormal img, *:first-child+html a.mceButtonSelected img, *:first-child+html a.mceButtonDisabled img {border: 0 !important; margin-top: 2px; margin-bottom: 1px;} +*:first-child+html a.mceButtonDisabled img {filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30); border: 0 !important;} *:first-child+html a.mceButtonDisabled {border: 1px solid #F0F0EE !important;} -*:first-child+html a.mceButtonNormal, *:first-child+html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;} -*:first-child+html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;} -*:first-child+html a.mceButtonNormal:hover, *:first-child+html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;} +*:first-child+html a.mceButtonNormal, *:first-child+html a.mceButtonSelected {border: 1px solid #F0F0EE !important; cursor: default;} +*:first-child+html a.mceButtonSelected {border: 1px solid #6779AA !important; background-color: #D4D5D8;} +*:first-child+html a.mceButtonNormal:hover, *:first-child+html a.mceButtonSelected:hover {border: 1px solid #0A246A !important; background-color: #B6BDD2; cursor: default;} *: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 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 .mceColors td a {width: 10px; height: 10px;} -*:first-child+html .mceColorPreview {margin: 0; padding-left: 4px; margin-top: 14px; width: 14px;} +*: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 2285832df4..3d918914b7 100644 --- a/wp-includes/js/tinymce/themes/advanced/editor_template.js +++ b/wp-includes/js/tinymce/themes/advanced/editor_template.js @@ -1,8 +1,8 @@ /** - * $Id: editor_template_src.js 129 2006-10-23 09:45:17Z spocke $ + * $Id: editor_template_src.js 166 2007-01-05 10:31:50Z spocke $ * * @author Moxiecode - * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. */ /* Import theme specific language pack */ @@ -713,8 +713,13 @@ var TinyMCE_AdvancedTheme = { template['html'] += '<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>'; template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML); - template['delta_width'] = 0; - template['delta_height'] = deltaHeight; + + // Set to default values + if (!template['delta_width']) + template['delta_width'] = 0; + + if (!template['delta_height']) + template['delta_height'] = deltaHeight; return template; }, @@ -732,6 +737,12 @@ var TinyMCE_AdvancedTheme = { inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink'); }, + removeInstance : function(inst) { + var fcm = new TinyMCE_Layer(inst.editorId + '_fcMenu'); + + fcm.remove(); + }, + _handleMenuEvent : function(e) { var te = tinyMCE.isMSIE ? window.event.srcElement : e.target; tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId)); @@ -782,10 +793,6 @@ var TinyMCE_AdvancedTheme = { return false; }; - function getAttrib(elm, name) { - return elm.getAttribute(name) ? elm.getAttribute(name) : ""; - }; - // No node provided if (node == null) return; @@ -839,7 +846,7 @@ var TinyMCE_AdvancedTheme = { var st = tinyMCE.getAttrib(path[i], "style"); if (st != "") { st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st)); - nodeData += "style: " + st + " "; + nodeData += "style: " + tinyMCE.xmlEncode(st) + " "; } } @@ -849,18 +856,18 @@ var TinyMCE_AdvancedTheme = { var face = tinyMCE.getAttrib(path[i], "face"); if (face != "") - nodeData += "font: " + face + " "; + nodeData += "font: " + tinyMCE.xmlEncode(face) + " "; var size = tinyMCE.getAttrib(path[i], "size"); if (size != "") - nodeData += "size: " + size + " "; + nodeData += "size: " + tinyMCE.xmlEncode(size) + " "; var color = tinyMCE.getAttrib(path[i], "color"); if (color != "") - nodeData += "color: " + color + " "; + nodeData += "color: " + tinyMCE.xmlEncode(color) + " "; } - if (getAttrib(path[i], 'id') != "") { + if (tinyMCE.getAttrib(path[i], 'id') != "") { nodeData += "id: " + path[i].getAttribute('id') + " "; } @@ -868,22 +875,22 @@ var TinyMCE_AdvancedTheme = { if (className != "" && className.indexOf('mceItem') == -1) nodeData += "class: " + className + " "; - if (getAttrib(path[i], 'src') != "") { + if (tinyMCE.getAttrib(path[i], 'src') != "") { var src = tinyMCE.getAttrib(path[i], "mce_src"); if (src == "") src = tinyMCE.getAttrib(path[i], "src"); - nodeData += "src: " + src + " "; + nodeData += "src: " + tinyMCE.xmlEncode(src) + " "; } - if (path[i].nodeName == 'A' && getAttrib(path[i], 'href') != "") { + if (path[i].nodeName == 'A' && tinyMCE.getAttrib(path[i], 'href') != "") { var href = tinyMCE.getAttrib(path[i], "mce_href"); if (href == "") href = tinyMCE.getAttrib(path[i], "href"); - nodeData += "href: " + href + " "; + nodeData += "href: " + tinyMCE.xmlEncode(href) + " "; } className = tinyMCE.getAttrib(path[i], "class"); @@ -894,11 +901,11 @@ var TinyMCE_AdvancedTheme = { if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") { nodeName = "a"; - nodeName += "#" + anchor; + nodeName += "#" + tinyMCE.xmlEncode(anchor); nodeData = ""; } - if (getAttrib(path[i], 'name').indexOf("mce_") != 0) { + if (tinyMCE.getAttrib(path[i], 'name').indexOf("mce_") != 0) { var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false); if (className != "" && className.indexOf('mceItem') == -1) { nodeName += "." + className; @@ -1124,7 +1131,7 @@ var TinyMCE_AdvancedTheme = { break; case "IMG": - if (getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) { + if (tinyMCE.getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) { tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected'); } break; diff --git a/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js b/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js index 8395340ce8..83648be49c 100644 --- a/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js +++ b/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js @@ -25,7 +25,7 @@ function setWrap(val) { s.wrap = val; - if (tinyMCE.isGecko) { + if (tinyMCE.isGecko || tinyMCE.isOpera) { var v = s.value; var n = s.cloneNode(false); n.setAttribute("wrap", val); @@ -47,14 +47,13 @@ function resizeInputs() { var el = document.getElementById('htmlSource'); if (!tinyMCE.isMSIE) { - wHeight = self.innerHeight-80; - wWidth = self.innerWidth-16; + wHeight = self.innerHeight - 60; + wWidth = self.innerWidth - 16; } else { - wHeight = document.body.clientHeight - 80; + wHeight = document.body.clientHeight - 60; wWidth = document.body.clientWidth - 16; } el.style.height = Math.abs(wHeight) + 'px'; el.style.width = Math.abs(wWidth) + 'px'; } - diff --git a/wp-includes/js/tinymce/tiny_mce.js b/wp-includes/js/tinymce/tiny_mce.js index aece8d1475..c3f2159bc4 100644 --- a/wp-includes/js/tinymce/tiny_mce.js +++ b/wp-includes/js/tinymce/tiny_mce.js @@ -5,8 +5,8 @@ function TinyMCE_Engine() { var ua; this.majorVersion = "2"; - this.minorVersion = "0.8"; - this.releaseDate = "2006-10-23"; + this.minorVersion = "0.9"; + this.releaseDate = "2007-01-09"; this.instances = new Array(); this.switchClassCache = new Array(); @@ -192,6 +192,7 @@ TinyMCE_Engine.prototype = { this._def("hidden_tab_class", ''); this._def("display_tab_class", ''); this._def("gecko_spellcheck", false); + this._def("hide_selects_on_submit", true); // Force strict loading mode to false on non Gecko browsers if (this.isMSIE && !this.isOpera) @@ -242,7 +243,7 @@ TinyMCE_Engine.prototype = { this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40); this.uniqueURL = 'javascript:TINYMCE_UNIQUEURL();'; // Make unique URL non real URL this.uniqueTag = '<div id="mceTMPElement" style="display: none">TMP</div>'; - this.callbacks = new Array('onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup'); + this.callbacks = new Array('onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance'); // Theme url this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme; @@ -338,6 +339,11 @@ TinyMCE_Engine.prototype = { } catch (e) { } } + + // Setup XML encoding regexps + this.xmlEncodeAposRe = new RegExp('[<>&"\']', 'g'); + this.xmlEncodeRe = new RegExp('[<>&"]', 'g'); +// this.xmlEncodeEnts = {'&':'&','"':'"',"'":''','<':'<','>':'>'}; }, _addUnloadEvents : function() { @@ -570,6 +576,9 @@ TinyMCE_Engine.prototype = { tinyMCE.undoLevels = n; tinyMCE.undoIndex = n.length; + // Dispatch remove instance call + tinyMCE.dispatchCallback(ti, 'remove_instance_callback', 'removeInstance', ti); + return ti; }, @@ -836,6 +845,7 @@ TinyMCE_Engine.prototype = { content = content.replace(/&/g, '&'); } + tinyMCE.selectedInstance = inst; inst.switchSettings(); // Not loaded correctly hit it again, Mozilla bug #997860 @@ -1015,8 +1025,8 @@ TinyMCE_Engine.prototype = { storeAwayURLs : function(s) { // Remove all mce_src, mce_href and replace them with new ones - // s = s.replace(new RegExp('mce_src\\s*=\\s*\"[^ >\"]*\"', 'gi'), ''); - // s = s.replace(new RegExp('mce_href\\s*=\\s*\"[^ >\"]*\"', 'gi'), ''); + // s = s.replace(new RegExp('mce_src\\s*=\\s*\"[^ >\"]*\"', 'gi'), ''); + // s = s.replace(new RegExp('mce_href\\s*=\\s*\"[^ >\"]*\"', 'gi'), ''); if (!s.match(/(mce_src|mce_href)/gi, s)) { s = s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'src="$1" mce_src="$1"'); @@ -1038,6 +1048,38 @@ TinyMCE_Engine.prototype = { } }, + removeTinyMCEFormElements : function(form_obj) { + var i, elementId; + + // Skip form element removal + if (!tinyMCE.getParam('hide_selects_on_submit')) + return; + + // Check if form is valid + if (typeof(form_obj) == "undefined" || form_obj == null) + return; + + // If not a form, find the form + if (form_obj.nodeName != "FORM") { + if (form_obj.form) + form_obj = form_obj.form; + else + form_obj = tinyMCE.getParentElement(form_obj, "form"); + } + + // Still nothing + if (form_obj == null) + return; + + // Disable all UI form elements that TinyMCE created + for (i=0; i<form_obj.elements.length; i++) { + elementId = form_obj.elements[i].name ? form_obj.elements[i].name : form_obj.elements[i].id; + + if (elementId.indexOf('mce_editor_') == 0) + form_obj.elements[i].disabled = true; + } + }, + handleEvent : function(e) { var inst = tinyMCE.selectedInstance; @@ -1086,6 +1128,7 @@ TinyMCE_Engine.prototype = { return; case "submit": + tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE ? window.event.srcElement : e.target); tinyMCE.triggerSave(); tinyMCE.isNotDirty = true; return; @@ -1433,6 +1476,7 @@ TinyMCE_Engine.prototype = { }, submitPatch : function() { + tinyMCE.removeTinyMCEFormElements(this); tinyMCE.triggerSave(); tinyMCE.isNotDirty = true; this.mceOldSubmit(); @@ -1649,14 +1693,19 @@ TinyMCE_Engine.prototype = { }, triggerNodeChange : function(focus, setup_content) { + var elm, inst, editorId, undoIndex = -1, undoLevels = -1, doc, anySelection = false; + if (tinyMCE.selectedInstance) { - var inst = tinyMCE.selectedInstance; - var editorId = inst.editorId; - var elm = (typeof(setup_content) != "undefined" && setup_content) ? tinyMCE.selectedElement : inst.getFocusElement(); - var undoIndex = -1, doc; - var undoLevels = -1; - var anySelection = false; - var selectedText = inst.selection.getSelectedText(); + inst = tinyMCE.selectedInstance; + elm = (typeof(setup_content) != "undefined" && setup_content) ? tinyMCE.selectedElement : inst.getFocusElement(); + +/* if (elm == inst.lastTriggerEl) + return; + + inst.lastTriggerEl = elm;*/ + + editorId = inst.editorId; + selectedText = inst.selection.getSelectedText(); if (tinyMCE.settings.auto_resize) inst.resizeToContent(); @@ -1754,6 +1803,8 @@ TinyMCE_Engine.prototype = { openWindow : function(template, args) { var html, width, height, x, y, resizable, scrollbars, url; + args = !args ? {} : args; + args['mce_template_file'] = template['file']; args['mce_width'] = template['width']; args['mce_height'] = template['height']; @@ -2256,18 +2307,10 @@ TinyMCE_Engine.prototype = { }, evalFunc : function(f, idx, a, o) { - var s = '(', i; + o = !o ? window : o; + f = typeof(f) == 'function' ? f : o[f]; - for (i=idx; i<a.length; i++) { - s += 'a[' + i + ']'; - - if (i < a.length-1) - s += ','; - } - - s += ');'; - - return o ? eval("o." + f + s) : eval("f" + s); + return f.apply(o, Array.prototype.slice.call(a, idx)); }, dispatchCallback : function(i, p, n) { @@ -2289,7 +2332,7 @@ TinyMCE_Engine.prototype = { l = tinyMCE.getParam(p, ''); - if (l != '' && (v = tinyMCE.evalFunc(typeof(l) == "function" ? l : eval(l), 3, a)) == s && m > 0) + if (l != '' && (v = tinyMCE.evalFunc(l, 3, a)) == s && m > 0) return true; if (ins != null) { @@ -2312,8 +2355,8 @@ TinyMCE_Engine.prototype = { return false; }, - xmlEncode : function(s) { - return s ? ('' + s).replace(new RegExp('[<>&"\']', 'g'), function (c, b) { + xmlEncode : function(s, skip_apos) { + return s ? ('' + s).replace(!skip_apos ? this.xmlEncodeAposRe : this.xmlEncodeRe, function (c, b) { switch (c) { case '&': return '&'; @@ -2398,11 +2441,11 @@ function TinyMCE_Control(settings) { entities : s.entities, entity_encoding : s.entity_encoding, debug : s.cleanup_debug, - url_converter : 'TinyMCE_Cleanup.prototype._urlConverter', indent : s.apply_source_formatting, invalid_elements : s.invalid_elements, verify_html : s.verify_html, - fix_content_duplication : s.fix_content_duplication + fix_content_duplication : s.fix_content_duplication, + convert_fonts_to_spans : s.convert_fonts_to_spans }); // Wrap old theme @@ -2593,7 +2636,13 @@ TinyMCE_Control.prototype = { }, handleShortcut : function(e) { - var i, s = this.shortcuts, o; + var i, s, o; + + // Normal key press, then ignore it + if (!e.altKey && !e.ctrlKey) + return false; + + s = this.shortcuts; for (i=0; i<s.length; i++) { o = s[i]; @@ -2702,8 +2751,11 @@ TinyMCE_Control.prototype = { //debug("command: " + command + ", user_interface: " + user_interface + ", value: " + value); this.contentDocument = doc; // <-- Strange, unless this is applied Mozilla 1.3 breaks - if (tinyMCE.execCommandCallback(this, 'execcommand_callback', 'execCommand', this.editorId, this.getBody(), command, user_interface, value)) - return; + // Don't dispatch key commands + if (!/mceStartTyping|mceEndTyping/.test(command)) { + if (tinyMCE.execCommandCallback(this, 'execcommand_callback', 'execCommand', this.editorId, this.getBody(), command, user_interface, value)) + return; + } // Fix align on images if (focusElm && focusElm.nodeName == "IMG") { @@ -2813,7 +2865,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) + 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 this.selection.selectNode(focusElm, false); } @@ -2825,14 +2877,6 @@ TinyMCE_Control.prototype = { return true; - case "FormatBlock": - if (!this.cleanup.isValid(value)) - return true; - - this.getDoc().execCommand(command, user_interface, value); - tinyMCE.triggerNodeChange(); - break; - case "InsertUnorderedList": case "InsertOrderedList": this.getDoc().execCommand(command, user_interface, value); @@ -2857,6 +2901,9 @@ TinyMCE_Control.prototype = { if (elm) this.execCommand("mceRemoveNode", false, elm); } else { + if (!this.cleanup.isValid(value)) + return true; + if (tinyMCE.isGecko && new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>', 'gi').test(value)) value = value.replace(/[^a-z]/gi, ''); @@ -2915,6 +2962,7 @@ TinyMCE_Control.prototype = { break; + case "mceSetStyleInfo": case "SetStyleInfo": var rng = this.getRng(); var sel = this.getSel(); @@ -3246,7 +3294,7 @@ TinyMCE_Control.prototype = { break; case "mceSetCSSClass": - this.execCommand("SetStyleInfo", false, {command : "setattrib", name : "class", value : value}); + this.execCommand("mceSetStyleInfo", false, {command : "setattrib", name : "class", value : value}); break; case "mceInsertRawHTML": @@ -3478,6 +3526,7 @@ TinyMCE_Control.prototype = { } break; + case "RemoveFormat": case "removeformat": var text = this.selection.getSelectedText(); @@ -3494,11 +3543,11 @@ TinyMCE_Control.prototype = { // Do nothing } - this.execCommand("SetStyleInfo", false, {command : "removeformat"}); + this.execCommand("mceSetStyleInfo", false, {command : "removeformat"}); } else { this.getDoc().execCommand(command, user_interface, value); - this.execCommand("SetStyleInfo", false, {command : "removeformat"}); + this.execCommand("mceSetStyleInfo", false, {command : "removeformat"}); } // Remove class @@ -3997,6 +4046,8 @@ TinyMCE_Engine.prototype.serializeStyle = function(ar) { if (tinyMCE.getParam("force_hex_style_colors")) val = tinyMCE.convertRGBToHex(val, true); + val = val.replace(/\"/g, '\''); + if (val != "url('')") str += key.toLowerCase() + ": " + val + "; "; } @@ -4043,12 +4094,12 @@ TinyMCE_Engine.prototype.convertHexToRGB = function(s) { TinyMCE_Engine.prototype.convertSpansToFonts = function(doc) { var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(','); - var h = doc.body.innerHTML; + /*var h = doc.body.innerHTML; h = h.replace(/<span/gi, '<font'); h = h.replace(/<\/span/gi, '</font'); - tinyMCE.setInnerHTML(doc.body, h); + tinyMCE.setInnerHTML(doc.body, h);*/ - var s = doc.getElementsByTagName("font"); + var s = tinyMCE.selectElements(doc, 'span,font'); for (var i=0; i<s.length; i++) { var size = tinyMCE.trim(s[i].style.fontSize).toLowerCase(); var fSize = 0; @@ -4082,10 +4133,10 @@ TinyMCE_Engine.prototype.convertSpansToFonts = function(doc) { TinyMCE_Engine.prototype.convertFontsToSpans = function(doc) { var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(','); - var h = doc.body.innerHTML; +/* var h = doc.body.innerHTML; h = h.replace(/<font/gi, '<span'); h = h.replace(/<\/font/gi, '</span'); - tinyMCE.setInnerHTML(doc.body, h); + tinyMCE.setInnerHTML(doc.body, h);*/ var fsClasses = tinyMCE.getParam('font_size_classes'); if (fsClasses != '') @@ -4093,7 +4144,7 @@ TinyMCE_Engine.prototype.convertFontsToSpans = function(doc) { else fsClasses = null; - var s = doc.getElementsByTagName("span"); + var s = tinyMCE.selectElements(doc, 'span,font'); for (var i=0; i<s.length; i++) { var fSize, fFace, fColor; @@ -4182,7 +4233,7 @@ TinyMCE_Engine.prototype._fixTables = function(d) { for (i=0; i<nl.length; i++) { n = nl[i]; - if ((p = tinyMCE.getParentElement(n, 'p,div,h1,h2,h3,h4,h5,h6')) != null) { + if ((p = tinyMCE.getParentElement(n, 'p,h1,h2,h3,h4,h5,h6')) != null) { np = p.cloneNode(false); np.removeAttribute('id'); @@ -4380,6 +4431,8 @@ TinyMCE_Cleanup.prototype = { this.fillStr = s.entity_encoding == "named" ? " " : " "; this.idCount = 0; + this.xmlEncodeRe = new RegExp('[\u007F-\uFFFF<>&"]', 'g'); + this.xmlEncodeAposRe = new RegExp('[\u007F-\uFFFF<>&"\']', 'g'); }, addRuleStr : function(s) { @@ -4404,6 +4457,10 @@ TinyMCE_Cleanup.prototype = { isValid : function(n) { this._setupRules(); // Will initialize cleanup rules + // Empty is true since it removes formatting + if (!n) + return true; + // Clean the name up a bit n = n.replace(/[^a-z0-9]+/gi, '').toUpperCase(); @@ -4606,7 +4663,7 @@ TinyMCE_Cleanup.prototype = { _convertToXML : function(n, xn) { var xd, el, i, l, cn, at, no, hc = false; - if (this._isDuplicate(n)) + if (tinyMCE.isRealIE && this._isDuplicate(n)) return; xd = this.xmlDoc; @@ -4649,11 +4706,11 @@ TinyMCE_Cleanup.prototype = { }, serializeNodeAsHTML : function(n, inn) { - var en, no, h = '', i, l, t, st, r, cn, va = false, f = false, at, hc, cr; + var en, no, h = '', i, l, t, st, r, cn, va = false, f = false, at, hc, cr, nn; this._setupRules(); // Will initialize cleanup rules - if (this._isDuplicate(n)) + if (tinyMCE.isRealIE && this._isDuplicate(n)) return ''; // Skip non valid child elements @@ -4677,21 +4734,34 @@ TinyMCE_Cleanup.prototype = { if ((tinyMCE.isRealIE) && n.nodeName.indexOf('/') != -1) break; - if (this.vElementsRe.test(n.nodeName) && (!this.iveRe || !this.iveRe.test(n.nodeName)) && !inn) { + nn = n.nodeName; + + // Convert fonts to spans + if (this.settings.convert_fonts_to_spans) { + // On get content FONT -> SPAN + if (this.settings.on_save && nn == 'FONT') + nn = 'SPAN'; + + // On insert content SPAN -> FONT + if (!this.settings.on_save && nn == 'SPAN') + nn = 'FONT'; + } + + if (this.vElementsRe.test(nn) && (!this.iveRe || !this.iveRe.test(nn)) && !inn) { va = true; - r = this.rules[n.nodeName]; + r = this.rules[nn]; if (!r) { at = this.rules; for (no in at) { - if (at[no] && at[no].validRe.test(n.nodeName)) { + if (at[no] && at[no].validRe.test(nn)) { r = at[no]; break; } } } - en = r.isWild ? n.nodeName.toLowerCase() : r.oTagName; + en = r.isWild ? nn.toLowerCase() : r.oTagName; f = r.fill; if (r.removeEmpty && !hc) @@ -4728,13 +4798,13 @@ TinyMCE_Cleanup.prototype = { t = null; // Close these - if (t != null && this.closeElementsRe.test(n.nodeName)) + if (t != null && this.closeElementsRe.test(nn)) return t + ' />'; if (t != null) h += t + '>'; - if (this.isIE && this.codeElementsRe.test(n.nodeName)) + if (this.isIE && this.codeElementsRe.test(nn)) h += n.innerHTML; } break; @@ -4796,7 +4866,7 @@ TinyMCE_Cleanup.prototype = { av = t; if (os && av.length != 0 && this.settings.url_converter.length != 0 && /^(src|href|longdesc)$/.test(an)) - av = eval(this.settings.url_converter + '(this, n, av)'); + av = this._urlConverter(this, n, av); if (av.length != 0 && r.validAttribValues && r.validAttribValues[an] && !r.validAttribValues[an].test(av)) return ""; @@ -4806,7 +4876,7 @@ TinyMCE_Cleanup.prototype = { if (av.length != 0) { if (an.indexOf('on') != 0) - av = this.xmlEncode(av); + av = this.xmlEncode(av, 1); return " " + an + "=" + '"' + av + '"'; } @@ -4852,24 +4922,24 @@ TinyMCE_Cleanup.prototype = { return o; }, - xmlEncode : function(s) { - var cl = this; + xmlEncode : function(s, skip_apos) { + var cl = this, re = !skip_apos ? this.xmlEncodeAposRe : this.xmlEncodeRe; this._setupEntities(); // Will intialize lookup table switch (this.settings.entity_encoding) { case "raw": - return tinyMCE.xmlEncode(s); + return tinyMCE.xmlEncode(s, skip_apos); case "named": - return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']', 'g'), function (c, b) { + return s.replace(re, function (c, b) { b = cl.entities[c.charCodeAt(0)]; return b ? '&' + b + ';' : c; }); case "numeric": - return s.replace(new RegExp('[\u007F-\uFFFF<>&"\']', 'g'), function (c, b) { + return s.replace(re, function (c, b) { return b ? '&#' + c.charCodeAt(0) + ';' : c; }); } @@ -4898,34 +4968,47 @@ TinyMCE_Cleanup.prototype = { }, _getAttrib : function(e, n, d) { + var v, ex, nn; + if (typeof(d) == "undefined") d = ""; if (!e || e.nodeType != 1) return d; - var v = e.getAttribute(n, 0); + try { + v = e.getAttribute(n, 0); + } catch (ex) { + // IE 7 may cast exception on invalid attributes + v = e.getAttribute(n, 2); + } if (n == "class" && !v) v = e.className; - if (this.isIE && n == "http-equiv") - v = e.httpEquiv; + if (this.isIE) { + if (n == "http-equiv") + v = e.httpEquiv; - if (this.isIE && e.nodeName == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded") - v = ""; + nn = e.nodeName; - if (this.isIE && e.nodeName == "INPUT" && n == "size" && v == "20") - v = ""; + // Skip the default values that IE returns + if (nn == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded") + v = ""; - if (this.isIE && e.nodeName == "INPUT" && n == "maxlength" && v == "2147483647") - v = ""; + if (nn == "INPUT" && n == "size" && v == "20") + v = ""; - if (n == "style" && !tinyMCE.isOpera) - v = e.style.cssText; + if (nn == "INPUT" && n == "maxlength" && v == "2147483647") + v = ""; + } + + if (n == 'style' && v) { + if (!tinyMCE.isOpera) + v = e.style.cssText; - if (n == 'style') v = tinyMCE.serializeStyle(tinyMCE.parseStyle(v)); + } if (this.settings.on_save && n.indexOf('on') != -1 && this.settings.on_save && v && v != "") v = tinyMCE.cleanupEventStr(v); @@ -4936,8 +5019,12 @@ TinyMCE_Cleanup.prototype = { _urlConverter : function(c, n, v) { if (!c.settings.on_save) return tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, v); - else if (tinyMCE.getParam('convert_urls')) - return eval(tinyMCE.settings.urlconverter_callback + "(v, n, true);"); + else if (tinyMCE.getParam('convert_urls')) { + if (!this.urlConverter) + this.urlConverter = eval(tinyMCE.settings.urlconverter_callback); + + return this.urlConverter(v, n, true); + } return v; }, @@ -5225,7 +5312,12 @@ TinyMCE_Engine.prototype.getAttrib = function(elm, name, dv) { if (!elm || elm.nodeType != 1) return dv; - v = elm.getAttribute(name); + try { + v = elm.getAttribute(name, 0); + } catch (ex) { + // IE 7 may cast exception on invalid attributes + v = elm.getAttribute(name, 2); + } // Try className for class attrib if (name == "class" && !v) @@ -5876,7 +5968,12 @@ TinyMCE_Engine.prototype.setEventHandlers = function(inst, s) { for (i=0; i<ot.length; i++) f(doc, ot[i], tinyMCE.handleEvent); - eval('try { doc.designMode = "On"; } catch(e) {}'); // Force designmode + // Force designmode + try { + doc.designMode = "On"; + } catch (e) { + // Ignore + } } }; @@ -6047,8 +6144,8 @@ TinyMCE_Selection.prototype = { h = tinyMCE._cleanupHTML(inst, inst.contentDocument, inst.settings, e, e, false, true, false); // When editing always use fonts internaly - if (tinyMCE.getParam("convert_fonts_to_spans")) - tinyMCE.convertSpansToFonts(inst.getDoc()); + //if (tinyMCE.getParam("convert_fonts_to_spans")) + // tinyMCE.convertSpansToFonts(inst.getDoc()); return h; }, @@ -6251,6 +6348,9 @@ TinyMCE_Selection.prototype = { } if (tinyMCE.isGecko || tinyMCE.isOpera) { + if (!sel) + return false; + if (bookmark.rng) { sel.removeAllRanges(); sel.addRange(bookmark.rng); @@ -6462,7 +6562,33 @@ TinyMCE_Selection.prototype = { if (tinyMCE.isSafari && !s.getRangeAt) return '' + window.getSelection(); - return s.getRangeAt(0); + if (s.rangeCount > 0) + return s.getRangeAt(0); + + return null; + }, + + isCollapsed : function() { + var r = this.getRng(); + + if (r.item) + return false; + + return r.boundingWidth == 0 || this.getSel().isCollapsed; + }, + + collapse : function(b) { + var r = this.getRng(), s = this.getSel(); + + if (r.select) { + r.collapse(b); + r.select(); + } else { + if (b) + s.collapseToStart(); + else + s.collapseToEnd(); + } }, getFocusElement : function() { @@ -7117,6 +7243,16 @@ TinyMCE_Layer.prototype = { return 0; return parseInt(s); + }, + + remove : function() { + var e = this.getElement(), b = this.getBlocker(); + + if (e) + e.parentNode.removeChild(e); + + if (b) + b.parentNode.removeChild(b); } }; @@ -7208,7 +7344,7 @@ TinyMCE_Menu.prototype = tinyMCE.extend(TinyMCE_Layer.prototype, { break; default: - h += '<tr><td><a href="#" onclick="return tinyMCE.cancelEvent(event);" onmousedown="return tinyMCE.cancelEvent(event);" onmouseup="' + tinyMCE.xmlEncode(m[i].js) + ';return tinyMCE.cancelEvent(event);"><span' + c +'>' + t + '</span></a>'; + h += '<tr><td><a href="' + tinyMCE.xmlEncode(m[i].js) + '" onmousedown="' + tinyMCE.xmlEncode(m[i].js) + ';return tinyMCE.cancelEvent(event);" onclick="return tinyMCE.cancelEvent(event);" onmouseup="return tinyMCE.cancelEvent(event);"><span' + c +'>' + t + '</span></a>'; } h += '</td></tr>'; diff --git a/wp-includes/js/tinymce/utils/editable_selects.js b/wp-includes/js/tinymce/utils/editable_selects.js new file mode 100644 index 0000000000..e72336541e --- /dev/null +++ b/wp-includes/js/tinymce/utils/editable_selects.js @@ -0,0 +1,61 @@ +/** + * $Id: editable_selects.js 162 2007-01-03 16:16:52Z spocke $ + * + * Makes select boxes editable. + * + * @author Moxiecode + * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. + */ + +var TinyMCE_EditableSelects = { + editSelectElm : null, + + init : function() { + var nl = document.getElementsByTagName("select"), i, d = document, o; + + for (i=0; i<nl.length; i++) { + if (nl[i].className.indexOf('mceEditableSelect') != -1) { + o = new Option('(value)', '__mce_add_custom__'); + + o.className = 'mceAddSelectValue'; + + nl[i].options[nl[i].options.length] = o; + nl[i].setAttribute('onchange', 'TinyMCE_EditableSelects.onChangeEditableSelect(this);'); + } + } + }, + + onChangeEditableSelect : function(se) { + var d = document, ne; + + if (se.options[se.selectedIndex].value == '__mce_add_custom__') { + ne = d.createElement("input"); + ne.id = se.id + "_custom"; + ne.name = se.name + "_custom"; + ne.type = "text"; + + ne.style.width = se.clientWidth; + se.parentNode.insertBefore(ne, se); + se.style.display = 'none'; + ne.focus(); + ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput; + TinyMCE_EditableSelects.editSelectElm = se; + } + }, + + onBlurEditableSelectInput : function() { + var se = TinyMCE_EditableSelects.editSelectElm; + + if (se) { + if (se.previousSibling.value != '') { + addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value); + selectByValue(document.forms[0], se.id, se.previousSibling.value); + } else + selectByValue(document.forms[0], se.id, ''); + + se.style.display = 'inline'; + se.parentNode.removeChild(se.previousSibling); + TinyMCE_EditableSelects.editSelectElm = null; + } + } +}; diff --git a/wp-includes/js/tinymce/utils/form_utils.js b/wp-includes/js/tinymce/utils/form_utils.js index 66a3ce046d..110a720e03 100644 --- a/wp-includes/js/tinymce/utils/form_utils.js +++ b/wp-includes/js/tinymce/utils/form_utils.js @@ -1,10 +1,10 @@ /** - * $Id: form_utils.js 43 2006-08-08 16:10:07Z spocke $ + * $Id: form_utils.js 162 2007-01-03 16:16:52Z spocke $ * * Various form utilitiy functions. * * @author Moxiecode - * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. */ var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme"); diff --git a/wp-includes/js/tinymce/utils/mclayer.js b/wp-includes/js/tinymce/utils/mclayer.js index 016df17c52..23982db197 100644 --- a/wp-includes/js/tinymce/utils/mclayer.js +++ b/wp-includes/js/tinymce/utils/mclayer.js @@ -1,10 +1,10 @@ /** - * $Id: mclayer.js 18 2006-06-29 14:11:23Z spocke $ + * $Id: mclayer.js 162 2007-01-03 16:16:52Z spocke $ * * Moxiecode floating layer script. * * @author Moxiecode - * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. */ function MCLayer(id) { diff --git a/wp-includes/js/tinymce/utils/mctabs.js b/wp-includes/js/tinymce/utils/mctabs.js index 01b32bd752..d643402834 100644 --- a/wp-includes/js/tinymce/utils/mctabs.js +++ b/wp-includes/js/tinymce/utils/mctabs.js @@ -1,10 +1,10 @@ /** - * $Id: mctabs.js 18 2006-06-29 14:11:23Z spocke $ + * $Id: mctabs.js 162 2007-01-03 16:16:52Z spocke $ * * Moxiecode DHTML Tabs script. * * @author Moxiecode - * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. */ function MCTabs() { diff --git a/wp-includes/js/tinymce/utils/validate.js b/wp-includes/js/tinymce/utils/validate.js index 1b8101b8d0..92b44edc02 100644 --- a/wp-includes/js/tinymce/utils/validate.js +++ b/wp-includes/js/tinymce/utils/validate.js @@ -1,10 +1,10 @@ /** - * $Id: validate.js 65 2006-08-24 15:54:55Z spocke $ + * $Id: validate.js 162 2007-01-03 16:16:52Z spocke $ * * Various form validation methods. * * @author Moxiecode - * @copyright Copyright � 2004-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright � 2004-2007, Moxiecode Systems AB, All rights reserved. */ /** diff --git a/wp-includes/js/tinymce/wp-mce-help.php b/wp-includes/js/tinymce/wp-mce-help.php index 08931275cc..e28132a952 100644 --- a/wp-includes/js/tinymce/wp-mce-help.php +++ b/wp-includes/js/tinymce/wp-mce-help.php @@ -164,7 +164,7 @@ <div id="content4" class="hidden"> <h2><?php _e('About TinyMCE'); ?></h2> - <p><?php printf(__('Version: %s'), '2.0.8') ?></p> + <p><?php printf(__('Version: %s'), '2.0.9') ?></p> <p><?php printf(__('TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under %sLGPL</a> by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.'), '<a href="'.get_bloginfo('home').'/wp-includes/js/tinymce/license.txt" target="_blank" title="'.__('GNU Library General Public Licence').'">') ?></p> <p><?php _e('Copyright © 2005, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.') ?></p> <p><?php _e('For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.') ?></p> diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 17042bb36a..3351eef692 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -15,9 +15,9 @@ class WP_Scripts { $this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' ); $this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3517' ); $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' ); - $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20061113' ); + $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20070124' ); $mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php'); - $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20061113' ); + $this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070124' ); $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0'); $this->add( 'autosave', '/wp-includes/js/autosave-js.php', array('prototype', 'sack'), '20070116'); $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '20070118');