allow delete command only after opening contextmenu
this will break delete from browser edit menu, but it is not as important as ime textinput fixes #1325
This commit is contained in:
parent
f118db4560
commit
0f4fd999ee
1 changed files with 5 additions and 3 deletions
|
|
@ -198,6 +198,7 @@ var TextInput = function(parentNode, host) {
|
||||||
var inputHandler = null;
|
var inputHandler = null;
|
||||||
this.setInputHandler = function(cb) {inputHandler = cb};
|
this.setInputHandler = function(cb) {inputHandler = cb};
|
||||||
this.getInputHandler = function() {return inputHandler};
|
this.getInputHandler = function() {return inputHandler};
|
||||||
|
var afterContextMenu = false;
|
||||||
|
|
||||||
var sendText = function(data) {
|
var sendText = function(data) {
|
||||||
if (inputHandler) {
|
if (inputHandler) {
|
||||||
|
|
@ -210,7 +211,7 @@ var TextInput = function(parentNode, host) {
|
||||||
host.onPaste(data);
|
host.onPaste(data);
|
||||||
pasted = false;
|
pasted = false;
|
||||||
} else if (data == PLACEHOLDER[0]) {
|
} else if (data == PLACEHOLDER[0]) {
|
||||||
if (Date.now() - lastCompositionTime > 100)
|
if (afterContextMenu)
|
||||||
host.execCommand("del", {source: "ace"});
|
host.execCommand("del", {source: "ace"});
|
||||||
} else {
|
} else {
|
||||||
if (data.substring(0, 2) == PLACEHOLDER)
|
if (data.substring(0, 2) == PLACEHOLDER)
|
||||||
|
|
@ -226,6 +227,8 @@ var TextInput = function(parentNode, host) {
|
||||||
if (data)
|
if (data)
|
||||||
host.onTextInput(data);
|
host.onTextInput(data);
|
||||||
}
|
}
|
||||||
|
if (afterContextMenu)
|
||||||
|
afterContextMenu = false;
|
||||||
};
|
};
|
||||||
var onInput = function(e) {
|
var onInput = function(e) {
|
||||||
if (inCompostion)
|
if (inCompostion)
|
||||||
|
|
@ -356,11 +359,9 @@ var TextInput = function(parentNode, host) {
|
||||||
host.onCompositionUpdate(text.value);
|
host.onCompositionUpdate(text.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
var lastCompositionTime = -1;
|
|
||||||
var onCompositionEnd = function(e) {
|
var onCompositionEnd = function(e) {
|
||||||
inCompostion = false;
|
inCompostion = false;
|
||||||
host.onCompositionEnd();
|
host.onCompositionEnd();
|
||||||
lastCompositionTime = Date.now();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var syncComposition = lang.delayedCall(onCompositionUpdate, 50);
|
var syncComposition = lang.delayedCall(onCompositionUpdate, 50);
|
||||||
|
|
@ -378,6 +379,7 @@ var TextInput = function(parentNode, host) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onContextMenu = function(e) {
|
this.onContextMenu = function(e) {
|
||||||
|
afterContextMenu = true;
|
||||||
if (!tempStyle)
|
if (!tempStyle)
|
||||||
tempStyle = text.style.cssText;
|
tempStyle = text.style.cssText;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue