Soma Posted September 6, 2013 Share Posted September 6, 2013 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: create a new folder in /site/tinymce create new folder in /site/tinymce/plugins add this plugin folder into it. The folder should be called "addcontent" 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. add this to the text on a new line: addcontent: /site/tinymce/plugins/addcontent add the button to one of the theme_advanced_buttons "...,addcontent" done You should now have a new button in your toolbar, click it to add a new paragraph to the end of the content. I couldn't think of a better name. "addcontent" maybe someone has an better name? 3 Link to comment Share on other sites More sharing options...
ryan Posted September 8, 2013 Share Posted September 8, 2013 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. 1 Link to comment Share on other sites More sharing options...
Soma Posted September 9, 2013 Author Share Posted September 9, 2013 Thanks for mention it! Yes yes this is the other strange thing I noticed as well when using pre element. Now just thinking about it we may need a prepend and an append button... 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now