2012-01-17 76 views
0

我想要的是将TinyMce wysiwyg编辑器插入到前端。目前我所拥有的是:在按钮上单击ajax请求的首页使用tinymce.init脚本加载textarea。 tiny_mce.js文件被加载到头部。当我打开可编辑的textarea,我能够写东西,但我在html结构是什么样的Magento。正确插入wysiwyg

false> false> false> false> false> false> false> false> false> false> false> false > false> false> false> false> false> false> false> false> false> false> false> false> false> false> false>等等等等。

更新1

的问题是:我需要所见即所得的前端。我在前端添加了tiny_mce.js,并运行init。但为什么它不能正常工作。按钮不起作用,如果我输入文本,则不会创建html。所以我总是在html节点中得到错误的false false。

UPDATE 2 我目前的tinymce配置如下。我能够显示所见即所得的编辑器窗口。此外,我可以得到上传窗口,没有magento的文件选择。

<script language="javascript" type="text/javascript"> 
    //NB: the single quotes for the doctype param must be backslashed; wiki format is removing them. 
    // Event.observe(window, 'load', function() { 
     tinyMCE.init({ 
      mode : "exact", 
      theme : "advanced", 
      strict_loading_mode : true, 
      elements : "block_content", 
      plugins : "preview,media,iespell,insertdatetime,advimage,advlink,emotions,table,save,advhr,style,layer,inlinepopups,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",   
      theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", 
      theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", 
      theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", 
      theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,|,visualchars,nonbreaking", 
      theme_advanced_toolbar_location : "top", 
      theme_advanced_toolbar_align : "left", 
      theme_advanced_path_location : "bottom",   
      theme_advanced_resize_horizontal : "true", 
      theme_advanced_resizing : "true", 
      apply_source_formatting : "true", 
      convert_urls : "false", 
      doctype : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', 

      force_p_newlines : 'false', 
      force_br_newlines : 'true', 
      forced_root_block : 'false',    //btw, I still get <p> tags if this is false 
      remove_trailing_nbsp : 'false', 
      verify_html : false, 
      extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style],tr"   
     }); 
    // }); 

    </script> 
+0

对不起,我不明白你的问题在这里 – Thariama 2012-01-17 16:16:10

+0

检查更新 – 2012-01-18 06:34:51

回答

2

好的。我想我发现错误的问题。

forced_root_block : 'false' 

告诉tinyMce将元素换成false。

+1

请标记为已接受。 – 2012-01-18 08:44:28

+1

明天我才能做到,因为现在我做不到。感兴趣的还有很好的参考链接:http://stackoverflow.com/questions/3554338/insert-line-break-instead-of-p-in-tinymce – 2012-01-18 09:02:12