在'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