Expand/collapse in internal linking. Props koopersmith, nacin. see #15739

git-svn-id: http://svn.automattic.com/wordpress/trunk@16931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-12-15 02:36:24 +00:00
parent 47b8f4a8cc
commit 7f88c122ea
12 changed files with 66 additions and 19 deletions

File diff suppressed because one or more lines are too long

View File

@ -1524,7 +1524,8 @@ fieldset.inline-edit-col-right .inline-edit-col {
background: #D1E5ee;
}
#screen-meta a.show-settings {
#screen-meta a.show-settings,
.toggle-arrow {
background-image:url("../images/screen-options-toggle-vs.gif?ver=20100531");
}

File diff suppressed because one or more lines are too long

View File

@ -1517,7 +1517,8 @@ fieldset.inline-edit-col-right .inline-edit-col {
text-decoration: underline;
}
#screen-meta a.show-settings {
#screen-meta a.show-settings,
.toggle-arrow {
background-image:url("../images/screen-options-toggle.gif?ver=20100531");
}

File diff suppressed because one or more lines are too long

View File

@ -747,7 +747,17 @@ form.upgrade .hint {
list-style-type: disc;
margin-left: 18px;
}
.toggle-arrow {
background-repeat: no-repeat;
background-position: top left;
background-color: transparent;
height: 22px;
line-height: 22px;
display: block;
}
.toggle-arrow-active {
background-position: bottom left;
}
#screen-meta a.show-settings {
text-decoration: none;
z-index: 1;

View File

@ -84,9 +84,10 @@ function wp_link_dialog() {
<label for="link-target-checkbox"><input type="checkbox" id="link-target-checkbox" tabindex="30" /> <?php _e( 'Open link in a new window/tab' ); ?></label>
</div>
</div>
<div id="search-panel">
<?php $show_internal = '1' == get_user_setting( 'wplink', '0' ); ?>
<p class="howto" id="internal-toggle"><a href="#" class="toggle-arrow <?php if ( $show_internal ) echo 'toggle-arrow-active'; ?>"><?php _e( 'Link to Content on this Site' ); ?></a></p>
<div id="search-panel"<?php if ( ! $show_internal ) echo ' style="display:none"'; ?>>
<div class="link-search-wrapper">
<p class="howto"><?php _e( 'Or, link to existing site content:' ); ?></p>
<label for="search-field">
<span><?php _e( 'Search' ); ?></span>
<input type="text" id="search-field" class="link-search-field" tabindex="60" autocomplete="off" />

View File

@ -1 +1 @@
#wp-link p.howto{margin:3px;}#link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 5px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#wp-link .link-target{width:auto;padding:3px 0 0;margin:0 0 0 87px;font-size:11px;}#wp-link .query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto;position:relative;}#wp-link li,#wp-link .query-notice{clear:both;margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#333;padding:4px 6px;cursor:pointer;}#wp-link li:hover{background:#eaf2fa;color:#151515;}#wp-link li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#333;}#wp-link li.selected{background:#ddd;color:#333;}#wp-link li.selected .item-title{font-weight:bold;}#wp-link .item-info{text-transform:uppercase;color:#666;font-size:11px;float:right;}#search-results{display:none;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 10px;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;}
#wp-link #link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link p.howto{margin:3px;}#wp-link #internal-toggle{margin:0 5px;}#wp-link #internal-toggle a{padding-left:18px;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 6px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#wp-link .link-target{width:auto;padding:3px 0 0;margin:0 0 0 87px;font-size:11px;}#wp-link .query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto;position:relative;}#wp-link li,#wp-link .query-notice{clear:both;margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#333;padding:4px 6px;cursor:pointer;}#wp-link li:hover{background:#eaf2fa;color:#151515;}#wp-link li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#333;}#wp-link li.selected{background:#ddd;color:#333;}#wp-link li.selected .item-title{font-weight:bold;}#wp-link .item-info{text-transform:uppercase;color:#666;font-size:11px;float:right;}#search-results{display:none;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 10px;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;}

View File

@ -1,11 +1,17 @@
#wp-link p.howto {
margin: 3px;
}
#link-options {
#wp-link #link-options {
padding: 10px 0 14px;
border-bottom: 1px solid #dfdfdf;
margin: 0 6px 14px;
}
#wp-link p.howto {
margin: 3px;
}
#wp-link #internal-toggle {
margin: 0 5px;
}
#wp-link #internal-toggle a {
padding-left: 18px;
}
#wp-link label input[type="text"] {
width: 360px;
margin-top: 5px;
@ -17,7 +23,7 @@
padding-right: 5px;
}
#wp-link .link-search-wrapper {
margin: 5px 5px 9px;
margin: 5px 6px 9px;
display: block;
overflow: hidden;
}

View File

@ -32,6 +32,7 @@ var wpLink;
e.preventDefault();
});
$('#wp-link-cancel').click( wpLink.cancel );
$('#internal-toggle a').click( wpLink.toggleInternalLinking );
rivers.elements.bind('river-select', wpLink.updateFields );
@ -242,6 +243,33 @@ var wpLink;
funcContext = this;
funcTriggered = true;
};
},
toggleInternalLinking : function( event ) {
var panel = $('#search-panel'),
widget = inputs.dialog.wpdialog('widget'),
// We're about to toggle visibility; it's currently the opposite
visible = !panel.is(':visible'),
win = $(window);
$(this).toggleClass('toggle-arrow-active', visible);
panel.slideToggle( 300, function() {
setUserSetting('wplink', visible ? '1' : '0');
inputs[ visible ? 'search' : 'url' ].focus();
// Move the box if the box is now expanded, was opened in a collapsed state,
// and if it needs to be moved. (Judged by bottom not being positive or
// bottom being smaller than top.)
var scroll = win.scrollTop(),
top = widget.offset().top,
bottom = top + widget.outerHeight(),
diff = bottom - win.height();
if ( diff > scroll ) {
widget.animate({'top': diff < top ? top - diff : scroll }, 200);
}
});
event.preventDefault();
}
}

File diff suppressed because one or more lines are too long

View File

@ -270,7 +270,7 @@ function wp_default_scripts( &$scripts ) {
'l10n_print_after' => 'try{convertEntities(adminBarL10n);}catch(e){};',
) );
$scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101207' );
$scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101214' );
$scripts->localize( 'wplink', 'wpLinkL10n', array(
'update' => __('Update'),
'save' => __('Save Link'),
@ -485,13 +485,13 @@ function wp_default_styles( &$styles ) {
// Any rtl stylesheets that don't have a .dev version for ltr
$no_suffix = array( 'farbtastic' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20101206' );
$styles->add( 'wp-admin', "/wp-admin/css/wp-admin$suffix.css", array(), '20101214' );
$styles->add( 'ie', "/wp-admin/css/ie$suffix.css", array(), '20101102' );
$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
// all colors stylesheets need to have the same query strings (cache manifest compat)
$colors_version = '20101211';
$colors_version = '20101214';
// Register "meta" stylesheet for admin colors. All colors-* style sheets should have the same version string.
$styles->add( 'colors', true, array(), $colors_version );
@ -518,7 +518,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100907' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101214' );
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101119' );
$styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101206' );
$styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101214' );
foreach ( $rtl_styles as $rtl_style ) {
$styles->add_data( $rtl_style, 'rtl', true );