mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-20 14:45:56 +08:00
Add support to characters in smartAnnotation [SCI-8656] (#5617)
Co-authored-by: Sboursen <dev.sboursen@gmail.com>
This commit is contained in:
parent
b4d4043271
commit
c71d8df470
|
@ -26,10 +26,12 @@ var SmartAnnotation = (function() {
|
|||
var $html = $(html);
|
||||
var $liText = $html.find('.item-text, .sa-type');
|
||||
if ($liText.length === 0 || !query) return html;
|
||||
const highlightRegex = new RegExp(query.replace(/[()]/g, '\\$&')
|
||||
.split(' ')
|
||||
.join('|'), 'gi');
|
||||
|
||||
$.each($liText, function(i, item) {
|
||||
$(item).html($(item).text().replace(new RegExp(query.split(' ').join('|'), 'gi'),
|
||||
'<span class="atwho-highlight">$&</span>'));
|
||||
$.each($liText, function(_i, item) {
|
||||
$(item).html($(item).text().replace(highlightRegex, '<span class="atwho-highlight">$&</span>'));
|
||||
});
|
||||
|
||||
return $html;
|
||||
|
@ -111,10 +113,12 @@ var SmartAnnotation = (function() {
|
|||
}
|
||||
a = decodeURI('%C3%80');
|
||||
y = decodeURI('%C3%BF');
|
||||
regexp = new RegExp(`${cleanedFlag}$|${cleanedFlag}(\\S[A-Za-z${a}-${y}0-9_/:\\s+-]*)$|${cleanedFlag}(\\S[^\\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[1] || '';
|
||||
return (match[1] || '').trim();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue