Skip to content

Commit

Permalink
提交上线SQL时删除默认提示 (#2704)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: 王飞 <fei.wang@xgo.one>
  • Loading branch information
feiazifeiazi and 王飞 authored Jul 2, 2024
1 parent 5c9e83f commit 52ce759
Showing 1 changed file with 19 additions and 1 deletion.
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

0 comments on commit 52ce759

Please sign in to comment.