From 04401859a2dce7b42a96ddc394de522caaddf92a Mon Sep 17 00:00:00 2001 From: Yueyu Date: Wed, 1 Sep 2021 20:14:10 +0800 Subject: [PATCH] Don't close the text form when click on the textbox --- src/editor/ui/UI.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/editor/ui/UI.js b/src/editor/ui/UI.js index 1d5268c..a02b6c9 100644 --- a/src/editor/ui/UI.js +++ b/src/editor/ui/UI.js @@ -952,11 +952,14 @@ export default class UI { static createFormForText (p) { var tf = newHTML('div', 'pagetext off', p); tf.setAttribute('id', 'textbox'); - if (isAndroid) { - tf.onmousedown = function (e) { - e.preventDefault(); - }; - } + // If the textbox is click or touched, the input may lost focus, + // and it may cause the text form miss closed. + var eatEvent = function (e) { + e.stopPropagation(); + e.preventDefault(); + }; + tf.ontouchstart = eatEvent; + tf.onmousedown = eatEvent; var activetb = newHTML('form', 'pageform', tf); activetb.name = 'activetextbox'; activetb.id = 'myform';