Skip to content

Commit 1924956

Browse files
committed
优化:中文输入文字输入法状态优化
1 parent 2e784fa commit 1924956

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/App.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ window.__page.onSetSubInputValue((value: string) => {
111111
manager.setSubInputValue(value);
112112
})
113113
114-
115114
window.addEventListener('keydown', (e) => {
116115
const {resultKey} = onKeyDown(e)
117116
if (resultKey) {

src/pages/Main/Lib/resultOperate.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,9 @@ export const useResultOperate = () => {
195195
if (['up', 'down', 'left', 'right'].includes(key)) {
196196
doActionNavigate(key)
197197
} else if ('enter' === key) {
198+
if (manager.searchIsCompositing) {
199+
return;
200+
}
198201
const action = getActiveAction()
199202
if (action) {
200203
if (activeActionGroup.value === 'window') {

src/pages/Main/MainSearch.vue

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@
5656
@input="(e) => onSearchValueChange(e)"
5757
@blur="onBlur"
5858
@dblclick="onSearchDoubleClick"
59+
@compositionstart="(e) => {
60+
manager.searchIsCompositing = true
61+
}"
62+
@compositionend="(e) => {
63+
manager.searchIsCompositing = false
64+
}"
5965
:model-value="manager.searchValue">
6066
</a-input>
6167
<div class="placeholder"
@@ -154,12 +160,12 @@ const onSearchValueChange = (value: string) => {
154160
};
155161
156162
const onShow = () => {
157-
mainInput.value.focus();
163+
mainInput.value?.focus();
158164
EntryListener.prepareSearch({}).then();
159165
};
160166
161167
const focus = () => {
162-
mainInput.value.focus();
168+
mainInput.value?.focus();
163169
EntryListener.prepareSearch({}).then();
164170
};
165171
@@ -169,7 +175,7 @@ const doLogoClick = () => {
169175
170176
const onBlur = () => {
171177
setTimeout(() => {
172-
mainInput.value.focus();
178+
mainInput.value?.focus();
173179
}, 0)
174180
}
175181

src/store/modules/manager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const managerStore = defineStore("manager", {
3939
searchPlaceholder: 'FocusAny,让您的工作专注高效',
4040
searchSubPlaceholder: '',
4141
searchSubIsVisible: false,
42+
searchIsCompositing: false,
4243

4344
detachWindowActions: [] as ActionRecord[],
4445
searchActions: [] as ActionRecord[],

0 commit comments

Comments
 (0)