代码之家  ›  专栏  ›  技术社区  ›  ltdev

在TinyMCE上设置响应式文件管理器

  •  0
  • ltdev  · 技术社区  · 10 年前

    我使用TinyMCE 4作为所见即所得编辑器 Responsive Filemanager .

    我已经试着非常仔细地遵循说明,但当我预览页面时,“浏览”按钮不会出现。

    我当前正在计算机上使用localhost,因此我的文件夹结构如下所示:

    htdocs>网站>example(root),因此url为h**p://localhost/websites/example

    文件夹结构:

    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
    

    配置如下:

    $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/'; 
    

    这是我页面上设置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>
    
    1 回复  |  直到 8 年前
        1
  •  3
  •   Sharlike    9 年前

    我发现这是config.php上的错误。

    解决方案:

    $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/';  
    

    也可以这样初始化javascript:

    external_filemanager_path: "/websites/example/filemanager/",
    filemanager_title: "Responsive Filemanager" ,
    external_plugins: { "filemanager" : "/websites/example/filemanager/plugin.min.js"}