TinyMCE 2.0RC4 Props skeltoac. fixes #1830

git-svn-id: http://svn.automattic.com/wordpress/trunk@2993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-11-06 03:30:11 +00:00
parent 81669e4652
commit 344b1dcee0
34 changed files with 1473 additions and 593 deletions

View File

@ -80,7 +80,7 @@ addLoadEvent(blurry);
<script type="text/javascript" src="list-manipulation.js"></script>
<?php if ( isset( $editing ) ) : ?>
<?php if ( 'true' == get_user_option('rich_editing') ) :?>
<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php"></script>
<script language="javascript" type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?index=0&theme=advanced&plugins=wordpress,autosave"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "specific_textareas",
@ -101,7 +101,7 @@ tinyMCE.init({
relative_urls : false,
remove_script_host : false,
valid_elements : "a[href|title],strong/b,em/i,strike,u,p[class|align],ol,ul,li,br,img[class|src|alt|title|width|height|align],sub,sup,blockquote,table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],div[dir|class|align],span[class|align],pre[class],address,h1[class|align],h2[class|align],h3[class|align],h4[class|align],h5[class|align],h6[class|align],hr",
plugins : "contextmenu,wordpress"
plugins : "wordpress,autosave"
<?php do_action('mce_options'); ?>
});
</script>

View File

@ -38,7 +38,7 @@ if ('' != $pinged) {
$pings .= '</ul>';
}
$saveasdraft = '<input name="save" type="submit" id="save" tabindex="6" value="' . __('Save and Continue Editing') . '" />';
$saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . __('Save and Continue Editing') . '" />';
if (empty($post->post_status)) $post->post_status = 'draft';
@ -148,6 +148,43 @@ endforeach;
<script type="text/javascript">
<!--
edCanvas = document.getElementById('content');
//-->
</script>
<?php else : ?>
<script type="text/javascript">
<!--
// This code is meant to allow tabbing from Title to Post (TinyMCE).
if ( tinyMCE.isMSIE )
document.getElementById('title').onkeydown = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
else
document.getElementById('title').onkeypress = function (e)
{
e = e ? e : window.event;
if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
var i = tinyMCE.selectedInstance;
if(typeof i == 'undefined')
return true;
tinyMCE.execCommand("mceStartTyping");
this.blur();
i.contentWindow.focus();
e.returnValue = false;
return false;
}
}
//-->
</script>
<?php endif; ?>
@ -158,10 +195,10 @@ edCanvas = document.getElementById('content');
<p class="submit"><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />
<?php
if ( 'publish' != $post->post_status || 0 == $post_ID ) {
if ('publish' != $post_status || 0 == $post_ID) {
?>
<?php if ( current_user_can('publish_posts') ) : ?>
<input name="publish" type="submit" id="publish" tabindex="6" accesskey="p" value="<?php _e('Publish') ?>" />
<input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
<?php endif; ?>
<?php
}
@ -175,13 +212,19 @@ else
<?php do_action('edit_form_advanced'); ?>
<iframe border="0" src="image-uploading.php?action=view&amp;post=<?php echo 0 == $post_ID ? $temp_ID : $post_ID; ?>" id="imageup">This feature requires iframe support.</iframe>
<?php
$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
$uploading_iframe_src = "image-uploading.php?action=view&amp;post=$uploading_iframe_ID";
$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
if ( false != $uploading_iframe_src )
echo '<iframe id="uploading" border="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
?>
<div id="advancedstuff" class="dbx-group" >
<fieldset id="postexcerpt" class="dbx-box">
<h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
<div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="7" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
<div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
</fieldset>
<fieldset class="dbx-box">

View File

@ -1,2 +1,2 @@
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('autosave','en,sv,cs');function TinyMCE_autosave_getInfo(){return{longname:'Auto save',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};};function TinyMCE_autosave_beforeUnloadHandler(){var msg=tinyMCE.getLang("lang_autosave_unload_msg");var anyDirty=false;for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(inst.isDirty())return msg;}return;}window.onbeforeunload=TinyMCE_autosave_beforeUnloadHandler;
tinyMCE.importPluginLanguagePack('autosave','en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');function TinyMCE_autosave_getInfo(){return{longname:'Auto save',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};};function TinyMCE_autosave_beforeUnloadHandler(){var msg=tinyMCE.getLang("lang_autosave_unload_msg");var anyDirty=false;for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.isDirty())return msg;}return;}window.onbeforeunload=TinyMCE_autosave_beforeUnloadHandler;

View File

@ -1,5 +1,5 @@
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs');
tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
function TinyMCE_autosave_getInfo() {
return {
@ -17,6 +17,8 @@ function TinyMCE_autosave_beforeUnloadHandler() {
var anyDirty = false;
for (var n in tinyMCE.instances) {
var inst = tinyMCE.instances[n];
if (!tinyMCE.isInstance(inst))
continue;
if (inst.isDirty())
return msg;

View File

@ -1,11 +0,0 @@
/**
* Czech lang variables
* encoding: utf-8
*
* $Id$
*/
tinyMCE.addToLang('',{
autosave_unload_msg : 'Změny, které jste udělal(a) budou ztraceny, jestliže opustíte tuto stránku.'
});

View File

@ -1,6 +0,0 @@
// SE lang variables
tinyMCE.addToLang('',{
autosave_unload_msg : 'F&ouml;r&auml;ndringarna du gjorde kommer att g&aring; f&ouml;rlorade om du v&auml;ljer att l&auml;mna denna sida.'
});

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
/**
* $RCSfile: editor_plugin_src.js,v $
* $Revision: 1.2 $
* $Date: 2005/08/23 20:28:34 $
* $Revision: 1.3 $
* $Date: 2005/10/18 13:59:43 $
*
* Moxiecode DHTML Windows script.
*
@ -54,8 +54,12 @@ TinyMCE.prototype.openWindow = function(template, args) {
height += 18;
// Replace all args as variables in URL
for (var name in args)
for (var name in args) {
if (typeof(args[name]) == 'function')
continue;
url = tinyMCE.replaceVar(url, name, escape(args[name]));
}
var elm = document.getElementById(this.selectedInstance.editorId + '_parent');
var pos = tinyMCE.getAbsPosition(elm);
@ -79,6 +83,8 @@ TinyMCE.prototype.closeWindow = function(win) {
TinyMCE.prototype.setWindowTitle = function(win_ref, title) {
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win_ref.name == win.id + "_iframe")
window.frames[win.id + "_iframe"].document.getElementById(win.id + '_title').innerHTML = title;
@ -279,9 +285,9 @@ MCWindows.prototype.open = function(url, name, features) {
html += ' <div id="' + id + '_title" class="mceWindowTitle"';
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();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/window_close.gif" /></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
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>';
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>';
@ -524,6 +530,8 @@ MCWindow.prototype.close = function() {
var mcWindowsNew = new Array();
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win.name != this.name)
mcWindowsNew[n] = win;
@ -604,6 +612,8 @@ MCWindow.prototype.onFocus = function(e) {
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (winRef.name == win.id + "_iframe") {
win.focus();

View File

@ -1,7 +1,7 @@
/**
* $RCSfile: mcwindows.js,v $
* $Revision: 1.1 $
* $Date: 2005/08/10 21:21:00 $
* $Revision: 1.2 $
* $Date: 2005/10/18 13:59:43 $
*
* Moxiecode DHTML Windows script.
*
@ -64,6 +64,8 @@ MCWindows.prototype.eventDispatcher = function(e) {
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win.headElement == elm || win.resizeElement == elm) {
win.focus();
@ -408,10 +410,6 @@ MCWindow.prototype.onMouseMove = function(e) {
}
};
function debug(msg) {
document.getElementById('debug').value += msg + "\n";
}
MCWindow.prototype.onMouseUp = function(e) {
mcWindows.action = "none";
};
@ -422,6 +420,8 @@ MCWindow.prototype.onFocus = function(e) {
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (winRef.name == win.id) {
win.focus();

View File

@ -7,9 +7,11 @@ function TinyMCE_wordpress_initInstance(inst) {
}
function TinyMCE_wordpress_getControlHTML(control_name) {
switch (control_name) {
case "wordpress":
return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="More..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><!--<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="...Page..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
switch (control_name) {
case "wordpress":
var titleMore = tinyMCE.getLang('lang_wordpress_more_button');
var titlePage = tinyMCE.getLang('lang_wordpress_page_button');
return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="'+titleMore+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><!--<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="'+titlePage+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
}
return "";
@ -22,6 +24,8 @@ function TinyMCE_wordpress_parseAttributes(attribute_string) {
var withInValue;
var attributes = new Array();
var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
var titleText = tinyMCE.getLang('lang_wordpress_more');
var titleTextPage = tinyMCE.getLang('lang_wordpress_page');
if (attribute_string == null || attribute_string.length < 2)
return null;
@ -72,7 +76,8 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
var template = new Array();
var inst = tinyMCE.getInstanceById(editor_id);
var focusElm = inst.getFocusElement();
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
flag = getAttrib(focusElm, 'class');
@ -86,7 +91,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
+ 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
@ -95,6 +100,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
var template = new Array();
var inst = tinyMCE.getInstanceById(editor_id);
var focusElm = inst.getFocusElement();
var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
@ -109,7 +115,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
+ 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
@ -124,6 +130,8 @@ function TinyMCE_wordpress_cleanup(type, content) {
case "insert_to_editor":
var startPos = 0;
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
var altPage = tinyMCE.getLang('lang_wordpress_page_alt');
// Parse all <!--more--> tags and replace them with images
while ((startPos = content.indexOf('<!--more-->', startPos)) != -1) {
@ -132,7 +140,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
content += 'alt="More..." title="More..." class="mce_plugin_wordpress_more" />';
content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" />';
content += contentAfter;
startPos++;
@ -146,7 +154,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
content += 'alt="...Next Page..." title="...Next Page..." class="mce_plugin_wordpress_page" />';
content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" />';
content += contentAfter;
startPos++;
@ -182,13 +190,6 @@ function TinyMCE_wordpress_cleanup(type, content) {
}
}
// Handle TinyMCE weirdness without messing up the core
//alert("Content before TinyMCE_wordpress_cleanup\n\n'"+content+"'");
// Strip any trailing <br /> and whitespace.
content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
//alert("Content after TinyMCE_wordpress_cleanup\n\n'"+content+"'");
break;
}
@ -215,4 +216,4 @@ function TinyMCE_wordpress_handleNodeChange(editor_id, node, undo_index, undo_le
} while ((node = node.parentNode));
return true;
}
}

View File

@ -7,9 +7,11 @@ function TinyMCE_wordpress_initInstance(inst) {
}
function TinyMCE_wordpress_getControlHTML(control_name) {
switch (control_name) {
case "wordpress":
return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="More..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><!--<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="...Page..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
switch (control_name) {
case "wordpress":
var titleMore = tinyMCE.getLang('lang_wordpress_more_button');
var titlePage = tinyMCE.getLang('lang_wordpress_page_button');
return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="'+titleMore+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><!--<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="'+titlePage+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
}
return "";
@ -22,6 +24,8 @@ function TinyMCE_wordpress_parseAttributes(attribute_string) {
var withInValue;
var attributes = new Array();
var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
var titleText = tinyMCE.getLang('lang_wordpress_more');
var titleTextPage = tinyMCE.getLang('lang_wordpress_page');
if (attribute_string == null || attribute_string.length < 2)
return null;
@ -72,7 +76,8 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
var template = new Array();
var inst = tinyMCE.getInstanceById(editor_id);
var focusElm = inst.getFocusElement();
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
flag = getAttrib(focusElm, 'class');
@ -86,7 +91,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
+ 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
@ -95,6 +100,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
var template = new Array();
var inst = tinyMCE.getInstanceById(editor_id);
var focusElm = inst.getFocusElement();
var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
// Is selection a image
if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
@ -109,7 +115,7 @@ function TinyMCE_wordpress_execCommand(editor_id, element, command, user_interfa
html = ''
+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+ ' width="100%" height="10px" '
+ 'alt="More..." title="More..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
+ 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
tinyMCE.execCommand("mceInsertContent",true,html);
tinyMCE.selectedInstance.repaint();
return true;
@ -124,6 +130,8 @@ function TinyMCE_wordpress_cleanup(type, content) {
case "insert_to_editor":
var startPos = 0;
var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
var altPage = tinyMCE.getLang('lang_wordpress_page_alt');
// Parse all <!--more--> tags and replace them with images
while ((startPos = content.indexOf('<!--more-->', startPos)) != -1) {
@ -132,7 +140,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
content += 'alt="More..." title="More..." class="mce_plugin_wordpress_more" />';
content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" />';
content += contentAfter;
startPos++;
@ -146,7 +154,7 @@ function TinyMCE_wordpress_cleanup(type, content) {
content = content.substring(0, startPos);
content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
content += ' width="100%" height="10px" ';
content += 'alt="...Next Page..." title="...Next Page..." class="mce_plugin_wordpress_page" />';
content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" />';
content += contentAfter;
startPos++;
@ -182,13 +190,6 @@ function TinyMCE_wordpress_cleanup(type, content) {
}
}
// Handle TinyMCE weirdness without messing up the core
//alert("Content before TinyMCE_wordpress_cleanup\n\n'"+content+"'");
// Strip any trailing <br /> and whitespace.
content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
//alert("Content after TinyMCE_wordpress_cleanup\n\n'"+content+"'");
break;
}
@ -215,4 +216,4 @@ function TinyMCE_wordpress_handleNodeChange(editor_id, node, undo_index, undo_le
} while ((node = node.parentNode));
return true;
}
}

View File

@ -1,6 +1,8 @@
// UK lang variables
// EN lang variables
/* Remember to namespace the language parameters lang_<your plugin>_<some name> */
tinyMCELang['lang_template_title'] = 'This is just a template popup';
tinyMCELang['lang_template_desc'] = 'This is just a template button';
tinyMCE.addToLang('',{
wordpress_more_button : 'Split post with More tag',
wordpress_page_button : 'Split post with Page tag',
wordpress_more_alt : 'More...',
wordpress_page_alt : '...page...'
});

View File

@ -6,7 +6,7 @@
<script language="javascript" type="text/javascript" src="jscripts/about.js"></script>
<link href="css/dialog_about.css" rel="stylesheet" type="text/css" />
</head>
<body id="about" onload="init();" style="display: none">
<body id="about" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<div class="tabs">
<ul>
<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_about}</a></span></li>

View File

@ -4,7 +4,7 @@
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/anchor.js"></script>
</head>
<body onload="init();" style="display: none">
<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<form onsubmit="insertAnchor();return false;" action="#">
<table border="0" cellpadding="4" cellspacing="0">

View File

@ -5,7 +5,7 @@
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/charmap.js"></script>
</head>
<body onload="init();" style="display: none">
<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
<table align="center" border="0" cellspacing="0" cellpadding="2">
<tr>
<td colspan="2" class="title">{$lang_theme_charmap_title}</td>

View File

@ -4,7 +4,7 @@
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script>
</head>
<body onload="init();" marginheight="3" topmargin="3" leftmargin="3" marginwidth="3" style="display: none">
<body onload="tinyMCEPopup.executeOnLoad('init();');" marginheight="3" topmargin="3" leftmargin="3" marginwidth="3" style="display: none">
<div align="center">
<script language="javascript" type="text/javascript">renderColorMap();</script>
</div>

View File

@ -2,11 +2,17 @@
/* You can extend this CSS by adding your own CSS file with the the content_css option */
body {
background-color: #fff;
background-color: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
line-height: 130%;
padding: 1em;
font-size: 10px;
scrollbar-3dlight-color: #F0F0EE;
scrollbar-arrow-color: #676662;
scrollbar-base-color: #F0F0EE;
scrollbar-darkshadow-color: #DDDDDD;
scrollbar-face-color: #E0E0DD;
scrollbar-highlight-color: #F0F0EE;
scrollbar-shadow-color: #F0F0EE;
scrollbar-track-color: #F5F5F5;
}
td {

View File

@ -1,6 +1,11 @@
/* This file contains the CSS data for the editor UI of TinyMCE instances */
.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected {
.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {
border: 0px; margin: 0px; padding: 0px; background: transparent;
}
.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceSeparatorLine, .mceButtonDisabled, .mceButtonSelected {
border: 0px; margin: 0px; padding: 0px; background: transparent;
margin-top: 1px;
margin-left: 1px;
}
@ -77,7 +82,7 @@
}
.mceLabel, .mceLabelDisabled {
font-family: "MS Sans Serif";
font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
font-size: 9pt;
}
@ -98,7 +103,7 @@
}
.mceEditorArea {
font-family: "MS Sans Serif";
font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
background: #FFFFFF;
padding: 0px;
margin: 0px;
@ -106,6 +111,8 @@
.mceToolbarTop, .mceToolbarBottom {
background: #F0F0EE;
line-height: 1px;
font-size: 1px;
}
.mceToolbarTop {
@ -121,7 +128,7 @@
}
.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {
font-family: "MS Sans Serif";
font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
font-size: 9pt;
padding: 2px;
line-height: 16px;
@ -142,7 +149,7 @@
.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {
text-decoration: none;
font-family: "MS Sans Serif";
font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
font-size: 9pt;
color: #000000;
}

File diff suppressed because one or more lines are too long

View File

@ -68,13 +68,15 @@ function TinyMCE_advanced_getControlHTML(button_name)
{
if (buttonTileMap[x] == but[1])
{
return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ')" onmousedown="return false;"><img id="{$editor_id}_' + but[0] +'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$themeurl}/images/buttons.gif); background-position: ' + (0-(x*20)) + 'px 0px" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\',' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ',\'' + but[5] + '\'' : '') + ')';
return '<a href="javascript:' + cmd + '" onclick="' + cmd + ';return false;" onmousedown="return false;" target="_self"><img id="{$editor_id}_' + but[0] +'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$themeurl}/images/buttons.gif); background-position: ' + (0-(x*20)) + 'px 0px" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
}
}
}
// Old style
return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ')" onmousedown="return false;"><img id="{$editor_id}_' + but[0] + '" src="{$themeurl}/images/' + but[1] + '" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\',' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ',\'' + but[5] + '\'' : '') + ')';
return '<a href="javascript:' + cmd + '" onclick="' + cmd + ';return false;" onmousedown="return false;" target="_self"><img id="{$editor_id}_' + but[0] + '" src="{$themeurl}/images/' + but[1] + '" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
}
}
@ -212,6 +214,7 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac
template['file'] = 'color_picker.htm';
template['width'] = 220;
template['height'] = 190;
template['close_previous'] = "no";
template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0);
template['height'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height', 0);
@ -244,9 +247,9 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac
var template = new Array();
template['file'] = 'charmap.htm';
template['width'] = 550;
template['width'] = 550 + (tinyMCE.isOpera ? 40 : 0);
template['height'] = 250;
template['width'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_width', 0);
template['height'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_height', 0);
@ -259,7 +262,7 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac
template['file'] = 'anchor.htm';
template['width'] = 320;
template['height'] = 90;
template['height'] = 90 + (tinyMCE.isNS7 ? 30 : 0);
template['width'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_width', 0);
template['height'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_height', 0);
@ -328,12 +331,10 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
// Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY!
var styleSelectHTML = '<option value="">{$lang_theme_style_select}</option>';
if (settings['theme_advanced_styles'])
{
if (settings['theme_advanced_styles']) {
var stylesAr = settings['theme_advanced_styles'].split(';');
for (var i=0; i<stylesAr.length; i++)
{
for (var i=0; i<stylesAr.length; i++) {
var key, value;
key = stylesAr[i].split('=')[0];
@ -345,8 +346,7 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
TinyMCE_advanced_autoImportCSSClasses = false;
}
switch(layoutManager)
{
switch(layoutManager) {
case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)...
var toolbarHTML = "";
var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom");
@ -359,11 +359,14 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
theme_advanced_buttons3 : "hr,removeformat,visualaid,separator,sub,sup,separator,charmap"
};
// Add accessibility control
toolbarHTML += '<a href="#" accesskey="q" title="' + tinyMCE.getLang("lang_toolbar_focus") + '"></a>';
// Render rows
for (var i=1; i<100; i++) {
var def = defVals["theme_advanced_buttons" + i];
buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ',');
var buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ',');
if (buttons.length == 0)
break;
@ -380,6 +383,9 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
}
}
// Add accessibility control
toolbarHTML += '<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"></a>';
// Setup template html
template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';
@ -435,7 +441,7 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId)
deltaHeight -= 23;
}
template['html'] += '</table>';
template['html'] += '</tbody></table>';
//"SimpleLayout"
break;
@ -585,10 +591,12 @@ function TinyMCE_advanced_setResizing(e, editor_id, state) {
function TinyMCE_advanced_initInstance(inst) {
if (tinyMCE.getParam("theme_advanced_resizing", false)) {
var w = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_width");
var h = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_height");
if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
var w = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_width");
var h = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_height");
TinyMCE_advanced_resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true));
TinyMCE_advanced_resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true));
}
}
}
@ -707,12 +715,14 @@ function TinyMCE_advanced_resizeEventHandler(e) {
TinyMCE_advanced_resizeTo(tinyMCE.getInstanceById(editorId), resizer.width + dx, resizer.height + dy, resizer.horizontal);
// Expire in a month
var expires = new Date();
expires.setTime(expires.getTime() + 3600000 * 24 * 30);
if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
var expires = new Date();
expires.setTime(expires.getTime() + 3600000 * 24 * 30);
// Set the cookies
TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires);
TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires);
// Set the cookies
TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires);
TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires);
}
break;
}
}
@ -756,17 +766,20 @@ function TinyMCE_advanced_getInsertImageTemplate()
/**
* Node change handler.
*/
function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
undo_levels, visual_aid, any_selection)
{
function selectByValue(select_elm, value)
{
if (select_elm)
{
for (var i=0; i<select_elm.options.length; i++)
{
if (select_elm.options[i].value == value)
{
function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) {
function selectByValue(select_elm, value, first_index) {
first_index = typeof(first_index) == "undefined" ? false : true;
if (select_elm) {
for (var i=0; i<select_elm.options.length; i++) {
var ov = "" + select_elm.options[i].value;
if (first_index && ov.toLowerCase().indexOf(value.toLowerCase()) == 0) {
select_elm.selectedIndex = i;
return true;
}
if (ov == value) {
select_elm.selectedIndex = i;
return true;
}
@ -776,8 +789,7 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
return false;
};
function getAttrib(elm, name)
{
function getAttrib(elm, name) {
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
};
@ -789,23 +801,21 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
// Update path
var pathElm = document.getElementById(editor_id + "_path");
if (pathElm)
{
var inst = tinyMCE.getInstanceById(editor_id);
var doc = inst.getDoc();
if (pathElm) {
// Get node path
var parentNode = node;
var path = new Array();
while (parentNode)
{
if (parentNode.nodeName.toLowerCase() == "body")
{
while (parentNode != null) {
if (parentNode.nodeName.toUpperCase() == "BODY") {
break;
}
// Only append element nodes to path
if (parentNode.nodeType == 1)
{
if (parentNode.nodeType == 1) {
path[path.length] = parentNode;
}
@ -814,23 +824,48 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
// Setup HTML
var html = "";
for (var i=path.length-1; i>=0; i--)
{
for (var i=path.length-1; i>=0; i--) {
var nodeName = path[i].nodeName.toLowerCase();
var nodeData = "";
if (nodeName == "b")
{
if (nodeName == "b") {
nodeName = "strong";
}
if (nodeName == "i")
{
if (nodeName == "i") {
nodeName = "em";
}
if (getAttrib(path[i], 'id') != "")
{
if (nodeName == "span") {
var cn = tinyMCE.getAttrib(path[i], "class");
if (cn != "" && cn.indexOf('mceItem') == -1)
nodeData += "class: " + cn + " ";
var st = tinyMCE.getAttrib(path[i], "style");
if (st != "") {
st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st));
nodeData += "style: " + st + " ";
}
}
if (nodeName == "font") {
if (tinyMCE.getParam("convert_fonts_to_spans"))
nodeName = "span";
var face = tinyMCE.getAttrib(path[i], "face");
if (face != "")
nodeData += "font: " + face + " ";
var size = tinyMCE.getAttrib(path[i], "size");
if (size != "")
nodeData += "size: " + size + " ";
var color = tinyMCE.getAttrib(path[i], "color");
if (color != "")
nodeData += "color: " + color + " ";
}
if (getAttrib(path[i], 'id') != "") {
nodeData += "id: " + path[i].getAttribute('id') + " ";
}
@ -838,52 +873,41 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
if (className != "" && className.indexOf('mceItem') == -1)
nodeData += "class: " + className + " ";
if (getAttrib(path[i], 'src') != "")
{
if (getAttrib(path[i], 'src') != "") {
nodeData += "src: " + path[i].getAttribute('src') + " ";
}
if (getAttrib(path[i], 'href') != "")
{
if (getAttrib(path[i], 'href') != "") {
nodeData += "href: " + path[i].getAttribute('href') + " ";
}
if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1)
{
if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1) {
nodeName = "flash";
nodeData = "";
nodeData = "src: " + path[i].getAttribute('title');
}
if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "")
{
if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
nodeName = "a";
nodeName += "#" + anchor;
nodeData = "";
}
if (getAttrib(path[i], 'name').indexOf("mce_") != 0)
{
if (getAttrib(path[i], 'name').indexOf("mce_") != 0) {
var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
if (className != "" && className.indexOf('mceItem') == -1)
if (className != "" && className.indexOf('mceItem') == -1) {
nodeName += "." + className;
}
}
if (tinyMCE.isMSIE)
{
html += '<a title="' + nodeData + '" href="javascript:void(0);" onmousedown="tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');return false;" class="mcePathItem">' + nodeName + '</a>';
}
else
{
html += '<a title="' + nodeData + '" href="javascript:tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');" class="mcePathItem">' + nodeName + '</a>';
}
var cmd = 'tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');';
html += '<a title="' + nodeData + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" target="_self" class="mcePathItem">' + nodeName + '</a>';
if (i > 0)
{
if (i > 0) {
html += " &raquo; ";
}
}
pathElm.innerHTML = tinyMCE.getLang('lang_theme_path') + ": " + html + '&nbsp;';
pathElm.innerHTML = '<a href="#" accesskey="x"></a>' + tinyMCE.getLang('lang_theme_path') + ": " + html + '&nbsp;';
}
// Reset old states
@ -970,7 +994,7 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
}
}
}
} while (!breakOut && classNode != null && (classNode = classNode.parentNode));
} while (!breakOut && classNode != null && (classNode = classNode.parentNode) != null);
selectElm.selectedIndex = index;
}
@ -995,57 +1019,68 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
// Select fontselect
var selectElm = document.getElementById(editor_id + "_fontNameSelect");
if (selectElm) {
var elm = tinyMCE.getParentElement(node);
if (!tinyMCE.isSafari && !(tinyMCE.isMSIE && !tinyMCE.isOpera)) {
var face = doc.queryCommandValue('FontName');
if (elm) {
var family = tinyMCE.getAttrib(elm, "face");
if (family == '')
family = '' + elm.style.fontFamily;
face = face == null || face == "" ? "" : face;
if (!selectByValue(selectElm, family))
selectByValue(selectElm, face, face != "");
} else {
var elm = tinyMCE.getParentElement(node, "font", "face");
if (elm) {
var family = tinyMCE.getAttrib(elm, "face");
if (family == '')
family = '' + elm.style.fontFamily;
if (!selectByValue(selectElm, family, family != ""))
selectByValue(selectElm, "");
} else
selectByValue(selectElm, "");
} else
selectByValue(selectElm, "");
}
}
// Select fontsize
var selectElm = document.getElementById(editor_id + "_fontSizeSelect");
if (selectElm) {
var elm = tinyMCE.getParentElement(node);
if (!tinyMCE.isSafari && !tinyMCE.isOpera) {
var size = doc.queryCommandValue('FontSize');
selectByValue(selectElm, size == null || size == "" ? "0" : size);
} else {
var elm = tinyMCE.getParentElement(node, "font", "size");
if (elm) {
var size = tinyMCE.getAttrib(elm, "size");
if (elm) {
var size = tinyMCE.getAttrib(elm, "size");
if (size == '') {
var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px');
if (size == '') {
var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px');
size = '' + elm.style.fontSize;
size = '' + elm.style.fontSize;
for (var i=0; i<sizes.length; i++) {
if (('' + sizes[i]) == size) {
size = i;
break;
for (var i=0; i<sizes.length; i++) {
if (('' + sizes[i]) == size) {
size = i;
break;
}
}
}
}
if (!selectByValue(selectElm, size))
selectByValue(selectElm, "");
} else
selectByValue(selectElm, "0");
if (!selectByValue(selectElm, size))
selectByValue(selectElm, "");
} else
selectByValue(selectElm, "0");
}
}
// Handle align attributes
alignNode = node;
breakOut = false;
do
{
if (!alignNode.getAttribute || !alignNode.getAttribute('align'))
{
do {
if (!alignNode.getAttribute || !alignNode.getAttribute('align')) {
continue;
}
switch (alignNode.getAttribute('align').toLowerCase())
{
switch (alignNode.getAttribute('align').toLowerCase()) {
case "left":
tinyMCE.switchClassSticky(editor_id + '_justifyleft', 'mceButtonSelected');
breakOut = true;
@ -1067,7 +1102,7 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
breakOut = true;
break;
}
} while (!breakOut && (alignNode = alignNode.parentNode));
} while (!breakOut && (alignNode = alignNode.parentNode) != null);
// Div justification
var div = tinyMCE.getParentElement(node, "div");
@ -1075,110 +1110,79 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
tinyMCE.switchClassSticky(editor_id + '_justifycenter', 'mceButtonSelected');
// Do special text
if (tinyMCE.isGecko && node.nodeType == 3)
{
var inst = tinyMCE.getInstanceById(editor_id);
var doc = inst.getDoc();
if (doc.queryCommandState("Bold"))
{
tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
if (!setup_content) {
// , "JustifyLeft", "_justifyleft", "JustifyCenter", "justifycenter", "JustifyRight", "justifyright", "JustifyFull", "justifyfull", "InsertUnorderedList", "bullist", "InsertOrderedList", "numlist", "InsertUnorderedList", "bullist", "Outdent", "outdent", "Indent", "indent", "subscript", "sub"
var ar = new Array("Bold", "_bold", "Italic", "_italic", "Strikethrough", "_strikethrough", "superscript", "_sup", "subscript", "_sub");
for (var i=0; i<ar.length; i+=2) {
if (doc.queryCommandState(ar[i]))
tinyMCE.switchClassSticky(editor_id + ar[i+1], 'mceButtonSelected');
}
if (doc.queryCommandState("Italic"))
{
tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
}
if (doc.queryCommandState("Underline") &&
(node.parentNode == null || node.parentNode.nodeName != "A"))
{
if (doc.queryCommandState("Underline") && (node.parentNode == null || node.parentNode.nodeName != "A")) {
tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
}
if (doc.queryCommandState("Strikethrough"))
{
tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
}
}
// Handle elements
do
{
switch (node.nodeName.toLowerCase())
{
case "b":
case "strong":
do {
switch (node.nodeName) {
/* case "B":
case "STRONG":
tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
break;
case "i":
case "em":
case "I":
case "EM":
tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
break;
case "u":
case "U":
tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
break;
case "strike":
case "STRIKE":
tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
break;
break;*/
case "ul":
case "UL":
tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonSelected');
break;
case "ol":
case "OL":
tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonSelected');
break;
case "sub":
tinyMCE.switchClassSticky(editor_id + '_sub', 'mceButtonSelected');
break;
case "sup":
tinyMCE.switchClassSticky(editor_id + '_sup', 'mceButtonSelected');
break;
case "hr":
case "HR":
tinyMCE.switchClassSticky(editor_id + '_hr', 'mceButtonSelected');
break;
case "img":
if (getAttrib(node, 'name').indexOf('mce_') != 0)
{
case "IMG":
if (getAttrib(node, 'name').indexOf('mce_') != 0) {
tinyMCE.switchClassSticky(editor_id + '_image', 'mceButtonSelected');
}
break;
}
} while ((node = node.parentNode));
} while ((node = node.parentNode) != null);
};
// This function auto imports CSS classes into the class selection droplist
function TinyMCE_advanced_setupCSSClasses(editor_id)
{
if (!TinyMCE_advanced_autoImportCSSClasses)
{
function TinyMCE_advanced_setupCSSClasses(editor_id) {
if (!TinyMCE_advanced_autoImportCSSClasses) {
return;
}
var selectElm = document.getElementById(editor_id + '_styleSelect');
if (selectElm && selectElm.getAttribute('cssImported') != 'true')
{
if (selectElm && selectElm.getAttribute('cssImported') != 'true') {
var csses = tinyMCE.getCSSClasses(editor_id);
if (csses && selectElm)
{
for (var i=0; i<csses.length; i++)
{
if (csses && selectElm) {
for (var i=0; i<csses.length; i++) {
selectElm.options[selectElm.length] = new Option(csses[i], csses[i]);
}
}
// Only do this once
if (csses != null && csses.length > 0)
{
if (csses != null && csses.length > 0) {
selectElm.setAttribute('cssImported', 'true');
}
}

View File

@ -5,7 +5,7 @@
<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
</head>
<body onload="init();" style="display: none">
<body onload="tinyMCEPopup.executeOnLoad('init();');document.getElementById('src').focus();" style="display: none">
<form onsubmit="insertImage();return false;">
<table border="0" cellpadding="0" cellspacing="0" width="200">
<tr>
@ -18,7 +18,7 @@
<td><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="src" type="text" id="src" value="" style="width: 200px" onchange="getImageData();"></td>
<td><script language="javascript" type="text/javascript">renderBrowser('srcbrowser','src','image','theme_advanced_image');</script></td>
<td id="srcbrowsercontainer">&nbsp;</td>
</tr>
</table></td>
</tr>
@ -78,7 +78,7 @@
<td><input name="hspace" type="text" id="hspace" value="" size="3" maxlength="3"></td>
</tr>
<tr>
<td nowrap="nowrap"><input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();">
<td nowrap="nowrap"><input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();">
</td>
<td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();"></td>
</tr>

View File

@ -26,12 +26,12 @@ function init() {
html += '<tr>';
if (info.infourl != null && info.infourl != '')
html += '<td width="50%" title="' + plugins[i] + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>';
html += '<td width="50%" title="' + plugins[i] + '"><a href="' + info.infourl + '" target="mceplugin">' + info.longname + '</a></td>';
else
html += '<td width="50%" title="' + plugins[i] + '">' + info.longname + '</td>';
if (info.authorurl != null && info.authorurl != '')
html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>';
html += '<td width="35%"><a href="' + info.authorurl + '" target="mceplugin">' + info.author + '</a></td>';
else
html += '<td width="35%">' + info.author + '</td>';

View File

@ -282,10 +282,9 @@ function renderCharMapHTML() {
+ ' onmouseover="tinyMCE.switchClass(this,\'charmapOver\');'
+ 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');"'
+ ' onmouseout="tinyMCE.restoreClass(this,\'charmapOver\');"'
+ ' onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');return false;"'
+ ' title="' + charmap[i][3] + '" nowrap="nowrap">'
+ ' nowrap="nowrap" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');"><a style="text-decoration: none;" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
+ charmap[i][1]
+ '</td>';
+ '</a></td>';
if ((cols+1) % charsPerRow == 0)
html += '</tr><tr height="' + tdHeight + '">';
}

View File

@ -1,7 +1,7 @@
var url = tinyMCE.getParam("external_image_list_url");
if (url != null) {
// Fix relative
if (url.charAt(0) != '/')
if (url.charAt(0) != '/' && url.indexOf('://') == -1)
url = tinyMCE.documentBasePath + "/" + url;
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
@ -26,6 +26,8 @@ function insertImage() {
function init() {
tinyMCEPopup.resizeToInnerSize();
document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
var formObj = document.forms[0];
for (var i=0; i<document.forms[0].align.options.length; i++) {

View File

@ -1,7 +1,7 @@
var url = tinyMCE.getParam("external_link_list_url");
if (url != null) {
// Fix relative
if (url.charAt(0) != '/')
if (url.charAt(0) != '/' && url.indexOf('://') == -1)
url = tinyMCE.documentBasePath + "/" + url;
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
@ -10,6 +10,8 @@ if (url != null) {
function init() {
tinyMCEPopup.resizeToInnerSize();
document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link');
var formObj = document.forms[0];
for (var i=0; i<document.forms[0].target.options.length; i++) {
@ -49,6 +51,13 @@ function insertLink() {
var style_class = document.forms[0].styleSelect.value;
var dummy;
// Make anchors absolute
if (href.charAt(0) == '#')
href = tinyMCE.settings['document_base_url'] + href;
if (target == '_self')
target = '';
window.opener.tinyMCE.insertLink(href, target, title, dummy, style_class);
tinyMCEPopup.close();
}

View File

@ -39,13 +39,12 @@ function resizeInputs() {
wHeight = self.innerHeight-80;
wWidth = self.innerWidth-16;
} else {
wHeight = document.body.clientHeight-80;
wWidth = document.body.clientWidth-16;
wHeight = document.body.clientHeight - 80;
wWidth = document.body.clientWidth - 16;
}
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
}
function renderWordWrap() {

View File

@ -71,5 +71,6 @@ version : 'Version',
loaded_plugins : 'Loaded plugins',
help : 'Help',
not_set : '-- Not set --',
close : 'Close'
close : 'Close',
toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X'
});

View File

@ -5,7 +5,7 @@
<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/link.js"></script>
</head>
<body onload="init();" style="display: none">
<body onload="tinyMCEPopup.executeOnLoad('init();');document.getElementById('href').focus();" style="display: none">
<form onsubmit="insertLink();return false;">
<table border="0" cellpadding="0" cellspacing="0" width="100">
<tr>
@ -18,7 +18,7 @@
<td> <table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input name="href" type="text" id="href" value="" style="width: 200px"></td>
<td><script language="javascript" type="text/javascript">renderBrowser('hrefbrowser','href','file','theme_advanced_link');</script></td>
<td id="hrefbrowsercontainer">&nbsp;</td>
</tr>
</table></td>
</tr>
@ -79,7 +79,7 @@
<td align="right">&nbsp;</td>
</tr>
<tr>
<td><input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();">
<td><input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();">
</td>
<td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();"></td>
</tr>

View File

@ -1,11 +1,11 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{$lang_theme_code_title}</title>
<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
<script language="javascript" type="text/javascript" src="jscripts/source_editor.js"></script>
</head>
<body onload="onLoadInit();" onresize="resizeInputs();" style="display: none">
<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');document.getElementById('htmlSource').focus();" onresize="resizeInputs();" style="display: none">
<form name="source" onsubmit="saveContent();" action="#">
<div style="float: left" class="title">{$lang_theme_code_title}</div>

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,12 @@
<?php
/**
* $RCSfile: tiny_mce_gzip.php,v $
* $Revision: 1.1 $
* $Date: 2005/06/14 18:55:34 $
* $Revision: $
* $Date: $
*
* @version 1.02
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
* @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
*
* This file compresses the TinyMCE JavaScript using GZip and
* enables the browser to do two requests instead of one for each .js file.
@ -15,6 +16,29 @@
* - Add local file cache for the GZip:ed version.
*/
@ include('../../../wp-config.php');
function wp_translate_tinymce_lang($text) {
if ( ! function_exists('__') ) {
return $text;
} else {
header('Content-Type: text/plain');
$search1 = "/^tinyMCELang\\[(['\"])(.*)\\1\]( ?= ?)(['\"])(.*)\\4/uem";
$replace1 = "'tinyMCELang[\\1\\2\\1]\\3'.stripslashes('\\4').__('\\5').stripslashes('\\4')";
$search2 = "/ : (['\"])(.*)\\1/uem";
$replace2 = "' : '.stripslashes('\\1').__('\\2').stripslashes('\\1')";
$search = array($search1, $search2);
$replace = array($replace1, $replace2);
$text = preg_replace($search, $replace, $text);
return $text;
}
}
// General options
$suffix = ""; // Set to "_src" to use source version
$expiresOffset = 3600 * 24 * 10; // 10 days util client cache expires
@ -23,44 +47,66 @@
$theme = isset($_REQUEST['theme']) ? $_REQUEST['theme'] : "";
$language = isset($_REQUEST['language']) ? $_REQUEST['language'] : "";
$plugins = isset($_REQUEST['plugins']) ? $_REQUEST['plugins'] : "";
$lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : "en";
$index = isset($_REQUEST['index']) ? $_REQUEST['index'] : -1;
// GZip compress and cache it for 10 days
ob_start ("ob_gzhandler");
// Only gzip the contents if clients and server support it
$encodings = explode(',', strtolower($_SERVER['HTTP_ACCEPT_ENCODING']));
if (in_array('gzip', $encodings) && function_exists('ob_gzhandler'))
ob_start("ob_gzhandler");
// Output rest of headers
header("Content-type: text/javascript; charset: UTF-8");
header("Cache-Control: must-revalidate");
// header("Cache-Control: must-revalidate");
header("Vary: Accept-Encoding"); // Handle proxies
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
if ($theme) {
if ($index > -1) {
// Write main script and patch some things
echo file_get_contents(realpath("tiny_mce" . $suffix . ".js"));
echo 'TinyMCE.prototype.loadScript = function() {};';
echo "tinyMCE.init(TinyMCECompressed_settings);";
if ($index == 0) {
echo file_get_contents(realpath("tiny_mce" . $suffix . ".js"));
echo "\n\n";
echo "TinyMCE.prototype.loadScript = function() {};\n";
}
// WP
$lang = $language = 'en';
echo "\n/* WP Cancels all TinyMCE language handling */\n";
echo "TinyMCE.prototype.importThemeLanguagePack = function() {};\n";
echo "TinyMCE.prototype.importPluginLanguagePack = function() {};\n\n";
// Do init based on index
// WP echo "tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);\n\n";
// Load theme, language pack and theme language packs
echo file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"));
echo file_get_contents(realpath("themes/" . $theme . "/langs/" . $language . ".js"));
echo file_get_contents(realpath("langs/" . $language . ".js"));
if ($theme) {
echo file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"));
echo wp_translate_tinymce_lang(file_get_contents(realpath("themes/" . $theme . "/langs/" . $lang . ".js")));
}
if ($language)
echo wp_translate_tinymce_lang(file_get_contents(realpath("langs/" . $language . ".js")));
// Load all plugins and their language packs
$plugins = explode(",", $plugins);
foreach ($plugins as $plugin) {
$pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
$languageFile = realpath("plugins/" . $plugin . "/langs/" . $language . ".js");
$languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js");
if ($pluginFile)
echo file_get_contents($pluginFile);
if ($languageFile)
echo file_get_contents($languageFile);
echo wp_translate_tinymce_lang(file_get_contents($languageFile));
}
die;
}
?>
var TinyMCECompressed_settings = null;
function TinyMCECompressed() {
this.configs = new Array();
this.loadedFiles = new Array();
}
TinyMCECompressed.prototype.init = function(settings) {
@ -78,11 +124,43 @@ TinyMCECompressed.prototype.init = function(settings) {
settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : "";
settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
this.configs[this.configs.length] = settings;
this.settings = settings;
scriptURL += "?theme=" + escape(settings["theme"]) + "&language=" + escape(settings["language"]) + "&plugins=" + escape(settings["plugins"]);
scriptURL += "?theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
}
TinyMCECompressed_settings = settings;
TinyMCECompressed.prototype.getOnce = function(str) {
var ar = str.split(',');
for (var i=0; i<ar.length; i++) {
if (ar[i] == '')
continue;
// Skip load
for (var x=0; x<this.loadedFiles.length; x++) {
if (this.loadedFiles[x] == ar[i])
ar[i] = null;
}
this.loadedFiles[this.loadedFiles.length] = ar[i];
}
// Glue
str = "";
for (var i=0; i<ar.length; i++) {
if (ar[i] == null)
continue;
str += ar[i];
if (i != ar.length-1)
str += ",";
}
return str;
}
var tinyMCE = new TinyMCECompressed();
var tinyMCECompressed = tinyMCE;

View File

@ -1,7 +1,7 @@
/**
* $RCSfile: tiny_mce_popup.js,v $
* $Revision: 1.14 $
* $Date: 2005/08/23 17:01:39 $
* $Revision: 1.18 $
* $Date: 2005/10/29 19:13:20 $
*
* @author Moxiecode
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
@ -20,6 +20,7 @@ TinyMCEPopup.prototype.init = function() {
window.opener = win;
this.windowOpener = win;
this.onLoadEval = "";
// Setup parent references
tinyMCE = win.tinyMCE;
@ -33,6 +34,9 @@ TinyMCEPopup.prototype.init = function() {
this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
this.storeSelection = tinyMCE.isMSIE && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
if (this.isWindow)
window.focus();
// Store selection
if (this.storeSelection)
tinyMCE.selectedInstance.execCommand('mceStoreSelection');
@ -62,6 +66,13 @@ TinyMCEPopup.prototype.init = function() {
TinyMCEPopup.prototype.onLoad = function() {
var body = document.body;
body.onkeydown = function (e) {
e = e ? e : window.event;
if ( e.keyCode == 27 && !e.shiftKey && !e.controlKey && !e.altKey ) {
tinyMCEPopup.close();
}
}
if (tinyMCE.getWindowArg('mce_replacevariables', true))
body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
@ -76,9 +87,27 @@ TinyMCEPopup.prototype.onLoad = function() {
if (body.style.display == 'none')
body.style.display = 'block';
// Execute real onload (Opera fix)
if (tinyMCEPopup.onLoadEval != "") {
eval(tinyMCEPopup.onLoadEval);
}
};
TinyMCEPopup.prototype.executeOnLoad = function(str) {
if (tinyMCE.isOpera)
this.onLoadEval = str;
else
eval(str);
};
TinyMCEPopup.prototype.resizeToInnerSize = function() {
// Netscape 7.1 workaround
if (this.isWindow && tinyMCE.isNS71) {
window.resizeBy(0, 10);
return;
}
if (this.isWindow) {
var doc = document;
var body = doc.body;
@ -114,7 +143,7 @@ TinyMCEPopup.prototype.resizeToInnerSize = function() {
// Create iframe
iframe = document.createElement("iframe");
iframe.id = "mcWinIframe";
iframe.src = "about:blank";
iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document'];
iframe.width = "100%";
iframe.height = "100%";
iframe.style.margin = '0px';

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/**
* $RCSfile: form_utils.js,v $
* $Revision: 1.3 $
* $Date: 2005/08/23 17:01:40 $
* $Revision: 1.5 $
* $Date: 2005/10/25 16:01:51 $
*
* Various form utilitiy functions.
*
@ -9,10 +9,10 @@
* @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
*/
function renderColorPicker(id, target_form_element) {
function getColorPickerHTML(id, target_form_element) {
var html = "";
html += '<a id="' + id + '_link" href="javascript:tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;">';
html += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
html += '<img id="' + id + '" src="../../themes/advanced/images/color.gif"';
html += ' onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');"';
html += ' onmouseout="tinyMCE.restoreClass(this);"';
@ -20,7 +20,12 @@ function renderColorPicker(id, target_form_element) {
html += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
document.write(html);
return html;
}
function pickColor(e, target_form_element) {
if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
tinyMCEPopup.pickColor(e, target_form_element);
}
function updateColor(img_id, form_element_id) {
@ -43,11 +48,11 @@ function setBrowserDisabled(id, state) {
}
}
function renderBrowser(id, target_form_element, type, prefix) {
function getBrowserHTML(id, target_form_element, type, prefix) {
var option = prefix + "_" + type + "_browser_callback";
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
if (cb == null)
return;
return "";
var html = "";
@ -59,7 +64,7 @@ function renderBrowser(id, target_form_element, type, prefix) {
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
document.write(html);
return html;
}
function openBrower(img_id, target_form_element, type, option) {
@ -136,3 +141,63 @@ function isVisible(element_id) {
return elm && elm.style.display != "none";
}
function convertRGBToHex(col) {
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
var rgb = col.replace(re, "$1,$2,$3").split(',');
if (rgb.length == 3) {
r = parseInt(rgb[0]).toString(16);
g = parseInt(rgb[1]).toString(16);
b = parseInt(rgb[2]).toString(16);
r = r.length == 1 ? '0' + r : r;
g = g.length == 1 ? '0' + g : g;
b = b.length == 1 ? '0' + b : b;
return "#" + r + g + b;
}
return col;
}
function convertHexToRGB(col) {
if (col.indexOf('#') != -1) {
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
r = parseInt(col.substring(0, 2), 16);
g = parseInt(col.substring(2, 4), 16);
b = parseInt(col.substring(4, 6), 16);
return "rgb(" + r + "," + g + "," + b + ")";
}
return col;
}
function trimSize(size) {
return size.replace(new RegExp('[^0-9%]', 'gi'), '');
}
function getCSSSize(size) {
size = trimSize(size);
if (size == "")
return "";
return size.indexOf('%') != -1 ? size : size + "px";
}
function getStyle(elm, attrib, style) {
var val = tinyMCE.getAttrib(elm, attrib);
if (val != '')
return '' + val;
if (typeof(style) == 'undefined')
style = attrib;
val = eval('elm.style.' + style);
return val == null ? '' : '' + val;
}