This is a migrated thread and some comments may be shown as answers.

control the output of the "createLink" tool

1 Answer 219 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ofer
Top achievements
Rank 1
Ofer asked on 17 Nov 2017, 03:37 PM

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

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 21 Nov 2017, 02:08 PM
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.
Tags
Editor
Asked by
Ofer
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or