fix: can not open external url in editor #143
This commit is contained in:
parent
df71ac7049
commit
29ffd83486
|
@ -3,6 +3,7 @@ import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
|
||||||
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'
|
import jsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker'
|
||||||
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker'
|
import cssWorker from 'monaco-editor/esm/vs/language/css/css.worker?worker'
|
||||||
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'
|
import htmlWorker from 'monaco-editor/esm/vs/language/html/html.worker?worker'
|
||||||
|
import { BrowserOpenURL } from 'wailsjs/runtime/runtime.js'
|
||||||
|
|
||||||
export const setupMonaco = () => {
|
export const setupMonaco = () => {
|
||||||
window.MonacoEnvironment = {
|
window.MonacoEnvironment = {
|
||||||
|
@ -40,4 +41,12 @@ export const setupMonaco = () => {
|
||||||
rules: [],
|
rules: [],
|
||||||
colors: {},
|
colors: {},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// register default link opening behavior
|
||||||
|
monaco.editor.registerLinkOpener({
|
||||||
|
open(resource) {
|
||||||
|
BrowserOpenURL(resource.toString())
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue