Jump to content

TinyMCE plugin "addcontent"


Soma
 Share

Recommended Posts

Just created a simple TinyMCE plugin to work around a issue with TinyMCE and using div's (inserted via templates).

I know (and many others) of this limitation since a long time, when using templates in TinyMCE and you have a single div you can't add content after it anymore as there's no element that can be focused. There's no real easy solution to this.

As I'm also sometimes using (not often, but will in my current project) templates I just created a simple TinyMCE plugin to add a button where if you click it, it will add a paragraph at the end of the content.  -> <p>Text ...</p>

Here you go:

https://github.com/somatonic/addcontent

You can add this plugin to PW TinyMCE:

  1. create a new folder in /site/tinymce
  2. create new folder in /site/tinymce/plugins
  3. add this plugin folder into it. The folder should be called "addcontent"
  4. now in the PW admin in the TinyMCE configuration settings of your field you can add custom plugins via the text field "Third-party plugin" at the bottom.
  5. add this to the text on a new line: addcontent: /site/tinymce/plugins/addcontent
  6. add the button to one of the theme_advanced_buttons "...,addcontent"
  7. done

You should now have a new button in your toolbar, click it to add a new paragraph to the end of the content.

post-100-0-17946500-1378465397_thumb.png

I couldn't think of a better name. "addcontent" maybe someone has an better name? :)

  • Like 3
Link to comment
Share on other sites

Nice job Soma. I've actually had the same issue with TinyMCE and I don't even use templates. When using the <pre> format, if it's the last thing in the document, there's no way to add something after it. For example, if I'm editing the processwire.com site and adding a code example, suddenly I can't continue with anything after that. So I have to open up the HTML modal and add a <p>...</p> manually. It sounds like your plugin would fix this issue too. 

  • 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...