require('codemirror/addon/fold/foldcode');
require('codemirror/addon/fold/foldgutter');
var cm = inkdrop.getActiveEditor().codeMirror;
cm.setOption('foldGutter', true);
cm.setOption('gutters', ['CodeMirror-foldgutter']);
Did you load the CSS file?
You may have other problem because I checked that it works as expected on the current version.
I didn’t change anything regarding the editor in the last release, so it should work.
Please describe me what’s going wrong such as errors you’ve got in detail as possible so that I can help you.
Okay, below code won’t work because unfortunately plugins can’t access to the app’s node_modules folder.
import foldCode from 'codemirror/addon/fold/foldcode'
import foldGutter from 'codemirror/addon/fold/foldgutter'
import foldMd from 'codemirror/addon/fold/markdown-fold.js'
So you have to include these files in your plugins.
Hope that helps.
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: