MCPcopy
hub / github.com/autoNumeric/autoNumeric / _onKeydownGlobal

Method _onKeydownGlobal

src/AutoNumeric.js:7813–7824  ·  view source on GitHub ↗

* Listen for the `alt` key keydown event globally, and if the event is caught, unformat the AutoNumeric element that is hovered by the mouse. * * @param {KeyboardEvent} e * @private

(e)

Source from the content-addressed store, hash-verified

7811 * @private
7812 */
7813 _onKeydownGlobal(e) {
7814 //TODO Find a way to keep the caret position between the alt keyup/keydown states
7815 if (AutoNumericHelper.character(e) === AutoNumericEnum.keyName.Alt) {
7816 const hoveredElement = AutoNumericHelper.getHoveredElement();
7817 if (AutoNumeric.isManagedByAutoNumeric(hoveredElement)) {
7818 const anElement = AutoNumeric.getAutoNumericElement(hoveredElement);
7819 if (!anElement.formulaMode && anElement.settings.unformatOnHover) {
7820 this.constructor._unformatAltHovered(anElement);
7821 }
7822 }
7823 }
7824 }
7825
7826 /**
7827 * Listen for the `alt` key keyup event globally, and if the event is caught, reformat the AutoNumeric element that is hovered by the mouse.

Callers 1

_createEventListenersMethod · 0.95

Calls 5

characterMethod · 0.80
getHoveredElementMethod · 0.80
getAutoNumericElementMethod · 0.80
_unformatAltHoveredMethod · 0.80

Tested by

no test coverage detected