Jump to content

Allowed javascript controllers doesn't work


Recommended Posts

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

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

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

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:

 

Could contain: Text

 

Edited by Nathan Explosion
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...