1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-03-07 04:47:44 +01:00

fix: query editor table fields suggestion

This commit is contained in:
Fabio Di Stasio 2022-04-28 13:22:15 +02:00
parent 9f0ec5e0ce
commit e9dedfaf32

@ -30,18 +30,21 @@ export default {
},
emits: ['update:modelValue'],
setup () {
const editor = null;
const applicationStore = useApplicationStore();
const { setBaseCompleters } = applicationStore;
const { baseCompleter } = storeToRefs(applicationStore);
return {
editor,
baseCompleter,
setBaseCompleters
};
},
data () {
return {
editor: null,
cursorPosition: 0,
fields: [],
customCompleter: [],
id: null,
@ -139,9 +142,6 @@ export default {
return 'sql';
}
},
cursorPosition () {
return this.editor.session.doc.positionToIndex(this.editor.getCursorPosition());
},
lastWord () {
const charsBefore = this.modelValue.slice(0, this.cursorPosition);
const words = charsBefore.replaceAll('\n', ' ').split(' ').filter(Boolean);
@ -167,6 +167,9 @@ export default {
}
},
watch: {
modelValue () {
this.cursorPosition = this.editor.session.doc.positionToIndex(this.editor.getCursorPosition());
},
editorTheme () {
if (this.editor)
this.editor.setTheme(`ace/theme/${this.editorTheme}`);