0

我无法将 tinymce 编辑器与 kcfinder Web 文件管理器集成。

编辑器加载正常,我可以从 kcfinder 上传、浏览和重命名图像。

但是当我想选择图像时没有任何反应,url 没有设置在字段上。我无法选择图像。

控制台日志上没有错误。

编辑: 在此处输入图像描述

当我选择图像时没有任何反应: 在此处输入图像描述

版本 Tinymce 4.9.6 Kcfinder 3.12

HTML 代码


<!doctype html>
<html lang='es' >
    <head>
        <meta charset="utf-8">
        <script src="./js/tinymce/tinymce.min.js"></script>
        <script src="./js/default_tinymce.js"></script>
    </head>
    <body>
        <form method="post" action="content-edit.php">
            <textarea name="content" class="tinymce"></textarea><br>
            <input type="submit">
        </form>
    </body>
</html>

javascript js/default_tiymce.js

tinymce.init({ 
        selector:'.tinymce',
        convert_urls: false, // default 1
        remove_script_host: false, // default 1
        browser_spellcheck: true,
        plugins: [
            "advlist autolink lists link image charmap print preview anchor",
            "searchreplace visualblocks code fullscreen",
            "insertdatetime media table contextmenu paste",
            "emoticons template paste textcolor colorpicker textpattern imagetools"
        ],
    file_picker_callback: function(field, url, type, win) {
            tinyMCE.activeEditor.windowManager.open({
                file: './kcfinder/browse.php?opener=tinymce&field=' + field + '&type=' + type,
                title: 'Kcfinder',
                width: 700,
                height: 500,
                inline: true,
                close_previous: false
            }, {
                window: win,
                input: field
            });
            return false;
        },
       toolbar: "insertfile undo redo | styleselect  | forecolor backcolor emoticons | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image ",
       paste_data_images: true
});

预期结果:双击图像时,应选择它并使用图像 url 填充字段。

实际结果:双击图像时没有任何反应。

请帮忙!!!

4

1 回答 1

1

好的,最后我找到了解决方案,我将tinymce集成代码替换为

javascript js/default_tiymce.js


this:tinymce.init(
{ 
        selector:'textarea',
        menubar: false,
        plugins: [
            "advlist autolink lists link image charmap print preview anchor",
            "searchreplace visualblocks code fullscreen",
            "insertdatetime media table contextmenu paste"
        ],
       toolbar: "undo redo | insert | styleselect  | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image ",
    file_browser_callback: function(field, url, type, win) {
        tinyMCE.activeEditor.windowManager.open({
            file: './kcfinder/browse.php?opener=tinymce4&field=' + field + '&type=' + type,
            title: 'KCFinder',
            width: 700,
            height: 500,
            inline: true,
            close_previous: false
        }, {
            window: win,
            input: field
        });
        return false;
    }

});

希望它可以帮助别人

于 2019-09-27T17:54:00.897 回答