mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-07 13:44:23 +08:00
Merge pull request #4657 from artoscinote/ma_SCI_7534
Move atwho initialization to when a field is focused [SCI-7534]
This commit is contained in:
commit
7cc09faa94
1 changed files with 14 additions and 11 deletions
|
@ -122,8 +122,10 @@ var SmartAnnotation = (function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
$(field)
|
$(field).on('focus', function() {
|
||||||
.on('shown.atwho', function() {
|
if ($(this).data('atwho-initialized')) return;
|
||||||
|
|
||||||
|
$(field).on('shown.atwho', function() {
|
||||||
var $currentAtWho = $('.atwho-view[style]:not(.old)');
|
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);
|
$currentAtWho.addClass('old').attr('data-at-who-id', atWhoId);
|
||||||
|
@ -157,8 +159,7 @@ var SmartAnnotation = (function() {
|
||||||
}
|
}
|
||||||
$currentAtWho.find(`.${filterType}`).click();
|
$currentAtWho.find(`.${filterType}`).click();
|
||||||
}
|
}
|
||||||
})
|
}).on('reposition.atwho', function(event, flag, query) {
|
||||||
.on('reposition.atwho', function(event, flag, query) {
|
|
||||||
let inputFieldLeft = query.$inputor.offset().left;
|
let inputFieldLeft = query.$inputor.offset().left;
|
||||||
if (inputFieldLeft > $(window).width()) {
|
if (inputFieldLeft > $(window).width()) {
|
||||||
let leftPosition;
|
let leftPosition;
|
||||||
|
@ -172,8 +173,7 @@ var SmartAnnotation = (function() {
|
||||||
if ($('.repository-show').length) {
|
if ($('.repository-show').length) {
|
||||||
query.$el.find('.atwho-view').css('top', flag.top + 'px');
|
query.$el.find('.atwho-view').css('top', flag.top + 'px');
|
||||||
}
|
}
|
||||||
})
|
}).atwho({
|
||||||
.atwho({
|
|
||||||
at: '@',
|
at: '@',
|
||||||
callbacks: {
|
callbacks: {
|
||||||
remoteFilter: function(query, callback) {
|
remoteFilter: function(query, callback) {
|
||||||
|
@ -202,6 +202,9 @@ var SmartAnnotation = (function() {
|
||||||
// .atwho(atWhoSettings('project#', FilterTypeEnum.PROJECT))
|
// .atwho(atWhoSettings('project#', FilterTypeEnum.PROJECT))
|
||||||
// .atwho(atWhoSettings('experiment#', FilterTypeEnum.EXPERIMENT))
|
// .atwho(atWhoSettings('experiment#', FilterTypeEnum.EXPERIMENT))
|
||||||
// .atwho(atWhoSettings('sample#', FilterTypeEnum.REPOSITORY));
|
// .atwho(atWhoSettings('sample#', FilterTypeEnum.REPOSITORY));
|
||||||
|
|
||||||
|
$(this).data('atwho-initialized', true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Add table
Reference in a new issue