mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Sandbox: Make window.monaco
and window.Prism
available for plugins inside the sandbox (#74977)
* Sandbox: Make `window.monaco` available for plugins inside the sandbox * Add Prism as an endowment * Fix typo
This commit is contained in:
parent
dfd6134ff1
commit
c7b6ac065a
@ -80,6 +80,15 @@ async function doImportPluginModuleInSandbox(meta: PluginMeta): Promise<System.M
|
||||
// window.locationSandbox. In the future `window.location` could be a proxy if we
|
||||
// want to intercept calls to it.
|
||||
locationSandbox: window.location,
|
||||
get monaco() {
|
||||
// `window.monaco` may be undefined when invoked. However, plugins have long
|
||||
// accessed it directly, aware of this possibility.
|
||||
return Reflect.get(window, 'monaco');
|
||||
},
|
||||
get Prism() {
|
||||
// Similar to `window.monaco`, `window.Prism` may be undefined when invoked.
|
||||
return Reflect.get(window, 'Prism');
|
||||
},
|
||||
// Plugins builds use the AMD module system. Their code consists
|
||||
// of a single function call to `define()` that internally contains all the plugin code.
|
||||
// This is that `define` function the plugin will call.
|
||||
|
Loading…
Reference in New Issue
Block a user