Try to use this instead:
editor.focus();
var selected_text = editor.selection.getContent();
shortcode="[checklist-box title="" + e.data.title + '"]' + selected_text + '[/checklist-box]';
editor.selection.setContent(shortcode);
editor.setContent(editor.getContent());
Basically, I’m first forcing editor focus and then use setContent instead to change the content. In my tests there were still some glitches on the editor but the source was ok, so I just copy all content and set it again to refresh the editor.
Related Posts:
- How to add a shortcode button to the TinyMCE editor?
- accessing wp.media api from a tinymce plugin
- Is there a good way to load tiny_mce_popup.js through editor.windowManager.open?
- How to include code only on specific pages?
- TinyMCE Advanced newline problem
- how to include other plugins css files in a shortcode?
- PHP Deprecated: Non-static method should not be called statically
- Disable text tab on WordPress text-editor
- Loading shortcode with ajax
- Cannot strip JW Player shortcode?
- How to pass multiple values in shortcode?
- append stylesheet via shortcode
- Calling function from within functions.php returns unwanted value
- plugin shortcodes not working on custom theme- unsure how to fix
- How to list all active and specific shortcodes in wordpress
- Adding rich text editor to my plugin
- Nested shortcodes
- White text on white background in TinyMCE when wp_editor is called in WP 3.9
- Plugin shortcode won’t work on a custom template file [closed]
- how to load tinymce external plugin
- shortcodes displaying outside of content area with echo statement, not what I wanted [duplicate]
- Trying to count the total number of paragraphs inside a blog article
- How Can I Pass the Shortcode’s $atts Variable to the Plugin’s Javascript Function
- Adding json as params to shortcode
- Shortcode is not working in homepage page template (custom front page)
- May i Use ShortCode in Template?
- How can I create a custom shortcode that will return a custom post type by ID?
- Adding Shortcode to Text Widget
- AddToAny shortcode in the loop
- How to add an automatic refresh in WordPress for a Page/Post or an embedded OneDrive/Excel HTML Code?
- Making a Template for a CPT created by a plugin
- How to edit content before post update
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- How to replace wordpress default text editor (TinyMCE) with a custom one.
- Creating shortcodes in plugin
- Visual Composer shortcode for child theme dir
- get_post_title is not working on homepage
- How to load wp_editor via AJAX
- Trouble adding tiny mce to textarea in custom plugin
- Hook into existing tinyMCE button
- Create shortcode to echo javascript
- Redirect to another page using contact form 7? [closed]
- Custom Shortcode Broken in WordPress 3.1
- Namespaced shortcode?
- Why shortcode always displayed after footer not in body
- Why am I unable to load scripts in head in plugin?
- Where to find the code used to render a page that has a shortcode and a template defined?
- convert more tag to shortcode
- Shortcode does not expand in Facebook like
- Override/ignore CSS from active theme as not to interfere with my custom CSS
- How to use template inside plugin shortcode with variables for big HTML code
- Get post content from outside the loop with plugin shortcode usability
- How to rewrite URL and get the values?
- How to prevent tabs from opening all at once
- Executing Javascript in Plugin
- Shortcode and variable
- How can I achieve this, using shortcodes
- Example for use tinymce in wordpress 3.5.1?
- Create Short code dynamically
- Get variable value based on string constant
- How to disable tinyMCE button added by a plugin?
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- How To Use do_shortcode with WooCommerce One Page Checkout
- How to hide the cell properties and row properties in TinyMCE WordPress?
- How to get current cart values using WC_Shortcodes?
- Can I add Short Code Of A Plugin In The Code Editor of WordPress?
- insert og image link in wordpress post
- Get a value from a shortcode for another function
- How to check if short code is present in template?
- How to call function in WordPress on button click?
- Why is my shortcode not working?
- save short-code in my custom plugin settings problem missed something
- WordPress show descriptions under images in gallery
- Modify Plugin PHP Class in Child Theme – Correct Method
- TinyMCE how to add css when inputing a text
- can’t use span or icon tags on when editing visual composer element
- Meta box or shortcode help
- function of parent not working in childtheme
- Extending the “Add Media”-Dialog … how do I finally insert something to the Post?
- Call/Run a Mathematica (.m) Shell Script from WordPress Page/Blog
- Filter html of WordPress editor in visual mode only
- Posting code inside the post instead of in the template file using shortcode
- How to use shortcode of any plugin to show it visually where i want?
- Why function hooked using object are executing at all time?
- Need to change contact email depending where user is from
- Pulling RSS from site and display it in posts
- Trying to Understand Shortcodes.
- Shortcode return is printing a 1 afterward
- How to use ‘Event Manager Shortcodes’ plugin via the php code? [closed]
- How can I replace the built in WordPress editor?
- Any way to hook into WP after a page displays?
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Display HTML5 jQuery Audio Player On Front Page
- Shortcode returning specific content of a post
- Invalid argument supplied for foreach()
- cURL External API request displays content above other content on page
- Beginner question: Accessing js script in plugin
- thumbnail_width not working in wordpress most popular post plugin
- Display file contents within Plugin