fixed #1083 (hopefully)

dev
Jens Mönig 2015-12-23 16:13:21 +01:00
rodzic 4fd33f7de9
commit 663c1af1ce
1 zmienionych plików z 22 dodań i 5 usunięć

Wyświetl plik

@ -4483,7 +4483,7 @@ function CursorMorph(aStringOrTextMorph) {
}
CursorMorph.prototype.init = function (aStringOrTextMorph) {
var ls, myself = this;
var ls;
// additional properties:
this.keyDownEventUsed = false;
@ -4501,8 +4501,13 @@ CursorMorph.prototype.init = function (aStringOrTextMorph) {
this.target.setAlignmentToLeft();
}
this.gotoSlot(this.slot);
this.initializeClipboardHandler();
};
CursorMorph.prototype.initializeClipboardHandler = function () {
// Add hidden text box for copying and pasting
var myself = this;
this.clipboardHandler = document.createElement('textarea');
this.clipboardHandler.style.position = 'absolute';
this.clipboardHandler.style.right = '101%'; // placed just out of view
@ -4903,13 +4908,25 @@ CursorMorph.prototype.destroy = function () {
this.target.drawNew();
this.target.changed();
}
if (this.clipboardHandler) {
document.body.removeChild(this.clipboardHandler);
this.clipboardHandler = null;
}
this.destroyClipboardHandler();
CursorMorph.uber.destroy.call(this);
};
CursorMorph.prototype.destroyClipboardHandler = function () {
var nodes = document.body.children,
each,
i;
if (this.clipboardHandler) {
for (i = 0; i < nodes.length; i += 1) {
each = nodes[i];
if (each === this.clipboardHandler) {
document.body.removeChild(this.clipboardHandler);
this.clipboardHandler = null;
}
}
}
};
// CursorMorph utilities:
CursorMorph.prototype.inspectKeyEvent = function (event) {