Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/ckeditor5-mention/src/mentionui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,14 @@ function getLastValidMarkerInText(
let lastValidMarker: any;

for ( const feed of feedsWithPattern ) {
const currentMarkerLastIndex = text.lastIndexOf( feed.marker );
// RegExp to check inner markers inside the text such as @me@mysite.com
const markerInside = `${feed.marker}[\\S]+${feed.marker}[\\S]+`;
let currentMarkerLastIndex: any;
if (text.match(markerInside)) {
currentMarkerLastIndex = text.lastIndexOf( feed.marker, text.lastIndexOf(feed.marker) - 1);
} else {
currentMarkerLastIndex = text.lastIndexOf( feed.marker );
}

if ( currentMarkerLastIndex > 0 && !text.substring( currentMarkerLastIndex - 1 ).match( feed.pattern ) ) {
continue;
Expand Down