Commit bb324194 authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander.Trofimov

[ios] для нативной версии добавил правки

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@67088 954022d7-b5bf-4e40-9824-e11837661b57
parent 38d07ba9
......@@ -154,6 +154,8 @@
selectionTimeout: 20
};
this.dontUpdateText = false;
this._init(settings);
return this;
......@@ -283,6 +285,8 @@
}
this.isOpened = false;
if (!window['IS_NATIVE_EDITOR']) {
if (window.removeEventListener) {
window.removeEventListener("keydown" , this.fKeyDown , false);
window.removeEventListener("keypress" , this.fKeyPress , false);
......@@ -296,6 +300,7 @@
this._hideCursor();
// hide
this._hideCanvas();
}
// delete autoComplete
this.objAutoComplete = {};
......@@ -1006,12 +1011,19 @@
}
}
if (doAjust) {this._adjustCanvas();}
if (!window['IS_NATIVE_EDITOR']) {
this._renderText(); // вызов нужен для пересчета поля line.startX, которое используется в _updateCursorPosition
this._fireUpdated(); // вызов нужен для обновление текста верхней строки, перед обновлением позиции курсора
this._updateCursorPosition(true);
this._showCursor();
}
this._updateUndoRedoChanged();
if (window['IS_NATIVE_EDITOR'] && !this.dontUpdateText) {
window['native'].onCellEditorChangeText(this._getFragmentsText(this.options.fragments));
}
};
CellEditor.prototype._fireUpdated = function () {
......@@ -1153,18 +1165,24 @@
CellEditor.prototype._drawSelection = function () {
var ctx = this.overlayCtx, ppix = ctx.getPPIX(), ppiy = ctx.getPPIY();
var begPos, endPos, top, top1, top2, begInfo, endInfo, line1, line2, i;
var begPos, endPos, top, top1, top2, begInfo, endInfo, line1, line2, i, selection = [];
function drawRect(x, y, w, h) {
if (window['IS_NATIVE_EDITOR']) {
selection.push([asc_calcnpt(x, ppix), asc_calcnpt(y, ppiy), asc_calcnpt(w, ppix), asc_calcnpt(h, ppiy)]);
} else {
ctx.fillRect(
asc_calcnpt(x, ppix), asc_calcnpt(y, ppiy),
asc_calcnpt(w, ppix), asc_calcnpt(h, ppiy));
}
}
begPos = this.selectionBegin;
endPos = this.selectionEnd;
if (!window['IS_NATIVE_EDITOR']) {
ctx.setFillStyle(this.defaults.selectColor).clear();
}
if (begPos !== endPos && !this.isTopLineActive) {
top = this.textRender.calcLineOffset(this.topLineIndex);
......@@ -1186,17 +1204,25 @@
}
}
}
return selection;
};
// Cursor
CellEditor.prototype.showCursor = function () {
if (window['IS_NATIVE_EDITOR'])
return;
if (!this.options) {this.options = {};}
this.options.isHideCursor = false;
this._showCursor();
};
CellEditor.prototype._showCursor = function () {
if (window['IS_NATIVE_EDITOR'])
return;
var t = this;
if (true === t.options.isHideCursor || t.isTopLineActive === true) {return;}
window.clearInterval(t.cursorTID);
......@@ -1207,6 +1233,9 @@
};
CellEditor.prototype._hideCursor = function () {
if (window['IS_NATIVE_EDITOR'])
return;
var t = this;
window.clearInterval(t.cursorTID);
t.cursorStyle.display = "none";
......@@ -1249,9 +1278,16 @@
curLeft >>= 1;
curTop >>= 1;
}
if (window['IS_NATIVE_EDITOR']) {
this.curLeft = curLeft;
this.curTop = curTop;
this.curHeight = curHeight;
} else {
this.cursorStyle.left = curLeft + "px";
this.cursorStyle.top = curTop + "px";
this.cursorStyle.height = curHeight + "px";
}
if (cur) {this.input.scrollTop = this.input.clientHeight * cur.lineIndex;}
if (this.isTopLineActive && !this.skipTLUpdate) {this._updateTopLineCurPos();}
......@@ -1404,10 +1440,14 @@
if (!this._checkMaxCellLength(length)) {return false;}
this.dontUpdateText = true;
if (this.selectionBegin !== this.selectionEnd) {
this._removeChars(undefined, undefined, isRange);
}
this.dontUpdateText = false;
if (pos === undefined) {pos = this.cursorPos;}
if (!this.undoMode) {
......@@ -1519,15 +1559,16 @@
function doChangeSelection(coord) {
var pos = t._findCursorPosition(coord);
if (pos !== undefined) {pos >= 0 ? t._selectChars(kPosition, pos) : t._selectChars(pos);}
if (t.isSelectMode) {
if (t.isSelectMode && !window['IS_NATIVE_EDITOR']) {
t.selectionTimer = window.setTimeout(
function () {doChangeSelection(coord);},
t.defaults.selectionTimeout);
}
}
if (!window['IS_NATIVE_EDITOR']) {
window.clearTimeout(t.selectionTimer);
t.selectionTimer = window.setTimeout(function () {doChangeSelection(coord);}, 0);
}
};
CellEditor.prototype._findFragment = function (pos, fragments) {
......@@ -1756,8 +1797,11 @@
};
CellEditor.prototype._tryCloseEditor = function (event) {
if (this.close(true))
if (this.close(true)) {
if (!window['IS_NATIVE_EDITOR']) {
this.handlers.trigger("applyCloseEvent", event);
}
}
};
CellEditor.prototype._getAutoComplete = function(str) {
......@@ -1844,6 +1888,9 @@
return false;
case 13: // "enter"
if (window['IS_NATIVE_EDITOR']) {
t._addNewLine();
} else {
if (!t.hasFocus) {t.setFocus(true);}
if (!(event.altKey && event.shiftKey)) {
if (event.altKey)
......@@ -1853,6 +1900,7 @@
t._tryCloseEditor(event);
}
}
}
return false;
case 9: // tab
......@@ -1864,11 +1912,15 @@
return false;
case 8: // "backspace"
if (window['IS_NATIVE_EDITOR']) {
t._removeChars(ctrlKey ? kPrevWord : kPrevChar);
} else {
// Отключим стандартную обработку браузера нажатия backspace
event.stopPropagation();
event.preventDefault();
if (hieroglyph) {t._syncEditors();}
t._removeChars(ctrlKey ? kPrevWord : kPrevChar);
}
return false;
case 46: // "del"
......@@ -2073,6 +2125,8 @@
var t = this;
var ctrlKey = event.metaKey || event.ctrlKey;
if (!window['IS_NATIVE_EDITOR']) {
if (!t.isOpened || !t.enableKeyEvents) {return true;}
if (t.skipKeyPress || event.which < 32 || event.altKey || ctrlKey) {
......@@ -2092,6 +2146,8 @@
}
//t.setFocus(true);
}
t.isUpdateValue = false;
var tmpCursorPos;
......@@ -2226,6 +2282,10 @@
/** @param event {MouseEvent} */
CellEditor.prototype._getCoordinates = function (event) {
if (window['IS_NATIVE_EDITOR']) {
return {x: event.pageX, y: event.pageY};
}
var t = this;
var offs = $(t.canvasOverlay).offset();
var x = (event.pageX - offs.left) / t.kx;
......@@ -2248,4 +2308,4 @@
}
)(jQuery, window);
)(jQuery, window);
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