fix: 公式变量点选时嵌套问题 (#4974)

This commit is contained in:
Allen 2022-07-26 17:07:48 +08:00 committed by GitHub
parent 4de1093d6d
commit 3860549a48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,6 +35,7 @@ export class FormulaPlugin {
if (value) {
// todo functions 也需要自动替换
this.autoMark(variables!);
this.focus(value);
}
}
@ -76,7 +77,7 @@ export class FormulaPlugin {
if (braces.length) {
for (let index = 0; index < braces.length; index++) {
const brace = braces[index];
if (from > brace.begin && to <= brace.end) {
if (from >= brace.begin && to <= brace.end) {
isIn = true;
break;
}
@ -228,6 +229,14 @@ export class FormulaPlugin {
}
}
// 焦点放在最后
focus(value: string) {
this.editor.setCursor({
line: 0,
ch: value?.length || 0
});
}
dispose() {}
validate() {}