2013-07-30 19 views
7

自分のファイルブラウザからファイルを選択して画像を選択し、それをtinymceの画像リンクのフィールドに送ることができるようにしようとしていますが、これ以外の情報はどこにもありません。 tinymce 4:独自のファイルマネージャを作成する方法は?

この

は私が立ち往生どこ

file_browser_callback: function(field_name, url, type, win) { 

    //tinymce.activeEditor.windowManager.close(); 
    //console.log(field_name); 

    tinymce.activeEditor.windowManager.open({ 
     title: 'Browse Image', 
     file: "yourbrowser.php?field=" + field_name + "&url=" + url, 
     width: 450, 
     height: 305, 
     resizable : "no", 
     inline : "yes", 
     close_previous : "no", 
     buttons: [{ 
      text: 'Insert', 
      classes: 'widget btn primary first abs-layout-item', 
      disabled: true, 
      onclick: 'close' 
     }, { 
      text: 'Close', 
      onclick: 'close', 
      window : win, 
      input : field_name 
     }] 
    }); 

    return false; 
}, 

これは、トップインサート/編集画像上の新しいポップアップを開くためのコードです - どのように私は私のファイルマネージャから画像を選択し、それを送ることができます挿入/画像ポップアップ編集の画像リンク?

以下は、これまで

$(document).ready(function(){ 

     $('.button').click(function(){ 

      // @reference: http://www.tinymce.com/wiki.php/api4:method.tinymce.remove# 
      if(tinyMCE.editors.length > 0) { 

       // Remove all editors bound to textareas 
       //tinymce.remove('textarea'); 

       // Remove all editors 
       tinymce.remove(); 
      } 

      $('.content').load('full.html', function() { 

       if(tinyMCE.editors.length == 0) { 

        tinymce.init({ 
         //selector: "textarea", 
         mode : "textareas", 
         editor_selector : "mce-customised", 
         editor_deselector : "not-editor", 
         theme: "modern", 
         plugins: [ 
          "advlist autolink lists link image charmap print preview hr anchor pagebreak", 
          "searchreplace wordcount visualblocks visualchars code fullscreen", 
          "insertdatetime media nonbreaking save table contextmenu directionality", 
          "emoticons template paste textcolor" 
         ], 
         toolbar1: "insertfile undo redo | styleselect | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image", 
         toolbar2: "print preview media | forecolor backcolor emoticons", 
         image_advtab: true, 

         file_browser_callback: function(field_name, url, type, win) { 

          //tinymce.activeEditor.windowManager.close(); 
          //console.log(field_name); 

          tinymce.activeEditor.windowManager.open({ 
           title: 'Browse Image', 
           file: "yourbrowser.php?field=" + field_name + "&url=" + url, 
           width: 450, 
           height: 305, 
           resizable : "no", 
           inline : "yes", 
           close_previous : "no", 
           buttons: [{ 
            text: 'Insert', 
            classes: 'widget btn primary first abs-layout-item', 
            disabled: true, 
            onclick: 'close' 
           }, { 
            text: 'Close', 
            onclick: 'close', 
            window : win, 
            input : field_name 
           }] 
          }); 

          return false; 
         }, 


         // Specifying an Absolute Image Path 
         document_base_url : "http://localhost/test/2013/js/tinymce/tinymce_4.0.2/", 
         relative_urls : false, 
         remove_script_host : false, 


         image_list: "image_list.php", 
         link_list: "link_list.php" 
        }); 

        $('.button-submit').submit_form(); 
       } 

      }); 

      return false; 
     }); 

    }); 

test site私の全体のコードです。

または、tinymceで動作する良いファイルマネージャーを知っていますか?

+0

あなたはhttp://www.tinymce.com/wiki.php/TinyMCE3x:Howを見てとっています-to_implement_a_custom_file_browserはいくつかの洞察を与えるべきです。ありがとう。 – RMK

+0

それがTinyMCE 3.x用であることを見てテストしました。私はTinyMCE 4に取り組んでいます.... – laukok

答えて

関連する問題