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: