Update regexp for smart annotation

This commit is contained in:
aignatov-bio 2020-09-23 11:13:59 +02:00
parent e288a1f911
commit 21dcf1157c

View file

@ -104,10 +104,10 @@ var SmartAnnotation = (function() {
}
a = decodeURI('%C3%80');
y = decodeURI('%C3%BF');
regexp = new RegExp(cleanedFlag + `([A-Za-z${a}-${y}0-9_/:\\s+-]*)$|${cleanedFlag}([^\\x00-\\xff]*)$`, 'gi');
regexp = new RegExp(`${cleanedFlag}$|${cleanedFlag}(\\S[A-Za-z${a}-${y}0-9_/:\\s+-]*)$|${cleanedFlag}(\\S[^\\x00-\\xff]*)$`, 'gi');
match = regexp.exec(subtext);
if (match) {
return match[2] || match[1];
return match[1] || '';
}
return null;
}
@ -123,7 +123,7 @@ var SmartAnnotation = (function() {
$(field)
.on('shown.atwho', function() {
var $currentAtWho = $('.atwho-view[style]:not(.old)');
var atWhoId = $currentAtWho.find('.atwho-header-res').data('at-who-key')
var atWhoId = $currentAtWho.find('.atwho-header-res').data('at-who-key');
$currentAtWho.addClass('old').attr('data-at-who-id', atWhoId);
$(field).attr('data-smart-annotation', atWhoId);
@ -140,7 +140,7 @@ var SmartAnnotation = (function() {
});
if ($currentAtWho.find('.tab-pane.active').length === 0) {
let filterType = DEFAULT_SEARCH_FILTER.tag;
let filterType = DEFAULT_SEARCH_FILTER.tag;
let teamId = $currentAtWho.find('.atwho-header-res').data('team-id');
let remeberedState = localStorage.getItem('smart_annotation_states/teams/' + teamId);
if (remeberedState) {