2014-09-04 80 views
1

当我加入一些文字与tinyMCE.execCommand它出现几秒钟,然后自动撤销。tinyMCE.execCommand(“mceInsertContent”自动越来越撤销

试图了解如何撤消水平的作品。 如何添加撤消/管理水平

条纹下来的代码版本中使用:

<html> 
<head> 
    <title>TinyMCE editor</title> 
    <script type="text/javascript" src="tiny_mce/tiny_mce.js"></script> 
    <script type="text/javascript" src="jquery/jquery-1.10.2.js"></script> 
    <script type="text/javascript" src="jquery/jquery-ui.js"></script> 
    <script type="text/javascript"> 
     var toolbar = 
       "fontselect,fontsizeselect, formatselect, bold,italic,underline,|," + 
       "forecolor,backcolor,|,removeformat,cleanup,|,codemirror2,charmap,|,fullscreen"; 

     var toolbar2 = 
       "undo,redo,|,pastetext,pasteword,|,bullist,numlist,|,outdent,indent,|," + 
       "justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,anchor,image"; 

     var initHtmlMode = { 
      mode: "textareas", 
      theme: "advanced", 
      theme_advanced_buttons1: toolbar, 
      theme_advanced_buttons2: toolbar2, 
      theme_advanced_toolbar_location: "top", 
      theme_advanced_toolbar_align: "left", 
      theme_advanced_statusbar_location: "bottom", 
      theme_advanced_resizing: true 
     }; 

     tinyMCE.init(initHtmlMode); 

     function showList() { 
      tinyMCE.execCommand('mceInsertContent', false, 'some text'); 
     } 
    </script> 
</head> 
<body> 
<form> 
    <textarea id="content" rows="15" style="width: 80%"></textarea> 
    <br/> 
    <button onclick="showList()">Insert</button> 
</form> 
</body> 
</html> 

回答

0

的onclick()是刷新页面

<form onsubmit="return false"> 

修正了它。