From decc10e92293492c7d1c07ff94fedae92aadbad6 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 30 Jan 2011 01:26:13 +0400 Subject: [PATCH] fix for chrome --- lib/ace/keyboard/textinput.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js index 9bcecb2a..097149a7 100644 --- a/lib/ace/keyboard/textinput.js +++ b/lib/ace/keyboard/textinput.js @@ -50,6 +50,7 @@ var TextInput = function(parentNode, host) { var inCompostion = false; var copied = false; + var tempStyle = ''; function sendText(valueToSend) { if (!copied) { @@ -190,21 +191,25 @@ var TextInput = function(parentNode, host) { }; this.onContextMenu = function(mousePos, isEmpty){ - if(mousePos){ + if (mousePos) { + if(!tempStyle) + tempStyle = text.style.cssText; text.style.cssText = 'position:fixed; z-index:1000;' + 'left:' + (mousePos.x - 2) + 'px; top:' + (mousePos.y - 2) + 'px;' } - if(isEmpty) + if (isEmpty) text.value=''; } this.onContextMenuClose = function(){ setTimeout(function () { + if (tempStyle) { + text.style.cssText = tempStyle; + tempStyle = ''; + } sendText(); }, 0); - text.style.position = ''; - text.style.zIndex = ''; } };