简体   繁体   English

TinyMCE未加载

[英]TinyMCE not loading

I followed the official installation instructions ( http://www.tinymce.com/wiki.php/installation ) and ended up with the following test code to get TinyMCE running: 我按照官方安装说明( http://www.tinymce.com/wiki.php/installation )进行操作,并得到以下测试代码以运行TinyMCE:

<html>
<head>
<title>New Document</title>
<script language="javascript" type="text/javascript" src="tinymce/tinymce.min.js"/>
<script type="text/javascript">
tinymce.init({ 
    selector: "textarea"
 });
</script>
</head>

<body>

<form method="post">
<textarea></textarea>
</form>

</body>
</html>

The problem is that nothing is happening to the textarea. 问题是文本区域没有任何反应。 The JS is indeed getting loaded, as I can see in the "network" tab of Chrome console. 正如我在Chrome控制台的“网络”标签中所看到的,JS确实已被加载。 What am I doing wrong? 我究竟做错了什么? I have version 4.0.12, by the way. 顺便说一下,我的版本是4.0.12。

<script language="javascript" type="text/javascript" src="tinymce/tinymce.min.js"/>

As much as they should be, script tags are not self-closing. 脚本标签虽然不应该自动关闭,但应尽可能多。 There may be a specific doctype that lets them be. 可能有特定的文档类型允许他们使用。

<script language="javascript" type="text/javascript" src="tinymce/tinymce.min.js"></script>

By the way, script tags should go before </body> unless you have inline javascript. 顺便说一句,脚本标签应该放在</body>之前,除非您有内联javascript。

The problem caused by loading scripts is that they block parallel downloads. 加载脚本引起的问题是它们阻止并行下载。 If the page is not parsed the user agent cannot know which subsequent resources need fetching, so a strictly conforming browser should not be able to fetch further resources until the first has actually been executed. 如果未解析页面,则用户代理将无法知道需要获取哪些后续资源,因此严格合规的浏览器应该无法获取其他资源,直到实际执行第一个资源为止。

Since jQuery in particular shouldn't execute until the DOM hierarchy has been fully constructed, and HTTP/4.01 specification states "[a script] element may appear any number of times in the HEAD or BODY of an HTML document," it doesn't make sense to start those JavaScript downloads before the page's body has even started to download, and doing so would slow down the perceived page load. 特别是由于jQuery在完整构建DOM层次结构之前不应该执行,并且HTTP / 4.01规范指出“ [一个脚本]元素可能在HTML文档的HEAD或BODY中出现任意次数,因此它不会在页面主体甚至尚未开始下载之前就开始进行这些JavaScript下载是有意义的,这样做会减慢感知到的页面负载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM