doulan9419 2012-12-06 14:46
浏览 228

在tinymce编辑器中浏览图像的问题

I am trying to implement photo upload option in tinymce editor. For that I have uploaded latest version of ajaxfilemanager. I just put the folder under the plugin folder of tinymce. and create one more folder called "uploaded" under plugin folder. Also modify the code for tinyMCE.init like

tinyMCE.init({
// General options
  mode : "textareas",
  elements : "ajaxfilemanager",
  theme : "advanced",
  plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,paste,fullscreen,noneditable,contextmenu",
    theme_advanced_buttons1_add_before : "newdocument,separator",
    theme_advanced_buttons1_add : "fontselect,fontsizeselect",
    theme_advanced_buttons2_add : "separator,forecolor,backcolor,liststyle",
    theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,",
    theme_advanced_buttons3_add_before : "tablecontrols,separator",
    theme_advanced_buttons3_add : "flash,advhr,separator,fullscreen",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    extended_valid_elements : "hr[class|width|size|noshade]",
    file_browser_callback : "ajaxfilemanager",
    paste_use_dialog : false,
    theme_advanced_resizing : true,
    theme_advanced_resize_horizontal : true,
    apply_source_formatting : true,
    force_br_newlines : true,
    force_p_newlines : false,
    relative_urls : true,


    // Example content CSS (should be your site CSS)
    // using false to ensure that the default browser settings are used for best Accessibility
    // ACCESSIBILITY SETTINGS
    content_css : false,
    // Use browser preferred colors for dialogs.
    browser_preferred_colors : true,
    detect_highcontrast : true,

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "lists/template_list.js",
    external_link_list_url : "lists/link_list.js",
    external_image_list_url : "lists/image_list.js",
    media_external_list_url : "lists/media_list.js",

    // Style formats
    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'}
    ],

    // Replace values for the template plugin
    template_replace_values : {
     username : "Some User",
     staffid : "991234"
    }
    });
function ajaxfilemanager(field_name, url, type, win) {
    var ajaxfilemanagerurl = "../tinymce/jscripts/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php?editor=tinymce";
    switch (type) {
        case "image":
            break;
        case "media":
            break;
        case "flash":
            break;
        case "file":
            break;
        default:
            return false;
    }
    var fileBrowserWindow = new Array();
    fileBrowserWindow["file"] = ajaxfilemanagerurl;
    fileBrowserWindow["title"] = "Ajax File Manager";
    fileBrowserWindow["width"] = "782";
    fileBrowserWindow["height"] = "440";
    fileBrowserWindow["close_previous"] = "no";
    tinyMCE.openWindow(fileBrowserWindow, {
      window : win,
      input : field_name,
      resizable : "yes",
      inline : "yes",
      editor_id : tinyMCE.getWindowArg("editor_id")
    });

    return false;
}

Also I have modified the config.base.php file which is under ajaxfilemanager/inc folder.

define('CONFIG_SYS_DEFAULT_PATH', 'http://localhost/object/all/tinymce/jscripts/tiny_mce/plugins/uploaded/'); //accept relative path only
define('CONFIG_SYS_ROOT_PATH', 'http://localhost/object/all/tinymce/jscripts/tiny_mce/plugins/uploaded/');  //accept relative path only

But I am unable to open browse windows. could you please guide me to fix up this issue?

I resolved some js errors. Now I got the image pop up and can upload some images. But whenever I am trying to get the Image URL, it is showing undefined in the Image URL fext-field. Now please help me how to proceed.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料