1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-18 22:58:10 +01:00

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