我需要将CKEditor 4.0升级到4.3。一切都很好,除了InlineCKeditor不想使用保存按钮。我收到错误:"Uncaught TypeError: Object Esave has no method 'render' "
。 Esave重命名为插件保存http://ckeditor.com/addon/save。我试图将此插件更改为最新的插件,将其重命名为esave,并在不重命名的情况下使用它,但仍会出现相同的错误。
我应该更改什么才能使“保存”按钮再次起作用?
这是InlineCKeditor代码,其中错误来自:
<?php
Yii::import('ext.widgets.inline.InlineEdit');
class InlineCKeditor extends InlineEdit
{
/**
* @var string path for CKeditor init script
*/
protected $tinyMceInitPath;
protected function loadCustomScript()
{
parent::loadCustomScript();
$this->scriptLogics();
Yii::app()->wysiwyg->getWysiwyg();
}
protected function scriptLogics()
{
$script = "
CKEDITOR.config.extraPlugins = 'esave,doNothing';
// The 'instanceCreated' event is fired for every editor instance created.
CKEDITOR.on( 'instanceCreated', function( event ) {
var editor = event.editor,
element = editor.element;
// Customize editors for headers and tag list.
// These editors don't need features like smileys, templates, iframes etc.
if ( $.inArray('ckeditor',element.$.classList) >= 0 ) {
// Customize the editor configurations on 'configLoaded' event,
// which is fired after the configuration file loading and
// execution. This makes it possible to change the
// configurations before the editor initialization takes place.
editor.on( 'configLoaded', function() {
// Remove unnecessary plugins to make the editor simpler.
editor.config.removePlugins = 'colorbutton,find,font,' +
'forms,iframe,newpage,removeformat,scayt,flash,' +
'smiley,stylescombo,templates,wsc, pagebreak';
// Rearrange the layout of the toolbar.
editor.config.toolbarGroups = [
{ name: 'editing', groups: [ 'basicstyles', 'links' ] },
{ name: 'insert'},
{ name: 'undo' },
'/',
{ name: 'styles'},
{ name: 'indents', groups: ['list', 'align','bidi']},
{ name : 'others', items : [ 'Esave' ] }
];
});
}else{
editor.on( 'configLoaded', function() {
editor.config.keystrokes =
[
//deleted
];
editor.config.removePlugins = 'a11yhelp,about,basicstyles,bidi,blockquote,' +
'clipboard, colorbutton, colordialog,contextmenu,dialog,dialogui,div,elementspath,' +
'enterkey,entities,filebrowser,find,flash,floatpanel,font,format,' +
'forms,horizontalrule,htmlwriter,iframe,image,indent,justify,link,list,listblock,liststyle,magicline,' +
'maximize,menu,menubutton,newpage,panel,panelbutton,pastefromword,pastetext,popup,preview,print,' +
'removeformat,resize,richcombo,save,scayt,selectall,showblocks,showborders,smiley,sourcearea,specialchar,stylescombo,' +
'tab,table,tabletools,templates,wsc,wysiwygarea';
editor.config.toolbarGroups = [{ name : 'others', items : [ 'Esave' ] }];
});
}
});
";
Yii::app()->clientScript->registerScript('editor_rules', $script, CClientScript::POS_BEGIN);
}
protected function getEditableClass()
{
return 'ckeditor edit_' . static::$innerIncrement;
}
}
答案 0 :(得分:0)
你确定它与Yii有某种关系吗?
关于CKEditor插件 - 你不能只在配置中重命名它,所以问题主要在这里。