Using the Tnymce Responsive File Manager in Django

48 Views Asked by At

** How can I use Tnymce File Responsive Manager in Django? I can't use it in any way! I tried writing some code but it didn't work. Please help me! I was supposed to connect to the file responsive manager by giving an id to the Textarea and calling it through a script, but it won't connect.

**

<div>
     <label>Full content</label>
     <textarea id="myTextarea" placeholder="Full Content" name="full_info">{{ new.full_info }}</textarea>
</div>


<script type="text/javascript">
        tinymce.init({
            selector: 'textarea#myTextarea',
            plugins: [
              'advlist', 'autolink', 'link', 'image', 'lists', 'charmap', 'preview', 'anchor', 'pagebreak',
              'searchreplace', 'wordcount', 'visualblocks', 'visualchars', 'code', 'fullscreen', 'insertdatetime',
              'media', 'table', 'emoticons', 'template', 'help',
            ],
            toolbar: 'undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | ' +
              'bullist numlist outdent indent | insertfile link image | print preview media fullscreen | ' +
              'forecolor backcolor emoticons | help',
            menu: {
              favs: { title: 'My Favorites', items: 'code visualaid | searchreplace | emoticons' }
            },
            menubar: 'favs file edit view insert format tools table help ',
            tinydrive_upload_path: '/upload',
            file_picker_callback: function(callback, value, meta) {
            if (meta.filetype === 'file') {
              tinymce.activeEditor.windowManager.openUrl({
                    url: '/admin/filepicker/',
                title: 'Fayl tanlash',
                onMessage: function(dialogApi, details) {
                  callback(details.file);
                  dialogApi.close();
                }
              });
            }
            }
        });
    </script>
0

There are 0 best solutions below