Add TinyMCE command to handle opening of the upload/insert popup, fix the shortcut "Alt+Shift+M", fix the "image" button in DFW, fixes #17992, fixes #18697, see $17144

git-svn-id: https://develop.svn.wordpress.org/trunk@18710 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2011-09-19 00:47:23 +00:00
parent e984d8503b
commit 945d4500b4
10 changed files with 38 additions and 76 deletions

View File

@ -1 +1 @@
div#media-upload-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;}body#media-upload ul#sidemenu{font-weight:normal;margin:0 5px;left:0;bottom:-1px;float:none;overflow:hidden;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.media-upload-form label.form-help,td.help{font-family:sans-serif;font-style:italic;font-weight:normal;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0;}#library-form .progress,#gallery-form .progress,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 8px 0;}.describe td.error{padding:2px 8px;}.describe td.A1{width:132px;}.describe input[type="text"],.describe textarea{width:460px;border-width:1px;border-style:solid;}.hidden{height:0;width:0;overflow:hidden;border:none;}#media-upload p.ml-submit{padding:1em 0;}#media-upload p.help,#media-upload label.help{font-family:sans-serif;font-style:italic;font-weight:normal;}#media-upload #media-items{border-bottom-width:1px;border-bottom-style:solid;width:623px;}#media-upload #media-items:empty{border:0 none;}#media-upload .media-item{border-style:solid solid none;border-width:1px 1px 0;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{width:100%;clear:both;cursor:default;}#media-upload .describe th.label{padding-top:.2em;text-align:left;min-width:120px;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{margin:0 20px;}#media-items a.delete{display:block;float:right;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#gallery-settings th.label{width:160px;}#gallery-settings #basic th.label{padding:5px 5px 5px 0;}#gallery-settings .title{clear:both;padding:0 0 3px;font-size:1.6em;border-bottom:1px solid #DADADA;}h3.media-title{font-size:1.6em;}h4.media-sub-title{border-bottom:1px solid #DADADA;font-size:1.3em;margin:12px;padding:0 0 3px;}#gallery-settings .title,h3.media-title,h4.media-sub-title{font-family:Georgia,"Times New Roman",Times,serif;font-weight:normal;color:#5A5A5A;}#gallery-settings .describe td{vertical-align:middle;height:3em;}#gallery-settings .describe th.label{padding-top:.5em;text-align:left;}#gallery-settings .describe{padding:5px;width:615px;clear:both;cursor:default;}#gallery-settings .describe select{width:15em;}#gallery-settings .describe select option,#gallery-settings .describe td{padding:0;}#gallery-settings label,#gallery-settings legend{font-size:13px;color:#464646;margin-right:15px;}#gallery-settings .align .field label{margin:0 1.5em 0 0;}#gallery-settings p.ml-submit{border-top:1px solid #dfdfdf;}#gallery-settings select#columns{width:6em;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;} div#media-upload-header{margin:0;padding:0 5px;font-weight:bold;position:relative;border-bottom-width:1px;border-bottom-style:solid;}body#media-upload ul#sidemenu{font-weight:normal;margin:0 5px;left:0;bottom:-1px;float:none;overflow:hidden;}div#media-upload-error{margin:1em;font-weight:bold;}form{margin:1em;}#search-filter{text-align:right;}th{position:relative;}.media-upload-form label.form-help,td.help{font-family:sans-serif;font-style:italic;font-weight:normal;}.media-upload-form p.help{margin:0;padding:0;}.media-upload-form fieldset{width:100%;border:none;text-align:justify;margin:0 0 1em 0;padding:0;}.image-align-none-label{background:url(../images/align-none.png) no-repeat center left;}.image-align-left-label{background:url(../images/align-left.png) no-repeat center left;}.image-align-center-label{background:url(../images/align-center.png) no-repeat center left;}.image-align-right-label{background:url(../images/align-right.png) no-repeat center left;}tr.image-size td{width:460px;}tr.image-size div.image-size-item{float:left;width:25%;margin:0;}#library-form .progress,#gallery-form .progress,.insert-gallery,.describe.startopen,.describe.startclosed{display:none;}.media-item .thumbnail{max-width:128px;max-height:128px;}thead.media-item-info tr{background-color:transparent;}thead.media-item-info th,thead.media-item-info td{border:none;margin:0;}.form-table thead.media-item-info{border:8px solid #fff;}abbr.required{text-decoration:none;border:none;}.describe label{display:inline;}.describe td{vertical-align:middle;padding:0 5px 8px 0;}.describe td.error{padding:2px 8px;}.describe td.A1{width:132px;}.describe input[type="text"],.describe textarea{width:460px;border-width:1px;border-style:solid;}#media-upload p.ml-submit{padding:1em 0;}#media-upload p.help,#media-upload label.help{font-family:sans-serif;font-style:italic;font-weight:normal;}#media-upload #media-items{border-bottom-width:1px;border-bottom-style:solid;width:623px;}#media-upload #media-items:empty{border:0 none;}#media-upload .media-item{border-style:solid solid none;border-width:1px 1px 0;min-height:36px;width:100%;}#media-upload .ui-sortable .media-item{cursor:move;}.filename{line-height:36px;padding:0 10px;overflow:hidden;}#media-upload .describe{width:100%;clear:both;cursor:default;}#media-upload .describe th.label{padding-top:.2em;text-align:left;min-width:120px;}#media-upload tr.image-size{margin-bottom:1em;height:3em;}#media-upload #filter{width:623px;}#media-upload #filter .subsubsub{margin:8px 0;}#filter .tablenav select{border-style:solid;border-width:1px;padding:2px;vertical-align:top;width:auto;}#media-upload .del-attachment{display:none;margin:5px 0;}.menu_order{float:right;font-size:11px;margin:10px 10px 0;}.menu_order_input{border:1px solid #ddd;font-size:10px;padding:1px;width:23px;}.ui-sortable-helper{background-color:#fff;border:1px solid #aaa;opacity:.6;filter:alpha(opacity=60);}#media-upload th.order-head{width:20%;text-align:center;}#media-upload th.actions-head{width:25%;text-align:center;}#media-upload a.wp-post-thumbnail{margin:0 20px;}#media-items a.delete{display:block;float:right;}#media-upload .widefat{width:626px;border-style:solid solid none;}.sorthelper{height:37px;width:623px;display:block;}#gallery-settings th.label{width:160px;}#gallery-settings #basic th.label{padding:5px 5px 5px 0;}#gallery-settings .title{clear:both;padding:0 0 3px;font-size:1.6em;border-bottom:1px solid #DADADA;}h3.media-title{font-size:1.6em;}h4.media-sub-title{border-bottom:1px solid #DADADA;font-size:1.3em;margin:12px;padding:0 0 3px;}#gallery-settings .title,h3.media-title,h4.media-sub-title{font-family:Georgia,"Times New Roman",Times,serif;font-weight:normal;color:#5A5A5A;}#gallery-settings .describe td{vertical-align:middle;height:3em;}#gallery-settings .describe th.label{padding-top:.5em;text-align:left;}#gallery-settings .describe{padding:5px;width:615px;clear:both;cursor:default;}#gallery-settings .describe select{width:15em;}#gallery-settings .describe select option,#gallery-settings .describe td{padding:0;}#gallery-settings label,#gallery-settings legend{font-size:13px;color:#464646;margin-right:15px;}#gallery-settings .align .field label{margin:0 1.5em 0 0;}#gallery-settings p.ml-submit{border-top:1px solid #dfdfdf;}#gallery-settings select#columns{width:6em;}#sort-buttons{font-size:.8em;margin:3px 25px -8px 0;text-align:right;max-width:625px;}#sort-buttons a{text-decoration:none;}#sort-buttons #asc,#sort-buttons #showall{padding-left:5px;}#sort-buttons span{margin-right:25px;}

View File

@ -364,23 +364,3 @@ h4.media-sub-title {
margin-right: 25px; margin-right: 25px;
} }
.drag-drop #drag-drop-area {
border: 4px dashed #DDDDDD;
height: 300px;
}
.drag-drop .drag-drop-inside {
padding-top: 100px;
}
.drag-drop .drag-drop-inside p {
text-align: center;
}
.dragdrop-info {
display: none;
}
.drag-drop .dragdrop-info {
display: block;
}

View File

@ -143,19 +143,14 @@ PubSub.prototype.publish = function( topic, args ) {
if ( typeof(wp_fullscreen_settings) != 'undefined' ) if ( typeof(wp_fullscreen_settings) != 'undefined' )
$.extend( s, wp_fullscreen_settings ); $.extend( s, wp_fullscreen_settings );
// enable DFW only on the Add/Edit Post screens for now
/*
s.editor_id = wpActiveEditor || 'content'; s.editor_id = wpActiveEditor || 'content';
if ( !s.title_id && $('input#title').length && s.editor_id == 'content' ) if ( !s.title_id ) {
s.title_id = 'title'; if ( $('input#title').length && s.editor_id == 'content' )
s.title_id = 'title';
if ( !s.title_id ) else
$('#wp-fullscreen-title').hide(); $('#wp-fullscreen-title').hide();
*/ }
s.editor_id = 'content';
s.title_id = 'title';
s.mode = $('#' + s.editor_id).is(':hidden') ? 'tinymce' : 'html'; s.mode = $('#' + s.editor_id).is(':hidden') ? 'tinymce' : 'html';
s.qt_canvas = $('#' + s.editor_id).get(0); s.qt_canvas = $('#' + s.editor_id).get(0);
@ -360,6 +355,8 @@ PubSub.prototype.publish = function( topic, args ) {
s.is_mce_on = true; s.is_mce_on = true;
} }
wpActiveEditor = 'wp_mce_fullscreen';
}); });
ps.subscribe( 'hide', function() { // This event occurs before the overlay blocks DFW. ps.subscribe( 'hide', function() { // This event occurs before the overlay blocks DFW.
@ -402,6 +399,7 @@ PubSub.prototype.publish = function( topic, args ) {
s.textarea_obj.value = ''; s.textarea_obj.value = '';
api.oldheight = 0; api.oldheight = 0;
wpActiveEditor = s.editor_id;
}); });
ps.subscribe( 'switchMode', function( from, to ) { ps.subscribe( 'switchMode', function( from, to ) {
@ -485,6 +483,11 @@ PubSub.prototype.publish = function( topic, args ) {
tinyMCE.execCommand('mceBlockQuote'); tinyMCE.execCommand('mceBlockQuote');
} }
api.medialib = function() {
if ( s.has_tinymce && 'tinymce' === s.mode )
tinyMCE.execCommand('WP_Medialib');
}
api.refresh_buttons = function( fade ) { api.refresh_buttons = function( fade ) {
fade = fade || false; fade = fade || false;

File diff suppressed because one or more lines are too long

View File

@ -594,10 +594,6 @@ class WP_Editor {
<div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="wp_themeSkin"> <div id="wp-fullscreen-button-bar"><div id="wp-fullscreen-buttons" class="wp_themeSkin">
<?php <?php
$media_link_type = 'image';
if ( is_multisite() && ( ( ! $mu_media_buttons = get_site_option( 'mu_media_buttons' ) ) || empty( $mu_media_buttons['image'] ) ) )
$media_link_type = 'media';
$buttons = array( $buttons = array(
// format: title, onclick, show in both editors // format: title, onclick, show in both editors
'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'onclick' => 'fullscreen.b();', 'both' => false ), 'bold' => array( 'title' => __('Bold (Ctrl + B)'), 'onclick' => 'fullscreen.b();', 'both' => false ),
@ -607,7 +603,7 @@ class WP_Editor {
'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'onclick' => 'fullscreen.ol();', 'both' => false ), 'numlist' => array( 'title' => __('Ordered list (Alt + Shift + O)'), 'onclick' => 'fullscreen.ol();', 'both' => false ),
'1' => 'separator', '1' => 'separator',
'blockquote' => array( 'title' => __('Blockquote (Alt+Shift+Q)'), 'onclick' => 'fullscreen.blockquote();', 'both' => false ), 'blockquote' => array( 'title' => __('Blockquote (Alt+Shift+Q)'), 'onclick' => 'fullscreen.blockquote();', 'both' => false ),
'image' => array( 'title' => __('Insert/edit image (Alt + Shift + M)'), 'onclick' => "jQuery('#add_{$media_link_type}').click();", 'both' => true ), 'image' => array( 'title' => __('Insert/edit image (Alt + Shift + M)'), 'onclick' => "fullscreen.medialib();", 'both' => true ),
'2' => 'separator', '2' => 'separator',
'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'onclick' => 'fullscreen.link();', 'both' => true ), 'link' => array( 'title' => __('Insert/edit link (Alt + Shift + A)'), 'onclick' => 'fullscreen.link();', 'both' => true ),
'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'onclick' => 'fullscreen.unlink();', 'both' => false ), 'unlink' => array( 'title' => __('Unlink (Alt + Shift + S)'), 'onclick' => 'fullscreen.unlink();', 'both' => false ),

View File

@ -63,6 +63,19 @@
setUserSetting('hidetb', '0'); setUserSetting('hidetb', '0');
} }
}); });
ed.addCommand('WP_Medialib', function() {
var id = ed.getParam('wp_fullscreen_editor_id') || ed.getParam('fullscreen_editor_id') || ed.id,
link = tinymce.DOM.select('#wp-' + id + '-media-buttons a.thickbox');
if ( link && link[0] )
link = link[0];
else
return;
tb_show('', link.href);
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
});
// Register buttons // Register buttons
ed.addButton('wp_more', { ed.addButton('wp_more', {
@ -86,49 +99,19 @@
cmd : 'WP_Adv' cmd : 'WP_Adv'
}); });
// Add Media buttons // Add Media button
ed.addButton('add_media', { ed.addButton('add_media', {
title : 'wordpress.add_media', title : 'wordpress.add_media',
image : url + '/img/media.gif',
onclick : function() {
tb_show('', tinymce.DOM.get('add_media').href);
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
}
});
ed.addButton('add_image', {
title : 'wordpress.add_image',
image : url + '/img/image.gif', image : url + '/img/image.gif',
onclick : function() { cmd : 'WP_Medialib'
tb_show('', tinymce.DOM.get('add_image').href);
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
}
});
ed.addButton('add_video', {
title : 'wordpress.add_video',
image : url + '/img/video.gif',
onclick : function() {
tb_show('', tinymce.DOM.get('add_video').href);
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
}
});
ed.addButton('add_audio', {
title : 'wordpress.add_audio',
image : url + '/img/audio.gif',
onclick : function() {
tb_show('', tinymce.DOM.get('add_audio').href);
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
}
}); });
// Add Media buttons to fullscreen and handle align buttons for image captions // Add Media buttons to fullscreen and handle align buttons for image captions
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val, o) { ed.onBeforeExecCommand.add(function(ed, cmd, ui, val, o) {
var DOM = tinymce.DOM, n, DL, DIV, cls, a, align; var DOM = tinymce.DOM, n, DL, DIV, cls, a, align;
if ( 'mceFullScreen' == cmd ) { if ( 'mceFullScreen' == cmd ) {
if ( 'mce_fullscreen' != ed.id && DOM.get('add_audio') && DOM.get('add_video') && DOM.get('add_image') && DOM.get('add_media') ) if ( 'mce_fullscreen' != ed.id && DOM.select('a.thickbox').length )
ed.settings.theme_advanced_buttons1 += ',|,add_image,add_video,add_audio,add_media'; ed.settings.theme_advanced_buttons1 += ',|,add_media';
} }
if ( 'JustifyLeft' == cmd || 'JustifyRight' == cmd || 'JustifyCenter' == cmd ) { if ( 'JustifyLeft' == cmd || 'JustifyRight' == cmd || 'JustifyCenter' == cmd ) {
@ -253,7 +236,7 @@
ed.addShortcut('alt+shift+n', ed.getLang('spellchecker.desc'), 'mceSpellCheck'); ed.addShortcut('alt+shift+n', ed.getLang('spellchecker.desc'), 'mceSpellCheck');
ed.addShortcut('alt+shift+a', ed.getLang('link_desc'), 'mceLink'); ed.addShortcut('alt+shift+a', ed.getLang('link_desc'), 'mceLink');
ed.addShortcut('alt+shift+s', ed.getLang('unlink_desc'), 'unlink'); ed.addShortcut('alt+shift+s', ed.getLang('unlink_desc'), 'unlink');
ed.addShortcut('alt+shift+m', ed.getLang('image_desc'), 'mceImage'); ed.addShortcut('alt+shift+m', ed.getLang('image_desc'), 'WP_Medialib');
ed.addShortcut('alt+shift+g', ed.getLang('fullscreen.desc'), 'mceFullScreen'); 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+z', ed.getLang('wp_adv_desc'), 'WP_Adv');
ed.addShortcut('alt+shift+h', ed.getLang('help_desc'), 'WP_Help'); ed.addShortcut('alt+shift+h', ed.getLang('help_desc'), 'WP_Help');

File diff suppressed because one or more lines are too long

View File

@ -86,7 +86,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110820', 1 ); $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), '20110820', 1 );
$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110826', 1 ); $scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), '20110918', 1 );
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1'); $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1');

View File

@ -18,7 +18,7 @@ $wp_db_version = 18541;
* *
* @global string $tinymce_version * @global string $tinymce_version
*/ */
$tinymce_version = '345-20110917'; $tinymce_version = '345-20110918';
/** /**
* Holds the cache manifest version * Holds the cache manifest version