我想elFinder
与TinyMCE集成。更具体地说,将其作为TinyMCE上的某个按钮提供(例如insert picture
对话框内部)。
到目前为止我做了什么:
1.在protected/extensions
文件夹下有Newtinymce,elfinder扩展。(作者说将这两者整合在代码中会更干净)
2.具有ElfinderController
,TinyMceController
如扩展页面所述。
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,
),
)); ?>
这给了我TinyMCE编辑器elFinder
没有窗口作为TinyMCE上的按钮(如insert picture
对话框内)。
当我添加以下内部视图文件时,它直接为我提供了一个放置代码的elFinder
区域。
<?php $this->widget('ext.elFinder.ServerFileInput', array(
'model' => $model,
'attribute' => 'content',
'connectorRoute' => 'elfinder/connector',
)
);?>
我想这意味着elFinder
正在工作。但我不希望它作为字段的单独小部件,而是希望它成为顶部所述TinyMCE
的一部分。
集成它们还需要什么?
这是一个形象问题。 fileManager
财产不是settings
的孩子,而是兄弟姐妹。
所以config/main.php
部分应该是这样的:
'widgetFactory'=>array(
'widgets'=>array(
'TinyMce'=>array(
'language'=>'en',
'settings'=>array(...),
'fileManager'=>array(
'class' => 'ext.elFinder.TinyMceElFinder',
'connectorRoute'=>'elfinder/connector',
),