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

how to remove element

2 Answers 72 Views
Editor
This is a migrated thread and some comments may be shown as answers.
hepek
Top achievements
Rank 1
Iron
hepek asked on 18 Feb 2020, 06:06 PM

I am trying to enable "delete control" functionality via right-click menu.
so far I have a code like this, but I cannot find the appropriate function like editor.DeleteSelectedElement (or something like that):

 Telerik.Web.UI.Editor.CommandList["Remove Hyperlink"] = function (commandName, editor) {
            var hyperLink = editor.getSelectedElement(); // get the selected Hyperlink element.   
            editor.selectElement(hyperLink); // select the hyperlink
            *I need to delete selected element here. how do I do that? 
 };

 

thank you

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 19 Feb 2020, 01:58 PM

Hi Nermin,

You can use 

editor.getSelectedElement().remove();

or

editor.get_document().execCommand("Delete");

If you'd like to unlink the link you can execute:

editor.fire("Unlink");

I hope this helps.

Regards,
Rumen
Progress Telerik

Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
0
hepek
Top achievements
Rank 1
Iron
answered on 19 Feb 2020, 02:36 PM
thank you for very nice support!
Tags
Editor
Asked by
hepek
Top achievements
Rank 1
Iron
Answers by
Rumen
Telerik team
hepek
Top achievements
Rank 1
Iron
Share this question
or