Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip esc if in composition #2991

Merged
merged 3 commits into from
May 29, 2022
Merged

fix: skip esc if in composition #2991

merged 3 commits into from
May 29, 2022

Conversation

Innei
Copy link
Contributor

@Innei Innei commented May 23, 2022

No description provided.

@vercel
Copy link

vercel bot commented May 23, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
naive-ui ✅ Ready (Inspect) Visit Preview May 28, 2022 at 2:54AM (UTC)

@Innei
Copy link
Contributor Author

Innei commented May 23, 2022

refer #2989

@07akioni
Copy link
Collaborator

有兴趣可以加一下 UI 开发者钉钉群 44551418

@Innei
Copy link
Contributor Author

Innei commented May 23, 2022

有兴趣可以加一下 UI 开发者钉钉群 44551418

搜不到。。

@07akioni
Copy link
Collaborator

有兴趣可以加一下 UI 开发者钉钉群 44551418

搜不到。。

啊这,钉钉顶部搜索栏,搜索公开群组?我看号没错

@Innei
Copy link
Contributor Author

Innei commented May 23, 2022

有兴趣可以加一下 UI 开发者钉钉群 44551418

搜不到。。

啊这,钉钉顶部搜索栏,搜索公开群组?我看号没错

来了来了!

Copy link
Collaborator

@07akioni 07akioni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得实现的太复杂了

compositionxxx 是冒泡的,所以直接在 window 监听应该是没问题的
https://developer.mozilla.org/zh-CN/docs/Web/API/Element/compositionstart_event

剩下唯一要判断的就是当前是不是在 compose 了

@Innei
Copy link
Contributor Author

Innei commented May 28, 2022

我觉得实现的太复杂了

compositionxxx 是冒泡的,所以直接在 window 监听应该是没问题的 developer.mozilla.org/zh-CN/docs/Web/API/Element/compositionstart_event

剩下唯一要判断的就是当前是不是在 compose 了

的确可以

@codecov
Copy link

codecov bot commented May 28, 2022

Codecov Report

Merging #2991 (b234de9) into main (3d7cbf3) will increase coverage by 0.06%.
The diff coverage is 52.57%.

@@            Coverage Diff             @@
##             main    #2991      +/-   ##
==========================================
+ Coverage   63.41%   63.47%   +0.06%     
==========================================
  Files        1000     1001       +1     
  Lines       20405    20457      +52     
  Branches     5272     5285      +13     
==========================================
+ Hits        12939    12986      +47     
- Misses       6100     6103       +3     
- Partials     1366     1368       +2     
Impacted Files Coverage Δ
src/dropdown/src/Dropdown.tsx 91.60% <ø> (+1.37%) ⬆️
src/dropdown/src/styles/index.cssr.ts 100.00% <ø> (ø)
src/input-number/src/styles/input-number.cssr.ts 100.00% <ø> (ø)
src/popover/src/styles/index.cssr.ts 100.00% <ø> (ø)
src/discrete/src/discrete.ts 30.00% <30.00%> (+9.16%) ⬆️
src/discrete/src/discreteApp.ts 33.33% <33.33%> (ø)
src/popover/src/PopoverBody.tsx 64.70% <33.33%> (-0.30%) ⬇️
src/discrete/src/InjectionExtractor.tsx 50.00% <50.00%> (ø)
src/drawer/src/Drawer.tsx 61.76% <66.66%> (+1.15%) ⬆️
src/modal/src/Modal.tsx 41.48% <66.66%> (+1.27%) ⬆️
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0bbc136...b234de9. Read the comment docs.

@@ -0,0 +1,26 @@
import { ref, Ref, onMounted, onUnmounted } from 'vue'

export const useOnIsCompositing: () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码还可以再优化,因为只需要一个监听器

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好哦,我当时也想过 ref 提到外面来着。react 思维惯性了

@07akioni 07akioni merged commit f635df2 into tusen-ai:main May 29, 2022
@07akioni
Copy link
Collaborator

可以看一下我的处理 fca40da

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants