TinyMCE for regular users

Permalink
I'm using concrete5's built-in TinyMCE editor and it appears it only works for administrators. Is it possible to make it work for regular users as well? As of now, tinymce "is not defined" on page load.

P.S. Bootstrap also doesn't work for regular users, only for admins. How to solve this?

 
nklatt replied on at Permalink Reply
I'm having this same issue right now - I have a textarea on a public-facing page that I want to be WYSIWYG but it only works if I'm logged in otherwise I get "ReferenceError: tinyMCE is not defined" in the console.

I was hopeful adding Loader::element('editor_init'); would fix it but it looks like that's been deprecated, given its content at the moment ("empty for legacy purposes").

What's the best (i.e., most c5) way to include the TinyMCE javascript?
nklatt replied on at Permalink Reply
Okay, I expect I need to do something like "$this->addHeaderItem(Loader::helper('html')->javascript('tiny_mce/tiny_mce.js'));" somewhere but adding it to my External Form brings me no joy. (I also tried addFooterItem in case I was simply too late to add to the header but that didn't work, either.)

I'm still pretty lost in c5 so I'm not sure what "this" would refer to from within an External Form - I believe it needs to refer to a controller, block controller, or view object. Do I need to add that call somewhere else? Do I need to modify it so it works from within the External Form?

(Oh, looks like "this" refers to a BlockView object there...)
nklatt replied on at Permalink Reply
Okay, getting there. I moved $this->addHeaderItem(Loader::helper('html')->javascript('tiny_mce/tiny_mce.js')); to the External Form's controller file and now the textarea is indeed being converted to TinyMCE but the Add Image / File / Link stuff isn't turning blue. Baby steps...
nklatt replied on at Permalink Reply
And - duh - I don't want those controls on a public-facing page! Adding that JS to on_start was all that was needed.
mhawke replied on at Permalink Reply
mhawke
I hate to interrupt the fine conversation you are having with yourself but what are you trying to build? What are you trying to accomplish? Perhaps there is a conceptually different way to solve this within the regular c5 structure.
nklatt replied on at Permalink Reply
That's okay, my convo with myself was complete.

I have a form that has a WYSIWYG input and I'm using TinyMCE for it. The TinyMCE javascript must be built into one of the script files included with all pages when someone is logged in but it needs to be included explicitly for forms being used by browsers that are not logged in.
mhawke replied on at Permalink Reply
mhawke
This might help.

If you haven't already used this free add-on, it's a good starting point.

http://www.concrete5.org/marketplace/addons/designer-content/...

Use it to build a block with just single Content Block and have a look at what gets installed in the controller.
nklatt replied on at Permalink Reply
I like it - thanks.
mhawke replied on at Permalink Reply
mhawke
Everybody does. Have fun!
nklatt replied on at Permalink Reply
Okay, I expect I need to do something like "$this->addHeaderItem(Loader::helper('html')->javascript('tiny_mce/tiny_mce.js'));" somewhere but adding it to my External Form brings me no joy. (I also tried addFooterItem in case I was simply too late to add to the header but that didn't work, either.)

I'm still pretty lost in c5 so I'm not sure what "this" would refer to from within an External Form - I believe it needs to refer to a controller, block controller, or view object. Do I need to add that call somewhere else? Do I need to modify it so it works from within the External Form?

(Oh, looks like "this" refers to a BlockView object there...)
mhawke replied on at Permalink Reply
mhawke
Just to make sure we're on the same page, have you actually added your form to the '[root]/blocks/external_form/' folder with a corresponding controller file added to '[root]/blocks/external_form/controllers/'
nklatt replied on at Permalink Reply
Precisely.

And, just to be sure you're not distracted by this unnecessarily, I was able to get things functioning by adding $this->addHeaderItem(Loader::helper('html')->javascript('tiny_mce/tiny_mce.js')); to my External Form's controller file.
rc255 replied on at Permalink Reply
rc255
Hi there, Iknow that this is an old link, but I am trying to get this exact thing to work.

I have it working for 'admin' but I can't get it to work for regular users....

I have a hard-coded form and I want to get the tiny_mce editor to work on a text area. I have tried adding
<? $this->addHeaderItem(Loader::helper('html')->javascript('tiny_mce/tiny_mce.js')); ?>

to the top of my page, but I am not using a controller as the page is just a hard-coded 'theme' page.

Any pointers as to what I can do to get it to work?

Many thanks

Rob