Update to TinyMCE 3.03. Define shortcuts. Relocate cached TMCE file. Props azaozz. fixes #6084

git-svn-id: http://svn.automattic.com/wordpress/trunk@7147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-03-04 00:07:29 +00:00
parent 4e45603410
commit 1365d48ac2
8 changed files with 184 additions and 175 deletions

File diff suppressed because one or more lines are too long

View File

@ -103,26 +103,28 @@
t._handleMoreBreak(ed, url);
// Add custom shortcuts
ed.addShortcut('alt+c', ed.getLang('justifycenter_desc'), 'JustifyCenter');
ed.addShortcut('alt+r', ed.getLang('justifyright_desc'), 'JustifyRight');
ed.addShortcut('alt+l', ed.getLang('justifyleft_desc'), 'JustifyLeft');
ed.addShortcut('alt+j', ed.getLang('justifyfull_desc'), 'JustifyFull');
ed.addShortcut('alt+q', ed.getLang('blockquote_desc'), 'mceBlockQuote');
ed.addShortcut('alt+shift+c', ed.getLang('justifycenter_desc'), 'JustifyCenter');
ed.addShortcut('alt+shift+r', ed.getLang('justifyright_desc'), 'JustifyRight');
ed.addShortcut('alt+shift+l', ed.getLang('justifyleft_desc'), 'JustifyLeft');
ed.addShortcut('alt+shift+j', ed.getLang('justifyfull_desc'), 'JustifyFull');
ed.addShortcut('alt+shift+q', ed.getLang('blockquote_desc'), 'mceBlockQuote');
ed.addShortcut('alt+shift+u', ed.getLang('bullist_desc'), 'InsertUnorderedList');
ed.addShortcut('alt+shift+o', ed.getLang('numlist_desc'), 'InsertOrderedList');
ed.addShortcut('alt+shift+d', ed.getLang('striketrough_desc'), 'Strikethrough');
ed.addShortcut('alt+shift+n', ed.getLang('spellchecker.desc'), 'mceSpellCheck');
ed.addShortcut('alt+shift+a', ed.getLang('link_desc'), 'mceLink');
ed.addShortcut('alt+shift+s', ed.getLang('unlink_desc'), 'unlink');
ed.addShortcut('alt+shift+m', ed.getLang('image_desc'), 'mceImage');
ed.addShortcut('alt+shift+g', ed.getLang('fullscreen.desc'), 'mceFullScreen');
ed.addShortcut('alt+shift+z', ed.getLang('wp_adv_desc'), 'WP_Adv');
ed.addShortcut('alt+shift+h', ed.getLang('help_desc'), 'WP_Help');
ed.addShortcut('alt+shift+t', ed.getLang('wp_more_desc'), 'WP_More');
ed.addShortcut('alt+shift+p', ed.getLang('wp_page_desc'), 'WP_Page');
ed.addShortcut('alt+u', ed.getLang('bullist_desc'), 'InsertUnorderedList');
ed.addShortcut('alt+o', ed.getLang('numlist_desc'), 'InsertOrderedList');
ed.addShortcut('alt+k', ed.getLang('striketrough_desc'), 'Striketrough');
ed.addShortcut('alt+n', ed.getLang('spellchecker.desc'), 'mceSpellCheck');
ed.addShortcut('alt+s', ed.getLang('link_desc'), 'mceLink');
ed.addShortcut('alt+d', ed.getLang('unlink_desc'), 'unlink');
ed.addShortcut('alt+m', ed.getLang('image_desc'), 'mceImage');
ed.addShortcut('alt+g', ed.getLang('fullscreen.desc'), 'mceFullScreen');
ed.addShortcut('alt+z', ed.getLang('wp_adv_desc'), 'WP_Adv');
ed.addShortcut('alt+x', ed.getLang('help_desc'), 'WP_Help');
ed.addShortcut('alt+y', ed.getLang('wp_more_desc'), 'WP_More');
ed.addShortcut('alt+p', ed.getLang('wp_page_desc'), 'WP_Page');
if ( tinymce.isWebKit ) {
ed.addShortcut('alt+shift+b', ed.getLang('bold_desc'), 'Bold');
ed.addShortcut('alt+shift+i', ed.getLang('italic_desc'), 'Italic');
}
},
getInfo : function() {
@ -131,7 +133,7 @@
author : 'WordPress', // add Moxiecode?
authorurl : 'http://wordpress.org',
infourl : 'http://wordpress.org',
version : '1.0a1'
version : '3.0'
};
},

View File

@ -50,8 +50,8 @@ var LinkDialog = {
ed.execCommand('mceInsertLink', false, {
href : f.href.value,
title : f.linktitle.value,
target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : null,
'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : null
target : f.target_list ? f.target_list.options[f.target_list.selectedIndex].value : '',
'class' : f.class_list ? f.class_list.options[f.class_list.selectedIndex].value : ''
});
tinyMCEPopup.close();

File diff suppressed because one or more lines are too long

View File

@ -82,7 +82,7 @@ $plugins = implode($plugins, ',');
$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'image', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ));
$mce_buttons = implode($mce_buttons, ',');
$mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', '|', 'removeformat', 'cleanup', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' ));
$mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' ));
$mce_buttons_2 = implode($mce_buttons_2, ',');
$mce_buttons_3 = apply_filters('mce_buttons_3', array());
@ -114,7 +114,7 @@ $initArray = array (
'relative_urls' => false,
'remove_script_host' => false,
'fix_list_elements' => true,
// 'fix_table_elements' => true,
'fix_table_elements' => true,
'gecko_spellcheck' => true,
'entities' => '38,amp,60,lt,62,gt',
'accessibility_focus' => false,
@ -123,7 +123,7 @@ $initArray = array (
'save_callback' => 'switchEditors.saveCallback',
'plugins' => "$plugins",
// pass-through the settings for compression and caching, so they can be changed with "tiny_mce_before_init"
'disk_cache' => false,
'disk_cache' => true,
'compress' => true,
'old_cache_max' => '1' // number of cache files to keep
);
@ -141,18 +141,7 @@ do_action('mce_options');
$mce_deprecated1 = ob_get_contents() || '';
ob_end_clean();
/*
// Do we need to support this? Most likely will break TinyMCE 3...
ob_start();
do_action('tinymce_before_init');
$mce_deprecated2 = ob_get_contents() || '';
ob_end_clean();
*/
// Settings for the gzip compression and cache
$cache_path = dirname(__FILE__); // ABSPATH . 'wp-content/uploads/js_cache'; // Cache path, this is where the .gz files will be stored
$cache_ext = '.js';
$disk_cache = ( ! isset($initArray['disk_cache']) || false == $initArray['disk_cache'] ) ? false : true;
$compress = ( ! isset($initArray['compress']) || false == $initArray['compress'] ) ? false : true;
$old_cache_max = ( isset($initArray['old_cache_max']) ) ? (int) $initArray['old_cache_max'] : 0;
@ -163,6 +152,13 @@ unset( $initArray['disk_cache'], $initArray['compress'], $initArray['old_cache_m
$isIE5 = ( ( $msie = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) && ( (int) substr( $_SERVER['HTTP_USER_AGENT'], $msie + 5, 3 ) < 6 ) ) ? true : false;
if ( $isIE5 ) $compress = false;
// Cache path, this is where the .gz files will be stored
$cache_path = ABSPATH . 'wp-content/uploads/js_cache';
if ( $disk_cache && ! is_dir($cache_path) )
$disk_cache = mkdir($cache_path);
$cache_ext = '.js';
$plugins = explode( ',', $initArray['plugins'] );
$theme = ( 'simple' == $initArray['theme'] ) ? 'simple' : 'advanced';
$language = isset($initArray['language']) ? substr( $initArray['language'], 0, 2 ) : 'en';
@ -179,7 +175,7 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
}
// Setup cache info
if ( $disk_cache && $cache_path ) {
if ( $disk_cache ) {
$ver = isset($_GET['ver']) ? (int) $_GET['ver'] : '';
$cacheKey = $suffix . $ver;
@ -231,7 +227,7 @@ foreach ( $plugins as $plugin )
$content .= getFileContents( 'plugins/' . $plugin . '/editor_plugin' . $suffix . '.js' );
// Add external plugins and init
$content .= $ext_plugins . 'tinyMCE.init({' . $mce_options . '});'; // $mce_deprecated2 .
$content .= $ext_plugins . 'tinyMCE.init({' . $mce_options . '});';
// Generate GZIP'd content
if ( '.gz' == $cache_ext ) {
@ -243,7 +239,7 @@ if ( '.gz' == $cache_ext ) {
echo $content;
// Write file
if ( '' != $cacheKey && $cache_path ) {
if ( '' != $cacheKey ) {
if ( $old_cache_max ) {
$keys_file = $cache_path . '/tinymce_compressed' . $cache_ext . '_key';
$old_keys = getFileContents($keys_file);

View File

@ -76,14 +76,17 @@ wp_admin_css();
border-left: 3px double #333;
border-right: 3px double #333;
}
#keys p {
.keys {
margin-bottom: 15px;
}
.keys p {
display: inline-block;
margin: 0px;
padding: 0px;
}
#keys .left { text-align: left; }
#keys .center { text-align: center; }
#keys .right { text-align: right; }
.keys .left { text-align: left; }
.keys .center { text-align: center; }
.keys .right { text-align: right; }
td b {
font-family: "Times New Roman" Times serif;
}
@ -104,8 +107,8 @@ wp_admin_css();
#flipper {
margin: 5px 0 3px 10px;
}
#keys .left, .top, .action { text-align: right; }
#keys .right { text-align: left; }
.keys .left, .top, .action { text-align: right; }
.keys .right { text-align: left; }
td b { font-family: Tahoma, "Times New Roman", Times, serif }
</style>
<?php endif; ?>
@ -154,7 +157,7 @@ wp_admin_css();
<h2><?php _e('Rich Editing Basics') ?></h2>
<p><?php _e('<em>Rich editing</em>, also called WYSIWYG for What You See Is What You Get, means your text is formatted as you type. The rich editor creates HTML code behind the scenes while you concentrate on writing. Font styles, links and images all appear approximately as they will on the internet.') ?></p>
<p><?php _e('WordPress includes a rich HTML editor that works well in all major web browsers used today. However editing HTML is not the same as typing text. Each web page has two major components: the structure, which is the actual HTML code and is produced by the editor as you type, and the display, that is applied to it by the currently selected WordPress theme and is defined in style.css. Furthermore WordPress is producing valid XHTML 1.0 which means that display cannot be controlled by structural elements. So inserting multiple line breaks (BR tags) after a paragraph would not produce white space on the web page. The BR tags will be stripped as invalid by the internal HTML correcting functions.') ?></p>
<p><?php _e('While using the editor, most basic keyboard shortcuts work like in any other text editor. For example: Shift+Enter inserts line break, Ctrl+C = copy, Ctrl+X = cut, Ctrl+Z = undo, Ctrl+Y = redo, Ctrl+B = bold, Ctrl+I = italic, Ctrl+U = underline, etc. (on Mac use the Apple key instead of Ctrl). See the Hotkeys tab for all available keyboard shortcuts.') ?></p>
<p><?php _e('While using the editor, most basic keyboard shortcuts work like in any other text editor. For example: Shift+Enter inserts line break, Ctrl+C = copy, Ctrl+X = cut, Ctrl+Z = undo, Ctrl+Y = redo, Ctrl+A = select all, etc. (on Mac use the Command key instead of Ctrl). See the Hotkeys tab for all available keyboard shortcuts.') ?></p>
<p><?php _e('If you do not like the way the rich editor works, you may turn it off from Your Profile submenu, under Users in the admin menu.') ?></p>
</div>
@ -169,30 +172,38 @@ wp_admin_css();
<div id="content3" class="hidden">
<h2><?php _e('Writing at Full Speed') ?></h2>
<p><?php _e('Rather than reaching for your mouse to click on the toolbar, use these access keys. Windows and Linux use Ctrl + letter. Macintosh uses Apple + letter.') ?></p>
<table id="keys" width="100%" style="border: none;">
<p><?php _e('Rather than reaching for your mouse to click on the toolbar, use these access keys. Windows and Linux use Ctrl + letter. Macintosh uses Command + letter.') ?></p>
<table class="keys" width="100%" style="border: 0 none;">
<tr class="top"><th class="key center"><?php _e('Letter') ?></th><th class="left"><?php _e('Action') ?></th><th class="key center"><?php _e('Letter') ?></th><th class="left"><?php _e('Action') ?></th></tr>
<tr><th>c</th><td><?php _e('Copy') ?></td><th>v</th><td><?php _e('Paste') ?></td></tr>
<tr><th>a</th><td><?php _e('Select all') ?></td><th>x</th><td><?php _e('Cut') ?></td></tr>
<tr><th>z</th><td><?php _e('Undo') ?></td><th>y</th><td><?php _e('Redo') ?></td></tr>
<tr><th>b</th><td><?php _e('Bold') ?></td><th>i</th><td><?php _e('Italic') ?></td></tr>
<tr><th>u</th><td><?php _e('Underline') ?></td><th>1</th><td><?php _e('Header 1') ?></td></tr>
<tr><th>2</th><td><?php _e('Header 2') ?></td><th>3</th><td><?php _e('Header 3') ?></td></tr>
<tr><th>4</th><td><?php _e('Header 4') ?></td><th>5</th><td><?php _e('Header 5') ?></td></tr>
<tr><th>6</th><td><?php _e('Header 6') ?></td><th>9</th><td><?php _e('Address') ?></td></tr>
<script type="text/javascript">
if ( ! tinymce.isWebKit )
document.write("<tr><th>b</th><td><?php _e('Bold') ?></td><th>i</th><td><?php _e('Italic') ?></td></tr>"+
"<tr><th>u</th><td><?php _e('Underline') ?></td><th>1</th><td><?php _e('Header 1') ?></td></tr>"+
"<tr><th>2</th><td><?php _e('Header 2') ?></td><th>3</th><td><?php _e('Header 3') ?></td></tr>"+
"<tr><th>4</th><td><?php _e('Header 4') ?></td><th>5</th><td><?php _e('Header 5') ?></td></tr>"+
"<tr><th>6</th><td><?php _e('Header 6') ?></td><th>9</th><td><?php _e('Address') ?></td></tr>")
</script>
</table>
<p><?php _e('The following shortcuts use different access keys. Windows and Linux use Alt + letter. Macintosh uses Ctrl + letter.') ?></p>
<table id="keys" width="100%" style="border: none;">
<p><?php _e('The following shortcuts use different access keys: Alt + Shift + letter.') ?></p>
<table class="keys" width="100%" style="border: 0 none;">
<tr class="top"><th class="key center"><?php _e('Letter') ?></th><th class="left"><?php _e('Action') ?></th><th class="key center"><?php _e('Letter') ?></th><th class="left"><?php _e('Action') ?></th></tr>
<script type="text/javascript">
if ( tinymce.isWebKit )
document.write("<tr><th>b</th><td><?php _e('Bold') ?></td><th>i</th><td><?php _e('Italic') ?></td></tr>")
</script>
<tr><th>n</th><td><?php _e('Check Spelling') ?></td><th>l</th><td><?php _e('Align Left') ?></td></tr>
<tr><th>j</th><td><?php _e('Justify Text') ?></td><th>c</th><td><?php _e('Align Center') ?></td></tr>
<tr><th>k</th><td><span style="text-decoration: line-through;"><?php _e('Strikethrough') ?></span></td><th>r</th><td><?php _e('Align Right') ?></td></tr>
<tr><th>u</th><td><strong>&bull;</strong> <?php _e('List') ?></td><th>s</th><td><?php _e('Insert link') ?></td></tr>
<tr><th>o</th><td>1. <?php _e('List') ?></td><th>d</th><td><?php _e('Remove link') ?></td></tr>
<tr><th>d</th><td><span style="text-decoration: line-through;"><?php _e('Strikethrough') ?></span></td><th>r</th><td><?php _e('Align Right') ?></td></tr>
<tr><th>u</th><td><strong>&bull;</strong> <?php _e('List') ?></td><th>a</th><td><?php _e('Insert link') ?></td></tr>
<tr><th>o</th><td>1. <?php _e('List') ?></td><th>s</th><td><?php _e('Remove link') ?></td></tr>
<tr><th>q</th><td><?php _e('Quote') ?></td><th>m</th><td><?php _e('Insert Image') ?></td></tr>
<tr><th>g</th><td><?php _e('Full Screen') ?></td><th>y</th><td><?php _e('Insert "More" Tag') ?></td></tr>
<tr><th>p</th><td><?php _e('Insert "Page break" tag') ?></td><th>x</th><td><?php _e('Help') ?></td></tr>
<tr><th>g</th><td><?php _e('Full Screen') ?></td><th>t</th><td><?php _e('Insert More Tag') ?></td></tr>
<tr><th>p</th><td><?php _e('Insert Page Break tag') ?></td><th>h</th><td><?php _e('Help') ?></td></tr>
<tr><th>e</th><td colspan="3"><?php _e('Switch to HTML mode') ?></td></tr>
</table>
</div>