Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check problem #5471

Open
sxw66 opened this issue Jan 23, 2024 · 1 comment
Open

check problem #5471

sxw66 opened this issue Jan 23, 2024 · 1 comment

Comments

@sxw66
Copy link

sxw66 commented Jan 23, 2024

Describe the bug

I want to add check check error, when I add useWorker: true in options, it does not work, must import ace from "ace-builds"; Then set ace.config.setModuleURL ("ace/mode/json_worker", workerJsonUrl);
Because I use VUE3 + TS syntax, when I set setModuleUrl, it reported a type error, so I need to add a global.d.ts to solve this problem, which is troublesome. The verification problem must be handled inside the package. Another problem is that I want to check if my input is correct when I lose focus, and this method like validate is not provided for me, so I have to take the write check myself which is not reasonable

Expected Behavior

Expected result If you want to fix this check method, just use options: configure useWorker: true to enable the check without me having to set it up again
ace.config.setModuleUrl("ace/mode/json_worker", workerJsonUrl); This is too much trouble. Hope we can fix this bug
My environment is VUE3 vite + ts, I don't know whether it is my configuration problem or the bug of the package, and I hope the author can add a verification method to it so that we don't need to judge when we lose focus in the local area

Current Behavior

Uploading bugs.png…

Reproduction Steps

// 表格搜索参数-【body模式】-输入项改变事件
const onJsonBlur = (val, aaa) => {
// vue3-ace-editor
try {
JSON.parse(dataForm.textareashow);
ElMessage.success("JSON 格式正确");
emits(
"handeParmsFormData",
state.ParmsObjectData,
state.HeaderObjectData,
dataForm.textareashow
);
} catch (error) {
console.error("error", error);
const errorMessage = JSON 格式错误:${error.message};
ElMessage.error(errorMessage);
}
};

Possible Solution

No response

Additional Information/Context

No response

Ace Version / Browser / OS / Keyboard layout

"ace-builds": "^1.32.3",

@akoreman
Copy link
Contributor

Hey, thanks for your issue. If I read you correctly the main issue you're raising here is that types not being properly defined for setModuleUrl.

Regarding the fetching of errors on losing focus, you can use editor.session.getAnnotations() on losing focus to get all the errors/warnings collected by Ace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants