semplon / summernote-ext-elfinder

Summernote Plugin for elFinder File Manager
MIT License
24 stars 21 forks source link

Elfinder does not open #3

Closed Ande1232 closed 3 years ago

Ande1232 commented 7 years ago

Hi, I have followed the readme file, the "file manager" button appears, but when I click the button, the error from console

Uncaught TypeError: $(...).dialogelfinder is not a function(…)

elfinderDialog @ admin.php?p=articolo&sk=crea:157

click @ summernote-ext-elfinder.js:35

dispatch @ jquery.js:4435

elemData.handle @ jquery.js:4121

This is my source:

http://pastebin.com/MZacyRVk

Ande1232 commented 7 years ago

I solved the problem, only that when I double-click on an image, is entered in the editor.

I have the same error of this person. You can help us find a solution?

semplon commented 7 years ago

@Ande1232 let me know the browser console log for the error

moxley5658 commented 6 years ago

@Ande1232, can you post you solution so that others with that issue can use that.. Like me :)

semplon commented 6 years ago

@moxley5658 can you share your code ? so i can inspect it ?

moxley5658 commented 6 years ago

Sure, and thanks - I made the above txt files for ease of view. If there is a better way of sharing, please let me know.

The Summernote window opens with the File Manager Button

But it throws the bellow error when pressed.

Error of: TypeError: e(this).addClass("dialogelfinder").css("position","absolute").hide().appendT o("body").draggable is not a function. (In 'e(this).addClass("dialogelfinder").css("position","absolute").hide().append To("body").draggable({handle:".dialogelfinder-drag",containment:"window",sto p:function(){r.trigger("resize"),o.trigger("resize")}})', 'e(this).addClass("dialogelfinder").css("position","absolute").hide().append To("body").draggable' is undefined)

I am using: elFinder Version 2.1.28 jQuery v2.1.1 Bootstrap v3.3.7 Summernote v0.8.8

Regards,

Michael Moxley Storm Group Enterprise www.stormbuilt.com (610) 742-9474

From: Puguh Wijayanto notifications@github.com Reply-To: semplon/summernote-ext-elfinder <reply+01e8a3d8371103e9aacf520ba3d06a72908f55b1ac9c2bdf92cf0000000115df0e819 2a169ce0b6e2155@reply.github.com> Date: Sunday, September 24, 2017 at 2:11 AM To: semplon/summernote-ext-elfinder summernote-ext-elfinder@noreply.github.com Cc: Michael Moxley mmoxley@stormbuilt.com, Mention mention@noreply.github.com Subject: Re: [semplon/summernote-ext-elfinder] Elfinder does not open (#3)

@moxley5658 https://github.com/moxley5658 can you share your code ? so i can inspect it ?

‹ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/semplon/summernote-ext-elfinder/issues/3#issuecomment-33 1689812 , or mute the thread https://github.com/notifications/unsubscribe-auth/Aeij2DcGntw-jquhZjvgUTHqL HYA_lmwks5slfKBgaJpZM4K8uD9 .

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4b b","name":"GitHub"},"entity":{"external_key":"github/semplon/summernote-ext- elfinder","title":"semplon/summernote-ext-elfinder","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143 418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"h ttps://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6 -9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/semplon/summernote-ext-elfinder"}},"update s":{"snippets":[{"icon":"PERSON","message":"@semplon in #3: @moxley5658 can you share your code ? so i can inspect it ?"}],"action":{"name":"View Issue","url":"https://github.com/semplon/summernote-ext-elfinder/issues/3#is suecomment-331689812"}}}

error_reporting(0); // Set E_ALL for debuging elFinder::$netDrivers['ftp'] = 'FTP';

function access($attr, $path, $data, $volume, $isDir, $relpath) { return basename($path)[0] === '.' // if file/folder begins with '.' (dot) with out volume root && strlen($relpath) !== 1 ? !($attr == 'read' || $attr == 'write') // set read+write to false, other (locked+hidden) set to true : null; // else elFinder decide it itself }

$opts = array( // 'debug' => true, 'roots' => array( // Items volume array( 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => '../../../../images/upload/', // path to files (REQUIRED) 'URL' => dirname($_SERVER['PHP_SELF']) . '../../../../images/files', // URL to files (REQUIRED) 'trashHash' => 't1_Lw', // elFinder's hash of trash folder 'uploadDeny' => array('all'), // All Mimetypes not allowed to upload 'uploadAllow' => array('image', 'text/plain'),// Mimetype image and text/plain allowed to upload 'uploadOrder' => array('deny', 'allow'), // allowed Mimetype image and text/plain only 'accessControl' => 'access' // disable and hide dot starting files (OPTIONAL) ), // Trash volume array( 'id' => '1', 'driver' => 'Trash', 'path' => '../../../../images/upload/.trash/', 'tmbURL' => dirname($_SERVER['PHP_SELF']) . '../../../../images/.trash/.tmb/', 'uploadDeny' => array('all'), // Recomend the same settings as the original volume that uses the trash 'uploadAllow' => array('image', 'text/plain'),// Same as above 'uploadOrder' => array('deny', 'allow'), // Same as above 'accessControl' => 'access', // Same as above ) ) );

$connector = new elFinderConnector(new elFinder($opts)); $connector->run();

ghost commented 6 years ago

You asked me via email, This is what I'm pulling in to make things work.

<script src="core/js/jquery-2.1.3.min.js"></script>
<script src="core/js/jquery-ui.min.js"></script>
<script src="core/js/bootstrap.min.js"></script>
<script src="core/js/summernote.js"></script>
<script src="core/js/plugin/elfinder/elfinder.js"></script>
<script src="core/elfinder/js/elfinder.min.js"></script>

The script second from bottom contains the scripting needed to tie Summernote to elFinder. And you need the below inlined into the page


function mediaDialog(id,t,c){
 var fm=$('<div/>').dialogelfinder({
 url:'http://localhost/LibreCMS/core/elfinder/php/connector.php',
/* Change the above location to suite your installation */
  lang:'en',
  width:840,
  height:450,
  destroyOnClose:true,
  useBrowserHistory:false,
  uiOptions:{
    cwd:{
      getClass:function(file){
        if(file.name.match(/archive/i)){
          return'archive-folder';
       }else if(file.name.match(/attachment/i)){
         return'attachments-folder';
       }else if(file.name.match(/avatar\|user\|users/i)){
         return'users-folder';
       }else if(file.name.match(/backup/i)){
         return'backup-folder';
       }else if(file.name.match(/carousel\|featured/i)){
         return'featured-folder';
       }else if(file.name.match(/order/i)){
         return'orders-folder';
       }else if(file.name.match(/photo\|picture\|image/i)){
         return'picture-folder';
       }else if(file.name.match(/doc/i)){
         return'document-folder';
       }else if(file.name.match(/vid\|mov/i)){
         return'video-folder';
       }else{
         return'';
       }
     }
   }
  },
  getFileCallback:function(files,fm){
/* This section is for using elFinder within a form file input */
    if(id>0){
      $('#'+c).val(files.url);
        if(t!='media'){
          $('#'+c+'image').attr('src',files.url);
          update(id,t,c,files.url);
        }
/* End: This section is for using elFinder within a form file input */
     }else{
       if(files.url.match(/\.(jpeg\|jpg\|gif\|png)$/)){
         $('.summernote').summernote('editor.insertImage',files.url);
       }else{
         $('.summernote').summernote('createLink',{
           text:files.name,
           url:files.url,
           newWindow:true
         });
       }
   }
   },
   commandsOptions:{
    getfile:{
     oncomplete:'close',
     folders:false
    }
   }
  }).dialogelfinder('instance');
 }
semplon commented 6 years ago

@moxley5658 did you had load the jquery-ui ? jquery-ui must be loaded to make this work

ghost commented 6 years ago

You also need to watch the order of loading the scripts in the document.

moxley5658 commented 6 years ago

When I try to load that by itself, it times out (too many HTML redirects). Regards,

Michael Moxley Storm Group Enterprise www.stormbuilt.com (610) 742-9474

From: Puguh Wijayanto notifications@github.com Reply-To: semplon/summernote-ext-elfinder <reply+01e8a3d81bbc7e4686ead33fcba8e7d401bc7b6d5756a25d92cf0000000115df6e299 2a169ce0b6e2155@reply.github.com> Date: Sunday, September 24, 2017 at 8:59 AM To: semplon/summernote-ext-elfinder summernote-ext-elfinder@noreply.github.com Cc: Michael Moxley mmoxley@stormbuilt.com, Mention mention@noreply.github.com Subject: Re: [semplon/summernote-ext-elfinder] Elfinder does not open (#3)

@moxley5658 https://github.com/moxley5658 did you had load the jquery-ui ? jquery-ui must be loaded to make this work

‹ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/semplon/summernote-ext-elfinder/issues/3#issuecomment-33 1708496 , or mute the thread https://github.com/notifications/unsubscribe-auth/Aeij2GM7ab4WUZ8iGvqXGT4y6 TBv2Y_Qks5sllIpgaJpZM4K8uD9 .

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4b b","name":"GitHub"},"entity":{"external_key":"github/semplon/summernote-ext- elfinder","title":"semplon/summernote-ext-elfinder","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143 418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"h ttps://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6 -9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/semplon/summernote-ext-elfinder"}},"update s":{"snippets":[{"icon":"PERSON","message":"@semplon in #3: @moxley5658 did you had load the jquery-ui ? jquery-ui must be loaded to make this work"}],"action":{"name":"View Issue","url":"https://github.com/semplon/summernote-ext-elfinder/issues/3#is suecomment-331708496"}}}

semplon commented 6 years ago

try this

https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css

moxley5658 commented 6 years ago

Thanks! Ill give that a wing!

Regards,

Michael Moxley Storm Group Enterprise www.stormbuilt.com (610) 742-9474

From: Dennis Suitters notifications@github.com Reply-To: semplon/summernote-ext-elfinder <reply+01e8a3d811e8a4e3b04f7be51793f26d1c37840cdfa820f292cf0000000115df70849 2a169ce0b6e2155@reply.github.com> Date: Sunday, September 24, 2017 at 9:09 AM To: semplon/summernote-ext-elfinder summernote-ext-elfinder@noreply.github.com Cc: Michael Moxley mmoxley@stormbuilt.com, Mention mention@noreply.github.com Subject: Re: [semplon/summernote-ext-elfinder] Elfinder does not open (#3)

You also need to watch the order of loading the scripts in the document.

‹ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/semplon/summernote-ext-elfinder/issues/3#issuecomment-33 1709078 , or mute the thread https://github.com/notifications/unsubscribe-auth/Aeij2N5uK1KAsIREvpeLw_tFd Ko1kplYks5sllSEgaJpZM4K8uD9 .

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4b b","name":"GitHub"},"entity":{"external_key":"github/semplon/summernote-ext- elfinder","title":"semplon/summernote-ext-elfinder","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143 418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"h ttps://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6 -9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/semplon/summernote-ext-elfinder"}},"update s":{"snippets":[{"icon":"PERSON","message":"@StudioJunkyard in #3: You also need to watch the order of loading the scripts in the document."}],"action":{"name":"View Issue","url":"https://github.com/semplon/summernote-ext-elfinder/issues/3#is suecomment-331709078"}}}

moxley5658 commented 6 years ago

Ok, we are getting somewhere, now, a new window opens, but it appear there are no file. There is also an error message that says 'Invalid backend response. Data is not JSON."

Regards,

Michael Moxley Storm Group Enterprise www.stormbuilt.com (610) 742-9474

From: Puguh Wijayanto notifications@github.com Reply-To: semplon/summernote-ext-elfinder <reply+01e8a3d87144028eecc3ce241403ef35ab9936ea77744a4192cf0000000115df7eb49 2a169ce0b6e2155@reply.github.com> Date: Sunday, September 24, 2017 at 10:09 AM To: semplon/summernote-ext-elfinder summernote-ext-elfinder@noreply.github.com Cc: Michael Moxley mmoxley@stormbuilt.com, Mention mention@noreply.github.com Subject: Re: [semplon/summernote-ext-elfinder] Elfinder does not open (#3)

try this

https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css

‹ You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/semplon/summernote-ext-elfinder/issues/3#issuecomment-33 1712588 , or mute the thread https://github.com/notifications/unsubscribe-auth/Aeij2Ml4-Ai_jR06EEkWaC70n bVdDCHMks5slmK0gaJpZM4K8uD9 .

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4b b","name":"GitHub"},"entity":{"external_key":"github/semplon/summernote-ext- elfinder","title":"semplon/summernote-ext-elfinder","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143 418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"h ttps://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6 -9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/semplon/summernote-ext-elfinder"}},"update s":{"snippets":[{"icon":"PERSON","message":"@semplon in #3: try this\r\n\r\nhttps://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui .min.js\r\nhttps://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui. min.css\r\n\r\n"}],"action":{"name":"View Issue","url":"https://github.com/semplon/summernote-ext-elfinder/issues/3#is suecomment-331712588"}}}

semplon commented 6 years ago

okay, awsome. now please take a look at this part. url : 'js/plugins/summernote/connector.minimal.php', // change with the url of your connector

this should be the url with http protocol where your connector located. it's usually at the elfinder itself.

ngrcode commented 5 years ago

please help me I dont have this file connector.php how can I get it?

semplon commented 4 years ago

@ngrcode the connector file can be found at your elfinder folder.

studio-42:

open this file. rename it or copy it to other file. you can insert this connector to the js code.