We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to detect if editing text


It seems that selecting one or more objects and then clicking on the Delete key, results in the browser navigating to the previous page.

I realize that I can detect the Delete key being pressed, but I also need to know that I am not editing text on a node or connector.  If that is the case, then the Delete key should be allowed to do what it normally would do - delete characters.  But if no text is being edited, I can then perform a diagram.remove(); rather than let the browser navigate.




1 Reply

SG Shyam G Syncfusion Team May 22, 2015 11:39 AM UTC

Hi Jim

Thanks for using Syncfusion products.

Please note that by default when we edit the node’s label and press the delete key, the node will not be deleted. However we suggest you to use label’s “mode” property to identify whether the label is in edit mode or view mode. Please refer the online UG documentation link for more details. Please refer the code snippet below.


Code snippet:

$(window).keydown(function (e) {

var diagram = $("#DiagramContent").ejDiagram("instance");

var node = diagram.model.selectedItems.children[0];

if (node && node.labels[0]) {

//identify whether label is in edit mode

if (ej.datavisualization.Diagram.LabelEditMode.Edit == "edit") {



//identify whether label is in view mode

if (ej.datavisualization.Diagram.LabelEditMode.View == "view") {




Please let me know if any concerns.

Shyam G

Live Chat Icon For mobile
Up arrow icon