Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to select the content before you can apply removeFormat to it.</p> <p>You could try grabbing the range ( even if it's just the cursor sitting at the insertion point ) and saving a bookmark before you paste.</p> <p>After you paste, use the bookmark to select that range again.</p> <p>That should select everything that you pasted between the start and end of the range.</p> <p>Then you can use removeFormat:</p> <pre><code>editor.execCommand( 'removeFormat', editor.selection ); </code></pre> <p>Here are the links to the range and selection API pages:<br /></p> <h3><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.range.html" rel="nofollow">http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.range.html</a></h3> <h3><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.selection.html" rel="nofollow">http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.selection.html</a></h3> <p>I've found it easier to work with ranges, the createBookmark method is good because it sets markers and you can grab the correct start and end points even if the DOM changes ( as it will when you paste in the new content ). You can use moveToBookmark() after the paste to select the range.</p> <h3><a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.range.html#createBookmark" rel="nofollow">http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dom.range.html#createBookmark</a></h3> <p>Because the documentation is sparse, I've found it helpful to search the source code for places where the methods are called. Looking at how they're used gives me a better idea of what kind of object I need to apply the methods to.</p> <p>Be Well, Joe</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload