<script type="text/javascript" charset="utf-8" src="<?php echo $this->basePath('/editor/ueditor/ueditor.config.js'); ?>"></script>
<script type="text/javascript" charset="utf-8" src="<?php echo $this->basePath('/editor/ueditor/ueditor.all.min.js'); ?>"></script>
<script>
    //实例化编辑器，关闭（开启也无用，没有对应的服务器端处理）了远程抓取图片功能
    <?php if($this->edit_array) {
    echo "var editorOption = {";
    if(is_array($this->edit_config) and !empty($this->edit_config)) {
        $editConfigStr = @implode(',',$this->edit_config);
        //当不需要上传时，设置serverUrl为空
        if (stripos($editConfigStr, 'serverUrl') === false) $editConfigStr .= ',serverUrl:""';

        echo $editConfigStr;

        if (stripos($editConfigStr, 'toolbars:') === false) {
            echo (!empty($editConfigStr) ? ',' : '')."toolbars: [[
            'fullscreen', 'source', '|', 'undo', 'redo', '|',
            'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
            'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
            'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
            'directionalityltr', 'directionalityrtl', 'indent', '|',
            'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
            'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
            'simpleupload', 'insertimage', 'emotion', 'insertvideo', 'map', '|',
            'horizontal', 'date', 'time', 'spechars', '|',
            'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', '|',
            'print', 'preview', 'help'
        ]]";
        }
    } else {
        echo ",initialFrameWidth:'100%',initialFrameHeight:500,autoHeightEnabled:false";
    }
    echo ",catchRemoteImageEnable:false,elementPathEnabled:false,wordCount:false,enableAutoSave:false,saveInterval:0};";

    foreach ($this->edit_array as $key => $value) {
    ?>
    var ue<?php echo $key; ?> = new UE.ui.Editor(editorOption);
    ue<?php echo $key; ?>.render('<?php echo $value; ?>');
    <?php
    }
    } ?>
</script>