TheFehr
TheFehr

I'm working on a free, open-source GraphQL plugin for OctoberCMS. And I found this amazing editor. It is a react component. I set up a simple react.ts project added that component and then built a bundle with webpack. When I tried to

$this->addJs("thebundle.js");

I ended up with unclear error message, I managed to figure out that I need to add a small custom js that loads the webpack bundle only after the dom is finished loading.

Now my questions:

  1. Would it be possible to extend the addJs function? Maybe so one can decide if the Js should be added in the header or after the body?
  2. Does anyone have experience with react in formwidgets, because now I got wierd styling errors and I don't know how to continue debugging.
mjauvin
mjauvin

The addCss will inject where {% styles %} is included in your layout, and addJs where {% scripts %} is included.

see: https://octobercms.com/docs/cms/pages#injecting-assets

TheFehr
TheFehr

Yes but in the backend I don't have control over the {% scripts %}.

mjauvin
mjauvin

what do you mean by "control"?

1-4 of 4