modify codecheck

Signed-off-by: zhaojunxia <zhaojunxia@kaihong.com>
This commit is contained in:
zhaojunxia 2024-06-04 17:22:19 +08:00
parent 606bfb3496
commit 0c1dd594dc
2 changed files with 20 additions and 7 deletions

View File

@ -35,7 +35,7 @@ interface CursorInfo {
y: number;
height: number
}
const previewContent: string = "hello world";
const previewContent: string = 'hello world';
const InputMethodEngine: inputMethodEngine.InputMethodAbility = inputMethodEngine.getInputMethodAbility();
const TAG: string = 'KeyboardController->';
const isDebug: boolean = false;
@ -102,7 +102,7 @@ export class InputHandler {
try {
this.addLog(`onInputStart sendPrivateCommand begin`);
let record: Record<string, inputMethodEngine.CommandDataType> = {
"previewTextStyle": "underline"
'previewTextStyle': 'underline'
}
this.mTextInputClient.sendPrivateCommand(record).then((err) => {
this.addLog(`insertText sendPrivateCommand success`);
@ -202,11 +202,10 @@ export class InputHandler {
} catch (err) {
this.addLog(`insertText preViewText Failed to setPreviewText: ${JSON.stringify(err)}`);
}
}
else if (this.intputText.length > length + 1){
} else if (this.intputText.length > length + 1){
this.addLog('insertText this.intputText ' + this.intputText);
let indexSubStrStart: number = this.intputText.lastIndexOf("hel");
let indexSubStrStart: number = this.intputText.lastIndexOf('hel');
this.addLog('insertText indexSubStrStart ' + indexSubStrStart.toString());
if (indexSubStrStart >= 0) {
@ -523,7 +522,6 @@ class KeyboardController {
this.inputHandle.addLog("pre on privateCommand");
try {
InputMethodEngine.on('privateCommand', (record : Record<string, inputMethodEngine.CommandDataType>) => {
console.log("on privateCommand");
this.inputHandle.addLog('keyboard privateCommand' + JSON.stringify(record));
Object.keys(record).forEach((key: string) => {
this.inputHandle.addLog(`onPageShow private command key: ${key}, value: ${record[key]}`);

View File

@ -1,3 +1,18 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF InputStyle KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import inputMethod from '@ohos.inputMethod';
import inputMethodEngine from '@ohos.inputMethodEngine';
import Log from '../model/Log';
@ -49,7 +64,7 @@ struct PrivatePreview {
controller: this.controllerPreview
})
.placeholderFont({ size: 16, weight: 400 })
.width("100%")
.width('100%')
.height(56)
.margin(10)
.fontSize(16)