1
EpicEditor 미리보기 iFrame에 스크립트 (예 : MathJax)를로드 할 수 있습니까? 내 미리보기를 올바른 Markdown으로 설정하고 자바 스크립트를 실행하여 MathJax 콘텐츠를 미리 보도록하고 싶습니다.Epiceditor with MathJax
감사합니다.
EpicEditor 미리보기 iFrame에 스크립트 (예 : MathJax)를로드 할 수 있습니까? 내 미리보기를 올바른 Markdown으로 설정하고 자바 스크립트를 실행하여 MathJax 콘텐츠를 미리 보도록하고 싶습니다.Epiceditor with MathJax
감사합니다.
미리보기 iframe에 수동으로 MathJax 스크립트를 삽입해야하는 것 같습니다. 이런 식으로 뭔가 :
var editor = new EpicEditor(opts).load();
previewer = editor.getElement('previewer');
var mathjax = previewer.createElement('script');
mathjax.type = 'text/javascript';
mathjax.src = 'http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
previewer.body.appendChild(mathjax);
var config = previewer.createElement('script');
config.type = 'text/x-mathjax-config';
config.text = "MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$']], displayMath: [['$$','$$']], processEscapes: true}});";
previewer.body.appendChild(config);
그리고 당신이 미리보기 이벤트에 대한 방정식을 렌더링 할 수 있습니다 또한 전체 화면 라이브 편집 모드에서 작동
editor.on('preview', function() {
editor.getElement('previewerIframe').contentWindow.eval(
'MathJax.Hub.Queue(["Typeset",MathJax.Hub]);');
});
.
이 방법을 사용하면 콘텐츠의 높이가 변경된 후 미리보기 iframe의 크기를 조정할 수있는 메커니즘이 있습니까? 리플 로우 메서드는 컨테이너를 기반으로 iframe의 크기를 조정합니다. 이는 좋지 않습니다. – jake
미래의 메모 : cdn.mathjax.org의 수명이 다해 가고 있습니다. https://www.mathjax.org/cdn-shutting-down에서 마이그레이션 팁을 확인하십시오 (향후 독자를 위해 게시물을 업데이트 할 수 있습니다). –