From e5e1ccff4e31f679a52ca26dcdc0d3c25d2e6779 Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Thu, 24 Jun 2021 11:50:03 +0700 Subject: [PATCH] fix(web): Simplify initialization of options --- web/source/kmwnative.ts | 2 +- web/testing/attachment-api/index.html | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/web/source/kmwnative.ts b/web/source/kmwnative.ts index 40b06d7253..6bf7c3e949 100644 --- a/web/source/kmwnative.ts +++ b/web/source/kmwnative.ts @@ -30,7 +30,7 @@ if(!window['keyman']['initialized']) { */ keymanweb.setDefaultDeviceOptions = function(opt : com.keyman.OptionType) { // Element attachment type - if (opt['attachType'] == '' || opt['attachType'] === undefined) { + if (!opt['attachType']) { opt['attachType'] = (device.touchable ? 'manual' : 'auto'); } } diff --git a/web/testing/attachment-api/index.html b/web/testing/attachment-api/index.html index 0616d5f0bd..37cb68476c 100644 --- a/web/testing/attachment-api/index.html +++ b/web/testing/attachment-api/index.html @@ -41,12 +41,9 @@ var attachText = attachType ? attachType : "default"; var kmw=window.keyman; - if (attachType) { - kmw.init({ - attachType: attachType}); - } else { - kmw.init({}); - } + kmw.init({ + attachType: attachType ? attachType : '' + });