Fix Electron plotting: expose Plotly as a global
Electron wraps every renderer <script> in its own CommonJS module scope,
so const Plotly = require('plotly.js-dist') stayed module-local and the
bare Plotly references in myplots.js (Plot_xy) and TrimSPlib.js
(Plotly.purge) threw ReferenceError, breaking both the Plot menu popups
and the in-app Plots tab. Export window.Plotly = Plotly, matching the
window.openElectronAuxiliaryWindow pattern already used in the file.
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
|
||||
// Load required packages
|
||||
const Plotly = require('plotly.js-dist');
|
||||
// Electron wraps every renderer <script> in its own CommonJS module scope, so
|
||||
// the bundled Plotly object must be exported to the global scope explicitly.
|
||||
// myplots.js and TrimSPlib.js call Plotly.plot/relayout/purge as a global on
|
||||
// the main window and inside the Plot-menu popup windows.
|
||||
window.Plotly = Plotly;
|
||||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
const fs = require('fs');
|
||||
const { execSync, execFile } = require('child_process');
|
||||
|
||||
Reference in New Issue
Block a user