Browse Source

Prevent submitting before editor loaded

master
Menci 6 years ago
parent
commit
a7683f302c
  1. 4
      views/admin_raw.ejs
  2. 4
      views/article.ejs
  3. 4
      views/article_edit.ejs
  4. 4
      views/contest_edit.ejs
  5. 4
      views/problem_edit.ejs
  6. 4
      views/user_edit.ejs

4
views/admin_raw.ejs

@ -19,11 +19,13 @@ window.onEditorLoaded(function () {
$('form').on('submit', function () { $('form').on('submit', function () {
input.val(editor.getValue()); input.val(editor.getValue());
}); });
$('#submit_button').removeClass('disabled');
}); });
</script> </script>
<div style="text-align: center; "> <div style="text-align: center; ">
<button class="ui blue labeled icon button"><i class="ui edit icon"></i>提交</button> <button id="submit_button" class="ui disabled blue labeled icon button"><i class="ui edit icon"></i>提交</button>
</div> </div>
</form> </form>
<% include admin_footer %> <% include admin_footer %>

4
views/article.ejs

@ -102,7 +102,7 @@
</div> </div>
<input type="hidden" name="comment"> <input type="hidden" name="comment">
<div style="text-align: center; "> <div style="text-align: center; ">
<button type="submit" class="ui labeled submit icon button"> <button id="submit_button" type="submit" class="ui disabled labeled submit icon button">
<i class="icon edit"></i> 回复 <i class="icon edit"></i> 回复
</button> </button>
</div> </div>
@ -119,6 +119,8 @@
var input = document.getElementsByName(name)[0]; var input = document.getElementsByName(name)[0];
editor.editor = window.createMarkdownEditor(editorElement, editor.defaultValue, input); editor.editor = window.createMarkdownEditor(editorElement, editor.defaultValue, input);
} }
$('#submit_button').removeClass('disabled');
}); });
</script> </script>
<% } %> <% } %>

4
views/article_edit.ejs

@ -40,7 +40,7 @@
<div id="pv-content" class="font-content"></div> <div id="pv-content" class="font-content"></div>
</div> </div>
<div style="text-align: center; "> <div style="text-align: center; ">
<button type="submit" class="ui labeled submit icon button"> <button id="submit_button" type="submit" class="ui disabled labeled submit icon button">
<i class="icon edit"></i> 提交 <i class="icon edit"></i> 提交
</button> </button>
</div> </div>
@ -59,6 +59,8 @@ window.onEditorLoaded(function () {
var input = document.getElementsByName(name)[0]; var input = document.getElementsByName(name)[0];
editor.editor = window.createMarkdownEditor(editorElement, editor.defaultValue, input); editor.editor = window.createMarkdownEditor(editorElement, editor.defaultValue, input);
} }
$('#submit_button').removeClass('disabled');
}); });
$(function () { $(function () {

4
views/contest_edit.ejs

@ -89,7 +89,7 @@
<label><span style="visibility: hidden; "> </span></label> <label><span style="visibility: hidden; "> </span></label>
</div> </div>
</div> </div>
<div style="text-align: center; "><button type="submit" class="ui labeled icon blue button"><i class="ui edit icon"></i>提交</button></div> <div style="text-align: center; "><button id="submit_button" type="submit" class="ui disabled labeled icon blue button"><i class="ui edit icon"></i>提交</button></div>
</div> </div>
</form> </form>
<script> <script>
@ -105,6 +105,8 @@ window.onEditorLoaded(function () {
var input = document.getElementsByName(name)[0]; var input = document.getElementsByName(name)[0];
editor.editor = window.createMarkdownEditor(editorElement, editor.defaultValue, input); editor.editor = window.createMarkdownEditor(editorElement, editor.defaultValue, input);
} }
$('#submit_button').removeClass('disabled');
}); });
$(function () { $(function () {

4
views/problem_edit.ejs

@ -97,7 +97,7 @@
</div> </div>
<% if (problem.allowedEdit) { %> <% if (problem.allowedEdit) { %>
<div style="text-align: center; "> <div style="text-align: center; ">
<button type="submit" class="ui labeled submit icon button"> <button type="submit" id="submit_button" class="ui disabled labeled submit icon button">
<i class="icon edit"></i> 提交 <i class="icon edit"></i> 提交
</button> </button>
</div> </div>
@ -120,6 +120,8 @@ window.onEditorLoaded(function () {
var input = document.getElementsByName(name)[0]; var input = document.getElementsByName(name)[0];
editor.editor = window.createMarkdownEditor(editorElement, editor.defaultValue, input); editor.editor = window.createMarkdownEditor(editorElement, editor.defaultValue, input);
} }
$('#submit_button').removeClass('disabled');
}); });
$(function () { $(function () {

4
views/user_edit.ejs

@ -87,7 +87,7 @@
</div> </div>
</div> </div>
<div style="text-align: center; margin-top: 30px; "> <div style="text-align: center; margin-top: 30px; ">
<button type="submit" class="ui blue labeled icon button"><i class="ui icon edit"></i>修改</button> <button id="submit_button" type="submit" class="ui disabled blue labeled icon button"><i class="ui icon edit"></i>修改</button>
<a href="<%= syzoj.utils.makeUrl(['user', edited_user.id]) %>" class="ui labeled icon button"><i class="ui icon angle left"></i>返回</a> <a href="<%= syzoj.utils.makeUrl(['user', edited_user.id]) %>" class="ui labeled icon button"><i class="ui icon angle left"></i>返回</a>
</div> </div>
</div> </div>
@ -114,6 +114,8 @@ window.onEditorLoaded(function () {
var input = document.getElementsByName(name)[0]; var input = document.getElementsByName(name)[0];
editor.editor = window.createMarkdownEditor(editorElement, editor.defaultValue, input); editor.editor = window.createMarkdownEditor(editorElement, editor.defaultValue, input);
} }
$('#submit_button').removeClass('disabled');
}); });
function make_md5(tag) { function make_md5(tag) {

Loading…
Cancel
Save