goog.events.listen key-press event
Oxygen general issues.
-
- Posts: 32
- Joined: Mon Apr 10, 2017 8:56 pm
goog.events.listen key-press event
Hello,
I'm trying to stop the propagation of the key-press event for the delete key by using the code below in the framework.js file.The delete key fails to stop propagating. Am I listening at the correct eventSource as in goog.events.listen(eventSource, eventType, listener, [capturePhase, [handler]]); for this action?
Any thoughts would be appreciated.
Thanks!
John
I'm trying to stop the propagation of the key-press event for the delete key by using the code below in the framework.js file.
Code: Select all
goog.events.listen(goog.dom.getDocument(), goog.events.EventType.KEYDOWN, function(e) {
if(e.keyCode == goog.events.KeyCodes.DELETE){
//do stuff...
e.getBrowserEvent().preventDefault();
e.getBrowserEvent().stopPropagation();
}
});
Any thoughts would be appreciated.
Thanks!
John
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: goog.events.listen key-press event
Post by cristi_talau »
Hello,
It works if you listen on the "capture" phase (note the last parameter - true):
Anyway, depending on your use-case (e.g. if you are trying to alter the behaviour of the editor deletion), using the Java API might be a better idea, for example https://www.oxygenxml.com/InstData/Edit ... ilter.html .
Best,
Cristian
It works if you listen on the "capture" phase (note the last parameter - true):
Code: Select all
goog.events.listen(goog.dom.getDocument(), goog.events.EventType.KEYDOWN, function(e) {
if(e.keyCode == goog.events.KeyCodes.DELETE){
//do stuff...
e.getBrowserEvent().preventDefault();
e.getBrowserEvent().stopPropagation();
}
}, true);
Best,
Cristian
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service