mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
21 lines
541 B
JavaScript
21 lines
541 B
JavaScript
import { AutoloadPage } from 'vj/misc/Page';
|
|
import delay from 'vj/utils/delay';
|
|
import CmEditor from '.';
|
|
|
|
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;
|