2013-07-30 10 views
7

मैं अपना खुद का फ़ाइल ब्राउज़र बनाने की कोशिश कर रहा हूं ताकि मैं अपनी फ़ाइल से छवि का चयन कर सकूं और इसे टिनिमस के छवि लिंक के फ़ील्ड भेज सकूं, लेकिन मुझे यह और भी जानकारी मिल सकती है कि मैं इसे कैसे प्राप्त कर सकता हूं।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 है।

या, क्या आप किसी भी अच्छी फ़ाइल प्रबंधक प्लगइन को जानते हैं जो टिनिमस के साथ काम करता है?

+0

आप http://www.tinymce.com/wiki.php/TinyMCE3x:How पर एक नज़र लिया है -to_implement_a_custom_file_browser कुछ अंतर्दृष्टि देना चाहिए। – RMK

+0

धन्यवाद। देखा और परीक्षण किया कि, यह TinyMCE 3.x के लिए है। मैं टिनीएमसीई 4 पर काम कर रहा हूं .... – laukok

उत्तर

संबंधित मुद्दे