Skip to content

Commit

Permalink
fix: add possibility to set urlRegex and emailRegex properties (ckedi…
Browse files Browse the repository at this point in the history
  • Loading branch information
serggoodwill committed Mar 15, 2020
1 parent 5ace43e commit b3d35b0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions plugins/autolink/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
if ( CKEDITOR.env.ie && !CKEDITOR.env.edge ) {
return;
}

// (#3156)
var urlRegex = editor.config.autolink_urlRegex || CKEDITOR.config.autolink_urlRegex;
var emailRegex = editor.config.autolink_emailRegex || CKEDITOR.config.autolink_emailRegex;
var commitKeystrokes = editor.config.autolink_commitKeystrokes || CKEDITOR.config.autolink_commitKeystrokes;
editor.on( 'key', function( evt ) {
if ( editor.mode !== 'wysiwyg' || CKEDITOR.tools.indexOf( commitKeystrokes, evt.data.keyCode ) == -1 ) {
Expand Down Expand Up @@ -100,7 +102,7 @@
text: text,
link: text.replace( doubleQuoteRegex, '%22' )
},
template = opts.link.match( CKEDITOR.config.autolink_urlRegex ) ?
template = opts.link.match( urlRegex ) ?
urlTemplate.output( opts )
: emailTemplate.output( opts );

Expand All @@ -124,8 +126,8 @@
}

function matchLink( query ) {
return query.match( CKEDITOR.config.autolink_urlRegex ) ||
query.match( CKEDITOR.config.autolink_emailRegex );
return query.match( urlRegex ) ||
query.match( emailRegex );
}
}
} );
Expand Down

0 comments on commit b3d35b0

Please sign in to comment.