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: make Keybinding work after reloading Molecule #686

Merged
merged 2 commits into from
Mar 4, 2022
Merged

Conversation

kiwiwong
Copy link
Collaborator

@kiwiwong kiwiwong commented Mar 3, 2022

简介

修复重载Molecule后Keybinding功能失效问题。
说明:Keybinding功能之所以会失效,是因为Molecule重载后重新渲染了dom,导致原先注册并绑定到dom上的监听事件丢失了。

Fixes #612

变更

  • 每次加载MoleculeProvider时都执行一次monacoService的初始化,以确保能将Keybinding事件绑定到dom上。
  • layoutService中的container改为每次都去查找最新的dom,以确保初始化monacoService时拿到的是最新的dom。

@kiwiwong kiwiwong added the bug Something isn't working label Mar 3, 2022
@kiwiwong kiwiwong self-assigned this Mar 3, 2022
@codecov
Copy link

codecov bot commented Mar 3, 2022

Codecov Report

Merging #686 (b952acd) into main (c230885) will increase coverage by 0.13%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #686      +/-   ##
==========================================
+ Coverage   90.69%   90.82%   +0.13%     
==========================================
  Files         189      189              
  Lines        5944     5943       -1     
  Branches     1430     1429       -1     
==========================================
+ Hits         5391     5398       +7     
+ Misses        546      538       -8     
  Partials        7        7              
Impacted Files Coverage Δ
src/provider/molecule.tsx 100.00% <100.00%> (ø)
src/services/workbench/layoutService.ts 100.00% <100.00%> (ø)
src/common/dom.ts 95.52% <0.00%> (+4.47%) ⬆️
src/common/utils.ts 94.59% <0.00%> (+6.75%) ⬆️

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 c230885...b952acd. Read the comment docs.

@wewoor
Copy link
Collaborator

wewoor commented Mar 3, 2022

@kiwiwong 还有,这种 Case 你是如何测试的呢

@kiwiwong
Copy link
Collaborator Author

kiwiwong commented Mar 3, 2022

@kiwiwong 还有,这种 Case 你是如何测试的呢

我目前是分别针对正常情况和二次加载后这两种情况,手动测试一遍monacoService相关的功能,比如:打开命令面板、主题设置以及editor中的编辑操作等,目前没有问题。

@wewoor
Copy link
Collaborator

wewoor commented Mar 3, 2022

单测覆盖率下去了

Copy link
Collaborator

@wewoor wewoor left a comment

Choose a reason for hiding this comment

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

+1

src/services/workbench/layoutService.ts Show resolved Hide resolved
@wewoor wewoor merged commit a88a71e into main Mar 4, 2022
@wewoor wewoor deleted the fix/keybinding branch March 4, 2022 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reload the molecule. There is a problem with the editing function
2 participants