Jump to content

TinyMCE not loaded automatically in front end form.


adrian
 Share

Recommended Posts

Hi everyone,

Not sure if this is a bug or intended behavior, but I am using

$form = $modules->get('InputfieldForm');
 

to load a page for editing in a front end form. Everything works great, including applying InputfieldTinyMCE as a class on the <li> and loading the tiny config settings in the head: 'var config = .........' 

But, the one thing missing is the tinymce scripts themselves - ie:

<script type='text/javascript' src='/wire/modules/Inputfield/InputfieldTinyMCE/InputfieldTinyMCE.js?v=358'></script>
<script type='text/javascript' src='/wire/modules/Inputfield/InputfieldTinyMCE/tinymce-3.5.8/tiny_mce.js'></script>
 

Obviously I can manually add these, but I feel like they should be added automatically if a field requires the editor to be loaded.

Thanks.

Link to comment
Share on other sites

I have no idea about this really, but I would think you would normally add these manually to the template for the form.

Generally speaking, PW doesn't force you to load anything unless you actually want it to! At least, not in the front end, which is seen as your domain rather than PW's domain.

Which is unusual and rather welcome :)

On the other hand, this might be something else entirely....

Link to comment
Share on other sites

Hi Joss - I am not sure either really. I definitely like the fact that PW doesn't load tons of stuff on the front end automatically.

I guess I just think in this case it is applying the class and loading the TinyMCE config settings, which it only does when there is a form field that requires them, so it seems to me that it is only doing half the job. I think perhaps it should either load everything, or nothing?

There is quite possibly a very logical reason for this that I am not seeing though :)

Link to comment
Share on other sites

Thanks Soma - I hadn't come across that approach to loading scripts and styles. That completely takes care of loading the required files.

Just in case someone else comes across this, as per http://processwire.com/talk/topic/1204-modules-css-listed-in-config-styles-frontend/ I am using the following:

foreach($config->scripts->unique() as $file) echo "\n\t<script type='text/javascript' src='$file'></script>";
foreach($config->styles->unique() as $file) echo "\n\t<link type='text/css' href='$file' rel='stylesheet' />";

Thanks, and sorry for not understanding the way $config could be used like this on the front end - very handy!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...