Skip to content

Commit

Permalink
fix(monaco): Do not use CDN version of monaco-editor (fixes #1186) (#…
Browse files Browse the repository at this point in the history
…1187)

(cherry picked from commit f0805fa)
  • Loading branch information
grgrzybek committed Oct 25, 2024
1 parent 190ba0a commit 8022fdf
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"css-loader": "^7.1.2",
"html-webpack-plugin": "^5.6.0",
"jest": "^29.7.0",
"monaco-editor": "^0.52.0",
"monaco-editor-webpack-plugin": "^7.1.0",
"style-loader": "^4.0.0",
"swc-loader": "^0.2.6",
Expand Down
2 changes: 2 additions & 0 deletions packages/hawtio/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const config: Config = {
'\\.(css|less)$': '<rootDir>/src/__mocks__/styleMock.js',
'@hawtiosrc/(.*)': '<rootDir>/src/$1',
'react-markdown': '<rootDir>/../../node_modules/react-markdown/react-markdown.min.js',
'monaco-editor': path.resolve(__dirname, './src/__mocks__/monacoEditor.js'),
'@monaco-editor/react': path.resolve(__dirname, './src/__mocks__/monacoEditor.js'),
'@patternfly/react-code-editor': path.resolve(__dirname, './src/__mocks__/codeEditorMock.js'),
oauth4webapi: path.resolve(__dirname, './src/__mocks__/oauth4webapi.js'),
},
Expand Down
1 change: 1 addition & 0 deletions packages/hawtio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"@hawtio/camel-model-v4_8": "npm:@hawtio/camel-model@~4.8.0",
"@jolokia.js/simple": "^2.1.7",
"@module-federation/utilities": "^3.1.16",
"@monaco-editor/react": "^4.6.0",
"@patternfly/react-charts": "~7.3.0",
"@patternfly/react-code-editor": "~5.3.3",
"@patternfly/react-core": "~5.3.3",
Expand Down
5 changes: 5 additions & 0 deletions packages/hawtio/src/__mocks__/monacoEditor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
loader: {
config: _config => {},
},
}
4 changes: 4 additions & 0 deletions packages/hawtio/src/plugins/camel/endpoints/SendMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ import { doSendMessage } from './endpoints-service'
// TODO: Parameterise the version of Camel mode for the exchange headers
import { headers as exchangeHeaders } from './exchange-headers-camel-model.json'

import { loader } from '@monaco-editor/react'

loader.config({ monaco: monacoEditor })

export const SendMessage: React.FunctionComponent = () => {
const { selectedNode } = useContext(CamelContext)
const messageHeaders = useRef<{ name: string; value: string }[]>([])
Expand Down
5 changes: 5 additions & 0 deletions packages/hawtio/src/plugins/camel/routes/Source.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { routesService } from './routes-service'
import { eventService } from '@hawtiosrc/core'
import { Alert, AlertActionCloseButton, AlertVariant } from '@patternfly/react-core'

import * as monaco from 'monaco-editor'
import { loader } from '@monaco-editor/react'

loader.config({ monaco })

export const Source: React.FunctionComponent = () => {
const { selectedNode } = useContext(CamelContext)
const [xmlSource, setXmlSource] = useState('')
Expand Down
2 changes: 2 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2021,6 +2021,7 @@ __metadata:
"@hawtio/camel-model-v4_8": "npm:@hawtio/camel-model@~4.8.0"
"@jolokia.js/simple": "npm:^2.1.7"
"@module-federation/utilities": "npm:^3.1.16"
"@monaco-editor/react": "npm:^4.6.0"
"@patternfly/react-charts": "npm:~7.3.0"
"@patternfly/react-code-editor": "npm:~5.3.3"
"@patternfly/react-core": "npm:~5.3.3"
Expand Down Expand Up @@ -4726,6 +4727,7 @@ __metadata:
css-loader: "npm:^7.1.2"
html-webpack-plugin: "npm:^5.6.0"
jest: "npm:^29.7.0"
monaco-editor: "npm:^0.52.0"
monaco-editor-webpack-plugin: "npm:^7.1.0"
react: "npm:^18.3.1"
react-dom: "npm:^18.3.1"
Expand Down

0 comments on commit 8022fdf

Please sign in to comment.