Upgrade TinyMCE to 2.1.0. Props andy. fixes #3788

git-svn-id: http://svn.automattic.com/wordpress/trunk@5256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rob1n 2007-04-12 17:04:03 +00:00
parent 75efedc528
commit dbda3aabaa
12 changed files with 579 additions and 158 deletions

View File

@ -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 {

View File

@ -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
};
},

View File

@ -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
};
},

View File

@ -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 += '<head>';
html += '<title>Wrapper iframe</title>';
if (this.isMac) html += '<style type="text/css">.mceWindowTitle{float:none;margin:0;width:100%;text-align:center;}.mceWindowClose{float:none;position:absolute;left:0px;top:0px;}</style>';
html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />';
if ( this.isMac ) html += '<style type="text/css">.mceWindowTitle{float:none;margin:0;text-align:center;}.mceWindowClose{float:none;position:absolute;left:0px;top:0px;}</style>';
html += '</head>';
html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
@ -297,8 +404,9 @@ TinyMCE_Windows.prototype.open = function(url, name, features) {
html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';
html += ' <div class="mceWindowHeadTools">';
html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/window_close.gif" /></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>';
if (features['resizable'] == "yes" && features['maximizable'] == "yes")
html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"><img border="0" src="' + imgPath + '/window_maximize.gif" /></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>';
html += ' </div>';
html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe" scrolling="' + features['scrollbars'] + '"></iframe></div>';
@ -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;

View File

@ -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":

View File

@ -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 {

View File

@ -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;}

View File

@ -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'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';
if (toolbarLocation == "top") {
template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
}
if (toolbarLocation == "top")
template['html'] += '<tr><td dir="ltr" class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
if (statusbarLocation == "top") {
template['html'] += '<tr><td class="mceStatusbarTop" height="1">' + statusbarHTML + '</td></tr>';
@ -610,9 +627,8 @@ var TinyMCE_AdvancedTheme = {
template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';
if (toolbarLocation == "bottom") {
template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
}
if (toolbarLocation == "bottom")
template['html'] += '<tr><td dir="ltr" class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
// 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 += '</tr></table>';
/*
h += '<a href="" class="mceMoreColors">More colors</a>';
*/
if (tinyMCE.getParam("theme_advanced_more_colors", true))
h += '<a href="#" onclick="TinyMCE_AdvancedTheme._pickColor(\'' + id + '\',\'' + cm + '\');" class="mceMoreColors">' + tinyMCE.getLang('lang_more_colors') + '</a>';
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');

View File

@ -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 += '<table border="0" cellspacing="1" cellpadding="0">'
for (i = 0; i < detail; i++){
h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"'
+ ' onclick="changeFinalColor(this.style.backgroundColor)"'
+ ' onmousedown="isMouseDown = true; return false;"'
+ ' onmouseup="isMouseDown = false;"'
+ ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"'
+ ' onmouseover="isMouseOver = true;"'
+ ' onmouseout="isMouseOver = false;"'
+ '></div>';
}
el.innerHTML = h;
}
function generateWebColors() {
var el = document.getElementById('webcolors'), h = '', i;
if (el.className == 'generated')
return;
h += '<table border="0" cellspacing="1" cellpadding="0">'
+ '<tr>';
for (var i=0; i<colors.length; i++) {
html += '<td bgcolor="' + colors[i] + '">'
for (i=0; i<colors.length; i++) {
h += '<td bgcolor="' + colors[i] + '">'
+ '<a href="javascript:selectColor();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');">'
+ '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] + '" alt="' + colors[i] + '" /></a></td>';
if ((i+1) % 18 == 0)
html += '</tr><tr>';
h += '</tr><tr>';
}
html += '<tr><td colspan="18">'
+ '<table width="100%" border="0" cellspacing="0" cellpadding="0">'
+ '<tr><td>'
+ '<img id="selectedColor" style="background-color:' + tinyMCE.getWindowArg('input_color') + '" border="0" src="images/spacer.gif" width="80" height="16" />'
+ '</td><td align="right">'
+ '<input id="selectedColorBox" name="selectedColorBox" type="text" size="7" maxlength="7" style="width:65px" value="' + inputColor + '" />'
+ '</td></tr>'
+ '</table>'
+ '<div style="float: left"><input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();"></div>'
+ '<div style="float: right"><input type="button" name="cancel" value="{$lang_cancel}" style="margin-top:3px" onclick="tinyMCEPopup.close();" id="cancel" /></div>'
+ '</td></tr>'
+ '</table>';
document.write(html);
}
h += '</table>';
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 += '<a href="javascript:selectColor();" onmouseover="showColor(\'' + n + '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>'
}
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<detail; i++) {
if ((i>=0) && (i<partDetail)) {
finalCoef = i / partDetail;
finalR = dechex(255 - (255 - r) * finalCoef);
finalG = dechex(255 - (255 - g) * finalCoef);
finalB = dechex(255 - (255 - b) * finalCoef);
} else {
finalCoef = 2 - i / partDetail;
finalR = dechex(r * finalCoef);
finalG = dechex(g * finalCoef);
finalB = dechex(b * finalCoef);
}
color = finalR + finalG + finalB;
document.getElementById('gs' + i).style.backgroundColor = '#'+color;
}
}
function changeFinalColor(color) {
if (color.indexOf('#') == -1)
color = convertRGBToHex(color);
document.getElementById('preview').style.backgroundColor = color;
document.getElementById('color').value = color;
}
window.focus();

View File

@ -27,6 +27,7 @@ function init() {
document.forms[0].href.value = tinyMCE.getWindowArg('href') || 'http://';
document.forms[0].href.select();
document.forms[0].href.focus();
document.forms[0].linktitle.value = tinyMCE.getWindowArg('title');
document.forms[0].insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true);
@ -57,8 +58,8 @@ function insertLink() {
var title = document.forms[0].linktitle.value;
var style_class = document.forms[0].styleSelect ? document.forms[0].styleSelect.value : "";
var dummy;
// Make anchors absolute
// WordPress: Make anchors absolute;
if (href.charAt(0) == '#')
href = tinyMCE.settings['document_base_url'] + href;

View File

@ -78,5 +78,14 @@ help : 'Help',
not_set : '-- Not set --',
close : 'Close',
toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
invalid_data : 'Error: Invalid values entered, these are marked in red.'
invalid_data : 'Error: Invalid values entered, these are marked in red.',
more_colors : 'More colors',
color_picker_tab : 'Picker',
color_picker : 'Color picker',
web_colors_tab : 'Web safe',
web_colors : 'Web safe colors',
named_colors_tab : 'Named',
named_colors : 'Named colors',
color : 'Color:',
color_name : 'Name:'
});

View File

@ -5,8 +5,8 @@ function TinyMCE_Engine() {
var ua;
this.majorVersion = "2";
this.minorVersion = "0.9";
this.releaseDate = "2007-01-09";
this.minorVersion = "1.0";
this.releaseDate = "2007-02-13";
this.instances = new Array();
this.switchClassCache = new Array();
@ -186,7 +186,7 @@ TinyMCE_Engine.prototype = {
this._def("custom_shortcuts", true);
this._def("convert_on_click", false);
this._def("content_css", '');
this._def("fix_list_elements", false);
this._def("fix_list_elements", true);
this._def("fix_table_elements", false);
this._def("strict_loading_mode", document.contentType == 'application/xhtml+xml');
this._def("hidden_tab_class", '');
@ -241,7 +241,7 @@ TinyMCE_Engine.prototype = {
this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';
this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i");
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.uniqueURL = 'javascript:void(091039730);'; // 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', 'removeInstance');
@ -740,6 +740,35 @@ TinyMCE_Engine.prototype = {
tinyMCE.removeMCEControl(value);
return;
case "mceToggleEditor":
var inst = tinyMCE.getInstanceById(value), pe, te;
if (inst) {
pe = document.getElementById(inst.editorId + '_parent');
te = inst.oldTargetElement;
if (typeof(inst.enabled) == 'undefined')
inst.enabled = true;
inst.enabled = !inst.enabled;
if (!inst.enabled) {
pe.style.display = 'none';
te.value = inst.getHTML();
te.style.display = inst.oldTargetDisplay;
tinyMCE.dispatchCallback(inst, 'hide_instance_callback', 'hideInstance', inst);
} else {
pe.style.display = 'block';
te.style.display = 'none';
inst.setHTML(te.value);
inst.useCSS = false;
tinyMCE.dispatchCallback(inst, 'show_instance_callback', 'showInstance', inst);
}
} else
tinyMCE.addMCEControl(tinyMCE._getElementById(value), value);
return;
case "mceResetDesignMode":
// Resets the designmode state of the editors in Gecko
if (!tinyMCE.isIE) {
@ -961,10 +990,6 @@ TinyMCE_Engine.prototype = {
// Fix for bug #957681
//inst.getDoc().designMode = inst.getDoc().designMode;
// Setup element references
var parentElm = inst.targetDoc.getElementById(inst.editorId + '_parent');
inst.formElement = tinyMCE.isGecko ? parentElm.previousSibling : parentElm.nextSibling;
tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual'], inst);
tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc());
@ -1445,9 +1470,9 @@ TinyMCE_Engine.prototype = {
h += '</a></span>';
} else {
if (tinyMCE.isRealIE)
h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';
h += '<span id="{$editor_id}_' + id + '" dir="ltr" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';
else
h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
h += '<span id="{$editor_id}_' + id + '" dir="ltr" class="mceMenuButton">';
h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
h += '<img src="' + img + '" title="{$' + lang + '}" /></a>';
@ -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<output.length && addClass; p++) {
if (output[p] == cssClass)
for (var p=0; p<inst.cssClasses.length && addClass; p++) {
if (inst.cssClasses[p] == cssClass)
addClass = false;
}
if (addClass)
output[output.length] = cssClass;
inst.cssClasses[inst.cssClasses.length] = cssClass;
}
}
}
@ -2257,11 +2282,7 @@ TinyMCE_Engine.prototype = {
}
}
// Cache em
if (output.length > 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 '<span dir="rtl">' + tinyMCE.replaceVar(v, "pluginurl", o.baseURL) + '</span>';
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 '<span dir="rtl">' + v + '</span>';
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 = '<textarea wrap="off" id="' + form_element_name + '" name="' + form_element_name + '" cols="100" rows="15"></textarea>';
} else {
hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />';
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(/<strong/gi, '<b');
h = h.replace(/<em(\/?)/gi, '<i');
h = h.replace(/<em /gi, '<i');
h = h.replace(/<embed([^>]*)>/gi, '<tmpembed$1>');
h = h.replace(/<em([^>]*)>/gi, '<i$1>');
h = h.replace(/<tmpembed([^>]*)>/gi, '<embed$1>');
h = h.replace(/<strong([^>]*)>/gi, '<b$1>');
h = h.replace(/<\/strong>/gi, '</b>');
h = h.replace(/<\/em>/gi, '</i>');
}
@ -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() {