Last Updated: 13 Apr 2020 09:12 by ADMIN
Created on: 10 Apr 2020 12:47
Category: Editor
Type: Feature Request
Snippets and PasteCleanup options

Hello there,


I'm trying to use both snippets (to make a shortcode for our users to add templated Links) and pasteCleanup option (to prevent any style to be import from a copy paste) but it seems like the pasteCleanUp option is preventing my html tags from snippets to be added.


Here my code :

      .HtmlAttributes(new { style = ViewData["style"], @class = ViewData["class"] })
      .Resizable(resizable => resizable.Content(true).Toolbar(true))
      .PasteCleanup(paste => paste.All(true))
      .Tools(tools => tools
                .Snippets(snippets =>
                    snippets.Add("Test", " <a class='testclass' href='www.test.com'>TestLink</a> ");

If I don't remove the line

.PasteCleanup(paste => paste.All(true))

All I can get from my snippet is "TestLink" instead of "


<a class='testclass' href='www.test.com'>TestLink</a>


But maybe i'm doing this wrong ?


Thx a lot.



1 comment
Posted on: 13 Apr 2020 09:12

Hi Philippe,

With the current implementation of the Editor widget, the Snippet command actually pastes the predefined snippet in the editable area, thus the observed behavior can be expected. However, as different behavior is expected I have converted this thread to a Feature Request and made it available on our Feedback portal here. We will monitor the community interest in the proposed Feature and based on the interest and our tasks queue will consider adding it to a future release. 

As a possible workaround, you can handle the execution of the inserthtml command within the execute event on the client-side. When the command is executed you would need to turn off the pasteCleanup, paste the snippet, and then reset the pastCleanup configuration:

        if(e.name == "inserthtml"){
          e.sender.options.pasteCleanup.all = false;

Here is a dojo that demonstrates this approach.

Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.