kopia lustrzana https://github.com/backface/turtlestitch
fixed #1083 (hopefully)
rodzic
4fd33f7de9
commit
663c1af1ce
27
morphic.js
27
morphic.js
|
@ -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) {
|
||||
|
|
Ładowanie…
Reference in New Issue