Don't show popup at beginning of input and only when there are results
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2bb0c01914
commit
c0850e44c4
|
@ -165,13 +165,21 @@ if (holder) {
|
|||
let value = input.value
|
||||
let end = input.selectionEnd
|
||||
let start = value.lastIndexOf("[[", end)
|
||||
if (start < 0) {
|
||||
return true
|
||||
}
|
||||
|
||||
let linkEnd = value.lastIndexOf("]]", end - 1)
|
||||
if (start < linkEnd) {
|
||||
return
|
||||
return true
|
||||
}
|
||||
let query = value.substring(start+2, end);
|
||||
let results = search.search(query)
|
||||
|
||||
if (results.length === 0) {
|
||||
return true
|
||||
}
|
||||
|
||||
let pos = getCaretCoordinates(input, value.selectionEnd, {})
|
||||
let off = $(input).offset()
|
||||
pos.top += off.top + pos.height
|
||||
|
@ -183,6 +191,7 @@ if (holder) {
|
|||
var template = document.getElementById('link-template').innerHTML;
|
||||
var rendered = Mustache.render(template, {results: results}, {}, ['[[', ']]']);
|
||||
$lc.html(rendered).fadeIn()
|
||||
return true
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user