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 customise the output of the WP image gallery shortcode from a plugin?
- How to load wp_editor via AJAX
- How to include code only on specific pages?
- Custom media upload content for inserting custom post shortcode
- How to Add WYSIWYG Editor (tinyMCE) to plugin options page compatible with WordPress 3.0 and up?
- TinyMCE Advanced newline problem
- Checking if an attribute exists in a shortcode
- how to include other plugins css files in a shortcode?
- What characters are allowed as a shortcode tag and how should they be sanitized?
- All shortcodes not working on custom theme
- enqueue script only if it is not already enqueue
- Shortcode output appears before post body [duplicate]
- Autogenerate wordpress shortcodes using array?
- PHP Deprecated: Non-static method should not be called statically
- Disable text tab on WordPress text-editor
- How to parse nested shortcodes?
- Loading shortcode with ajax
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- Adding Custom Fields for Img in Posts
- How to call shortcode function directly and pass $atts
- How To Ignore a Filter On Applying Filter the Content In a Function
- Cannot strip JW Player shortcode?
- Issues creating a tinyMCE plugin that creates a custom link
- Shortcode display outside the div
- How to pass multiple values in shortcode?
- append stylesheet via shortcode
- Shortcode under a Shortcode Multiple times Possible?
- Pass $this to function nested in another public function of the same class
- change plugin shortcode function [closed]
- 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
- Dynamic HTML not displaying at respective place
- shortcode doesn’t work
- Plugin form unable to process
- Adding rich text editor to my plugin
- Calling shortcode in wp_localize_script strips result
- Nested shortcodes
- WordPress shortcodes & performance
- How to Add TinyMCE’s plugin in wordpress?
- White text on white background in TinyMCE when wp_editor is called in WP 3.9
- Is it possible to make shortcodes NOT case sensitive?
- Short code for Venues
- do_shortcode() doesn’t work if shortcode contained in variable, works if shortcode passed as string
- Layout shop page: resize images and columns
- How to add inline css/js inside a shortcode
- How extend shortcode default values for a plugin?
- how to show database content in wordpress post
- wp_specialchars and wp_specialchars_decode in a shortcode plugin
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Shortcode in AJAX popup
- Frontend editing, Frontend user dashboard
- echo do_shortcode is not working on theme’s template
- Looking for a solution – slightly convoluted problem
- Can’t get custom posts of taxonomy to show
- How can I get the post content displayed in a text field that allows to edit posts?
- How to add custom JS to tinymce in wordpress
- Plugin shortcode won’t work on a custom template file [closed]
- how to load tinymce external plugin
- Can I use a Shortcode output as an HTML attribute value?
- WP theme with Backbone
- shortcodes displaying outside of content area with echo statement, not what I wanted [duplicate]
- Shortcode doesn’t work if I directly paste its function in a template file?
- 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)
- Can wp_localize_script be used within a shortcode?
- Shortcode to generate and save password in a file
- Force [wordpress_social_login] shortcode to display where it is embedded [closed]
- Overriding Attributes values in Shortcode Plugins
- Set WordPress TinyMCE Editor To Readonly
- May i Use ShortCode in Template?
- Pass variable to nested shortcode
- Add custom variable in Contact Form 7 mail body
- Demystifying and understanding shortcode nomenclature
- How to modify shortcode attributes with data from current post
- get shortcode value
- Confused about shortcode and settings values
- Running jquery script after shortcode [closed]
- How to generate CSS from a shortcode within a plugin
- Add htmlentities and/or shortcode into data-attributes
- Storing Options in a Shortcode
- Getting selected (highlighted) html from the Visual Editor on Edit Post page?
- Custom CSS for plugin form
- Any Short code Availble for Get Post List With Thumbnail Plugin?
- Where to call add_shortcode function in WordPress Plugin Boilerplate?
- Show history of post revisions on front end
- Prevent shortcode from being wrapped in tags
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- Plugin echos text from shortcode function in gutenberg page editor
- Shortcode based chart plugin
- Plugin shortcodes not working in custom theme
- tag breaks shortcode output (other solutions don’t work)
- Input with spaces in Shortcode attributes overwritten by defaults
- How can I create a custom shortcode that will return a custom post type by ID?
- Plugin Handle URL With Custom Theme