mirror of
https://github.com/phpbb/phpbb.git
synced 2025-01-31 05:37:59 +01:00
Merge pull request #2610 from brunoais/ticket/12699
[Ticket/12699] Remove magic numbers in the message textarea keydown callback * brunoais/ticket/12699: [ticket/12699] Replace magic numbers for the TAB and for ENTER keydown [ticket/12699] Add tab key to keymap
This commit is contained in:
commit
82cf239294
@ -7,6 +7,7 @@ phpbb.alertTime = 100;
|
||||
|
||||
// define a couple constants for keydown functions.
|
||||
var keymap = {
|
||||
TAB: 9,
|
||||
ENTER: 13,
|
||||
ESC: 27
|
||||
};
|
||||
@ -1201,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");
|
||||
@ -1214,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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user