Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Split out getLinkAttributes() in .htmleditor JavaScript for more flex…

…ibility

Saves us from overwriting the whole insertLink() method just
to add another option.
  • Loading branch information...
commit f30277c3cf27c887b607a2337d4281d70c548a0e 1 parent fd80c4f
@chillu chillu authored
Showing with 10 additions and 7 deletions.
  1. +10 −7 javascript/HtmlEditorField.js
View
17 javascript/HtmlEditorField.js
@@ -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() {
Please sign in to comment.
Something went wrong with that request. Please try again.