TinyMCE updates from azaozz. fixes #6340

git-svn-id: https://develop.svn.wordpress.org/trunk@7464 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-03-21 22:13:03 +00:00
parent 333cc6c1c8
commit 8c0ae81b06
13 changed files with 82 additions and 50 deletions

View File

@ -24,38 +24,44 @@ switchEditors = {
},
pre_wpautop : function(content) {
// We have a TON of cleanup to do.
// We have a TON of cleanup to do. Line breaks are already stripped.
// Pretty it up for the source editor
var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|pre|p';
content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
// Mark </p> if it has any attributes.
content = content.replace(new RegExp('(<p[^>]+>.*?)</p>', 'mg'), '$1</p#>');
//content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '</p>\n\n');
//content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '<br />\n');
//content = content.replace(new RegExp('( )+', 'g'), ' ');
content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');
content = content.replace(new RegExp('</p>\\s*</div>', 'mgi'), '\n</div>');
// Get it ready for wpautop.
content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'g'), '<div$1>\n\n');
content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
content = content.replace(new RegExp('\\s*<p>', 'mgi'), '');
content = content.replace(new RegExp('\\s*</p>\\s*', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\n\\s*\\n', 'mgi'), '\n\n');
content = content.replace(new RegExp('\\s*<br ?/?>\\s*', 'gi'), '\n');
// Fix some block element newline issues
var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre';
content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
content = content.replace(new RegExp('\\s*</('+blocklist+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
content = content.replace(new RegExp('<li>', 'g'), '\t<li>');
if ( content.indexOf('<object') != -1 ) {
content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'g'), "<param$1>"); // no pee inside object/embed
content = content.replace(new RegExp('\\s*</embed>\\s*', 'g'), '</embed>');
content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
}
// Unmark special paragraph closing tags
content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
content = content.replace(new RegExp('\\s*(<p[^>]+>.*</p>)', 'mg'), '\n$1');
// Trim trailing whitespace
// Trim whitespace
content = content.replace(new RegExp('^\\s*', ''), '');
content = content.replace(new RegExp('\\s*$', ''), '');
// Hope.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -812,11 +812,11 @@
<div class="mceActionPanel">
<div style="float: left">
<input type="submit" id="insert" name="insert" value="{#insert}" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
<div style="float: right">
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
<input type="submit" id="insert" name="insert" value="{#insert}" />
</div>
</div>
</form>

File diff suppressed because one or more lines are too long

View File

@ -102,10 +102,6 @@
// Add listeners to handle more break
t._handleMoreBreak(ed, url);
ed.onPostProcess.add(function(se, o) {
o.content = o.content.replace(/\r?\n/g, ' ');
});
// Add custom shortcuts
ed.addShortcut('alt+shift+c', ed.getLang('justifycenter_desc'), 'JustifyCenter');
ed.addShortcut('alt+shift+r', ed.getLang('justifyright_desc'), 'JustifyRight');

View File

@ -21,7 +21,7 @@
<p>Version: <span id="version"></span> (<span id="date"></span>)</p>
<p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a>
by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>
<p>Copyright &copy; 2003-2007, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
<p>Copyright &copy; 2003-2008, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
<p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p>
<div id="buttoncontainer">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -143,7 +143,7 @@ $mce_buttons_4 = implode($mce_buttons_4, ',');
$initArray = array (
'mode' => 'none',
'onpageload' => 'wpEditorInit',
'width' => '100%',
'width' => '100%',
'theme' => 'advanced',
'skin' => 'wp_theme',
'theme_advanced_buttons1' => "$mce_buttons",
@ -160,6 +160,8 @@ $initArray = array (
'dialog_type' => 'modal',
'relative_urls' => false,
'remove_script_host' => false,
'apply_source_formatting' => false,
'remove_linebreaks' => true,
'gecko_spellcheck' => true,
'entities' => '38,amp,60,lt,62,gt',
'accessibility_focus' => false,
@ -184,9 +186,13 @@ $initArray = apply_filters('tiny_mce_before_init', $initArray); // changed from
// support for deprecated actions
ob_start();
do_action('mce_options');
$mce_deprecated1 = ob_get_contents() || '';
$mce_deprecated = ob_get_contents();
ob_end_clean();
$mce_deprecated = (string) $mce_deprecated;
if ( strlen( $mce_deprecated ) < 10 || ! strpos( $mce_deprecated, ':' ) || ! strpos( $mce_deprecated, ',' ) )
$mce_deprecated = '';
// Settings for the gzip compression and cache
$disk_cache = ( ! isset($initArray['disk_cache']) || false == $initArray['disk_cache'] ) ? false : true;
$compress = ( ! isset($initArray['compress']) || false == $initArray['compress'] ) ? false : true;
@ -222,7 +228,7 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
// Setup cache info
if ( $disk_cache ) {
$cacheKey = apply_filters('tiny_mce_version', '20080317');
$cacheKey = apply_filters('tiny_mce_version', '20080321');
foreach ( $initArray as $v )
$cacheKey .= $v;
@ -267,7 +273,8 @@ if ( $disk_cache && is_file($cache_file) && is_readable($cache_file) ) {
foreach ( $initArray as $k => $v )
$mce_options .= $k . ':"' . $v . '",';
$mce_options .= $mce_deprecated1;
if ( $mce_deprecated ) $mce_options .= $mce_deprecated;
$mce_options = rtrim( trim($mce_options), '\n\r,' );
$content = 'var tinyMCEPreInit = { settings : { themes : "' . $theme . '", plugins : "' . $initArray['plugins'] . '", languages : "' . $language . '", debug : false }, base : "' . $baseurl . '", suffix : "" };';

View File

@ -210,7 +210,7 @@ tinyMCEPopup = {
// Focus element with mceFocus class
tinymce.each(document.forms, function(f) {
tinymce.each(f.elements, function(e) {
if (t.dom.hasClass(e, 'mceFocus')) {
if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
e.focus();
return false; // Break loop
}

View File

@ -10,21 +10,45 @@ header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
<?php
wp_admin_css( 'css/global' );
wp_admin_css();
wp_admin_css( 'css/colors' );
?>
<style type="text/css">
body {
}
#wphead {
padding-top: 2px;
padding-left: 15px;
#wphead {
font-size: 80%;
border-top: 0;
color:#555;
background-color: #e4f2fd;
}
#wphead h1 {
font-size: 32px;
color: #555;
margin: 0;
padding: 10px;
}
#adminmenu {
padding-top: 2px;
padding-left: 15px;
font-size: 80%;
background-color: #e4f2fd;
border-color: #C6D9E9;
}
#adminmenu a.current {
background-color: #fff;
border-color: #c6d9e9;
border-bottom-color: #fff;
color: #d54e21;
}
#adminmenu a {
color: #2583AD;
padding: 6px;
border-width: 1px;
border-style: solid solid none;
border-color: #E4F2FD;
}
#adminmenu a:hover {
color: #d54e21;
}
.wrap h2 {
border-bottom-color:#DADADA;
color:#666666;
}
#user_info {
right: 5%;
@ -132,10 +156,6 @@ wp_admin_css( 'css/colors' );
document.getElementById('date').innerHTML = tinymce.releaseDate;
}
tinyMCEPopup.onInit.add(init);
// For modal dialogs in IE
if (tinymce.isIE)
document.write('<base target="_self" />');
</script>
</head>
<body>
@ -143,10 +163,10 @@ wp_admin_css( 'css/colors' );
<div id="wphead"><h1><?php echo get_bloginfo('blogtitle'); ?></h1></div>
<ul id="adminmenu">
<li><a id="tab1" href="javascript:flipTab(1)" title="<?php _e('Basics of Rich Editing') ?>" accesskey="1" class="current"><?php _e('Basics') ?></a></li>
<li><a id="tab2" href="javascript:flipTab(2)" title="<?php _e('Advanced use of the Rich Editor') ?>" accesskey="2"><?php _e('Advanced') ?></a></li>
<li><a id="tab3" href="javascript:flipTab(3)" title="<?php _e('Hotkeys') ?>" accesskey="3"><?php _e('Hotkeys') ?></a></li>
<li><a id="tab4" href="javascript:flipTab(4)" title="<?php _e('About the software') ?>" accesskey="4"><?php _e('About') ?></a></li>
<li><a id="tab1" href="javascript:flipTab(1)" title="<?php _e('Basics of Rich Editing') ?>" accesskey="1" tabindex="1" class="current"><?php _e('Basics') ?></a></li>
<li><a id="tab2" href="javascript:flipTab(2)" title="<?php _e('Advanced use of the Rich Editor') ?>" accesskey="2" tabindex="2"><?php _e('Advanced') ?></a></li>
<li><a id="tab3" href="javascript:flipTab(3)" title="<?php _e('Hotkeys') ?>" accesskey="3" tabindex="3"><?php _e('Hotkeys') ?></a></li>
<li><a id="tab4" href="javascript:flipTab(4)" title="<?php _e('About the software') ?>" accesskey="4" tabindex="4"><?php _e('About') ?></a></li>
</ul>
<div id="flipper" class="wrap">
@ -163,9 +183,12 @@ wp_admin_css( 'css/colors' );
<h2><?php _e('Advanced Rich Editing') ?></h2>
<h3><?php _e('Images and Attachments') ?></h3>
<p><?php _e('There is a button in the editor toolbar for inserting images that are already hosted somewhere on the internet. If you have a URL for an image, click this button and enter the URL in the box which appears.') ?></p>
<p><?php _e('If you need to upload an image or sound file from your computer, you can use the uploading tool below the editor. The tool will attempt to create a thumbnail-sized image when you upload an image. To insert your uploaded image into the post, first click on the thumbnail to reveal a menu of options. Clicking on a "Using.." or "Linked..." option will change that option. For instance, you might want to use the thumbnail in the post and link it to a page showing the original with a caption. When you have selected the options you like, click "Send to Editor" and your image or file will appear in the post you are editing.') ?></p>
<p><?php _e('If you need to upload an image or sound file from your computer, you can use the media library buttons above the editor. The media library will attempt to create a thumbnail-sized image when you upload an image. To insert your uploaded image into the post, first click on the thumbnail to reveal a menu of options. When you have selected the options you like, click "Send to Editor" and your image or file will appear in the post you are editing.') ?></p>
<h3><?php _e('HTML in the Rich Editor') ?></h3>
<p><?php _e('Any HTML entered directly into the rich editor will show up as text when the post is viewed. What you see is what you get. When you want to include HTML elements that cannot be generated with the toolbar buttons, you must enter it by hand in the HTML editor. Examples are tables and &lt;code&gt;. To do this, click the HTML button and edit the code, then click Update. If the code is valid and understood by the editor, you should see it rendered immediately.') ?></p>
<p><?php _e('Any HTML entered directly into the rich editor will show up as text when the post is viewed. What you see is what you get. When you want to include HTML elements that cannot be generated with the toolbar buttons, you must enter it by hand in the HTML editor. Examples are tables and &lt;code&gt;. To do this, click the HTML tab and edit the code, then switch back to Visual mode. If the code is valid and understood by the editor, you should see it rendered immediately.') ?></p>
<h3><?php _e('Pasting in the Rich Editor') ?></h3>
<p><?php _e('When pasting content from another web page the results can be inconsistent and depend on your browser and on the web page you are pasting from. The editor tries to correct any invalid HTML code that was pasted, but for best results try using the HTML tab or one of the paste buttons that are on the second row. Alternatively try pasting paragraph by paragraph. In most browsers to select one paragraph at a time, triple-click on it.') ?></p>
<p><?php _e('Pasting content from another application, like Word or Excel, is best done with the Paste from Word button on the second row, or in HTML mode.') ?></p>
</div>
<div id="content3" class="hidden">

View File

@ -31,12 +31,12 @@ class WP_Scripts {
// Let a plugin replace the visual editor
$visual_editor = apply_filters('visual_editor', array('tiny_mce'));
$this->add( 'editor', false, $visual_editor, '20080218' );
$this->add( 'editor', false, $visual_editor, '20080321' );
$this->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080317' );
$this->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080321' );
// Modify this version when tinyMCE plugins are changed.
$mce_version = apply_filters('tiny_mce_version', '20080317');
$mce_version = apply_filters('tiny_mce_version', '20080321');
$this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version );
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');