Enable tinyMCE in a textarea
Permalink
I'm building my own block and I'm having trouble to setup tinyMCE in it.
What should I do? I want one like the "content" block. I took a look at the code but I'm not being able to put it in the textarea from my block.
Thanks in advance,
Lucas Lobosque.
What should I do? I want one like the "content" block. I took a look at the code but I'm not being able to put it in the textarea from my block.
Thanks in advance,
Lucas Lobosque.
Hi. TinyMCE is a beast -- definitely not easy to work with. I think your best bet would be to copy the built-in "content" block and modify it from there (so instead of building your block and then adding a TinyMCE editor, you should start with a copy of the Content block and add in your custom functionality).
You could also download the free "Content Around Image" block from the marketplace, which integrates a TinyMCE editor.
Note that both of those blocks have a lot of code which deals with filtering the saved html (so that things like links to other site pages are given the proper URL).
I'm thinking about building a block that utilizes the TinyMCE editor myself, but it's definitely going to be a challenge -- please post back here with any insights you gain in the process!
-Jordan
You could also download the free "Content Around Image" block from the marketplace, which integrates a TinyMCE editor.
Note that both of those blocks have a lot of code which deals with filtering the saved html (so that things like links to other site pages are given the proper URL).
I'm thinking about building a block that utilizes the TinyMCE editor myself, but it's definitely going to be a challenge -- please post back here with any insights you gain in the process!
-Jordan
In response to smallgoodthing, I would say that using the TinyMCE editor on its own might be easier to develop with, but you're going to lose a very important feature which is the ability to integrate the C5 site map and file manager (those "Insert Page Link", "Insert File", etc. links at the top of the editor).
This might be good enough if you're just building this block for yourself or a client, but it's not going to work well if you plan on putting this up on the marketplace.
This might be good enough if you're just building this block for yourself or a client, but it's not going to work well if you plan on putting this up on the marketplace.
1. Forget everything you know about Concrete5's implementation of tinyMCE Rich Text Editor, and go to tinyMCE's "Try it" website (http://tinymce.moxiecode.com/tryit/full.php).
2. There, click "View Source" and copy the code.
3. Add the code either as a block on the front-end or to a script in yoursite.com/single_pages/yourpage.php (you should find this file at concrete/single_pages/..., then just copy yourpage.php to yoursite.com/single_pages/...).
4. If at this point it's still not working, modify to your liking the following code and then add it between <div> tags in the body of yourpage.php:
[code][/code]