[se] Paste

Use function _addChars to paste text in cell editor
This commit is contained in:
Alexander.Trofimov
2019-01-31 16:45:14 +03:00
parent 909e06d36b
commit 67d2469518

View File

@ -619,45 +619,11 @@
text = text.replace(/\r/g, "");
text = text.replace(/^\n+|\n+$/g, "");
var length = text.length;
if (!(length > 0)) {
return;
}
if (!this._checkMaxCellLength(length)) {
if (0 === text.length) {
return;
}
var wrap = -1 !== text.indexOf(kNewLine);
if (this.selectionBegin !== this.selectionEnd) {
this._removeChars();
}
// save info to undo/redo
this.undoList.push({fn: this._removeChars, args: [this.cursorPos, length]});
this.redoList = [];
var opt = this.options;
var nInsertPos = this.cursorPos;
var fr;
fr = this._findFragmentToInsertInto(nInsertPos - (nInsertPos > 0 ? 1 : 0));
if (fr) {
var oCurFragment = opt.fragments[fr.index];
if (fr.end <= nInsertPos) {
oCurFragment.text += text;
} else {
var sNewText = oCurFragment.text.substring(0, nInsertPos);
sNewText += text;
sNewText += oCurFragment.text.substring(nInsertPos);
oCurFragment.text = sNewText;
}
this.cursorPos = nInsertPos + length;
this._update();
}
if (wrap) {
this._wrapText();
this._update();
}
this._addChars(text);
};
CellEditor.prototype.paste = function (fragments, cursorPos) {