You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
691 B
JavaScript
19 lines
691 B
JavaScript
import { AutoloadPage } from 'vj/misc/Page';
|
|
import load from 'vj/components/wastyle/index';
|
|
import Notification from 'vj/components/notification/index';
|
|
|
|
const highlighterPage = new AutoloadPage('highlighterPage', async () => {
|
|
const [{ default: prismjs }, [success, format]] = await Promise.all([
|
|
import('./prismjs'),
|
|
UserContext.formatCode ? load() : [true, null],
|
|
]);
|
|
if (!success) Notification.error(`Astyle load fail: ${format}`);
|
|
function runHighlight($container) {
|
|
prismjs.highlightBlocks($container, success ? format : null);
|
|
}
|
|
runHighlight($('body'));
|
|
$(document).on('vjContentNew', (e) => runHighlight($(e.target)));
|
|
});
|
|
|
|
export default highlighterPage;
|