www.example.com/elfinder.html?tv=22&res=109 www.example.com/elfinder.html?tv=<? echo $tvID; ?>&res=<? echo $resourceID; ?> www.example.com/elfinder.html?tv=[[!tvID]]&res=[[*id]] //MODX snippet and/or placeholde "www.example.com/elfinder.html?tv="+tvID+"&res="+resourceID //JavaScript www.example.com/elfinder.html?tv=0&res=0 //request made by RTE or other than TV www.example.com/elfinder.html //request made by RTE or other than TV
//elfinder.html <html> <body> <!--etc etc--> $(document).ready(function() { $('#elfinder').elfinder({ customData : { tv: "[[!getUrlParam? &name=`tv` &default=`0` &int=`1`]]", //grab TV id from url and pass to connector.php res: "[[!getUrlParam? &name=`res` &default=`0` &int=`1`]]" //grab Resource id from url and pass to connector.php //more }, //more }); }); </body> </html>
//connector.php $tv = $res = $context = ""; if(isset($_GET["tv"]) && !empty($_GET["tv"])){ $tv = $_GET["tv"]; //force to be integer } if(isset($_GET["res"]) && !empty($_GET["res"])){ $res = $_GET["res"]; //force to be integer } if($tv && $res){ $context = $modx->getObject("modResource", $res); $context = empty($context) ? 'web' : $context->get('contextKey'); $tvObj = $modx->getObject('modTemplateVar', $tv); $source = $tvObj ->getSource($context, false); $properties = $source->getProperties(); $basePath = $properties['basePath']['value']; $baseURL = $properties['baseUrl']['value']; } else{ $basePath = "~path/assets/folder/"; //non TV request $baseURL = "/assets/folder/"; //non TV request } $opts = array( 'roots' => array( array( 'driver' => 'LocalFileSystem', // driver for accessing file system (REQUIRED) 'path' => $basePath, // path to files (REQUIRED) 'URL' => $baseURL, // URL to files (REQUIRED) ) ) ); // run elFinder $connector = new elFinderConnector(new elFinder($opts)); $connector->run();
RE: robcarey
To speak plainly, sir, I think there be a demon in that thing. MODX + that Editor causes untold rise of that maniacal entity.
Sorry for not having an answer at hand. I believe I have tried almost everything MODX-wise.
I can create a plugin to fix that, but that would be another time.
Yup, you may safely remove the old chunks.
Only make sure you have backed up the changes you made in order to re-implement them within the new version.
Consider also: duplicating all the chunks, retain their original names, but add a suffix, e.g. TinymceWrapperContent-suf, or TinymceWrapperContentHacked
Then open the plugin, go to default properties -> chunkSuffix, enter -suf or Hacked
In this way, you get to survive the dictatorial tendencies of upgrades.
Please test with your Articles container and child pages, do the RichTVs remain activated even when RTE is disabled for that resource? I remember you and some complained about this issue.
...However, the "auto detection" of "css, html, js" stops working in other pages. So basically the "code editor" stops working after this.
So I disabled this "suffix".
What can I do to use this suffix, and still keep all functions ?
Another (maybe stupid) question: where can I add simple defined "css classes" from my css file to be able to use by "click" in the editor ?
So when one selects a word, and clicks on the menu with the classes, and chooses one "css class", that element is wrapped with that css- class
tinymce.init({ ..., style_formats: [ { title: 'Bold text', inline: 'strong' }, { title: 'Red text', inline: 'span', styles: { color: '#ff0000' } }, { title: 'Red header', block: 'h1', styles: { color: '#ff0000' } }, { title: 'Badge', inline: 'span', styles: { display: 'inline-block', border: '1px solid #2276d2', 'border-radius': '5px', padding: '2px 5px', margin: '0 2px', color: '#2276d2' } }, { title: 'Table row 1', selector: 'tr', classes: 'tablerow1' } ], formats: { alignleft: { selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'left' }, aligncenter: { selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'center' }, alignright: { selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'right' }, alignfull: { selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes: 'full' }, bold: { inline: 'span', 'classes': 'bold' }, italic: { inline: 'span', 'classes': 'italic' }, underline: { inline: 'span', 'classes': 'underline', exact: true }, strikethrough: { inline: 'del' }, customformat: { inline: 'span', styles: { color: '#00ff00', fontSize: '20px' }, attributes: { title: 'My custom format' }, classes: 'example1' }, }, content_css: [ '//fast.fonts.net/cssapi/e6dc9b99-64fe-4292-ad98-6974f93cd2a2.css', '//www.tinymce.com/css/codepen.min.css' ] });