{
xtype: 'textarea'
,fieldLabel: _('narkfaqs.question_text')
,name: 'question_text'
,height: '100'
,id: 'question_text'
,anchor: '100%'
},{
xtype: 'textarea'
,fieldLabel: _('narkfaqs.answer_text')
,name: 'answer_text'
,height: '100'
,id: 'answer_text'
,anchor: '100%'
}NarkFaqs.window.UpdateNarkFaq = function(config) {
config = config || {};
Ext.applyIf(config,{
title: _('narkfaqs.narkfaq_update')
,url: NarkFaqs.config.connectorUrl
,baseParams: {
action: 'mgr/narkfaq/update'
}
,fields: [{
xtype: 'hidden'
,name: 'id'
},{
xtype: 'textfield'
,fieldLabel: _('narkfaqs.question_author')
,name: 'question_author'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: _('narkfaqs.question_header')
,name: 'question_header'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: _('narkfaqs.linkid')
,name: 'linkid'
,anchor: '100%'
},{
xtype: 'textarea'
,fieldLabel: _('narkfaqs.question_text')
,name: 'question_text'
,id: 'question_text'
,height: '100'
,anchor: '100%'
},{
xtype: 'textarea'
,fieldLabel: _('narkfaqs.answer_text')
,name: 'answer_text'
,id: 'answer_text'
,height: '100'
,anchor: '100%'
},{
xtype: 'xcheckbox'
,name: 'published'
,boxLabel: _('narkfaqs.published')
}]
});
NarkFaqs.window.UpdateNarkFaq.superclass.constructor.call(this,config);
this.on('activate',function(w,e) { // Add this
MODx.loadRTE('question_text'); // Add this // Load by id [,id: 'question_text']
MODx.loadRTE('answer_text'); // Add this // Load by id [,id: 'answer_text']
},this); // Add this
};$plugin=$this->modx->getObject('modPlugin',array('name'=>'TinyMCE'));
$tinyPath = $this->modx->getOption('core_path').'components/tinymce/';
$tinyProperties=$plugin->getProperties();
require_once $tinyPath.'tinymce.class.php';
$tiny = new TinyMCE($this->modx, $tinyProperties);
$tinyProperties['language'] = $this->modx->getOption('cultureKey',null,$this->modx->getOption('manager_language',null,'en'));
$tinyProperties['frontend'] = true;
$tinyProperties['cleanup'] = true;
//$tinyProperties['width'] = 300;
$tinyProperties['height'] = 100;
$tinyProperties['tiny.custom_buttons1'] = 'undo,redo,separator,pastetext,search,replace,separator,cleanup,removeformat,tablecontrols,separator,modxlink,unlink,anchor,separator,image,media,separator,code';
$tinyProperties['tiny.custom_buttons2'] = 'formatselect,separator,forecolor,backcolor,separator,bold,italic,underline,separator,strikethrough,sub,sup,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,rj_insertcode,blockquote,separator,hr,charmap';
$tinyProperties['tiny.custom_buttons3'] = '';
$tiny->setProperties($tinyProperties);
$tiny->initialize();MODx.loadRTE('question_text');function __construct(modX &$modx,array $config = array()) {
// some code...
$this->activateRTE();
}
public function activateRTE(){
$plugin=$this->modx->getObject('modPlugin',array('name'=>'TinyMCE'));
$tinyPath = $this->modx->getOption('core_path').'components/tinymce/';
$tinyProperties=$plugin->getProperties();
require_once $tinyPath.'tinymce.class.php';
$tiny = new TinyMCE($this->modx, $tinyProperties);
$tinyProperties['language'] = $this->modx->getOption('cultureKey',null,$this->modx->getOption('manager_language',null,'ru'));
$tinyProperties['cleanup'] = true;
$tinyProperties['width'] = '100%';
$tinyProperties['height'] = 100;
$tinyProperties['tiny.custom_buttons1'] = 'undo,redo,separator,pastetext,search,replace,separator,cleanup,removeformat,tablecontrols,separator,modxlink,unlink,anchor,separator,image,media,separator,code';
$tinyProperties['tiny.custom_buttons2'] = 'formatselect,separator,forecolor,backcolor,separator,bold,italic,underline,separator,strikethrough,sub,sup,separator,justifyleft,justifycenter,justifyright,justifyfull';
$tinyProperties['tiny.custom_buttons3'] = '';
$tiny->setProperties($tinyProperties);
$tiny->initialize();
}// some code...
NarkFaqs.window.UpdateNarkFaq = function(config) {
config = config || {};
Ext.applyIf(config,{
title: _('narkfaqs.narkfaq_update')
,url: NarkFaqs.config.connectorUrl
,width: 510
// some code...
,fields: [
// some code...
{
xtype: 'textarea'
,fieldLabel: _('narkfaqs.question_text')
,name: 'question_text'
,id: 'question_text'
,height: '100'
,anchor: '100%'
},{
xtype: 'textarea'
,fieldLabel: _('narkfaqs.answer_text')
,name: 'answer_text'
,id: 'answer_text'
,height: '100'
,anchor: '100%'
}
// some code...
]
});
NarkFaqs.window.UpdateNarkFaq.superclass.constructor.call(this,config);
// Added from that line...
this.on('activate',function(w,e) {
MODx.loadRTE('question_text');
MODx.loadRTE('answer_text');
},this);
this.on('deactivate',function(w,e) {
tinyMCE.execCommand('mceRemoveControl',true,'question_text');
tinyMCE.execCommand('mceRemoveControl',true,'answer_text');
},this);
// To that line
};
// some code...