简体   繁体   English

TinyMCE在虚拟主机上不起作用?

[英]TinyMCE not working on Virtual Host?

I am have a project to make WYSIWYG Editor for my website dashboard. 我有一个项目要为我的网站仪表板制作“所见即所得”编辑器。 So I am already have somekind script to worked on server. 所以我已经有某种脚本可以在服务器上工作了。 Ex: natabuana.com/editor 例如: natabuana.com/editor
And when I am trying the same file on localhost, it's turn to be white page, Why this happen ? 当我在localhost上尝试同一文件时,它变成白页,为什么会发生这种情况?
CORECTION : on this address http://localhost/editor.php look like it's work as usual. 纠正:在此地址上http://localhost/editor.php看起来像往常一样工作。 And NOT working on this address http://www.natabuana.com/editor.php (still on localhost) 而且不能在此地址上工作http://www.natabuana.com/editor.php (still on localhost)

The problem is I am using Virtual Host to stimulate real web address into my project, So maybe problem is about Javascript / JQuery on Apache Virtual Host ... 问题是我正在使用虚拟主机来刺激真实的Web地址进入我的项目,所以也许问题是关于Javascript / JQuery on Apache Virtual Host ...

Problem here is that your tinymce initialisation takes place before a html dom element is loaded. 这里的问题是您的tinymce初始化发生在加载html dom元素之前。 Use this to make it work: 使用它来使其工作:

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="tinymce/tinymce.min.js"></script>
    <title>JS Rich-Text Editor</title>
</head>
<body style="font-family:fantasy">
    <h1>TinyMCE Getting Started Guide</h1>
    <form method="post" action="editor.php">
    <textarea id="mytextarea" name="content" style="height:256px"></textarea>
    <p><input type="submit" value="submit" /></p>
</form>
</body>
    <script type="text/javascript">
        tinymce.init({ selector: "#mytextarea", menubar:false , plugins: "table image link code", tools: "inserttable", fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt", toolbar: ["code | fontselect | fontsizeselect | bold italic | link image | alignleft aligncenter alignright | table inserttable | undo redo" ] });
    </script>
</html>

Alternative: 选择:

if you use jQuery put your tinymce initalization into a document-ready call 如果您使用jQuery,则将您的tinymce initalization放入文档就绪调用中

<script type="text/javascript">
$(document).ready(function() {
    tinymce.init({ selector: "#mytextarea", menubar:false , plugins: "table image link code", tools: "inserttable", fontsize_formats: "8pt 10pt 12pt 14pt 18pt 24pt 36pt", toolbar: ["code | fontselect | fontsizeselect | bold italic | link image | alignleft aligncenter alignright | table inserttable | undo redo" ] });
});
</script>

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

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