[ticket/12699] Replace magic numbers for the TAB and for ENTER keydown

Replaced the magic numbers 9 and 13 in the keydown for the text editor
with constants in the existing keymap for phpBB.

PHPBB3-12699
This commit is contained in:
brunoais 2014-06-13 12:10:38 +01:00
parent 2c70cec4fb
commit e1b72c0b86

View file

@ -1202,10 +1202,10 @@ phpbb.applyCodeEditor = function(textarea) {
var key = event.keyCode || event.which; var key = event.keyCode || event.which;
// intercept tabs // intercept tabs
if (key == 9 && if (key == keymap.TAB &&
!event.ctrlKey && !event.ctrlKey &&
!event.shiftKey && !event.shiftKey &&
!event.altKey && !event.altKey &&
!event.metaKey) { !event.metaKey) {
if (inTag()) { if (inTag()) {
appendText("\t"); appendText("\t");
@ -1215,7 +1215,7 @@ phpbb.applyCodeEditor = function(textarea) {
} }
// intercept new line characters // intercept new line characters
if (key == 13) { if (key == keymap.ENTER) {
if (inTag()) { if (inTag()) {
var lastLine = getLastLine(true), var lastLine = getLastLine(true),
code = '' + /^\s*/g.exec(lastLine); code = '' + /^\s*/g.exec(lastLine);