diff --git a/src/renderer/src/index.ts b/src/renderer/src/index.ts index 40af47b..44fba52 100644 --- a/src/renderer/src/index.ts +++ b/src/renderer/src/index.ts @@ -2,6 +2,8 @@ import 'swagger-editor-dist/swagger-editor.css' import SwaggerEditorBundle from "swagger-editor-dist/swagger-editor-bundle.js"; import SwaggerEditorStandalonePreset from "swagger-editor-dist/swagger-editor-standalone-preset.js"; +import electronMenus from './plugins/electron-menus' + window.onload = function() { // Build a system\ const editor = window.SwaggerEditorBundle({ @@ -9,6 +11,9 @@ window.onload = function() { layout: 'StandaloneLayout', presets: [ window.SwaggerEditorStandalonePreset + ], + plugins: [ + electronMenus ] }); diff --git a/src/renderer/src/plugins/electron-menus.ts b/src/renderer/src/plugins/electron-menus.ts new file mode 100644 index 0000000..688d67b --- /dev/null +++ b/src/renderer/src/plugins/electron-menus.ts @@ -0,0 +1,20 @@ +class ElectronMenus { + system = undefined; + + constructor() { + window.electron.ipcRenderer.on("update-spec", this.updateSpec); + } + + updateSpec = (_event, spec) => { + this.system.specActions.updateSpec(spec); + } + + setupPlugin = (system) => { + this.system = system; + return {} + } +}; + +const electronMenus = new ElectronMenus() + +export default electronMenus.setupPlugin