mirror of
https://gitee.com/openharmony/inputmethod_imf
synced 2025-02-18 22:28:38 +00:00
修改GetEditorAttributeSync接口
Signed-off-by: guojin31 <guojin31@huawei.com>
This commit is contained in:
parent
d5701d4ee2
commit
e3c82f6726
@ -159,7 +159,6 @@ napi_value JsKeyboardDelegateSetting::GetKDInstance(napi_env env, napi_callback_
|
||||
IMSA_HILOGE("napi_get_reference_value(env, KDSRef_, &cons) != napi_ok");
|
||||
return nullptr;
|
||||
}
|
||||
IMSA_HILOGE("Get a reference to the global variable appAccountRef_ complete");
|
||||
if (napi_new_instance(env, cons, 0, nullptr, &instance) != napi_ok) {
|
||||
IMSA_HILOGE("napi_new_instance(env, cons, 0, nullptr, &instance) != napi_ok");
|
||||
return nullptr;
|
||||
|
@ -568,7 +568,7 @@ napi_value JsTextInputClientEngine::GetEditorAttributeSync(napi_env env, napi_ca
|
||||
}
|
||||
IMSA_HILOGD("patternCode: %{public}d", inputPattern);
|
||||
|
||||
const InputAttribute attribute = { .inputPattern = enterKeyType, .enterKeyType = inputPattern };
|
||||
const InputAttribute attribute = { .inputPattern = inputPattern, .enterKeyType = enterKeyType };
|
||||
return JsUtils::GetValue(env, attribute);
|
||||
}
|
||||
|
||||
|
@ -193,11 +193,16 @@ export class KeyboardController {
|
||||
}
|
||||
}
|
||||
|
||||
getAttributeSync() {
|
||||
async getAttributeSync() {
|
||||
try {
|
||||
let editAttribute = globalThis.textInputClient.getEditorAttributeSync();
|
||||
let editAttribute1 = await globalThis.textInputClient.getEditorAttribute();
|
||||
this.addLog(`[inputDemo] publish getEditorAttributeSync editAttribute= ${JSON.stringify(editAttribute)}`);
|
||||
this.publishCommonEvent('getEditorAttributeSyncResult', TEST_RESULT_CODE.SUCCESS);
|
||||
if(editAttribute.inputPattern == editAttribute1.inputPattern && editAttribute.enterKeyType == editAttribute1.enterKeyType) {
|
||||
this.publishCommonEvent('getEditorAttributeSyncResult', TEST_RESULT_CODE.SUCCESS);
|
||||
} else{
|
||||
this.publishCommonEvent('getEditorAttributeSyncResult', TEST_RESULT_CODE.FAILED);
|
||||
}
|
||||
} catch (err) {
|
||||
this.publishCommonEvent('getEditorAttributeSyncResult', TEST_RESULT_CODE.FAILED);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user