StartBackspacePressed: function(sender, args);
sender. Event source.
args. Event information.
The StartBackspacePressed event occurs after pressing the BACKSPACE key when the cursor is before the first term character.
To execute the example, the HTML page must contain links to the PP.js and PP.Ufe.js scenario files and PP.css and PP.Ufe.css styles files in the <body> tag of HTML document of the <div> element with the "termedit" identifier. Create a formula editor and add the 20+30 string:
function createTerm() { // Create a formula editor termEdit = new PP.Ufe.Ui.TermEdit({ // Set parent element ParentNode: document.getElementById("termEdit") }); // Add terms termEdit.insertString("20+30"); }
Put the cursor to the term with the 30 contents. Add a handler of the StartBackspacePressed event to the selected term, set a keyboard key press event handler to the formula editor:
// Get selected term term = termEdit.getSelectedTerm(); // Set BACKSPACE key pressing before term event handler for the selected term term.StartBackspacePressed.add(function (sender, args) { console.log("The BACKSPACE key is pressed before the selected term"); });
Put the cursor before the term with the 30 contents and press the BACKSPACE key. As a result the term with the + contents is deleted:
The console displays a message about pressing the BACKSPACE key before the selected term:
The BACKSPACE key is pressed before the selected term
See also: