implemented tab input support from #40, thank you azlux!
This commit is contained in:
parent
2e3bacb699
commit
87b41a0c3d
|
@ -8,6 +8,7 @@ MrKooky - HTML5 markup, CSS cleanup
|
|||
Simon Rupf - MVC refactoring, configuration, i18n and unit tests
|
||||
Hexalyse - Password protection
|
||||
Viktor Stanchev - File upload support
|
||||
azlux - Tab character input support
|
||||
|
||||
Translations:
|
||||
Hexalyse - French
|
||||
|
|
|
@ -1073,7 +1073,7 @@ $(function() {
|
|||
},
|
||||
|
||||
/**
|
||||
* Reload the page
|
||||
* Reload the page.
|
||||
*
|
||||
* @param Event event
|
||||
*/
|
||||
|
@ -1084,7 +1084,7 @@ $(function() {
|
|||
},
|
||||
|
||||
/**
|
||||
* Return raw text
|
||||
* Return raw text.
|
||||
*
|
||||
* @param Event event
|
||||
*/
|
||||
|
@ -1120,6 +1120,30 @@ $(function() {
|
|||
$('.navbar-toggle').click();
|
||||
},
|
||||
|
||||
/**
|
||||
* Support input of tab character.
|
||||
*
|
||||
* @param Event event
|
||||
*/
|
||||
supportTabs: function(event)
|
||||
{
|
||||
var keyCode = event.keyCode || event.which;
|
||||
// tab was pressed
|
||||
if (keyCode === 9)
|
||||
{
|
||||
// prevent the textarea to lose focus
|
||||
event.preventDefault();
|
||||
// get caret position & selection
|
||||
var val = this.value,
|
||||
start = this.selectionStart,
|
||||
end = this.selectionEnd;
|
||||
// set textarea value to: text before caret + tab + text after caret
|
||||
this.value = val.substring(0, start) + '\t' + val.substring(end);
|
||||
// put caret at right position again
|
||||
this.selectionStart = this.selectionEnd = start + 1;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new paste.
|
||||
*/
|
||||
|
@ -1203,6 +1227,7 @@ $(function() {
|
|||
this.rawTextButton.click($.proxy(this.rawText, this));
|
||||
this.fileRemoveButton.click($.proxy(this.removeAttachment, this));
|
||||
$('.reloadlink').click($.proxy(this.reloadPage, this));
|
||||
this.message.keydown(this.supportTabs);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue