mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-09 15:57:26 +02:00
autocomplete by the word up to the the caret position
This commit is contained in:
1 parent
fd5b9e5f75
commit
3c9427667d
7 files changed
+10
-9
No files matched your search
@@ -209,9 +209,9 @@ window.app.components.codeEditor = function(propsArg = {}) {
|
||||
|
||||
let suggestions = [];
|
||||
if (typeof props.autocomplete == "function") {
|
||||
suggestions = props.autocomplete(match.word) || [];
|
||||
suggestions = props.autocomplete(match.prefix || match.word) || [];
|
||||
} else if (!app.utils.isEmpty(props.autocomplete)) {
|
||||
const wordLowercased = match.word.toLowerCase();
|
||||
const wordLowercased = (match.prefix || match.word).toLowerCase();
|
||||
suggestions = props.autocomplete.filter((item) => {
|
||||
if (typeof item == "object") {
|
||||
item = item?.value;
|
||||
@@ -460,6 +460,7 @@ function getWord(value, caretPos) {
|
||||
|
||||
return {
|
||||
word: value.substring(start, end + 1),
|
||||
prefix: value.substring(start, caretPos),
|
||||
start: start,
|
||||
end: end,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user