Based on the current UX feedback, remove the "Insert Link" UI from under the caption fields, see #18311

git-svn-id: http://svn.automattic.com/wordpress/trunk@20114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz
2012-03-05 07:31:31 +00:00
parent 71fb0d40d9
commit 9f4408c741
10 changed files with 29 additions and 260 deletions

View File

@@ -338,48 +338,15 @@ function uploadSizeError( up, file, over100mb ) {
}
jQuery(document).ready(function($){
var insert_link, bookmark;
$('.media-upload-form').bind('click.uploader', function(e) {
var target = $(e.target), tr, c, el, textarea, sel, text, startPos, endPos;
var target = $(e.target), tr, c;
if ( target.hasClass('caption-insert-link') ) {
el = target.siblings('div.caption-insert-link-wrap'), textarea = target.parent().siblings('textarea').get(0);
if ( document.selection ) {
textarea.focus();
sel = document.selection.createRange();
bookmark = sel.getBookmark();
if ( sel.text )
el.find('.caption-insert-link-text').val(sel.text);
} else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
text = textarea.value;
startPos = textarea.selectionStart;
endPos = textarea.selectionEnd;
if ( startPos != endPos )
el.find('.caption-insert-link-text').val( text.substring(startPos, endPos) );
}
target.hide();
el.show();
el.find('.caption-insert-link-url').focus();
} else if ( target.hasClass('caption-cancel') || target.hasClass('caption-save') ) {
el = target.closest('div.caption-insert-link-wrap');
if ( target.hasClass('caption-save') )
insert_link( el.closest('.edit-caption-controls').siblings('textarea'), el );
el.hide();
el.siblings('.caption-insert-link').show();
} else if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment
if ( target.is('input[type="radio"]') ) { // remember the last used image size and alignment
tr = target.closest('tr');
if ( $(tr).hasClass('align') )
if ( tr.hasClass('align') )
setUserSetting('align', target.val());
else if ( $(tr).hasClass('image-size') )
else if ( tr.hasClass('image-size') )
setUserSetting('imgsize', target.val());
} else if ( target.is('button.button') ) { // remember the last used image link url
@@ -427,45 +394,6 @@ jQuery(document).ready(function($){
e.preventDefault();
}
});
insert_link = function(textarea, parent) {
var sel, content, startPos, endPos, scrollTop, text,
url = parent.find('.caption-insert-link-url'), link_text = parent.find('.caption-insert-link-text');
if ( !url.length || !link_text.length )
return;
textarea = textarea.get(0);
content = "<a href='"+url.val()+"'>"+link_text.val()+"</a>";
if ( document.selection ) {
textarea.focus();
sel = document.selection.createRange();
if ( bookmark ) {
sel.moveToBookmark( bookmark );
bookmark = '';
}
sel.text = content;
textarea.focus();
} else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
text = textarea.value;
startPos = textarea.selectionStart;
endPos = textarea.selectionEnd;
scrollTop = textarea.scrollTop;
textarea.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);
textarea.focus();
textarea.selectionStart = startPos + content.length;
textarea.selectionEnd = startPos + content.length;
textarea.scrollTop = scrollTop;
}
url.val('');
link_text.val('');
};
// init and set the uploader
uploader_init = function() {

View File

@@ -499,7 +499,5 @@ s120:"120%",
s130:"130%",
img_title:"Title",
caption:"Caption",
insert_link:"Insert link",
linked_text:"Linked text",
alt:"Alternate Text"
});

View File

@@ -542,8 +542,6 @@ function wp_mce_translation() {
's130' => __('130%'),
'img_title' => __('Title'),
'caption' => __('Caption'),
'insert_link' => __('Insert link'),
'linked_text' => __('Linked text'),
'alt' => __('Alternate Text')
);

View File

@@ -357,38 +357,6 @@ div#media-upload-error {
color: #CFCFCF;
}
#img-edit .edit-caption-controls {
margin: 5px 0;
}
#img-edit .edit-caption-controls label {
margin: 5px 0;
display: block;
}
#img-edit .edit-caption-controls label span {
width: 100px;
float: left;
line-height: 22px;
}
#img-edit .edit-caption-controls input[type="text"] {
width: 335px;
}
#img-edit .caption-insert-link-buttons {
text-align: right;
margin: 5px 12px;
}
#img-edit .caption-insert-link-wrap {
padding: 5px 0 5px 12px;
background-color: #f8f8f8;
border: 1px solid #eee;
-webkit-border-radius: 3px;
border-radius: 3px;
}
#img-edit #img_cap_text {
font: normal 12px/18px monospace;
}

View File

@@ -102,22 +102,6 @@ if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
</th>
<td class="field">
<textarea id="img_cap_text"></textarea>
<div class="edit-caption-controls">
<input type="button" class="button caption-insert-link" value="{#wpeditimage.insert_link}" />
<div class="caption-insert-link-wrap hidden">
<label><span>{#advanced_dlg.link_url}</span>
<input type="text" value="" class="caption-insert-link-url" /></label>
<label><span>{#wpeditimage.linked_text}</span>
<input type="text" value="" class="caption-insert-link-text" /></label>
<div class="caption-insert-link-buttons">
<input type="button" class="button caption-cancel" value="{#cancel}" />
<input type="button" class="button-primary caption-save" value="{#insert}" />
<br class="clear" />
</div></div></div>
</td>
</tr>

View File

@@ -186,7 +186,7 @@
cls = ( cls && cls[1] ) ? cls[1] : '';
cls = cls.match(/align[a-z]+/) || 'alignnone';
cap = cap.replace(/<[a-z][^<>]+>/g, function(a){
cap = cap.replace(/<[a-zA-Z0-9]+ [^<>]+>/g, function(a){ // look only for html tags with attributes
a = a.replace(/="[^"]+"/, function(b){
return b.replace(/'/g, '&#39;');
});

View File

@@ -21,7 +21,6 @@ tinyMCEPopup = {
tinyMCE = w.tinyMCE;
t.editor = tinymce.EditorManager.activeEditor;
t.params = t.editor.windowManager.params;
t.events = new tinymce.dom.EventUtils();
// Setup local DOM
t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
@@ -245,7 +244,7 @@ wpImage = {
setup : function() {
var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor,
d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa, bookmark, insert_link;
d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa;
document.dir = tinyMCEPopup.editor.getParam('directionality','');
@@ -330,79 +329,6 @@ wpImage = {
t.showSizeSet();
document.body.style.display = '';
tinyMCEPopup.events.add(document.body, 'click', function(e) {
var target = e.target, parent = target.parentNode, tr, c, el, textarea, sel, text, startPos, endPos;
if ( dom.hasClass(target, 'caption-insert-link') ) {
el = dom.select('div.caption-insert-link-wrap', parent)[0], textarea = dom.select('#img_cap_text')[0];
if ( document.selection ) {
textarea.focus();
sel = document.selection.createRange();
bookmark = sel.getBookmark();
if ( sel.text )
dom.select('.caption-insert-link-text', el)[0].value = sel.text;
} else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
text = textarea.value;
startPos = textarea.selectionStart;
endPos = textarea.selectionEnd;
if ( startPos != endPos )
dom.select('.caption-insert-link-text', el)[0].value = text.substring(startPos, endPos);
}
dom.hide(target);
dom.show(el);
dom.select('.caption-insert-link-url', el)[0].focus();
} else if ( dom.hasClass(target, 'caption-cancel') || dom.hasClass(target, 'caption-save') ) {
if ( dom.hasClass(target, 'caption-save') )
insert_link();
dom.hide( dom.select('.caption-insert-link-wrap') );
dom.show( dom.select('.caption-insert-link') );
}
});
insert_link = function() {
var sel, content, startPos, endPos, scrollTop, text, textarea = dom.select('#img_cap_text')[0],
url = dom.select('.caption-insert-link-url')[0], link_text = dom.select('.caption-insert-link-text')[0];
if ( !url || !link_text )
return;
content = "<a href='"+url.value+"'>"+link_text.value+"</a>";
if ( document.selection ) {
textarea.focus();
sel = document.selection.createRange();
if ( bookmark ) {
sel.moveToBookmark( bookmark );
bookmark = '';
}
sel.text = content;
textarea.focus();
} else if ( textarea.selectionStart || textarea.selectionStart == '0' ) {
text = textarea.value;
startPos = textarea.selectionStart;
endPos = textarea.selectionEnd;
scrollTop = textarea.scrollTop;
textarea.value = text.substring(0, startPos) + content + text.substring(endPos, text.length);
textarea.focus();
textarea.selectionStart = startPos + content.length;
textarea.selectionEnd = startPos + content.length;
textarea.scrollTop = scrollTop;
}
url.value = '';
link_text.value = '';
};
},
remove : function() {

File diff suppressed because one or more lines are too long