I looked into your code.
If you looked into the addons, you find that they require CodeMirror at
<your_plugin>/node_modules/codemirror/lib/codemirror but they get a CodeMirror class object different from Inkdrop’s one because it is a module in a different path.
So the addons are being installed to another CodeMirror.
That’s why it doesn’t work.
A workaround would be to import the modules from the app’s
node_module in order for the addons to use the same CodeMirror class object, like so:
const app = require('electron').remote.app;
const modulePath = app.getAppPath() + '/node_modules/'
require(modulePath + 'codemirror/addon/fold/foldcode.js');
require(modulePath + 'codemirror/addon/fold/foldgutter.js');
require(modulePath + 'codemirror/addon/fold/markdown-fold.js');
And please remove the dependency on ‘codemirror’ from your
I confirmed it works.
Hope that helps!