feat$(abcjs): pass plugin a callback, render notesheet once DOM loaded

This commit is contained in:
Felix Wu 2018-08-01 22:31:56 +02:00
parent 7488856489
commit cda25587d1

View File

@ -1,13 +1,23 @@
// import abcjs from 'abcjs';
import abcjs from 'abcjs';
import markdownItNotesSheet from './libs/markdownItNotesSheet';
import extensionSvc from '../services/extensionSvc';
let abc;
extensionSvc.onGetOptions((options, properties) => {
options.abc = properties.extensions.abc.enabled;
});
extensionSvc.onInitConverter(2, (markdown, options) => {
if (options.abc) {
markdown.use(markdownItNotesSheet);
markdown.use(markdownItNotesSheet, (val) => {
abc = val;
});
}
});
extensionSvc.onSectionPreview(() => {
if (document.querySelector('#abcSheetPaper') != null && abc != null) {
abcjs.renderAbc('abcSheetPaper', abc, {});
}
});