Split out getLinkAttributes() in .htmleditor JavaScript for more flexibility

Saves us from overwriting the whole insertLink() method just
to add another option.
This commit is contained in:
Ingo Schommer 2013-01-10 23:32:13 +01:00
parent fd80c4fb3e
commit f30277c3cf

View File

@ -520,7 +520,10 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
this.find('.field#AnchorRefresh').show();
}
},
insertLink: function() {
/**
* @return Object Keys: 'href', 'target', 'title'
*/
getLinkAttributes: function() {
var href, target = null, anchor = this.find(':input[name=Anchor]').val();
// Determine target
@ -555,22 +558,22 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
break;
}
var attributes = {
return {
href : href,
target : target,
title : this.find(':input[name=Description]').val()
};
},
insertLink: function() {
this.modifySelection(function(ed){
ed.insertLink(attributes);
})
ed.insertLink(this.getLinkAttributes());
});
this.updateFromEditor();
},
removeLink: function() {
this.modifySelection(function(ed){
ed.removeLink();
})
});
this.close();
},
addAnchorSelector: function() {