ReyDev Posted January 3 Share 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 Link to comment Share on other sites More sharing options...
Nathan Explosion Posted January 3 Share Posted January 3 Is that all you've done? Link to comment Share on other sites More sharing options...
ReyDev Posted January 3 Author Share 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. Link to comment Share on other sites More sharing options...
Nathan Explosion Posted January 3 Share Posted January 3 Did you load the js file? Link to comment Share on other sites More sharing options...
ReyDev Posted January 3 Author Share 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(.....) Link to comment Share on other sites More sharing options...
Nathan Explosion Posted January 3 Share 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 Link to comment Share on other sites More sharing options...
ReyDev Posted January 3 Author Share Posted January 3 thank you Nathan Explosion 1 Link to comment Share on other sites More sharing options...
ReyDev Posted January 5 Author Share Posted January 5 in my case, i used vanilla JS instead of Jquery. it worked! Link to comment Share on other sites More sharing options...
Recommended Posts