javascript 在 TinyMCE 上设置响应式文件管理器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22636825/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Set up Responsive filemanager on TinyMCE
提问by ltdev
I'm using TinyMCE 4 as my WYSIWYG editor and I've installed Responsive Filemanager.
我使用 TinyMCE 4 作为我的 WYSIWYG 编辑器,并且我已经安装了Responsive Filemanager。
I've tried to follow the instructions very carefully, but when I preview the page the "browse" button doesn't appear.
我已经尝试非常仔细地按照说明进行操作,但是当我预览页面时,“浏览”按钮没有出现。
I'm currently working localhost on my computer so my folder structure looks like this:
我目前在我的计算机上使用本地主机,所以我的文件夹结构如下所示:
htdocs > websites > example (root), so the url is h**p://localhost/websites/example
htdocs > 网站 > 示例(root),所以 url 是 h**p://localhost/websites/example
folder structure:
文件夹结构:
example
- css
- uploads
- source ( this is the upload folder )
- thumbs ( thumbnail folder )
- filemanager
-- config
--- config.php
- js
-- tinymce
--- plugins
---- responsivefilemanager
----- plugin.js , plugin.min.js
The config looks like this:
配置如下所示:
$url = ($_SERVER['HTTP_HOST'] == 'localhost') ? 'h**p://localhost/websites/example' : 'h**p://www.example.com' ;
$base_url = $url;
$upload_dir = '/source/';
$current_path = '../source/';
//thumbs folder can't put inside upload folder
$thumbs_base_path = '../thumbs/';
and this is the javascript on my page that sets TinyMCE
这是我页面上设置 TinyMCE 的 javascript
<script type="text/javascript">
tinymce.init({
selector: "textarea.tinymce",
entity_encoding : "raw",
// menubar: false,
subfolder:"content",
plugins: [
"link image media anchor responsivefilemanager",
"code"
],
// toolbar2: "| responsivefilemanager | link unlink anchor | image media | forecolor backcolor | print preview code ",
image_advtab: true,
// external_filemanager_path:"/filemanager/",
// filemanager_title:"Responsive Filemanager" ,
// external_plugins: { "filemanager" : "/responsivefilemanager/plugin.min.js"}
// toolbar: "undo redo | styleselect | bold italic underline |
// alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
});
</script>
回答by ltdev
I found out that it was an error on config.php.
我发现这是 config.php 上的错误。
Solution:
解决方案:
$base_url = "http://".$_SERVER['HTTP_HOST']; // DON'T TOUCH (base url (only domain) of site (without final /)).
$upload_dir = '/websites/example/uploads/source/';
$current_path = '../uploads/source/';
$thumbs_base_path = '../uploads/thumbs/';
also init the javascript like this:
也像这样初始化javascript:
external_filemanager_path: "/websites/example/filemanager/",
filemanager_title: "Responsive Filemanager" ,
external_plugins: { "filemanager" : "/websites/example/filemanager/plugin.min.js"}