TinyMCE Button to Insert Multiple Lines of Text?

Is there a way to get my custom TinyMCE button to insert multiple lines of text? Ultimately I am making a “Premade Themes” button where a user will select a theme and it will insert about 6-8 different shortcodes with one click and they can edit the shortcodes accordingly..

A problem I’m having is that all of these shortcodes get put in one line. Here’s the code I use that actually pastes the shortcodes:

tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : 'the shortcodes go here'});

Any help is appreciated!

1 Answer
1

This should be as easy as adding <br /> between shortcodes or every time you want to add a new line and also if you are inserting content you should use mceInsertContent instead of mceInsertClipboardContent unless you are actually getting the content from the clipbard, so:

tinyMCEPopup.editor.execCommand('mceInsertContent', false, '<p>[shotcode1]<br/>[shotcode2]<br/>[shotcode3]</p>'));

Leave a Comment