ReyDev Posted January 3 Posted January 3 I want to embed a content in ckEditor, this content has a controller. i added this controller to the `Allowed javascript controllers` option. but it doesn't work and the controller doesn't load. what should i do? I added the controller name with this structure in `Allowed javascript controllers` option: valaapp.front.vala.valajsfile the folder structure is : js->front->controllers->vala->ips.vala.valajsfile.js
ReyDev Posted January 3 Author Posted January 3 In fact, the program has the following: - Sources -> Class -> MyClass extends \IPS\Content\Item Implements \IPS\Content\Embeddable - .phtml file that has a data-controller attribute I guess everything is set up (I followed the embedded blog structure), I also checked all the structures of the other IPS apps, unfortunately, none of them had a controller in their embedded file.
ReyDev Posted January 3 Author Posted January 3 Yes in embedContent() function, before returning the embedded template, I added CSS and JS files to the Output Class, CSS and JS don't work: \IPS\Output::i()->cssFiles = array_merge(.....) \IPS\Output::i()->jsFiles = array_merge(.....)
Nathan Explosion Posted January 3 Posted January 3 (edited) OK - I'm not going to get the full picture with such small bits of information so here's a quick working example (dev folder and tar included in zip - now deleted) Install the application on your test site In your editor settings, add jscontroller.test to the allowed javascript controllers Create a post, add the following as the HTML (via the source) <div data-controller="jscontroller.test">TEST</div> Submit the post. Result: Edited January 3 by Nathan Explosion ReyDev 1
ReyDev Posted January 5 Author Posted January 5 in my case, i used vanilla JS instead of Jquery. it worked!
Recommended Posts