add async workaround for slow load of ipythongfm definition

if ipythongfm is defined after notebook is loaded, re-load it in all cells that are using it.
pull/1757/head
Min RK 10 years ago
parent d52e1e2419
commit f1fc424b19

@ -55,5 +55,16 @@
}, 'gfm');
CodeMirror.defineMIME("text/x-ipythongfm", "ipythongfm");
// async workaround:
// Cells may be loaded before this mode is defined.
// If that happens, trigger re-load of the mode:
if (Jupyter && Jupyter.notebook) {
Jupyter.notebook.get_cells().map(function (cell) {
if (cell.code_mirror && cell.code_mirror.getOption('mode') === 'ipythongfm') {
cell.code_mirror.setOption('mode', 'ipythongfm');
}
});
}
});
})
});

Loading…
Cancel
Save