From baadce4acd6842c449ccaa71173eb9f0f427a70e Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 11 Apr 2012 14:03:39 +0000 Subject: [PATCH] minibar: fix to prevent the typed input field from losing focus when turning word-for-word replacment on or off --- src/www/minibar/minibar_input.js | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/www/minibar/minibar_input.js b/src/www/minibar/minibar_input.js index 281df2011..7449cbbf7 100644 --- a/src/www/minibar/minibar_input.js +++ b/src/www/minibar/minibar_input.js @@ -84,17 +84,14 @@ Input.prototype.change_language=function () { this.add_words(new_input) } - Input.prototype.clear_all2=function() { with(this) { current.input=[]; local.put("current",current) - clear(surface) - if(surface.typed) surface.appendChild(surface.typed) + remove_surface_words() } } - Input.prototype.clear_all1=function() { with(this) { remove_typed_input(); @@ -205,6 +202,15 @@ Input.prototype.add_typed_input=function() { } } +Input.prototype.remove_surface_words=function() { + with(this) { + var typed=surface.typed; + if(typed) while(typed.previousSibling) + surface.removeChild(typed.previousSibling) + else clear(surface) + } +} + Input.prototype.remove_typed_input=function() { with(this) { if(surface.typed) { @@ -253,6 +259,7 @@ Input.prototype.add_words=function(ws) { Input.prototype.add_words1=function(ws) { for(var i=0;i