control the output of the "createLink" tool

2 posts, 0 answers
  1. Ofer
    Ofer avatar
    3 posts
    Member since:
    Apr 2016

    Posted 17 Nov Link to this post

    When users use the "createLink" tool of the editor, I need to trap the output and Make it Bold and Underline.

    How can I change the output? 

    Is there an event I can hook on? an API I can use?

    If there is a way to add functionality to any tool of the editor, I would like to be able to do it.

     

    Thank you in advance

  2. Dimitar
    Admin
    Dimitar avatar
    225 posts

    Posted 21 Nov Link to this post

    Hello Ofer,

    The desired behavior can be achieved by extending the LinkFormatter's apply() method as follows:
    <script>
    var _apply = kendo.ui.editor.LinkFormatter.fn.apply;
         
    kendo.ui.editor.LinkFormatter.fn.apply = function(range, attributes) {  
     var attributesExtended = $.extend({
      style: { "fontWeight": "bold", "textDecoration": "underline" }
     }, attributes);
           
    _apply.call(this, range, attributesExtended);
    }
    </script>

    I have prepared a Dojo example, where you can observe that after inserting a link, the output <a> tag is styled with font-weight: bold and text-decoration: underline. 

    The Kendo UI Editor also allows you to create custom tools. Refer to the below resources for examples and additional information:


    Regards,
    Dimitar
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top