芝麻web文件管理V1.00
编辑当前文件:/home/soundframestudio/www/wp-content/themes/betheme/visual-builder/assets/js/forms/fields/ace.js
function mfn_field_ace(field = false) { let html = `
`; setTimeout(function() {initAceEditor(field);}, 50); return html; } function initAceEditor(field = false) { ace.require("ace/ext/language_tools"); var editor = ace.edit("editor"); editor.session.setMode("ace/mode/html"); if( jQuery('#mfn-visualbuilder').hasClass('mfn-ui-dark') ){ editor.setTheme("ace/theme/tomorrow_night"); }else{ editor.setTheme("ace/theme/tomorrow"); } editor.setOptions({ minLines: 20, maxLines: Infinity, showGutter: true, useWorker: true, wrap: true, enableBasicAutocompletion: true, enableLiveAutocompletion: true }); if( _.has(edited_item['attr'], field.id) && edited_item['attr'][field.id].length ){ editor.setValue( edited_item['attr'][field.id] ); } editor.session.on('change', function(delta) { var val = editor.getValue(); if( !val ){ $content.find('.mcb-item-'+edited_item.uid+' .mfn-html-editor-wrapper').html('
'); }else{ let ready_html = val .replaceAll('', '') .replaceAll('', '') .replaceAll('', '') .replaceAll('', '
') .replaceAll('', ''); $content.find('.mcb-item-'+edited_item.uid+' .mfn-html-editor-wrapper').html(ready_html); } if( !_.has(edited_item, 'attr') ) edited_item.attr = {}; edited_item.attr[field.id] = val; }); }