21 lines
591 B
JavaScript
21 lines
591 B
JavaScript
|
define(function() {
|
||
|
|
||
|
var emailConverter = {
|
||
|
extensionId: "emailConverter",
|
||
|
extensionName: "Email Converter",
|
||
|
optional: true,
|
||
|
settingsBloc: '<p>Converts email adresses in the form <email@example.com> into a clickable links.</p>'
|
||
|
};
|
||
|
|
||
|
emailConverter.onEditorConfigure = function(editor) {
|
||
|
editor.getConverter().hooks.chain("postConversion", function(text) {
|
||
|
return text.replace(/<(mailto\:)?([^\s>]+@[^\s>]+\.\S+?)>/g, function(match, mailto, email) {
|
||
|
return '<a href="mailto:' + email + '">' + email + '</a>';
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
|
||
|
return emailConverter;
|
||
|
});
|
||
|
|