wp-shortcake / shortcake

Shortcake makes using WordPress shortcodes a piece of cake.
GNU General Public License v2.0
664 stars 143 forks source link

Select some text to wrap a shortcode around #115

Open danielbachhuber opened 9 years ago

danielbachhuber commented 9 years ago

It would be nice if a user could select some text, and wrap a shortcode around the text.

If we added a TinyMCE button to the editor, we could detect when text was selected.

Prompted by https://spinpress.com/inline-notes-shortcode-experiment/

swissspidy commented 9 years ago

Yay! I'm not quite familiar with TinyMCE, but maybe I can dig a bit into it next month to test this.

Looks like getting the selected text is quite easy

Maybe looking at the "Add link" button will help too.

jasonbahl commented 8 years ago

+1

diegoliv commented 8 years ago

+1 For this one too! I'm creating a shortcode that would wrap some html content around. One approach would be having a WYSIWYG textarea for inner_content (which has been discussed), and another approach would be creating the content using the WordPress Editor, then selecting the content, and adding the shortcode (automatically inserting the selected html content into inner_content).

cbergen commented 6 years ago

Here's what I'm using for the second approach described by @diegoliv. The selected content in the TinyMCE editor is inserted into the inner_content textarea.

https://gist.github.com/cbergen/a42dfaf963c6d41a801799ec2fe56d43