tinymce文本编辑器中没有显示工具栏

toolbar not being displayed in tinymce text editor

本文关键字:显示 工具栏 文本 文本编辑 编辑器 tinymce      更新时间:2023-09-26

这是我第一次使用tinymce。我正在遵循他们给出的例子,但它似乎不起作用。我只能看到一个圆角的文本框,没有工具栏和按钮。

我应该添加什么使它正常工作?这是代码:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org /TR/xhtml11            /DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<script type="text/javascript" src="/js/tinymce/tinymce.min.js" ></script >
<script type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    plugins : "emotions,spellchecker,advhr,insertdatetime,preview", 
    // Theme options - button# indicated the row# only
    theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontselect,fontsizeselect,formatselect",
    theme_advanced_buttons2 : "cut,copy,paste,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,|,code,preview,|,forecolor,backcolor",
    theme_advanced_buttons3 : "insertdate,inserttime,|,spellchecker,advhr,,removeformat,|,sub,sup,|,charmap,emotions",      
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true
});
</script>
</head>
<body>
    <form>  
    <textarea name="content" cols="50" rows="15" > 
    This is some content that will be editable with TinyMCE.
    </textarea>
    </form>
</body>
</html>

目前在主页上下载的是版本4,仍处于测试阶段。您问题中的文档和语法适用于版本3.x。版本4是一个重大的重写,许多旧的语法将不再工作。

你有三个选择:

  • 下载3.58版本与文档一起使用。
    http://download.moxiecode.com/tinymce/3.5.8/tinymce_3.5.8.zip

  • 从演示,论坛和他们的小提琴中找出你自己的新版本。
    http://fiddle.tinymce.com/

  • 等待版本4的稳定发布,因为文档可能会在那时修复。

从版本4开始,你只需要选择器:

tinymce.init({
    selector: "textarea"
});

这将给你默认的选项,没有插件。如果你看小提琴,你可以看到一些你可以做的。