更新
This commit is contained in:
parent
588c74aa88
commit
70eaaedacd
@ -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') ?>">
|
||||
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=20210529') ?>">
|
||||
<script>
|
||||
window.JoeConfig = {
|
||||
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
|
||||
@ -185,11 +185,10 @@ class Editor
|
||||
canPreview: false
|
||||
}
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
|
||||
<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=20210524') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=20210529') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js') ?>"></script>
|
||||
<?php
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* 获取主题当前版本号 */
|
||||
function _getVersion()
|
||||
{
|
||||
return "7.1.5";
|
||||
return "7.1.6";
|
||||
};
|
||||
|
||||
/* 判断是否是手机 */
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "typecho-joe-next",
|
||||
"version": "7.1.5",
|
||||
"version": "7.1.6",
|
||||
"description": "A Theme Of Typecho",
|
||||
"main": "index.php",
|
||||
"keywords": [
|
||||
|
2
typecho/write/css/joe.write.min.css
vendored
2
typecho/write/css/joe.write.min.css
vendored
File diff suppressed because one or more lines are too long
@ -161,6 +161,10 @@ body.fullscreen {
|
||||
border: 1px solid rgba(255, 255, 255, 0.25);
|
||||
margin: -1px;
|
||||
}
|
||||
.cm-activeLine {
|
||||
background-color: #292929;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.cmt-strong {
|
||||
color: #61afef;
|
||||
font-weight: 500;
|
||||
|
@ -1,19 +1,6 @@
|
||||
const parser = new HyperDown();
|
||||
const player = window.JoeConfig.playerAPI;
|
||||
|
||||
function throttle(fn, wait) {
|
||||
var pre = Date.now();
|
||||
return function () {
|
||||
var context = this;
|
||||
var args = arguments;
|
||||
var now = Date.now();
|
||||
if (now - pre >= wait) {
|
||||
fn.apply(context, args);
|
||||
pre = Date.now();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default function createPreviewHtml(str) {
|
||||
if (!window.JoeConfig.canPreview) return $('.cm-preview-content').html('1. 预览已默认关闭<br>2. 点击上方预览按钮启用预览<br>3. 若编辑器卡顿可尝试关闭预览');
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
import { EditorView, keymap } from '@codemirror/view';
|
||||
import { EditorView, keymap, highlightActiveLine } from '@codemirror/view';
|
||||
import { EditorState } from '@codemirror/state';
|
||||
import { bracketMatching } from '@codemirror/matchbrackets';
|
||||
import { closeBrackets, closeBracketsKeymap } from '@codemirror/closebrackets';
|
||||
@ -13,7 +13,7 @@ import createPreviewHtml from './_create';
|
||||
class Joe extends JoeAction {
|
||||
constructor() {
|
||||
super();
|
||||
this.plugins = [history(), classHighlightStyle, bracketMatching(), closeBrackets()];
|
||||
this.plugins = [classHighlightStyle, history(), bracketMatching(), closeBrackets(), highlightActiveLine()];
|
||||
this._isPasting = false;
|
||||
this.init_ViewPort();
|
||||
this.init_Editor();
|
||||
@ -372,25 +372,34 @@ class Joe extends JoeAction {
|
||||
init_AutoSave() {
|
||||
if (window.JoeConfig.autoSave !== 1) return;
|
||||
const formEl = $('#text')[0].form;
|
||||
let cid = $('input[name="cid"]').val();
|
||||
let temp = null;
|
||||
let cid = $(formEl).find('input[name="cid"]').val();
|
||||
/* 临时记录 */
|
||||
let _TempTimer = null;
|
||||
let _TempTitle = $(formEl).find('input[name="title"]').val();
|
||||
let _TempText = $(formEl).find('textarea[name="text"]').val();
|
||||
const saveFn = () => {
|
||||
$('input[name="cid"]').val(cid);
|
||||
$('#text').val(this.cm.state.doc.toString());
|
||||
let data = $(formEl).serialize();
|
||||
if (data !== temp) {
|
||||
$(formEl).find('input[name="cid"]').val(cid);
|
||||
$(formEl).find('textarea[name="text"]').val(this.cm.state.doc.toString());
|
||||
/* 创建新记录 */
|
||||
let _NewTempTitle = $(formEl).find('input[name="title"]').val();
|
||||
let _NewTempText = $(formEl).find('textarea[name="text"]').val();
|
||||
/* 若标题为空,则直接忽略 */
|
||||
if (_NewTempTitle.trim() === '') return;
|
||||
/* 若标题或内容发生改变,触发保存草稿 */
|
||||
if (_TempTitle !== _NewTempTitle || _TempText !== _NewTempText) {
|
||||
_TempTitle = _NewTempTitle;
|
||||
_TempText = _NewTempText;
|
||||
$('.cm-autosave').addClass('active');
|
||||
$.ajax({
|
||||
url: formEl.action,
|
||||
type: 'POST',
|
||||
data: data + '&do=save',
|
||||
data: $(formEl).serialize() + '&do=save',
|
||||
dataType: 'json',
|
||||
success: res => {
|
||||
cid = res.cid;
|
||||
temp = data;
|
||||
let timer = setTimeout(() => {
|
||||
_TempTimer = setTimeout(() => {
|
||||
$('.cm-autosave').removeClass('active');
|
||||
clearTimeout(timer);
|
||||
clearTimeout(_TempTimer);
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
@ -10,7 +10,7 @@
|
||||
"@codemirror/lang-markdown": "^0.18.3",
|
||||
"@codemirror/matchbrackets": "^0.18.0",
|
||||
"@codemirror/state": "^0.18.7",
|
||||
"@codemirror/view": "^0.18.13",
|
||||
"@codemirror/view": "^0.18.14",
|
||||
"@rollup/plugin-node-resolve": "^13.0.0",
|
||||
"rollup-plugin-uglify": "^6.0.4"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user