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.
This commit is contained in:
Mateusz Uzdowski 2012-07-10 16:30:13 +12:00
parent 998b8e048c
commit eef67b6f87

View File

@ -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;
}
}
});