From ea3d78c9bf6d6a2f8b600b677b4ce6c82a1dc62a Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Thu, 17 Dec 2020 20:25:38 +0530 Subject: [PATCH] leaflet: avoid keyboard suggestions after undo/redo problem: undoing something on mobile does not trigger any input method this causes problem in mobile working with suggestions i.e: type "than" and then select "thank" from suggestion now undo and then again select "thanks" from suggestions final output is "thans" this happens because undo doesn't change the textArea value and no other way to maintain the history So better to clean the textarea so no suggestions appear Signed-off-by: Pranam Lashkari Change-Id: Idfdfd8acfa6d738bf695a473610d399b123e7019 --- loleaflet/src/control/Control.Toolbar.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js index ed6357e8c..8a1c17a82 100644 --- a/loleaflet/src/control/Control.Toolbar.js +++ b/loleaflet/src/control/Control.Toolbar.js @@ -954,10 +954,22 @@ function onCommandResult(e) { map.fire('postMessage', {msgId: 'Action_Save_Resp', args: postMessageObj}); } - else if ((commandName === '.uno:Undo' || commandName === '.uno:Redo') && - e.success === true && e.result.value && !isNaN(e.result.value)) { /*UNDO_CONFLICT*/ - $('#tb_editbar_item_repair').w2overlay({ html: '
' + + else if (commandName === '.uno:Undo' || commandName === '.uno:Redo') { + if (e.success === true && e.result.value && !isNaN(e.result.value)) { /*UNDO_CONFLICT*/ + $('#tb_editbar_item_repair').w2overlay({ html: '
' + _('Conflict Undo/Redo with multiple users. Please use document repair to resolve') + '
'}); + } + else if (window.mode.isMobile()) { + //undoing something on mobile does not trigger any input method + //this causes problem in mobile working with suggestions + //i.e: type "than" and then select "thank" from suggestion + //now undo and then again select "thanks" from suggestions + //final output is "thans" + //this happens because undo doesn't change the textArea value + //and no other way to maintain the history + //So better to clean the textarea so no suggestions appear + map._textInput._textArea.value = map._textInput._preSpaceChar; + } } }