Commit a74c0530 authored by Alexander.Trofimov's avatar Alexander.Trofimov

move check AltGr to editorscommon

check enter z,a,i,u with ctrl in Latvian keyboard
parent 3669611c
...@@ -2162,7 +2162,7 @@ ...@@ -2162,7 +2162,7 @@
*/ */
CellEditor.prototype._onWindowKeyDown = function (event, isInput) { CellEditor.prototype._onWindowKeyDown = function (event, isInput) {
var t = this, kind = undefined, hieroglyph = false; var t = this, kind = undefined, hieroglyph = false;
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
if (!t.isOpened || (!isInput && !t.enableKeyEvents)) { if (!t.isOpened || (!isInput && !t.enableKeyEvents)) {
return true; return true;
......
...@@ -323,7 +323,7 @@ ...@@ -323,7 +323,7 @@
// Будем делать dblClick как в Excel // Будем делать dblClick как в Excel
asc_CEventsController.prototype.doMouseDblClick = function (event, isHideCursor) { asc_CEventsController.prototype.doMouseDblClick = function (event, isHideCursor) {
var t = this; var t = this;
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
// Для формулы не нужно выходить из редактирования ячейки // Для формулы не нужно выходить из редактирования ячейки
if (t.settings.isViewerMode || t.isFormulaEditMode || t.isSelectionDialogMode) {return true;} if (t.settings.isViewerMode || t.isFormulaEditMode || t.isSelectionDialogMode) {return true;}
...@@ -528,7 +528,7 @@ ...@@ -528,7 +528,7 @@
*/ */
asc_CEventsController.prototype._changeSelectionDone = function (event) { asc_CEventsController.prototype._changeSelectionDone = function (event) {
var coord = this._getCoordinates(event); var coord = this._getCoordinates(event);
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
if (false === ctrlKey) { if (false === ctrlKey) {
coord.x = -1; coord.x = -1;
coord.y = -1; coord.y = -1;
...@@ -591,7 +591,8 @@ ...@@ -591,7 +591,8 @@
asc_CEventsController.prototype._changeFillHandleDone = function (event) { asc_CEventsController.prototype._changeFillHandleDone = function (event) {
// Закончили автозаполнение, пересчитаем // Закончили автозаполнение, пересчитаем
var coord = this._getCoordinates(event); var coord = this._getCoordinates(event);
this.handlers.trigger("changeFillHandleDone", coord.x, coord.y, event.metaKey || event.ctrlKey); var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
this.handlers.trigger("changeFillHandleDone", coord.x, coord.y, ctrlKey);
}; };
/** /**
...@@ -661,7 +662,8 @@ ...@@ -661,7 +662,8 @@
/** @param event {MouseEvent} */ /** @param event {MouseEvent} */
asc_CEventsController.prototype._moveRangeHandleDone = function (event) { asc_CEventsController.prototype._moveRangeHandleDone = function (event) {
// Закончили перемещение диапазона, пересчитаем // Закончили перемещение диапазона, пересчитаем
this.handlers.trigger("moveRangeHandleDone", event.metaKey || event.ctrlKey); var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
this.handlers.trigger("moveRangeHandleDone", ctrlKey);
}; };
asc_CEventsController.prototype._moveResizeRangeHandleDone = function (event, target) { asc_CEventsController.prototype._moveResizeRangeHandleDone = function (event, target) {
...@@ -679,7 +681,7 @@ ...@@ -679,7 +681,7 @@
/** @param event {KeyboardEvent} */ /** @param event {KeyboardEvent} */
asc_CEventsController.prototype._onWindowKeyDown = function (event) { asc_CEventsController.prototype._onWindowKeyDown = function (event) {
var t = this, dc = 0, dr = 0, isViewerMode = t.settings.isViewerMode; var t = this, dc = 0, dr = 0, isViewerMode = t.settings.isViewerMode;
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
var shiftKey = event.shiftKey; var shiftKey = event.shiftKey;
var result = true; var result = true;
...@@ -1215,7 +1217,7 @@ ...@@ -1215,7 +1217,7 @@
} }
var t = this; var t = this;
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
var coord = t._getCoordinates(event); var coord = t._getCoordinates(event);
event.isLocked = t.isMousePressed = true; event.isLocked = t.isMousePressed = true;
...@@ -1456,7 +1458,7 @@ ...@@ -1456,7 +1458,7 @@
/** @param event {MouseEvent} */ /** @param event {MouseEvent} */
asc_CEventsController.prototype._onMouseMove = function (event) { asc_CEventsController.prototype._onMouseMove = function (event) {
var t = this; var t = this;
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
var coord = t._getCoordinates(event); var coord = t._getCoordinates(event);
t.hasCursor = true; t.hasCursor = true;
...@@ -1534,7 +1536,7 @@ ...@@ -1534,7 +1536,7 @@
/** @param event {MouseEvent} */ /** @param event {MouseEvent} */
asc_CEventsController.prototype._onMouseWheel = function (event) { asc_CEventsController.prototype._onMouseWheel = function (event) {
var ctrlKey = event.metaKey || event.ctrlKey; var ctrlKey = !AscCommon.getAltGr(event) && (event.metaKey || event.ctrlKey);
if (this.isFillHandleMode || this.isMoveRangeMode || this.isMoveResizeRange || ctrlKey) { if (this.isFillHandleMode || this.isMoveRangeMode || this.isMoveResizeRange || ctrlKey) {
return true; return true;
} }
......
...@@ -178,20 +178,8 @@ ...@@ -178,20 +178,8 @@
function check_KeyboardEvent(e) function check_KeyboardEvent(e)
{ {
global_keyboardEvent.AltKey = e.altKey; global_keyboardEvent.AltKey = e.altKey;
global_keyboardEvent.AltGr = AscCommon.getAltGr(e);
if (e.metaKey !== undefined) global_keyboardEvent.CtrlKey = !global_keyboardEvent.AltGr && (e.metaKey || e.ctrlKey);
global_keyboardEvent.CtrlKey = e.ctrlKey || e.metaKey;
else
global_keyboardEvent.CtrlKey = e.ctrlKey;
global_keyboardEvent.AltGr = (global_keyboardEvent.CtrlKey && global_keyboardEvent.AltKey) ? true : false;
if (AscBrowser.isMacOs)
{
global_keyboardEvent.AltGr = (!global_keyboardEvent.CtrlKey && global_keyboardEvent.AltKey) ? true : false;
}
if (global_keyboardEvent.AltGr)
global_keyboardEvent.CtrlKey = false;
global_keyboardEvent.ShiftKey = e.shiftKey; global_keyboardEvent.ShiftKey = e.shiftKey;
......
...@@ -2780,6 +2780,11 @@ CUserCacheColor.prototype.init = function(nColor) { ...@@ -2780,6 +2780,11 @@ CUserCacheColor.prototype.init = function(nColor) {
loadScript('./../../../../sdkjs/' + sdkName + '/sdk-all.js', callback); loadScript('./../../../../sdkjs/' + sdkName + '/sdk-all.js', callback);
} }
} }
function getAltGr (e) {
var ctrlKey = e.metaKey || e.ctrlKey;
var altKey = e.altKey;
return (altKey && (AscBrowser.isMacOs ? !ctrlKey : ctrlKey));
}
var g_oIdCounter = new CIdCounter(); var g_oIdCounter = new CIdCounter();
var g_oTableId = new CTableId(); var g_oTableId = new CTableId();
...@@ -2830,6 +2835,7 @@ window["SetDoctRendererParams"] = function(_params) ...@@ -2830,6 +2835,7 @@ window["SetDoctRendererParams"] = function(_params)
window["AscCommon"].CContentChangesElement = CContentChangesElement; window["AscCommon"].CContentChangesElement = CContentChangesElement;
window["AscCommon"].loadSdk = loadSdk; window["AscCommon"].loadSdk = loadSdk;
window["AscCommon"].getAltGr = getAltGr;
window["AscCommon"].g_oDocumentUrls = g_oDocumentUrls; window["AscCommon"].g_oDocumentUrls = g_oDocumentUrls;
window["AscCommon"].FormulaTablePartInfo = FormulaTablePartInfo; window["AscCommon"].FormulaTablePartInfo = FormulaTablePartInfo;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment