Open danielbachhuber opened 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.
+1
+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
).
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
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/