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;
|
||||
this.setInputHandler = function(cb) {inputHandler = cb};
|
||||
this.getInputHandler = function() {return inputHandler};
|
||||
var afterContextMenu = false;
|
||||
|
||||
var sendText = function(data) {
|
||||
if (inputHandler) {
|
||||
|
|
@ -210,7 +211,7 @@ var TextInput = function(parentNode, host) {
|
|||
host.onPaste(data);
|
||||
pasted = false;
|
||||
} else if (data == PLACEHOLDER[0]) {
|
||||
if (Date.now() - lastCompositionTime > 100)
|
||||
if (afterContextMenu)
|
||||
host.execCommand("del", {source: "ace"});
|
||||
} else {
|
||||
if (data.substring(0, 2) == PLACEHOLDER)
|
||||
|
|
@ -226,6 +227,8 @@ var TextInput = function(parentNode, host) {
|
|||
if (data)
|
||||
host.onTextInput(data);
|
||||
}
|
||||
if (afterContextMenu)
|
||||
afterContextMenu = false;
|
||||
};
|
||||
var onInput = function(e) {
|
||||
if (inCompostion)
|
||||
|
|
@ -356,11 +359,9 @@ var TextInput = function(parentNode, host) {
|
|||
host.onCompositionUpdate(text.value);
|
||||
};
|
||||
|
||||
var lastCompositionTime = -1;
|
||||
var onCompositionEnd = function(e) {
|
||||
inCompostion = false;
|
||||
host.onCompositionEnd();
|
||||
lastCompositionTime = Date.now();
|
||||
};
|
||||
|
||||
var syncComposition = lang.delayedCall(onCompositionUpdate, 50);
|
||||
|
|
@ -378,6 +379,7 @@ var TextInput = function(parentNode, host) {
|
|||
};
|
||||
|
||||
this.onContextMenu = function(e) {
|
||||
afterContextMenu = true;
|
||||
if (!tempStyle)
|
||||
tempStyle = text.style.cssText;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue