1

我想elFinder与 TinyMCE 集成。更具体地说,将其作为TinyMCE 上某处的按钮insert picture(如对话框内部)提供。

到目前为止我所做的:
1. 在文件夹下有newtinymceelfinder扩展protected/extensions。(作者说将这两者集成在代码中会更简洁)
2. have ElfinderControllerTinyMceController如扩展页面所述。
3.内protected/config/main.php component段:

    'widgetFactory'=>array(
        'widgets'=>array(
            'TinyMce'=>array(
                'language'=>'en',
                'settings'=>array(
                    'language' => 'en',
                    'theme' => "advanced",
                    'skin' => 'o2k7',
                    'plugins' => "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",

                    // Theme options
                    'theme_advanced_buttons1' => "removeformat,pagebreak,visualchars,visualaid,|,insertlayer,moveforward,movebackward,absolute,styleprops,attribs,|,undo,redo,search,replace,cleanup,print,preview,save,newdocument",
                    'theme_advanced_buttons2' => "pastetext,pasteword,|,hr,blockquote,|,bullist,numlist,outdent,indent,justifyleft,justifycenter,justifyright,justifyfull,ltr,rtl,formatselect",//copy,cut,paste,
                    'theme_advanced_buttons3' => "nonbreaking,sub,sup,charmap,|,bold,italic,underline,strikethrough,forecolor,backcolor,fontsizeselect,fontselect",
                    'theme_advanced_buttons4' => "tablecontrols,|,link,unlink,anchor,|,image,media",

                    'theme_advanced_toolbar_location' => "top",
                    'theme_advanced_toolbar_align' => "right",
                    'theme_advanced_statusbar_location' => "bottom",
                    'theme_advanced_resizing' => true,
                    'relative_urls' => false,
                    'spellchecker_languages' => null,

                    'fileManager'=>array(
                        'class' => 'ext.elFinder.TinyMceElFinder',
                        'connectorRoute'=>'elfinder/connector',

                    ),
                )
            )
        )
    ),  

4.在视图文件中:

    <?php
    $this->widget('ext.tinymce.TinyMce', array(
    'model' => $model,
    'attribute' => 'content',
    'compressorRoute' => 'tinyMce/compressor',
        'htmlOptions' => array(
        'rows' => 6,
        'cols' => 60,
    ),
    )); ?>  

这给了我没有elFinder窗口的 TinyMCE 编辑器作为 TinyMCE 某处的按钮(如insert picture对话框内部)。

当我添加以下内部视图文件时,它会直接给我一个放置代码 的elFinder 区域。

    <?php $this->widget('ext.elFinder.ServerFileInput', array(
      'model' => $model,
      'attribute' => 'content',
      'connectorRoute' => 'elfinder/connector',
      )
    );?>  

我想这意味着elFinder工作。但我不希望它作为字段的单独小部件,而是希望它成为顶部所述的 一部分。 TinyMCE

我还需要什么来集成它们?

4

1 回答 1

0

这是一个配置问题。fileManagerproperty 不是 的孩子settings,而是兄弟姐妹。
所以config/main.php部分应该是这样的:

'widgetFactory'=>array(
    'widgets'=>array(
        'TinyMce'=>array(
            'language'=>'en',
            'settings'=>array(...),
            'fileManager'=>array(
                'class' => 'ext.elFinder.TinyMceElFinder',
                'connectorRoute'=>'elfinder/connector',
            ),
于 2013-10-13T21:29:21.620 回答