Skip to content

Commit b076caf

Browse files
authored
Merge pull request #9 from CodinGame/fix-keybinding-service-now-singleton
Fix keybinding service usage which is now a singleton
2 parents a6ff897 + 86cb348 commit b076caf

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

package-lock.json

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codingame/monaco-editor-react",
3-
"version": "1.4.0",
3+
"version": "1.5.0",
44
"description": "Monaco Editor React component",
55
"scripts": {
66
"build": "tsc",
@@ -19,7 +19,7 @@
1919
],
2020
"types": "dist/index.d.ts",
2121
"dependencies": {
22-
"@codingame/monaco-editor-wrapper": "^1.5.0",
22+
"@codingame/monaco-editor-wrapper": "^1.6.0",
2323
"deep-equal": "^2.0.5",
2424
"lodash.debounce": "^4.0.8"
2525
},

src/MonacoEditor.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { ForwardedRef, forwardRef, ReactElement, useEffect, useMemo, useRef, useState } from 'react'
22
import debounce from 'lodash.debounce'
3-
import { monaco, createEditor, getMonacoLanguage, updateEditorKeybindings, registerEditorOpenHandler } from '@codingame/monaco-editor-wrapper'
3+
import { monaco, createEditor, getMonacoLanguage, updateEditorKeybindingsMode, registerEditorOpenHandler } from '@codingame/monaco-editor-wrapper'
44
import { useDeepMemo, useLastValueRef, useLastVersion, useThemeData, useUserConfiguration } from './hooks'
55
import './style'
66

@@ -75,7 +75,6 @@ export interface MonacoEditorProps {
7575
onChange?: (value: string, event: monaco.editor.IModelContentChangedEvent) => void
7676
markers?: monaco.editor.IMarkerData[]
7777
keyBindingsMode?: KeyBindingsMode
78-
keyBindings?: monaco.extra.IUserFriendlyKeybinding[]
7978
/**
8079
* Called when the editor will switch to another model
8180
*
@@ -107,7 +106,6 @@ function MonacoEditor ({
107106
options,
108107
overrideServices,
109108
onChange,
110-
keyBindings,
111109
keyBindingsMode = 'classic',
112110
markers,
113111
saveViewState = defaultSaveViewState,
@@ -247,14 +245,14 @@ function MonacoEditor ({
247245
editorRef.current!.updateOptions(allOptions)
248246
}, [allOptions])
249247

250-
// Keybindings
248+
// Keybindings mode
251249
useEffect(() => {
252250
const editor = editorRef.current!
253-
const disposable = updateEditorKeybindings(editor, keyBindingsMode, statusBarRef.current!, keyBindings)
251+
const disposable = updateEditorKeybindingsMode(editor, keyBindingsMode, statusBarRef.current!)
254252
return () => {
255253
disposable.dispose()
256254
}
257-
}, [keyBindings, keyBindingsMode])
255+
}, [keyBindingsMode])
258256

259257
// Update markers
260258
useEffect(() => {

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import { monaco } from '@codingame/monaco-editor-wrapper'
1+
import { monaco, updateKeybindings, updateUserConfiguration } from '@codingame/monaco-editor-wrapper'
22
import { useThemeData, useUserConfiguration } from './hooks'
33
import MonacoEditor, { MonacoEditorProps } from './MonacoEditor'
44

55
export default MonacoEditor
66
export {
77
monaco,
88
useThemeData,
9-
useUserConfiguration
9+
useUserConfiguration,
10+
updateKeybindings,
11+
updateUserConfiguration
1012
}
1113
export type {
1214
MonacoEditorProps

0 commit comments

Comments
 (0)