mirror of
https://dl.bcrjl.com/ghg/HaoOuBa/Joe.git
synced 2026-02-17 13:10:05 +08:00
更新
This commit is contained in:
@@ -99,8 +99,7 @@ export default function createPreviewHtml(str) {
|
||||
if (str.indexOf('{gird') !== -1) {
|
||||
str = str.replace(/{gird([^}]*)}([\s\S]*?){\/gird}/g, '<section style="margin-bottom: 15px"><joe-gird $1><span class="_temp" style="display: none">$2</span></joe-gird></section>');
|
||||
}
|
||||
|
||||
$('.cm-preview-content').html(str);
|
||||
$('.cm-preview-content p:empty').remove();
|
||||
$('.cm-preview-content pre code').each((i, el) => Prism.highlightElement(el));
|
||||
Prism.highlightAll();
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -43,8 +43,9 @@ class Joe extends JoeAction {
|
||||
<div class="cm-progress-right"></div>
|
||||
</div>
|
||||
`);
|
||||
createPreviewHtml($('#text').val());
|
||||
createPreviewHtml(null);
|
||||
let _temp = null;
|
||||
let _debounce = null;
|
||||
const cm = new EditorView({
|
||||
state: EditorState.create({
|
||||
doc: $('#text').val(),
|
||||
@@ -58,8 +59,8 @@ class Joe extends JoeAction {
|
||||
if (!update.docChanged) return;
|
||||
if (_temp !== update.state.doc.toString()) {
|
||||
_temp = update.state.doc.toString();
|
||||
if (window.requestAnimationFrame) window.requestAnimationFrame(() => createPreviewHtml(update.state.doc.toString()));
|
||||
else createPreviewHtml(update.state.doc.toString());
|
||||
clearTimeout(_debounce);
|
||||
_debounce = setTimeout(createPreviewHtml.bind(null, update.state.doc.toString()), 150);
|
||||
}
|
||||
}),
|
||||
EditorView.domEventHandlers({
|
||||
|
||||
Reference in New Issue
Block a user