@codingame/monaco-vscode-keybindings-service-override 23.2.1 → 23.3.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.
package/index.d.ts
CHANGED
|
@@ -11,9 +11,16 @@ declare function initUserKeybindings(configurationJson: string, options?: Partia
|
|
|
11
11
|
* Can be called at any time after the services are initialized to update the user configuration
|
|
12
12
|
*/
|
|
13
13
|
declare function updateUserKeybindings(keybindingsJson: string): Promise<void>;
|
|
14
|
-
interface
|
|
14
|
+
export interface LockKeyCodesOverride {
|
|
15
|
+
(keyCodes: string[], next: (keyCodes: string[]) => void): void;
|
|
16
|
+
}
|
|
17
|
+
export interface KeybindingsProps {
|
|
15
18
|
shouldUseGlobalKeybindings?: () => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Allows to override the key code lock (for instance, ['Escape'] during full screen)
|
|
21
|
+
*/
|
|
22
|
+
lockKeyCodesOverride?: LockKeyCodesOverride;
|
|
16
23
|
}
|
|
17
|
-
export default function getServiceOverride({ shouldUseGlobalKeybindings }?: KeybindingsProps): IEditorOverrideServices;
|
|
24
|
+
export default function getServiceOverride({ shouldUseGlobalKeybindings, lockKeyCodesOverride }?: KeybindingsProps): IEditorOverrideServices;
|
|
18
25
|
export { defaultUserKeybindindsFile, initUserKeybindings, updateUserKeybindings };
|
|
19
26
|
export type { IUserFriendlyKeybinding };
|
package/index.js
CHANGED
|
@@ -42,9 +42,10 @@ async function updateUserKeybindings(keybindingsJson) {
|
|
|
42
42
|
await fileService.writeFile(userDataProfilesService.defaultProfile.keybindingsResource, VSBuffer.fromString(keybindingsJson));
|
|
43
43
|
}
|
|
44
44
|
let DynamicWorkbenchKeybindingService = class DynamicWorkbenchKeybindingService extends WorkbenchKeybindingService {
|
|
45
|
-
constructor(shouldUseGlobalKeybindings, contextKeyService, commandService, telemetryService, notificationService, userDataProfileService, hostService, extensionService, fileService, uriIdentityService, logService, keyboardLayoutService) {
|
|
45
|
+
constructor(shouldUseGlobalKeybindings, _lockKeyCodesOverride, contextKeyService, commandService, telemetryService, notificationService, userDataProfileService, hostService, extensionService, fileService, uriIdentityService, logService, keyboardLayoutService) {
|
|
46
46
|
super(contextKeyService, commandService, telemetryService, notificationService, userDataProfileService, hostService, extensionService, fileService, uriIdentityService, logService, keyboardLayoutService);
|
|
47
47
|
this.shouldUseGlobalKeybindings = shouldUseGlobalKeybindings;
|
|
48
|
+
this._lockKeyCodesOverride = _lockKeyCodesOverride;
|
|
48
49
|
this.keybindingProviders = [];
|
|
49
50
|
this.authorizedContainers = [];
|
|
50
51
|
}
|
|
@@ -89,24 +90,29 @@ let DynamicWorkbenchKeybindingService = class DynamicWorkbenchKeybindingService
|
|
|
89
90
|
...this.keybindingProviders.flatMap((provider) => provider.provideKeybindings())
|
|
90
91
|
];
|
|
91
92
|
}
|
|
93
|
+
lockKeyCodes(keyCodes) {
|
|
94
|
+
this._lockKeyCodesOverride(keyCodes, (keyCodes) => super.lockKeyCodes(keyCodes));
|
|
95
|
+
}
|
|
92
96
|
};
|
|
93
97
|
DynamicWorkbenchKeybindingService = __decorate([
|
|
94
|
-
__param(
|
|
95
|
-
__param(
|
|
96
|
-
__param(
|
|
97
|
-
__param(
|
|
98
|
-
__param(
|
|
99
|
-
__param(
|
|
100
|
-
__param(
|
|
101
|
-
__param(
|
|
102
|
-
__param(
|
|
103
|
-
__param(
|
|
104
|
-
__param(
|
|
98
|
+
__param(2, IContextKeyService),
|
|
99
|
+
__param(3, ICommandService),
|
|
100
|
+
__param(4, ITelemetryService),
|
|
101
|
+
__param(5, INotificationService),
|
|
102
|
+
__param(6, IUserDataProfileService),
|
|
103
|
+
__param(7, IHostService),
|
|
104
|
+
__param(8, IExtensionService),
|
|
105
|
+
__param(9, IFileService),
|
|
106
|
+
__param(10, IUriIdentityService),
|
|
107
|
+
__param(11, ILogService),
|
|
108
|
+
__param(12, IKeyboardLayoutService)
|
|
105
109
|
], DynamicWorkbenchKeybindingService);
|
|
106
|
-
function getServiceOverride({ shouldUseGlobalKeybindings = () => false
|
|
110
|
+
function getServiceOverride({ shouldUseGlobalKeybindings = () => false, lockKeyCodesOverride = (keyCodes, next) => {
|
|
111
|
+
next(keyCodes);
|
|
112
|
+
} } = {}) {
|
|
107
113
|
return {
|
|
108
114
|
...getServiceOverride$1(),
|
|
109
|
-
[IKeybindingService.toString()]: new SyncDescriptor(DynamicWorkbenchKeybindingService, [shouldUseGlobalKeybindings], false),
|
|
115
|
+
[IKeybindingService.toString()]: new SyncDescriptor(DynamicWorkbenchKeybindingService, [shouldUseGlobalKeybindings, lockKeyCodesOverride], false),
|
|
110
116
|
[IKeyboardLayoutService.toString()]: new SyncDescriptor(BrowserKeyboardLayoutService, [], true),
|
|
111
117
|
[ICommandService.toString()]: new SyncDescriptor(CommandService, [], true)
|
|
112
118
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-keybindings-service-override",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor - keybindings service-override",
|
|
6
6
|
"keywords": [],
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"type": "module",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@codingame/monaco-vscode-2808e692-5fb9-54bf-bc21-1d3bff81e651-common": "23.
|
|
19
|
-
"@codingame/monaco-vscode-2a22c7b4-b906-5914-8cd1-3ed912fb738f-common": "23.
|
|
20
|
-
"@codingame/monaco-vscode-40cada32-7e9c-528a-81fc-766e4da54147-common": "23.
|
|
21
|
-
"@codingame/monaco-vscode-a3eaa464-944c-5b8f-8886-213068ba4897-common": "23.
|
|
22
|
-
"@codingame/monaco-vscode-api": "23.
|
|
23
|
-
"@codingame/monaco-vscode-d609a7d3-bf87-551a-884f-550a8b327ec5-common": "23.
|
|
24
|
-
"@codingame/monaco-vscode-files-service-override": "23.
|
|
18
|
+
"@codingame/monaco-vscode-2808e692-5fb9-54bf-bc21-1d3bff81e651-common": "23.3.0",
|
|
19
|
+
"@codingame/monaco-vscode-2a22c7b4-b906-5914-8cd1-3ed912fb738f-common": "23.3.0",
|
|
20
|
+
"@codingame/monaco-vscode-40cada32-7e9c-528a-81fc-766e4da54147-common": "23.3.0",
|
|
21
|
+
"@codingame/monaco-vscode-a3eaa464-944c-5b8f-8886-213068ba4897-common": "23.3.0",
|
|
22
|
+
"@codingame/monaco-vscode-api": "23.3.0",
|
|
23
|
+
"@codingame/monaco-vscode-d609a7d3-bf87-551a-884f-550a8b327ec5-common": "23.3.0",
|
|
24
|
+
"@codingame/monaco-vscode-files-service-override": "23.3.0"
|
|
25
25
|
},
|
|
26
26
|
"main": "index.js",
|
|
27
27
|
"module": "index.js",
|
|
@@ -26,6 +26,7 @@ export declare class WorkbenchKeybindingService extends AbstractKeybindingServic
|
|
|
26
26
|
private readonly _contributions;
|
|
27
27
|
private readonly kbsJsonSchema;
|
|
28
28
|
constructor(contextKeyService: IContextKeyService, commandService: ICommandService, telemetryService: ITelemetryService, notificationService: INotificationService, userDataProfileService: IUserDataProfileService, hostService: IHostService, extensionService: IExtensionService, fileService: IFileService, uriIdentityService: IUriIdentityService, logService: ILogService, keyboardLayoutService: IKeyboardLayoutService);
|
|
29
|
+
protected lockKeyCodes(keyCodes: string[]): void;
|
|
29
30
|
dispose(): void;
|
|
30
31
|
private _registerKeyListeners;
|
|
31
32
|
registerSchemaContribution(contribution: KeybindingsSchemaContribution): IDisposable;
|
|
@@ -207,20 +207,23 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
207
207
|
if (windowId !== mainWindow.vscodeWindowId) {
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
|
-
const keyboard = navigator.keyboard;
|
|
211
210
|
if (BrowserFeatures.keyboard === KeyboardSupport.None) {
|
|
212
211
|
return;
|
|
213
212
|
}
|
|
214
|
-
|
|
215
|
-
keyboard?.lock(['Escape']);
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
keyboard?.unlock();
|
|
219
|
-
}
|
|
213
|
+
this.lockKeyCodes(isFullscreen(mainWindow) ? ['Escape'] : []);
|
|
220
214
|
this._cachedResolver = null;
|
|
221
215
|
this._onDidUpdateKeybindings.fire();
|
|
222
216
|
}));
|
|
223
217
|
}
|
|
218
|
+
lockKeyCodes(keyCodes) {
|
|
219
|
+
const keyboard = mainWindow.navigator.keyboard;
|
|
220
|
+
if (keyCodes.length > 0) {
|
|
221
|
+
keyboard?.lock(keyCodes);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
keyboard?.unlock();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
224
227
|
dispose() {
|
|
225
228
|
this._contributions.forEach(c => c.listener?.dispose());
|
|
226
229
|
this._contributions.length = 0;
|