TinyMCE+;jQuery+;自定义插件=tinymce未定义?

TinyMCE+;jQuery+;自定义插件=tinymce未定义?,jquery,tinymce,wysiwyg,Jquery,Tinymce,Wysiwyg,当我尝试创建一个小插件,允许我在网站的所有文本区域上打开和关闭所见即所得时,问题就出现了 //$('form.default textarea').each(function(){ // console.log( $('<a href="#">Enable WYSIWYG editor</a>').insertAfter('form.default textarea').prev('textarea.wysiwyg').tinymce().hide() ); //});

当我尝试创建一个小插件,允许我在网站的所有文本区域上打开和关闭所见即所得时,问题就出现了

//$('form.default textarea').each(function(){
// console.log( $('<a href="#">Enable  WYSIWYG editor</a>').insertAfter('form.default textarea').prev('textarea.wysiwyg').tinymce().hide() );
//});
/$('form.default textarea')。每个(函数(){
//console.log($('').insertAfter('form.default textarea').prev('textarea.wysiwyg').tinymce().hide());
//});
完整(稍微简化)的代码如下所示:

$('textarea.wysiwyg').tinymce({
  skin : 'cirkuit',
  theme : 'advanced',
  plugins : 'pagebreak,style,layer,advlink,inlinepopups,contextmenu,paste,directionality,noneditable,nonbreaking,xhtmlxtras,template',
  // Theme options
  theme_advanced_buttons1 : 'formatselect,fontsizeselect,forecolor,|,bold,italic,strikethrough,|,bullist,numlist,|,justifyleft,justifycenter,justifyright,|,link,unlink,|,image,|,code,paste,pastetext,pasteword,removeformat,|,backcolor,|,underline,justifyfull,sup,|,outdent,indent,|,hr,charmap,|,undo,redo',
  theme_advanced_buttons2 : '',
  theme_advanced_buttons3 : '',
  theme_advanced_toolbar_location : 'top',
  theme_advanced_toolbar_align : 'left',
  theme_advanced_statusbar_location: 'bottom',
  theme_advanced_resizing : true,
  theme_advanced_resize_horizontal : false,
  height : 500,
  theme_advanced_resizing_min_height : 500,
  document_base_url : 'http://static.<?=$settings['system_host']?>/'
 });

 $('textarea.wysiwyg').each(function() {
  $(this).tinymce().hide();
 });
$('textarea.wysiwyg').tinymce({
皮肤:“cirkuit”,
主题:"先进",,
插件:'pagebreak,style,layer,advlink,inlinepopups,contextmenu,paste,directionality,NoEdit,NoBreaking,xhtmlxtras,template',
//主题选项
主题高级按钮1:“格式选择、字体大小选择、前景色、粗体、斜体、删除线、粗体、数字列表、右对齐、左对齐、居中对齐、右对齐、链接、取消链接、图像、代码、粘贴、粘贴文本、粘贴字、删除格式、背景色、下划线、对齐、上对齐、下对齐、缩进、下对齐、缩进、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、上对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、上对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐、下对齐,
主题\高级\按钮2:“”,
主题\高级\按钮3:“”,
主题\高级\工具栏\位置:'顶部',
主题\u高级\u工具栏\u对齐:“左”,
主题\高级\状态栏\位置:'底部',
主题\u高级\u大小调整:正确,
主题\u高级\u调整大小\u水平:false,
身高:500,
主题\u高级\u大小调整\u最小\u高度:500,
文档库url:'http://static./'
});
$('textarea.wysiwyg')。每个(函数(){
$(this.tinymce().hide();
});
错误是什么?FireBug说未定义的tinymce();此消息出现在每个()循环中。因此,tinymce()实际上已初始化


我真的很迷茫,是什么导致了这一点。

这里有一个切换功能,就像您正在寻找的:

使用:

<a href="#" title="toogle TinyMCE" onclick="toogleEditorMode('pagecontent');">Toogle TinyMCE</a>

我怀疑您的问题是在tinyMCE使用自己的JavaScript库时使用jQuery来实现这一点。它显然不喜欢隐藏。我会使用一些类似的例子,因为我们知道它是有效的

<a href="#" title="toogle TinyMCE" onclick="toogleEditorMode('pagecontent');">Toogle TinyMCE</a>