This commit is contained in:
杜恒 2021-05-31 10:30:10 +08:00
parent cbecb2a699
commit 31e15ebf06
6 changed files with 11 additions and 11 deletions

View File

@ -172,7 +172,7 @@ class Editor
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=202105291700') ?>">
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css') ?>">
<script>
window.JoeConfig = {
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
@ -188,7 +188,7 @@ class Editor
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=202105291700') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=20210531') ?>"></script>
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js') ?>"></script>
<?php
}

View File

@ -2,7 +2,7 @@
/* 获取主题当前版本号 */
function _getVersion()
{
return "7.1.7";
return "7.1.8";
};
/* 判断是否是手机 */

View File

@ -1,6 +1,6 @@
{
"name": "typecho-joe-next",
"version": "7.1.7",
"version": "7.1.8",
"description": "A Theme Of Typecho",
"main": "index.php",
"keywords": [

View File

@ -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

View File

@ -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({