问题描述
我在Q/A应用程序中将TinyMCE与Twitter Bootstrap v3.1一起使用.
I am using TinyMCE with Twitter Bootstrap v3.1 in a Q/A application.
由于某些原因,我在控制台中从TinyMCE收到多个404错误:
For some reason I am getting multiple 404 errors from TinyMCE in console:
GET http://localhost/assets/lib/TinyMCE/themes/modern/themeundefined.js 404 (Not Found) tinymce.min.js:3
Failed to load: /assets/lib/TinyMCE//themes/modern/themeundefined.js
据我所知,路径是正确的.我已经直接在浏览器栏中输入了路径(没有undefinedtheme.js),它会弹出.
As far as I can see the path is correct. I have typed the path directly into the browser bar (without undefinedtheme.js) and it pops up.
TinyMCE的完整路径为:http://localhost/application/assets/lib/TinyMCE/
Full path to TinyMCE is: http://localhost/application/assets/lib/TinyMCE/
- 我启用了mod-rewrite,我尝试禁用但没有帮助.
- 我尝试设置:
-
tinyMCE.baseURL = "/assets/lib/TinyMCE";
-
tinyMCE.baseURL = "/application/assets/lib/TinyMCE";
-
tinyMCE.baseURL = "localhost/application/assets/lib/TinyMCE";
-
- I have mod-rewrite enabled, I have tried disabling but didn't help.
- I have tried setting:
tinyMCE.baseURL = "/assets/lib/TinyMCE";
tinyMCE.baseURL = "/application/assets/lib/TinyMCE";
tinyMCE.baseURL = "localhost/application/assets/lib/TinyMCE";
我已经在TinyMCE常见问题解答中搜索了指向我指向mod_rewrite的问题.
I have searched the TinyMCE FAQ for the issue which pointed me to mod_rewrite.
基本上是什么原因导致了undefinedtheme.js
问题?
Basically what has caused the undefinedtheme.js
thing?
我的TinyMCE发起人:
//TinyMCE Initiator
//set scope
$(document).ready(function() {
tinyMCE.baseURL = "/assets/lib/TinyMCE";
tinymce.init({
selector: "textarea#tinymce",
theme: "modern",
/*width: 400,*/
height: 300,
plugins: [
"advlist autolink link lists charmap print preview hr anchor pagebreak spellchecker",
"searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime nonbreaking",
"save contextmenu directionality emoticons template paste textcolor"
],
content_css: "../assets/css/bootstrap.css",
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify bullist numlist forecolor | outdent indent | l ink | ",
style_formats: [
{title: 'Bold text', inline: 'b'},
{title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
{title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
{title: 'Example 1', inline: 'span', classes: 'example1'},
{title: 'Example 2', inline: 'span', classes: 'example2'},
{title: 'Table styles'},
{title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
]
});
});
推荐答案
TinyMCE应该包含在textarea标记之前,而不是
<doctype html>
<head>
<script src="/assets/lib/TinyMCE/tinymce.min.js"></script>
</head>
<body>
<div class="container" role="main">
<textarea id="tinymce"></textarea>
</div>
</body>
<script>
$(document).ready(function() {
tinymce.init({
selector: "textarea#tinymce",
theme: "modern",
//width: 400,
height: 300,
plugins: [
"advlist autolink link lists charmap print preview hr anchor pagebreak spellchecker",
"searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime nonbreaking",
"save contextmenu directionality emoticons template paste textcolor"
],
content_css: "../assets/css/bootstrap.css",
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify bullist numlist forecolor | outdent indent | l ink | ",
style_formats: [
{title: 'Bold text', inline: 'b'},
{title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
{title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
{title: 'Example 1', inline: 'span', classes: 'example1'},
{title: 'Example 2', inline: 'span', classes: 'example2'},
{title: 'Table styles'},
{title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
]
});
});
</script>
</html>
这篇关于TinyMCE 404/未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!