I’m a little stuck. I’ve attempted to load the relevant files (those that are called by the Manager when TinyMCE is needed to edit a Resource):
// header.php
$modx->regClientStartupScript($modx->config[’assets_url’].’components/tinymce/jscripts/tiny_mce/tiny_mce.js’);
$modx->regClientStartupScript($modx->config[’assets_url’].’components/tinymce/xconfig.js’);
$modx->regClientStartupScript($modx->config[’assets_url’].’components/tinymce/tiny.min.js’);
// ...snip...
...and initialize an editor...
$modx->regClientStartupHTMLBlock(
’<script type="text/javascript">
Ext.onReady(function() {
tinyMCE.init({
theme : "advanced",
mode : "none",
theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,formatselect,removeformat,cleanup",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "center",
theme_advanced_styles : "Code=codeStyle;Quote=quoteStyle",
entity_encoding : "raw",
add_unload_trigger : false,
remove_linebreaks : false,
inline_styles : false,
convert_fonts_to_spans : false
});
// ...
});
</script>’);
Here’s the ExtJS window that contains the rich-text field:
Shepherd.window.CreateArticle = function(config) {
config = config || {};
Ext.applyIf(config,{
title: _('shepherd.article_create')
,url: Shepherd.config.connectorUrl
,baseParams: { action: 'mgr/article/create' }
,width: 800
,fields:
[{ xtype: 'textfield'
,fieldLabel: _('shepherd.article_title')
,name: 'title'
,width: 300
},{
xtype: 'textarea'
,fieldLabel: _('shepherd.article_content')
,name: 'content'
,id: 'shepherd-article-content'
,width: 600
},{
xtype: 'shepherd-combo-authors'
,fieldLabel: 'Author'
} ]
});
Shepherd.window.CreateArticle.superclass.constructor.call(this,config);
};
Blindly, I tried adding
tinyMCE.execCommand('mceToggleEditor', false, 'shepherd-article-content'); before the final line of the definition, to no avail.
Any help much appreciated.