2017-12-05 1 views
0

의 FileManagerBundle을 사용합니다. 그리고 내 view.twig있는 창을 구현할 수 있지만 myFileBrowser() 만들 필요가 있는지 모르겠습니다.Symfony3와 함께 TinyMCE를 사용하여 FileMangerBundle (artgris) 구현 내 프로젝트에

이 내 twig.html입니다 : 당신이 생각이있는 경우

{% extends 'CoreBundle:Base:base.html.twig' %} 


{% block title %}TEST DOWNLOAD{% endblock %} 

{% block body %} 
    <div class="row"> 
     <div class="col-md-12 box-blanche-ombre"> 
      <div class="row boutontitre"> 
       <div class="col-md-6"> 
        <h1>TEST DOWNLOAD</h1> 
       </div> 
      </div> 
      {% for type in ['primary','success', 'info', 'warning','danger'] %} 
       {% for message in app.session.flashbag.get(type) %} 
        <p class="message bg-{{ type }}">{{ message|raw }}</p> 
       {% endfor %} 
      {% endfor %} 
      <form method="post" action="dump.php"> 
       <textarea name="content"></textarea> 
      </form> 
     </div> 
    </div> 
{% endblock %} 
{% block javascripts %} 
    {{ parent() }} 
    <script type="text/javascript"> 
     var BaseURL = "{{ app.request.getBaseURL() }}"; 
    </script> 
    <script src="{{ asset('Bootstrap-Confirmation-master/bootstrap-confirmation.js') }}"></script> 
    <script src="{{ asset('bootstrap-datepicker/js/bootstrap-datepicker.min.js') }}"></script> 
    <script src="{{ asset('bootstrap-datepicker/locales/bootstrap-datepicker.fr.min.js') }}"></script> 
    <script type="text/javascript"> 
     tinymce.init({ 
      selector: '#mytextarea', 
      file_browser_callback: myFileBrowser, 
      theme: 'modern', 
      height: 300, 
      plugins: [ 
       'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker', 
       'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking', 
       'save table contextmenu directionality emoticons template paste textcolor' 
      ], 
      toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons' 
     }); 

     function myFileBrowser(field_name, url, type, win) { 

     var cmsURL = "{{ path('file_manager', {module:'tiny', conf:'tiny'}) }}"; 
     if (cmsURL.indexOf("?") < 0) { 
      cmsURL = cmsURL + "?type=" + type; 
     } 
     else { 
      cmsURL = cmsURL + "&type=" + type; 
     } 

     tinyMCE.activeEditor.windowManager.open({ 
      file: cmsURL, 
      title: 'File Manager', 
      width: 1024, 
      height: 500 
     }, { 
      window: win, 
      input: field_name 
     }); 
     return false; 
    } 
    </script> 
{% endblock %} 

이이 문서에 대한 링크입니다, 감사합니다!

https://github.com/artgris/FileManagerBundle/blob/master/Resources/doc/tutorials/integrate-tinymce.md

호 그래, 당신이 선택하여 TinyMCE에 init을

답변

1

을 mywebsite.com/manager/?conf=default에 액세스 할 수 있습니다 '#mytextarea를'하지만 HTML이 ID를 포함하지, 당신 첫 번째 텍스트 영역에 ID를 추가해야합니다 :

<textarea name="content" id="mytextarea"></textarea> 

을 myFileBrowser 기능에 대해서는, 바로 이곳에 있습니다.

+0

좋아 감사하지만, CKEditor 같은 "큰"텍스트 영역을 가지고,하지만 난의 파일 관리자 인터페이스를하지 않은 등의 경우 그 우선 순위를 가진 것처럼 작은. – Verdouze

+0

filemanager 인터페이스를 단독으로 사용하려면 iframe'