[BUG反饋]當新增兩個,或兩個以上富文字時其中一個富文字框的內容無法正常儲存到資料庫

發表於2019-05-11
如題。 當在模型裡新建一個模型,並在模型中新增兩個編輯器,然後去內容裡提交,這兩個編輯器只能儲存其中一個編輯器的內容,另一個無法儲存。由於如果匯入兩個編輯器,Addons/EditorForAdmin/content.html中的模板"var editor;"變數重名衝突,下面那個editor就會覆蓋上一個editor的變數。建議修改。

我的修改如下,尚能正常使用:
<script type="text/javascript">
 eval('var {$addons_data.name};');
 KindEditor.ready(function(K) {
 eval("{$addons_data.name} = K.create(\"textarea[name='{$addons_data.name}']\", { allowFileManager : false, themesPath: K.basePath, width: \"100%\", height: \"{$addons_config.editor_height}\",resizeType: {$addons_config.editor_resize_type}, pasteType : 2, urlType : \"absolute\", fileManagerJson : \"{:U('fileManagerJson')}\",uploadJson : \"{:addons_url('EditorForAdmin://Upload/ke_upimg')}\", extraFileUploadParams: { session_id : \"{:session_id()}\" } });");
 });

 $(function(){
 //傳統表單提交同步
 $('textarea[name="{$addons_data.name}"]').closest('form').submit(function(){
     eval("{$addons_data.name}.sync()");
   });
 //ajax提交之前同步
 $('button[type="submit"],#submit,.ajax-post,#autoSave').click(function(){
     eval("{$addons_data.name}.sync()");
   });
 })
 </script>
回覆
最新開發版已修復
評論

相關文章