@opensumi/ide-core-browser 2.21.6 → 2.21.7-next-1670485458.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/lib/components/actions/index.d.ts.map +1 -1
  2. package/lib/components/actions/index.js +2 -22
  3. package/lib/components/actions/index.js.map +1 -1
  4. package/lib/components/tree/tree.module.less +1 -0
  5. package/lib/contextkey/testing.d.ts +1 -0
  6. package/lib/contextkey/testing.d.ts.map +1 -1
  7. package/lib/contextkey/testing.js +2 -1
  8. package/lib/contextkey/testing.js.map +1 -1
  9. package/lib/menu/next/menu.contrib.interface.d.ts +3 -2
  10. package/lib/menu/next/menu.contrib.interface.d.ts.map +1 -1
  11. package/lib/menu/next/menu.contrib.interface.js.map +1 -1
  12. package/lib/preferences/preference-configurations.js +1 -1
  13. package/lib/preferences/preference-configurations.js.map +1 -1
  14. package/lib/react-providers/config-provider.d.ts +4 -0
  15. package/lib/react-providers/config-provider.d.ts.map +1 -1
  16. package/lib/react-providers/config-provider.js.map +1 -1
  17. package/lib/services/storage-service.d.ts.map +1 -1
  18. package/lib/services/storage-service.js +7 -1
  19. package/lib/services/storage-service.js.map +1 -1
  20. package/lib/utils/label.d.ts.map +1 -1
  21. package/lib/utils/label.js +16 -9
  22. package/lib/utils/label.js.map +1 -1
  23. package/package.json +7 -6
  24. package/src/application/application-state-service.ts +54 -0
  25. package/src/application/application.service.ts +51 -0
  26. package/src/application/index.ts +2 -0
  27. package/src/authentication/authentication.contribution.ts +35 -0
  28. package/src/authentication/authentication.service.ts +517 -0
  29. package/src/bootstrap/app.ts +745 -0
  30. package/src/bootstrap/app.view.tsx +88 -0
  31. package/src/bootstrap/connection.ts +116 -0
  32. package/src/bootstrap/index.ts +3 -0
  33. package/src/bootstrap/inner-providers.ts +297 -0
  34. package/src/bootstrap/lifecycle.service.ts +19 -0
  35. package/src/browser-module.ts +24 -0
  36. package/src/common/common.command.ts +977 -0
  37. package/src/common/common.contribution.ts +343 -0
  38. package/src/common/common.define.ts +55 -0
  39. package/src/common/common.module.ts +33 -0
  40. package/src/common/common.storage.ts +22 -0
  41. package/src/common/container-id.ts +12 -0
  42. package/src/common/index.ts +4 -0
  43. package/src/components/actions/index.tsx +486 -0
  44. package/src/components/actions/placements.ts +47 -0
  45. package/src/components/actions/styles.module.less +144 -0
  46. package/src/components/badge/index.tsx +1 -0
  47. package/src/components/index.ts +26 -0
  48. package/src/components/layout/box-panel.tsx +88 -0
  49. package/src/components/layout/default-layout.tsx +61 -0
  50. package/src/components/layout/index.ts +4 -0
  51. package/src/components/layout/layout.ts +80 -0
  52. package/src/components/layout/split-panel.service.ts +56 -0
  53. package/src/components/layout/split-panel.tsx +296 -0
  54. package/src/components/layout/styles.module.less +21 -0
  55. package/src/components/loading/index.ts +1 -0
  56. package/src/components/loading/loading.less +14 -0
  57. package/src/components/loading/loading.view.tsx +7 -0
  58. package/src/components/loading/media/loading-dark.svg +52 -0
  59. package/src/components/loading/media/loading-hc.svg +52 -0
  60. package/src/components/loading/media/loading.svg +52 -0
  61. package/src/components/popover/styles.module.less +81 -0
  62. package/src/components/portal/index.tsx +13 -0
  63. package/src/components/progressbar/index.tsx +16 -0
  64. package/src/components/progressbar/styles.module.less +31 -0
  65. package/src/components/recycle-tree/index.ts +1 -0
  66. package/src/components/recycle-tree/recycle-tree.view.tsx +368 -0
  67. package/src/components/resize/resize.module.less +78 -0
  68. package/src/components/resize/resize.tsx +663 -0
  69. package/src/components/scroll/index.tsx +386 -0
  70. package/src/components/scroll/scroll.module.less +108 -0
  71. package/src/components/scrollbar/index.ts +1 -0
  72. package/src/components/scrollbar/scrollbar.less +36 -0
  73. package/src/components/scrollbar/scrollbar.view.ts +8 -0
  74. package/src/components/select/index.tsx +12 -0
  75. package/src/components/select/styles.less +6 -0
  76. package/src/components/tree/index.ts +3 -0
  77. package/src/components/tree/tree-node.view.tsx +546 -0
  78. package/src/components/tree/tree.module.less +297 -0
  79. package/src/components/tree/tree.view.tsx +486 -0
  80. package/src/context-key.ts +48 -0
  81. package/src/contextkey/dialog.ts +3 -0
  82. package/src/contextkey/explorer.ts +26 -0
  83. package/src/contextkey/index.ts +6 -0
  84. package/src/contextkey/outline.ts +4 -0
  85. package/src/contextkey/resource.ts +61 -0
  86. package/src/contextkey/terminal.ts +7 -0
  87. package/src/contextkey/testing.ts +9 -0
  88. package/src/contextkey/workspace.ts +7 -0
  89. package/src/core-preferences.ts +318 -0
  90. package/src/dom/index.ts +176 -0
  91. package/src/encoding-registry.ts +83 -0
  92. package/src/extensions/extensions-point.service.ts +78 -0
  93. package/src/extensions/index.ts +3 -0
  94. package/src/extensions/schema/browserViews.ts +96 -0
  95. package/src/extensions/schema/menu.ts +245 -0
  96. package/src/extensions/schema/opensumiExtensionPackageSchema.ts +12 -0
  97. package/src/extensions/schema/toolbar.ts +338 -0
  98. package/src/extensions/schema/vscodeExtensionPackageSchema.ts +330 -0
  99. package/src/fs/index.ts +12 -0
  100. package/src/hash-calculate/hash-calculate.contribution.ts +19 -0
  101. package/src/index.ts +42 -0
  102. package/src/keybinding/index.ts +1 -0
  103. package/src/keybinding/keybinding.ts +908 -0
  104. package/src/keyboard/index.ts +3 -0
  105. package/src/keyboard/keyboard-layout-provider.ts +412 -0
  106. package/src/keyboard/keyboard-layout-service.ts +449 -0
  107. package/src/keyboard/keys.ts +748 -0
  108. package/src/keyboard/layouts/_.contribution.ts +24 -0
  109. package/src/keyboard/layouts/cz.win.ts +168 -0
  110. package/src/keyboard/layouts/de-swiss.win.ts +168 -0
  111. package/src/keyboard/layouts/de.darwin.ts +131 -0
  112. package/src/keyboard/layouts/de.linux.ts +186 -0
  113. package/src/keyboard/layouts/de.win.ts +168 -0
  114. package/src/keyboard/layouts/dk.win.ts +168 -0
  115. package/src/keyboard/layouts/dvorak.darwin.ts +131 -0
  116. package/src/keyboard/layouts/en-belgian.win.ts +168 -0
  117. package/src/keyboard/layouts/en-ext.darwin.ts +131 -0
  118. package/src/keyboard/layouts/en-in.win.ts +168 -0
  119. package/src/keyboard/layouts/en-intl.darwin.ts +131 -0
  120. package/src/keyboard/layouts/en-intl.win.ts +168 -0
  121. package/src/keyboard/layouts/en-uk.darwin.ts +131 -0
  122. package/src/keyboard/layouts/en-uk.win.ts +168 -0
  123. package/src/keyboard/layouts/en.darwin.ts +139 -0
  124. package/src/keyboard/layouts/en.linux.ts +186 -0
  125. package/src/keyboard/layouts/en.win.ts +173 -0
  126. package/src/keyboard/layouts/es-latin.win.ts +168 -0
  127. package/src/keyboard/layouts/es.darwin.ts +131 -0
  128. package/src/keyboard/layouts/es.linux.ts +186 -0
  129. package/src/keyboard/layouts/es.win.ts +168 -0
  130. package/src/keyboard/layouts/fr.darwin.ts +131 -0
  131. package/src/keyboard/layouts/fr.linux.ts +186 -0
  132. package/src/keyboard/layouts/fr.win.ts +168 -0
  133. package/src/keyboard/layouts/hu.win.ts +168 -0
  134. package/src/keyboard/layouts/it.darwin.ts +131 -0
  135. package/src/keyboard/layouts/it.win.ts +168 -0
  136. package/src/keyboard/layouts/jp-roman.darwin.ts +131 -0
  137. package/src/keyboard/layouts/jp.darwin.ts +131 -0
  138. package/src/keyboard/layouts/ko.darwin.ts +131 -0
  139. package/src/keyboard/layouts/layout.contribution.darwin.ts +23 -0
  140. package/src/keyboard/layouts/layout.contribution.linux.ts +12 -0
  141. package/src/keyboard/layouts/layout.contribution.ts +9 -0
  142. package/src/keyboard/layouts/layout.contribution.win.ts +29 -0
  143. package/src/keyboard/layouts/no.win.ts +168 -0
  144. package/src/keyboard/layouts/pl.darwin.ts +131 -0
  145. package/src/keyboard/layouts/pl.win.ts +168 -0
  146. package/src/keyboard/layouts/pt-br.win.ts +169 -0
  147. package/src/keyboard/layouts/pt.darwin.ts +131 -0
  148. package/src/keyboard/layouts/pt.win.ts +168 -0
  149. package/src/keyboard/layouts/ru.darwin.ts +131 -0
  150. package/src/keyboard/layouts/ru.linux.ts +186 -0
  151. package/src/keyboard/layouts/ru.win.ts +168 -0
  152. package/src/keyboard/layouts/sv.darwin.ts +131 -0
  153. package/src/keyboard/layouts/sv.win.ts +168 -0
  154. package/src/keyboard/layouts/thai.win.ts +168 -0
  155. package/src/keyboard/layouts/tr.win.ts +168 -0
  156. package/src/keyboard/layouts/zh-hans.darwin.ts +131 -0
  157. package/src/layout/accordion/tab-bar-toolbar.tsx +59 -0
  158. package/src/layout/accordion/view-context-key.registry.ts +34 -0
  159. package/src/layout/constants.ts +7 -0
  160. package/src/layout/index.ts +5 -0
  161. package/src/layout/layout-hooks.ts +68 -0
  162. package/src/layout/layout-state.ts +107 -0
  163. package/src/layout/layout.interface.ts +101 -0
  164. package/src/layout/layout.ts +80 -0
  165. package/src/layout/view-id.ts +18 -0
  166. package/src/logger/browser-logger.ts +51 -0
  167. package/src/logger/index.ts +1 -0
  168. package/src/markdown/index.tsx +62 -0
  169. package/src/menu/next/base.ts +513 -0
  170. package/src/menu/next/ctxmenu-service.ts +188 -0
  171. package/src/menu/next/index.ts +10 -0
  172. package/src/menu/next/menu-id.ts +86 -0
  173. package/src/menu/next/menu-service.ts +252 -0
  174. package/src/menu/next/menu-util.ts +77 -0
  175. package/src/menu/next/menu.contrib.interface.ts +79 -0
  176. package/src/menu/next/menu.interface.ts +253 -0
  177. package/src/menu/next/menubar-service.ts +211 -0
  178. package/src/menu/next/renderer/ctxmenu/base.ts +18 -0
  179. package/src/menu/next/renderer/ctxmenu/browser.ts +45 -0
  180. package/src/menu/next/renderer/ctxmenu/electron.ts +207 -0
  181. package/src/menu/next/toolbar-action.service.ts +132 -0
  182. package/src/monaco/index.ts +128 -0
  183. package/src/opener/command-opener.ts +42 -0
  184. package/src/opener/default-opener.ts +31 -0
  185. package/src/opener/http-opener.ts +25 -0
  186. package/src/opener/index.ts +19 -0
  187. package/src/opener/opener.contribution.ts +57 -0
  188. package/src/opener/opener.service.ts +66 -0
  189. package/src/preferences/early-preferences.ts +117 -0
  190. package/src/preferences/index.ts +9 -0
  191. package/src/preferences/preference-configurations.ts +77 -0
  192. package/src/preferences/preference-contribution.ts +401 -0
  193. package/src/preferences/preference-provider.ts +414 -0
  194. package/src/preferences/preference-proxy.ts +292 -0
  195. package/src/preferences/preference-scope.ts +3 -0
  196. package/src/preferences/preference-service.ts +571 -0
  197. package/src/preferences/settings.ts +53 -0
  198. package/src/preferences/types.ts +111 -0
  199. package/src/progress/index.ts +58 -0
  200. package/src/progress/progress-bar.tsx +22 -0
  201. package/src/progress/progress-indicator.ts +90 -0
  202. package/src/progress/progress.module.less +46 -0
  203. package/src/progress/progress.service.tsx +429 -0
  204. package/src/quick-open/index.ts +655 -0
  205. package/src/quick-open/recent-files.ts +68 -0
  206. package/src/raw-context-key.ts +116 -0
  207. package/src/react-hooks/event.tsx +80 -0
  208. package/src/react-hooks/hot-key.tsx +58 -0
  209. package/src/react-hooks/index.ts +3 -0
  210. package/src/react-hooks/injectable-hooks.tsx +35 -0
  211. package/src/react-hooks/portal-hooks.tsx +38 -0
  212. package/src/react-providers/config-provider.tsx +263 -0
  213. package/src/react-providers/index.tsx +2 -0
  214. package/src/react-providers/slot.module.less +19 -0
  215. package/src/react-providers/slot.tsx +242 -0
  216. package/src/services/clipboard.service.ts +97 -0
  217. package/src/services/credentials-service.ts +91 -0
  218. package/src/services/crypto-service.ts +23 -0
  219. package/src/services/external-uri.service.ts +68 -0
  220. package/src/services/index.ts +7 -0
  221. package/src/services/label-service.ts +386 -0
  222. package/src/services/status-bar-service.ts +108 -0
  223. package/src/services/storage-service.ts +197 -0
  224. package/src/style/codicons/README.md +22 -0
  225. package/src/style/codicons/codicon-animations.css +15 -0
  226. package/src/style/codicons/generator.js +15 -0
  227. package/src/style/entry.less +25 -0
  228. package/src/style/icon/fileicons/file-default.svg +1 -0
  229. package/src/style/icon/fileicons/folder-default.svg +1 -0
  230. package/src/style/icon/fileicons.less +20 -0
  231. package/src/style/icon/icon.ts +543 -0
  232. package/src/style/icon/ide-iconfont.ts +13 -0
  233. package/src/style/icon/index.less +54 -0
  234. package/src/style/icon/seti.woff +0 -0
  235. package/src/style/icon/symbol-icons/boolean-dark.svg +3 -0
  236. package/src/style/icon/symbol-icons/boolean-light.svg +3 -0
  237. package/src/style/icon/symbol-icons/class-dark.svg +3 -0
  238. package/src/style/icon/symbol-icons/class-light.svg +3 -0
  239. package/src/style/icon/symbol-icons/constant-dark.svg +4 -0
  240. package/src/style/icon/symbol-icons/constant-light.svg +4 -0
  241. package/src/style/icon/symbol-icons/enumerator-dark.svg +3 -0
  242. package/src/style/icon/symbol-icons/enumerator-item-dark.svg +3 -0
  243. package/src/style/icon/symbol-icons/enumerator-item-light.svg +3 -0
  244. package/src/style/icon/symbol-icons/enumerator-light.svg +3 -0
  245. package/src/style/icon/symbol-icons/event-dark.svg +3 -0
  246. package/src/style/icon/symbol-icons/event-light.svg +3 -0
  247. package/src/style/icon/symbol-icons/field-dark.svg +3 -0
  248. package/src/style/icon/symbol-icons/field-light.svg +3 -0
  249. package/src/style/icon/symbol-icons/file-dark.svg +3 -0
  250. package/src/style/icon/symbol-icons/file-light.svg +3 -0
  251. package/src/style/icon/symbol-icons/indexer-dark.svg +3 -0
  252. package/src/style/icon/symbol-icons/indexer-light.svg +3 -0
  253. package/src/style/icon/symbol-icons/interface-dark.svg +3 -0
  254. package/src/style/icon/symbol-icons/interface-light.svg +3 -0
  255. package/src/style/icon/symbol-icons/keyword-dark.svg +3 -0
  256. package/src/style/icon/symbol-icons/keyword-light.svg +3 -0
  257. package/src/style/icon/symbol-icons/method-dark.svg +3 -0
  258. package/src/style/icon/symbol-icons/method-light.svg +3 -0
  259. package/src/style/icon/symbol-icons/namespace-dark.svg +3 -0
  260. package/src/style/icon/symbol-icons/namespace-light.svg +3 -0
  261. package/src/style/icon/symbol-icons/numeric-dark.svg +3 -0
  262. package/src/style/icon/symbol-icons/numeric-light.svg +3 -0
  263. package/src/style/icon/symbol-icons/operator-dark.svg +3 -0
  264. package/src/style/icon/symbol-icons/operator-light.svg +3 -0
  265. package/src/style/icon/symbol-icons/property-dark.svg +3 -0
  266. package/src/style/icon/symbol-icons/property-light.svg +3 -0
  267. package/src/style/icon/symbol-icons/snippet-dark.svg +3 -0
  268. package/src/style/icon/symbol-icons/snippet-light.svg +3 -0
  269. package/src/style/icon/symbol-icons/string-dark.svg +3 -0
  270. package/src/style/icon/symbol-icons/string-light.svg +3 -0
  271. package/src/style/icon/symbol-icons/structure-dark.svg +3 -0
  272. package/src/style/icon/symbol-icons/structure-light.svg +3 -0
  273. package/src/style/icon/symbol-icons/symbol-icons.css +284 -0
  274. package/src/style/icon/symbol-icons/template-dark.svg +3 -0
  275. package/src/style/icon/symbol-icons/template-light.svg +3 -0
  276. package/src/style/icon/symbol-icons/variable-dark.svg +3 -0
  277. package/src/style/icon/symbol-icons/variable-light.svg +3 -0
  278. package/src/style/icon.less +8 -0
  279. package/src/style/index.less +14 -0
  280. package/src/style/monaco-override.less +116 -0
  281. package/src/style/normalize.less +92 -0
  282. package/src/style/octicons/octicons-cdn.css +720 -0
  283. package/src/style/octicons/octicons.css +714 -0
  284. package/src/style/octicons/octicons.html +1882 -0
  285. package/src/style/octicons/octicons.svg +582 -0
  286. package/src/style/octicons/octicons.ttf +0 -0
  287. package/src/style/override.less +97 -0
  288. package/src/style/toolbar.less +199 -0
  289. package/src/style/utilities.less +8 -0
  290. package/src/style/variable.less +8 -0
  291. package/src/terminal/index.ts +7 -0
  292. package/src/toolbar/components/auto-complete.tsx +0 -0
  293. package/src/toolbar/components/button.tsx +440 -0
  294. package/src/toolbar/components/index.ts +2 -0
  295. package/src/toolbar/components/select.tsx +189 -0
  296. package/src/toolbar/index.ts +3 -0
  297. package/src/toolbar/toolbar.popover.registry.ts +32 -0
  298. package/src/toolbar/toolbar.registry.ts +352 -0
  299. package/src/toolbar/toolbar.tsx +710 -0
  300. package/src/toolbar/types.ts +383 -0
  301. package/src/tree/index.ts +3 -0
  302. package/src/tree/tree-expansion.ts +25 -0
  303. package/src/tree/tree-selection.ts +89 -0
  304. package/src/tree/tree.ts +294 -0
  305. package/src/utils/create-overlay.tsx +53 -0
  306. package/src/utils/electron.ts +92 -0
  307. package/src/utils/env.ts +26 -0
  308. package/src/utils/icon.ts +13 -0
  309. package/src/utils/index.ts +7 -0
  310. package/src/utils/json.ts +251 -0
  311. package/src/utils/label.tsx +36 -0
  312. package/src/utils/parse.ts +72 -0
  313. package/src/utils/react-hooks.ts +118 -0
  314. package/src/variable/index.ts +1 -0
  315. package/src/variable/variable.ts +84 -0
  316. package/src/window/index.ts +34 -0
  317. package/src/window/window.service.ts +100 -0
@@ -0,0 +1,745 @@
1
+ /**
2
+ * editor.main 包含了所有 monaco 自带的编辑器相关核心功能以及 contributes
3
+ * 并且 editor.main 也包含对 editor.all 的导入
4
+ */
5
+ import '@opensumi/monaco-editor-core/esm/vs/editor/editor.main';
6
+ import ResizeObserver from 'resize-observer-polyfill';
7
+
8
+ import { Injector, ConstructorOf } from '@opensumi/di';
9
+ import { RPCMessageConnection } from '@opensumi/ide-connection';
10
+ import { WSChannelHandler } from '@opensumi/ide-connection/lib/browser';
11
+ import {
12
+ CommandRegistry,
13
+ isOSX,
14
+ ContributionProvider,
15
+ MaybePromise,
16
+ createContributionProvider,
17
+ StorageProvider,
18
+ DefaultStorageProvider,
19
+ StorageResolverContribution,
20
+ ILoggerManagerClient,
21
+ SupportLogNamespace,
22
+ ILogServiceClient,
23
+ getDebugLogger,
24
+ isElectronRenderer,
25
+ setLanguageId,
26
+ IReporterService,
27
+ REPORT_NAME,
28
+ IEventBus,
29
+ asExtensionCandidate,
30
+ IApplicationService,
31
+ IDisposable,
32
+ Deferred,
33
+ isUndefined,
34
+ GeneralSettingsId,
35
+ UrlProvider,
36
+ LifeCyclePhase,
37
+ AppLifeCycleServiceToken,
38
+ IAppLifeCycleService,
39
+ } from '@opensumi/ide-core-common';
40
+ import {
41
+ DEFAULT_APPLICATION_DESKTOP_HOST,
42
+ DEFAULT_APPLICATION_NAME,
43
+ DEFAULT_APPLICATION_WEB_HOST,
44
+ DEFAULT_URI_SCHEME,
45
+ } from '@opensumi/ide-core-common/lib/const/application';
46
+ import { IElectronMainLifeCycleService } from '@opensumi/ide-core-common/lib/electron';
47
+
48
+ import { createElectronClientConnection } from '..';
49
+ import { ClientAppStateService } from '../application';
50
+ import { BrowserModule, IClientApp } from '../browser-module';
51
+ import { ClientAppContribution } from '../common';
52
+ import { CorePreferences } from '../core-preferences';
53
+ import { injectCorePreferences } from '../core-preferences';
54
+ import { KeybindingRegistry, KeybindingService, NO_KEYBINDING_NAME } from '../keybinding';
55
+ import { RenderedEvent } from '../layout/layout.interface';
56
+ import { MenuRegistryImpl, IMenuRegistry } from '../menu/next/base';
57
+ import {
58
+ PreferenceProviderProvider,
59
+ injectPreferenceSchemaProvider,
60
+ injectPreferenceConfigurations,
61
+ PreferenceScope,
62
+ PreferenceProvider,
63
+ PreferenceService,
64
+ PreferenceServiceImpl,
65
+ getPreferenceLanguageId,
66
+ registerLocalStorageProvider,
67
+ } from '../preferences';
68
+ import { AppConfig } from '../react-providers/config-provider';
69
+ import { DEFAULT_CDN_ICON, IDE_OCTICONS_CN_CSS, IDE_CODICONS_CN_CSS, updateIconMap } from '../style/icon/icon';
70
+ import { electronEnv } from '../utils';
71
+
72
+ import { renderClientApp, IAppRenderer } from './app.view';
73
+ import { createClientConnection2, bindConnectionService } from './connection';
74
+ import { injectInnerProviders } from './inner-providers';
75
+ import { AppLifeCycleService } from './lifecycle.service';
76
+
77
+ export type ModuleConstructor = ConstructorOf<BrowserModule>;
78
+ export type ContributionConstructor = ConstructorOf<ClientAppContribution>;
79
+ export type Direction = 'left-to-right' | 'right-to-left' | 'top-to-bottom' | 'bottom-to-top';
80
+ export interface IconMap {
81
+ [iconKey: string]: string;
82
+ }
83
+ export interface IPreferences {
84
+ [key: string]: any;
85
+ }
86
+ export interface IconInfo {
87
+ cssPath: string;
88
+ prefix: string;
89
+ iconMap: IconMap;
90
+ }
91
+ export interface IClientAppOpts extends Partial<AppConfig> {
92
+ modules: ModuleConstructor[];
93
+ contributions?: ContributionConstructor[];
94
+ modulesInstances?: BrowserModule[];
95
+ connectionPath?: UrlProvider;
96
+ connectionProtocols?: string[];
97
+ iconStyleSheets?: IconInfo[];
98
+ useCdnIcon?: boolean;
99
+ editorBackgroundImage?: string;
100
+ /**
101
+ * 插件开发模式下指定的插件路径
102
+ */
103
+ extensionDevelopmentPath?: string | string[];
104
+ }
105
+
106
+ export interface LayoutConfig {
107
+ [area: string]: {
108
+ modules: Array<string>;
109
+ // @deprecated
110
+ size?: number;
111
+ };
112
+ }
113
+
114
+ // 添加resize observer polyfill
115
+ if (typeof (window as any).ResizeObserver === 'undefined') {
116
+ (window as any).ResizeObserver = ResizeObserver;
117
+ }
118
+
119
+ export class ClientApp implements IClientApp, IDisposable {
120
+ /**
121
+ * 应用是否完成初始化
122
+ */
123
+ appInitialized: Deferred<void> = new Deferred();
124
+
125
+ browserModules: BrowserModule[] = [];
126
+
127
+ modules: ModuleConstructor[];
128
+
129
+ injector: Injector;
130
+
131
+ logger: ILogServiceClient;
132
+
133
+ connectionPath: UrlProvider;
134
+
135
+ connectionProtocols?: string[];
136
+
137
+ keybindingRegistry: KeybindingRegistry;
138
+
139
+ keybindingService: KeybindingService;
140
+
141
+ config: AppConfig;
142
+
143
+ contributionsProvider: ContributionProvider<ClientAppContribution>;
144
+
145
+ commandRegistry: CommandRegistry;
146
+
147
+ // 这里将 onStart contribution 方法放到 MenuRegistryImpl 上了
148
+ nextMenuRegistry: MenuRegistryImpl;
149
+
150
+ stateService: ClientAppStateService;
151
+
152
+ constructor(opts: IClientAppOpts) {
153
+ const {
154
+ modules,
155
+ contributions,
156
+ modulesInstances,
157
+ connectionPath,
158
+ connectionProtocols,
159
+ iconStyleSheets,
160
+ useCdnIcon,
161
+ editorBackgroundImage,
162
+ defaultPreferences,
163
+ allowSetDocumentTitleFollowWorkspaceDir = true,
164
+ devtools = false, // if not set, disable devtools support as default
165
+ ...restOpts // rest part 为 AppConfig
166
+ } = opts;
167
+
168
+ this.initEarlyPreference(opts.workspaceDir || '');
169
+ setLanguageId(getPreferenceLanguageId(defaultPreferences));
170
+ this.injector = opts.injector || new Injector();
171
+ this.modules = modules;
172
+ this.modules.forEach((m) => this.resolveModuleDeps(m));
173
+ // moduleInstance必须第一个是layout模块
174
+ this.browserModules = opts.modulesInstances || [];
175
+ const isDesktop = opts.isElectronRenderer || isElectronRenderer();
176
+ this.config = {
177
+ appName: DEFAULT_APPLICATION_NAME,
178
+ appHost: isDesktop ? DEFAULT_APPLICATION_DESKTOP_HOST : DEFAULT_APPLICATION_WEB_HOST,
179
+ appRoot: isUndefined(opts.appRoot) ? (isDesktop ? electronEnv.appPath : '') : opts.appRoot,
180
+ uriScheme: DEFAULT_URI_SCHEME,
181
+ // 如果通过 config 传入了 appName 及 uriScheme,则优先使用
182
+ ...restOpts,
183
+ // 一些转换和 typo 修复
184
+ isElectronRenderer: isDesktop,
185
+ workspaceDir: opts.workspaceDir || '',
186
+ extensionDir:
187
+ opts.extensionDir || (opts.isElectronRenderer || isDesktop ? electronEnv.metadata?.extensionDir : ''),
188
+ injector: this.injector,
189
+ wsPath: opts.wsPath || `ws://${window.location.hostname}:8000`,
190
+ layoutConfig: opts.layoutConfig as LayoutConfig,
191
+ editorBackgroundImage: opts.editorBackgroundImage || editorBackgroundImage,
192
+ allowSetDocumentTitleFollowWorkspaceDir,
193
+ devtools,
194
+ };
195
+
196
+ if (devtools) {
197
+ // set a global so the opensumi devtools can identify that
198
+ // the current page is powered by opensumi core
199
+ window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__ = {};
200
+ }
201
+
202
+ if (this.config.isElectronRenderer && electronEnv.metadata?.extensionDevelopmentHost) {
203
+ this.config.extensionDevelopmentHost = electronEnv.metadata.extensionDevelopmentHost;
204
+ }
205
+
206
+ if (opts.extensionDevelopmentPath) {
207
+ this.config.extensionCandidate = (this.config.extensionCandidate || []).concat(
208
+ Array.isArray(opts.extensionDevelopmentPath)
209
+ ? opts.extensionDevelopmentPath.map((e) => asExtensionCandidate(e, true))
210
+ : [asExtensionCandidate(opts.extensionDevelopmentPath, true)],
211
+ );
212
+
213
+ this.config.extensionDevelopmentHost = !!opts.extensionDevelopmentPath;
214
+ }
215
+
216
+ // 旧方案兼容, 把electron.metadata.extensionCandidate提前注入appConfig的对应配置中
217
+ if (this.config.isElectronRenderer && electronEnv.metadata?.extensionCandidate) {
218
+ this.config.extensionCandidate = (this.config.extensionCandidate || []).concat(
219
+ electronEnv.metadata.extensionCandidate || [],
220
+ );
221
+ }
222
+
223
+ this.connectionPath = connectionPath || `${this.config.wsPath}/service`;
224
+ this.connectionProtocols = connectionProtocols;
225
+ this.initBaseProvider();
226
+ this.initFields();
227
+ this.appendIconStyleSheets(iconStyleSheets, useCdnIcon);
228
+ this.createBrowserModules(defaultPreferences);
229
+ }
230
+
231
+ private _inComposition = false;
232
+
233
+ /**
234
+ * 将被依赖但未被加入modules的模块加入到待加载模块最后
235
+ */
236
+ public resolveModuleDeps(moduleConstructor: ModuleConstructor) {
237
+ const dependencies = Reflect.getMetadata('dependencies', moduleConstructor) as [];
238
+ if (dependencies) {
239
+ dependencies.forEach((dep) => {
240
+ if (this.modules.indexOf(dep) === -1) {
241
+ this.modules.push(dep);
242
+ }
243
+ });
244
+ }
245
+ }
246
+
247
+ get lifeCycleService(): IAppLifeCycleService {
248
+ return this.injector.get(AppLifeCycleServiceToken);
249
+ }
250
+
251
+ /**
252
+ * LifeCycle
253
+ * 1. Prepare
254
+ * 2. Initialize
255
+ * 3. Starting
256
+ * 4. Ready
257
+ */
258
+ public async start(
259
+ container: HTMLElement | IAppRenderer,
260
+ type?: 'electron' | 'web',
261
+ connection?: RPCMessageConnection,
262
+ ): Promise<void> {
263
+ const reporterService: IReporterService = this.injector.get(IReporterService);
264
+ const measureReporter = reporterService.time(REPORT_NAME.MEASURE);
265
+
266
+ this.lifeCycleService.phase = LifeCyclePhase.Prepare;
267
+
268
+ if (connection) {
269
+ await bindConnectionService(this.injector, this.modules, connection);
270
+ } else {
271
+ if (type === 'electron') {
272
+ await bindConnectionService(this.injector, this.modules, createElectronClientConnection());
273
+ } else if (type === 'web') {
274
+ await createClientConnection2(
275
+ this.injector,
276
+ this.modules,
277
+ this.connectionPath,
278
+ () => {
279
+ this.onReconnectContributions();
280
+ },
281
+ this.connectionProtocols,
282
+ this.config.clientId,
283
+ );
284
+
285
+ this.logger = this.getLogger();
286
+ // 回写需要用到打点的 Logger 的地方
287
+ this.injector.get(WSChannelHandler).replaceLogger(this.logger);
288
+ }
289
+ }
290
+ measureReporter.timeEnd('ClientApp.createConnection');
291
+
292
+ this.logger = this.getLogger();
293
+ this.stateService.state = 'client_connected';
294
+ this.registerEventListeners();
295
+ // 在 connect 之后立即初始化数据,保证其它 module 能同步获取数据
296
+ await this.injector.get(IApplicationService).initializeData();
297
+
298
+ // 在 contributions 执行完 onStart 上报一次耗时
299
+ await this.measure('Contributions.start', () => this.startContributions(container));
300
+ this.stateService.state = 'started_contributions';
301
+ this.stateService.state = 'ready';
302
+
303
+ this.lifeCycleService.phase = LifeCyclePhase.Ready;
304
+ measureReporter.timeEnd('Framework.ready');
305
+ }
306
+
307
+ private getLogger() {
308
+ if (this.logger) {
309
+ return this.logger;
310
+ }
311
+ this.logger = this.injector.get(ILoggerManagerClient).getLogger(SupportLogNamespace.Browser);
312
+ return this.logger;
313
+ }
314
+
315
+ private onReconnectContributions() {
316
+ const contributions = this.contributions;
317
+
318
+ for (const contribution of contributions) {
319
+ if (contribution.onReconnect) {
320
+ contribution.onReconnect(this);
321
+ }
322
+ }
323
+ }
324
+
325
+ /**
326
+ * 给 injector 初始化默认的 Providers
327
+ */
328
+ private initBaseProvider() {
329
+ this.injector.addProviders({ token: IClientApp, useValue: this });
330
+ this.injector.addProviders({ token: AppConfig, useValue: this.config });
331
+ injectInnerProviders(this.injector);
332
+ }
333
+
334
+ /**
335
+ * 从 injector 里获得实例
336
+ */
337
+ private initFields() {
338
+ this.contributionsProvider = this.injector.get(ClientAppContribution);
339
+ this.commandRegistry = this.injector.get(CommandRegistry);
340
+ this.keybindingRegistry = this.injector.get(KeybindingRegistry);
341
+ this.keybindingService = this.injector.get(KeybindingService);
342
+ this.stateService = this.injector.get(ClientAppStateService);
343
+ this.nextMenuRegistry = this.injector.get(IMenuRegistry);
344
+ }
345
+
346
+ private createBrowserModules(defaultPreferences?: IPreferences) {
347
+ const injector = this.injector;
348
+
349
+ for (const Constructor of this.modules) {
350
+ const instance = injector.get(Constructor);
351
+ this.browserModules.push(instance);
352
+
353
+ if (instance.providers) {
354
+ this.injector.addProviders(...instance.providers);
355
+ }
356
+
357
+ if (instance.preferences) {
358
+ instance.preferences(this.injector);
359
+ }
360
+ }
361
+
362
+ injectCorePreferences(this.injector);
363
+
364
+ // 注册PreferenceService
365
+ this.injectPreferenceService(this.injector, defaultPreferences);
366
+
367
+ // 注册存储服务
368
+ this.injectStorageProvider(this.injector);
369
+
370
+ for (const instance of this.browserModules) {
371
+ if (instance.contributionProvider) {
372
+ if (Array.isArray(instance.contributionProvider)) {
373
+ for (const contributionProvider of instance.contributionProvider) {
374
+ createContributionProvider(this.injector, contributionProvider);
375
+ }
376
+ } else {
377
+ createContributionProvider(this.injector, instance.contributionProvider);
378
+ }
379
+ }
380
+ }
381
+ }
382
+
383
+ get contributions(): ClientAppContribution[] {
384
+ return this.contributionsProvider.getContributions();
385
+ }
386
+
387
+ protected async startContributions(container) {
388
+ // 先渲染 layout,模块视图的时序由layout控制
389
+ await this.measure('RenderApp.render', () => this.renderApp(container));
390
+
391
+ this.lifeCycleService.phase = LifeCyclePhase.Initialize;
392
+ await this.measure('Contributions.initialize', () => this.initializeContributions());
393
+
394
+ // 初始化命令、快捷键与菜单
395
+ await this.initializeCoreRegistry();
396
+
397
+ // 核心模块初始化完毕
398
+ this.stateService.state = 'core_module_initialized';
399
+
400
+ this.lifeCycleService.phase = LifeCyclePhase.Starting;
401
+ await this.measure('Contributions.onStart', () => this.onStartContributions());
402
+
403
+ await this.runContributionsPhase(this.contributions, 'onDidStart');
404
+ }
405
+
406
+ /**
407
+ * 初始化核心模板
408
+ */
409
+ private async initializeCoreRegistry() {
410
+ this.commandRegistry.initialize();
411
+ await this.keybindingRegistry.initialize();
412
+ this.nextMenuRegistry.initialize();
413
+ }
414
+
415
+ /**
416
+ * run contribution#initialize
417
+ */
418
+ private async initializeContributions() {
419
+ await this.runContributionsPhase(this.contributions, 'initialize');
420
+ this.appInitialized.resolve();
421
+
422
+ this.logger.verbose('contributions.initialize done');
423
+ }
424
+
425
+ /**
426
+ * run contribution#onStart
427
+ */
428
+ private async onStartContributions() {
429
+ await this.runContributionsPhase(this.contributions, 'onStart');
430
+ }
431
+
432
+ private async runContributionsPhase(contributions: ClientAppContribution[], phaseName: keyof ClientAppContribution) {
433
+ return await Promise.all(
434
+ contributions.map((contribution) => this.contributionPhaseRunner(contribution, phaseName)),
435
+ );
436
+ }
437
+
438
+ private async contributionPhaseRunner(contribution: ClientAppContribution, phaseName: keyof ClientAppContribution) {
439
+ const phase = contribution[phaseName];
440
+ if (typeof phase === 'function') {
441
+ try {
442
+ const uid = contribution.constructor.name + '.' + phaseName;
443
+ return await this.measure(uid, () => phase.call(contribution, this));
444
+ } catch (error) {
445
+ this.logger.error(`Could not run contribution#${phaseName}`, error);
446
+ }
447
+ }
448
+ }
449
+
450
+ private async renderApp(container: HTMLElement | IAppRenderer) {
451
+ await renderClientApp(this, container);
452
+
453
+ const eventBus = this.injector.get(IEventBus);
454
+ eventBus.fire(new RenderedEvent());
455
+ }
456
+
457
+ protected async measure<T>(name: string, fn: () => MaybePromise<T>): Promise<T> {
458
+ const reporterService: IReporterService = this.injector.get(IReporterService);
459
+ const measureReporter = reporterService.time(REPORT_NAME.MEASURE);
460
+ const result = await fn();
461
+ measureReporter.timeEnd(name);
462
+ return result;
463
+ }
464
+
465
+ /**
466
+ * `beforeunload` listener implementation
467
+ */
468
+ protected preventStop(): boolean {
469
+ // 获取corePreferences配置判断是否弹出确认框
470
+ const corePreferences = this.injector.get(CorePreferences);
471
+ const confirmExit = corePreferences['application.confirmExit'];
472
+ if (confirmExit === 'never') {
473
+ return false;
474
+ }
475
+ for (const contribution of this.contributions) {
476
+ if (contribution.onWillStop) {
477
+ try {
478
+ const res = contribution.onWillStop(this);
479
+ if (res) {
480
+ return true;
481
+ }
482
+ } catch (e) {
483
+ getDebugLogger().error(e);
484
+ }
485
+ }
486
+ }
487
+ return confirmExit === 'always';
488
+ }
489
+
490
+ /**
491
+ * electron 退出询问
492
+ */
493
+ protected async preventStopElectron(): Promise<boolean> {
494
+ // 获取corePreferences配置判断是否弹出确认框
495
+ const corePreferences = this.injector.get(CorePreferences);
496
+ const confirmExit = corePreferences['application.confirmExit'];
497
+ if (confirmExit === 'never') {
498
+ return false;
499
+ }
500
+ for (const contribution of this.contributions) {
501
+ if (contribution.onWillStop) {
502
+ try {
503
+ const res = await contribution.onWillStop(this);
504
+ if (res) {
505
+ return true;
506
+ }
507
+ } catch (e) {
508
+ getDebugLogger().error(e);
509
+ }
510
+ }
511
+ }
512
+ return false;
513
+ }
514
+
515
+ /**
516
+ * Stop the frontend application contributions. This is called when the window is unloaded.
517
+ */
518
+ protected stopContributions(): void {
519
+ for (const contribution of this.contributions) {
520
+ if (contribution.onStop) {
521
+ try {
522
+ contribution.onStop(this);
523
+ } catch (error) {
524
+ this.logger.error('Could not stop contribution', error);
525
+ }
526
+ }
527
+ }
528
+ }
529
+
530
+ protected async stopContributionsElectron(): Promise<void> {
531
+ const promises: Array<Promise<void>> = [];
532
+ for (const contribution of this.contributions) {
533
+ if (contribution.onStop) {
534
+ promises.push(
535
+ (async () => {
536
+ try {
537
+ await contribution.onStop!(this);
538
+ } catch (error) {
539
+ this.logger.error('Could not stop contribution', error);
540
+ }
541
+ })(),
542
+ );
543
+ }
544
+ }
545
+ await Promise.all(promises);
546
+ }
547
+
548
+ /**
549
+ * 注册全局事件监听
550
+ */
551
+ protected registerEventListeners(): void {
552
+ window.addEventListener('beforeunload', this._handleBeforeUpload);
553
+ window.addEventListener('unload', this._handleUnload);
554
+
555
+ window.addEventListener('resize', this._handleResize);
556
+ // 处理中文输入回退时可能出现多个光标问题
557
+ // https://github.com/eclipse-theia/theia/pull/6673
558
+ window.addEventListener('compositionstart', this._handleCompositionstart);
559
+ window.addEventListener('compositionend', this._handleCompositionend);
560
+ window.addEventListener('keydown', this._handleKeydown, true);
561
+ window.addEventListener('keyup', this._handleKeyup, true);
562
+
563
+ if (isOSX) {
564
+ document.body.addEventListener('wheel', this._handleWheel, { passive: false });
565
+ }
566
+ }
567
+
568
+ injectPreferenceService(injector: Injector, defaultPreferences?: IPreferences): void {
569
+ const preferencesProviderFactory = () => (scope: PreferenceScope) => {
570
+ const provider: PreferenceProvider = injector.get(PreferenceProvider, { tag: scope });
571
+ provider.asScope(scope);
572
+ return provider;
573
+ };
574
+ injectPreferenceConfigurations(injector);
575
+
576
+ injectPreferenceSchemaProvider(injector);
577
+
578
+ // 用于获取不同scope下的PreferenceProvider
579
+ injector.addProviders(
580
+ {
581
+ token: PreferenceProviderProvider,
582
+ useFactory: preferencesProviderFactory,
583
+ },
584
+ {
585
+ token: PreferenceService,
586
+ useClass: PreferenceServiceImpl,
587
+ },
588
+ );
589
+ // 设置默认配置
590
+ if (defaultPreferences) {
591
+ const providerFactory: PreferenceProviderProvider = injector.get(PreferenceProviderProvider);
592
+ const defaultPreference: PreferenceProvider = providerFactory(PreferenceScope.Default);
593
+ for (const key of Object.keys(defaultPreferences)) {
594
+ defaultPreference.setPreference(key, defaultPreferences[key]);
595
+ }
596
+ }
597
+ }
598
+
599
+ injectStorageProvider(injector: Injector) {
600
+ injector.addProviders({
601
+ token: DefaultStorageProvider,
602
+ useClass: DefaultStorageProvider,
603
+ });
604
+ injector.addProviders({
605
+ token: StorageProvider,
606
+ useFactory: () => (storageId) => injector.get(DefaultStorageProvider).get(storageId),
607
+ });
608
+ createContributionProvider(injector, StorageResolverContribution);
609
+ }
610
+
611
+ /**
612
+ * 通知上层需要刷新浏览器
613
+ * @param forcedReload 当取值为 true 时,将强制浏览器从服务器重新获取当前页面资源,而不是从浏览器的缓存中读取,如果取值为 false 或不传该参数时,浏览器则可能会从缓存中读取当前页面。
614
+ */
615
+ fireOnReload(forcedReload = false) {
616
+ // 默认调用 location reload
617
+ // @ts-ignore
618
+ window.location.reload(forcedReload);
619
+ }
620
+
621
+ protected appendIconStyleSheets(iconInfos?: IconInfo[], useCdnIcon?: boolean) {
622
+ const iconPaths: string[] = useCdnIcon ? [DEFAULT_CDN_ICON, IDE_OCTICONS_CN_CSS, IDE_CODICONS_CN_CSS] : [];
623
+ if (iconInfos && iconInfos.length) {
624
+ iconInfos.forEach((info) => {
625
+ this.updateIconMap(info.prefix, info.iconMap);
626
+ iconPaths.push(info.cssPath);
627
+ });
628
+ }
629
+ for (const path of iconPaths) {
630
+ const link = document.createElement('link');
631
+ link.setAttribute('rel', 'stylesheet');
632
+ link.setAttribute('href', path);
633
+ document.getElementsByTagName('head')[0].appendChild(link);
634
+ }
635
+ }
636
+
637
+ protected updateIconMap(prefix: string, iconMap: IconMap) {
638
+ if (prefix === 'kaitian-icon kticon-') {
639
+ this.logger.error('icon prefix与内置图标冲突,请检查图标配置!');
640
+ }
641
+ updateIconMap(prefix, iconMap);
642
+ }
643
+
644
+ protected initEarlyPreference(workspaceDir: string) {
645
+ registerLocalStorageProvider(GeneralSettingsId.Theme, workspaceDir);
646
+ registerLocalStorageProvider(GeneralSettingsId.Icon, workspaceDir);
647
+ registerLocalStorageProvider(GeneralSettingsId.Language, workspaceDir);
648
+ }
649
+
650
+ public async dispose() {
651
+ window.removeEventListener('beforeunload', this._handleBeforeUpload);
652
+ window.removeEventListener('unload', this._handleUnload);
653
+ window.removeEventListener('resize', this._handleResize);
654
+ window.removeEventListener('compositionstart', this._handleCompositionstart);
655
+ window.removeEventListener('compositionend', this._handleCompositionend);
656
+ window.removeEventListener('keydown', this._handleKeydown, true);
657
+ if (isOSX) {
658
+ document.body.removeEventListener('wheel', this._handleWheel);
659
+ }
660
+
661
+ this.disposeSideEffect();
662
+ }
663
+
664
+ private disposeSideEffect() {
665
+ for (const contribution of this.contributions) {
666
+ if (contribution.onDisposeSideEffects) {
667
+ try {
668
+ contribution.onDisposeSideEffects(this);
669
+ } catch (error) {
670
+ this.logger.error('Could not dispose contribution', error);
671
+ }
672
+ }
673
+ }
674
+ }
675
+
676
+ private _handleBeforeUpload = (event: BeforeUnloadEvent) => {
677
+ // 浏览器关闭事件前
678
+ if (this.config.isElectronRenderer) {
679
+ if (this.stateService.state === 'electron_confirmed_close') {
680
+ return;
681
+ }
682
+ // 在electron上,先直接prevent, 然后进入ask环节
683
+ event.returnValue = '';
684
+ event.preventDefault();
685
+ if (this.stateService.state !== 'electron_asking_close') {
686
+ this.stateService.state = 'electron_asking_close';
687
+ this.preventStopElectron().then((res) => {
688
+ if (res) {
689
+ this.stateService.state = 'ready';
690
+ } else {
691
+ return this.stopContributionsElectron().then(() => {
692
+ this.stateService.state = 'electron_confirmed_close';
693
+ const electronLifeCycle: IElectronMainLifeCycleService = this.injector.get(IElectronMainLifeCycleService);
694
+ // 在下一个 event loop 执行,否则可能导致第一次无法关闭。
695
+ setTimeout(() => {
696
+ electronLifeCycle.closeWindow(electronEnv.currentWindowId);
697
+ }, 0);
698
+ });
699
+ }
700
+ });
701
+ }
702
+ } else {
703
+ // 为了避免不必要的弹窗,如果页面并没有发生交互浏览器可能不会展示在 beforeunload 事件中引发的弹框,甚至可能即使发生交互了也直接不显示。
704
+ if (this.preventStop()) {
705
+ (event || window.event).returnValue = true;
706
+ return true;
707
+ }
708
+ }
709
+ };
710
+
711
+ private _handleUnload = () => {
712
+ // 浏览器关闭事件
713
+ this.stateService.state = 'closing_window';
714
+ if (!this.config.isElectronRenderer) {
715
+ this.disposeSideEffect();
716
+ this.stopContributions();
717
+ }
718
+ };
719
+
720
+ private _handleResize = () => {
721
+ // 浏览器resize事件
722
+ };
723
+
724
+ private _handleKeydown = (event: any) => {
725
+ if (event && event.target!.name !== NO_KEYBINDING_NAME && !this._inComposition) {
726
+ this.keybindingService.run(event);
727
+ }
728
+ };
729
+
730
+ private _handleKeyup = (event: any) => {
731
+ this.keybindingService.resolveModifierKey(event);
732
+ };
733
+
734
+ private _handleCompositionstart = () => {
735
+ this._inComposition = true;
736
+ };
737
+
738
+ private _handleCompositionend = () => {
739
+ this._inComposition = false;
740
+ };
741
+
742
+ private _handleWheel = () => {
743
+ // 屏蔽在OSX系统浏览器中由于滚动导致的前进后退事件
744
+ };
745
+ }