Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

API Clean up the return values for getCurrentLink

Returning a link type "internal" in the situation when no link has been
detected is confusing and makes it hard to know downstream if the link
was detected or not. Switched that to null.

Also added target option to file downloads, as we don't currently have a
mechanism to default this field to "yes" for files.
  • Loading branch information...
commit eef67b6f8761ac947dc473defd46e2c6c4dbc083 1 parent 998b8e0
@mateusz mateusz authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 javascript/HtmlEditorField.js
View
13 javascript/HtmlEditorField.js
@@ -631,8 +631,9 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
}
},
/**
- * Return information about the currently selected link, suitable for population of the link
- * form.
+ * Return information about the currently selected link, suitable for population of the link form.
+ *
+ * Returns null if no link was currently selected.
*/
getCurrentLink: function() {
var selectedEl = this.getSelection(),
@@ -682,7 +683,8 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
return {
LinkType: 'file',
file: RegExp.$1,
- Description: title
+ Description: title,
+ TargetBlank: target ? true : false
};
} else if(href.match(/^#(.*)$/)) {
return {
@@ -707,9 +709,8 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
TargetBlank: target ? true : false
};
} else {
- return {
- LinkType: 'internal'
- };
+ // No link/invalid link selected.
+ return null;
}
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.