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.
Hydro/ui/components/cmeditor/cmeditor.page.js

24 lines
619 B
JavaScript

import { AutoloadPage } from 'vj/misc/PageLoader';
import delay from 'vj/utils/delay';
import CmEditor from '.';
import 'vj-simplemde/src/css/simplemde.css';
import './cmeditor.styl';
function runSubstitute($container) {
const selector = ['textarea[data-markdown]'];
$container.find(selector.join(', ')).get().forEach((element) => {
CmEditor.getOrConstruct($(element));
});
}
const cmEditorPage = new AutoloadPage('cmEditorPage', () => {
runSubstitute($('body'));
$(document).on('vjContentNew', async (e) => {
await delay(0);
runSubstitute($(e.target));
});
});
export default cmEditorPage;