【问题标题】:tinymce editor remove for some textareatinymce 编辑器删除一些文本区域
【发布时间】:2013-03-21 07:28:59
【问题描述】:

我有几个 textarea。我正在尝试删除除一个 textarea 之外的某些 textarea 的 tinymce。

我正在使用以下代码 sn-p 删除 tinymce。

    window.addEvent('load', function(){
      $$('textarea[id^="fields-"],textarea[id^="classified_photo_"]').each(function(item){
          tinyMCE.execCommand('mceFocus', false, item.get('id'));
          tinyMCE.execCommand("mceRemoveControl", false, item.get('id'));
          tinyMCE.triggerSave();
      })
    });

使用此代码后,我发现它正在删除 tinymce,但添加一些 html 标签可能来自 tinymce。

任何帮助都将不胜感激。

【问题讨论】:

  • 你为什么不编辑你的html模板?
  • @itskawsar 因为它来自社交引擎视图助手核心文件,我不想更改核心文件。谢谢
  • 在社交引擎中他们使用了 smarty 模板引擎。你应该检查一下。模板文件带有 tpl 扩展名。 :)
  • @itskawsar 没有社交引擎不使用 smarty。当社交引擎在引导时初始化前端控制器时,它只是将其视图后缀设置为 tpl,默认情况下为 phtml。

标签: zend-framework tinymce mootools socialengine


【解决方案1】:

关闭 tinymce 实例后,html 源元素(在您的情况下为 textareas)将再次生效。

【讨论】:

  • Thariama 感谢您的回复,我的问题是在我删除对 tinymce 的控制后,当我转到 textarea 源代码时,它仍然显示 html 标签,我只看到没有 html 的文本,但没有显示在那里。跨度>
  • 你确定你看到的真的是一个 textares 而不是其他类型的 html 元素(在这种情况下,brwoeser 将呈现 html 并且你只会看到文本内容)。你可以使用 firebug 来查看你是否得到了 palin 文本或呈现的 html 结构
  • Thariama 我不确定这是否是 textarea,但当我检查源代码时,我再也看不到 tinymce 编辑器的代码了。感谢您的回复。
【解决方案2】:

我正在使用社交引擎,并且在看到代码后我不想更改我的核心助手,我找到了以下解决方案,该解决方案使某些选定的 textarea 作为 tinymce 编辑器,其余的 textarea 保持不变,

$form = new Engine_Form();

$form->addElement('Tinymce', 'birthdate', array('editorOptions' => array('theme_advanced_buttons1' => array('undo', 'redo', 'cleanup', 'removeformat', 'pasteword', '|', 'code',
  'media', 'image', 'link', 'fullscreen', 'preview'), 'editor_selector' => 'mceEditor')))->setAttrib('class', 'mceEditor');
$form->birthdate->setAttrib('class', 'mceEditor');

这里 editorOptions 数组键设置 tinymce 配置。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多