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

提交上线SQL时删除默认提示 #2704

Merged
merged 7 commits into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion sql/templates/sqlsubmit.html
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,27 @@ <h4 class="modal-title text-danger">提交信息确认</h4>
}
return true
}


function removeStartsWith(str,prefix) {
if (typeof str !== 'string' || str === null) {
return str;
}
if (str.startsWith(prefix)) {
return str.substring(prefix.length);
}
return str;
};
$("#btn-autoreview").click(function () {
//先做表单验证成功了提交ajax给后端
const sqlTips = "-- 请在此输入SQL,以分号结尾,仅支持DML和DDL语句,查询语句请使用SQL查询功能。\n";
var editorValue=editor.getValue();
// 删除默认的提示字符串
editorValueRemove=removeStartsWith(editorValue,sqlTips);
if(editorValue!==editorValueRemove)
{
editor.setValue(editorValueRemove);
}
$("#sql_content").val(editorValueRemove);
$("#sql_content").val(editor.getValue());
if (validateForm($("#form-submitsql")) && checkRunDate()) {
autoreview();
Expand Down
Loading