This commit is contained in:
Maksim Degtyarev 2018-12-27 09:25:04 +05:00
parent cf89d330df
commit 3579a82d11
3 changed files with 26 additions and 9 deletions

View File

@ -942,7 +942,8 @@ var datetimepickerFactory = function ($) {
KEY9 = 57,
_KEY0 = 96,
_KEY9 = 105,
CTRLKEY = 17,
CTRLKEY = 17,
CMDKEY = 91,
DEL = 46,
ENTER = 13,
ESC = 27,
@ -958,7 +959,8 @@ var datetimepickerFactory = function ($) {
VKEY = 86,
ZKEY = 90,
YKEY = 89,
ctrlDown = false,
ctrlDown = false,
cmdDown = false,
options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
lazyInitTimer = 0,
@ -2453,8 +2455,12 @@ var datetimepickerFactory = function ($) {
// hitting backspace in a selection, you can possibly go back any further - go forward
pos += (key === BACKSPACE && !hasSel) ? -1 : 1;
}
}
if (event.metaKey) { // cmd has been pressed
pos = 0;
hasSel = true;
}
if (hasSel) {
// pos might have moved so re-calc length
@ -2576,16 +2582,27 @@ var datetimepickerFactory = function ($) {
}
};
$(options.ownerDocument)
.off('keydown.xdsoftctrl keyup.xdsoftctrl')
.off('keydown.xdsoftctrl keyup.xdsoftctrl')
.off('keydown.xdsoftcmd keyup.xdsoftcmd')
.on('keydown.xdsoftctrl', function (e) {
if (e.keyCode === CTRLKEY) {
ctrlDown = true;
}
}
})
.on('keyup.xdsoftctrl', function (e) {
if (e.keyCode === CTRLKEY) {
ctrlDown = false;
}
}
})
.on('keydown.xdsoftcmd', function (e) {
if (e.keyCode === CMDKEY) {
cmdDown = true;
}
})
.on('keyup.xdsoftcmd', function (e) {
if (e.keyCode === CMDKEY) {
cmdDown = false;
}
});
this.each(function () {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long