在'put'请求更新对象字段之后,我遇到ACE编辑器问题(使用django rest framework,它使用PUT/PATCH/DELETE/OPTIONS方法使用Ajax Form) 。放置请求后ACE编辑器呈现错误
我目前在表单中隐藏一个textarea,并用ace编辑器替换,更改textarea时更改了编辑器的内容。
然而,在说 - 会发生以下情况
成为
,我不知道怎么回事。可能是ace/css/ace_editor.css没有加载,但我不知道为什么会发生这种情况...
任何帮助将不胜感激!
$(function() {
$('textarea[name=SQL]').each(function() {
console.log('new editor');
$('form').find('textarea[name=SQL]').attr('id','textarea-code');
$('#textarea-code').parent().append('<div id="ace-editor" class="ace-editor-class" style="height: auto;min-height:100px"></div>');
var editor = ace.edit("ace-editor");
editor.setTheme("ace/theme/crimson_editor");
editor.getSession().setMode("ace/mode/sql");
var textarea = $('#textarea-code').css('display', 'none');
editor.getSession().setValue(textarea.val());
editor.getSession().on('change', function(){
textarea.val(editor.getSession().getValue());
editor.resize(true);
});
});
});
你的意思是“在http放置请求后”和“放置”是什么意思?哪些资源正在“推出”?这个HTML在HTTP PUT请求中吗? –
用更多的信息更新了问题:) – Liz