This commit is contained in:
haoouba 2021-03-28 15:40:48 +08:00
parent d02cfcd81d
commit bd2e97857b
14 changed files with 1489 additions and 53 deletions

View File

@ -41,7 +41,8 @@ class Editor
public static function Edit() public static function Edit()
{ {
?> ?>
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=6.1.4') ?>"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=6.1.6') ?>">
<script> <script>
window.JoeConfig = { window.JoeConfig = {
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>', uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
@ -49,8 +50,9 @@ class Editor
characterAPI: '<?php Helper::options()->themeUrl('typecho/write/json/character.json') ?>', characterAPI: '<?php Helper::options()->themeUrl('typecho/write/json/character.json') ?>',
} }
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/hyperdown@2.4.10/Parser.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/prism/prism.js"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=6.1.4') ?>"></script> <script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=6.1.6') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=6.1.6') ?>"></script>
<?php <?php
} }
} }

View File

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

View File

@ -15,7 +15,7 @@
<head> <head>
<?php $this->need('public/include.php'); ?> <?php $this->need('public/include.php'); ?>
<!-- 友联页面需要用到的CSS及JS --> <!-- 友联页面需要用到的CSS及JS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/prism/prism.js"></script> <script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/prism/prism.js"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.post&page.min.js'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.post&page.min.js'); ?>"></script>

View File

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

View File

@ -4,7 +4,7 @@
<head> <head>
<?php $this->need('public/include.php'); ?> <?php $this->need('public/include.php'); ?>
<!-- 独立页面需要用到CSS及JS --> <!-- 独立页面需要用到CSS及JS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/prism/prism.js"></script> <script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/prism/prism.js"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.post&page.min.js'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.post&page.min.js'); ?>"></script>

View File

@ -3,7 +3,7 @@
<head> <head>
<?php $this->need('public/include.php'); ?> <?php $this->need('public/include.php'); ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/prism/prism.js"></script> <script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/prism/prism.js"></script>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.post.min.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.post.min.css'); ?>">

File diff suppressed because one or more lines are too long

View File

@ -203,11 +203,6 @@ body.fullscreen {
color: #606266; color: #606266;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
h1, h1,
h2, h2,
h3, h3,
@ -217,6 +212,7 @@ body.fullscreen {
color: #303133; color: #303133;
font-size: 18px; font-size: 18px;
line-height: 24px; line-height: 24px;
margin: 0;
margin-bottom: 15px; margin-bottom: 15px;
position: relative; position: relative;
} }
@ -299,6 +295,7 @@ body.fullscreen {
} }
} }
hr { hr {
margin: 0;
border: none; border: none;
height: 1px; height: 1px;
background-color: #e4e7ed; background-color: #e4e7ed;
@ -306,9 +303,11 @@ body.fullscreen {
} }
p { p {
line-height: 26px; line-height: 26px;
margin: 0;
margin-bottom: 15px; margin-bottom: 15px;
} }
blockquote { blockquote {
margin: 0;
line-height: 26px; line-height: 26px;
margin-bottom: 15px; margin-bottom: 15px;
background: #ecf8ff; background: #ecf8ff;
@ -320,7 +319,22 @@ body.fullscreen {
margin: 0; margin: 0;
} }
} }
code { pre {
margin: 0;
margin-bottom: 15px;
&::-webkit-scrollbar-track {
background: #fff;
}
&::-webkit-scrollbar {
width: 6px;
height: 6px;
}
&::-webkit-scrollbar-thumb {
border-radius: 3px;
background: #c0c4cc;
}
}
p code {
display: inline-block; display: inline-block;
min-height: 26px; min-height: 26px;
line-height: 26px; line-height: 26px;
@ -331,24 +345,9 @@ body.fullscreen {
color: #e6a23c; color: #e6a23c;
vertical-align: top; vertical-align: top;
} }
pre {
background: #f0f0ec;
padding: 15px;
margin-bottom: 15px;
}
pre code {
display: unset;
vertical-align: unset;
min-height: unset;
line-height: unset;
border-radius: unset;
font-size: unset;
background: unset;
padding: unset;
color: unset;
}
ol, ol,
ul { ul {
margin: 0;
margin-bottom: 15px; margin-bottom: 15px;
padding-left: 36px; padding-left: 36px;
li { li {
@ -392,17 +391,13 @@ body.fullscreen {
} }
} }
} }
img:not(.owo_image) { img {
display: block; display: block;
max-width: 100%; max-width: 100%;
border-radius: 4px; border-radius: 4px;
transition: transform 0.35s, box-shadow 0.35s; transition: transform 0.35s, box-shadow 0.35s;
margin: 0 auto; margin: 0 auto;
} }
.owo_image {
max-height: 26px;
vertical-align: top;
}
a { a {
display: inline-block; display: inline-block;
line-height: 26px; line-height: 26px;

View File

@ -306,11 +306,49 @@ export default class JoeAction {
innerHtml: ` innerHtml: `
<div class="fitem"> <div class="fitem">
<label>语言类型</label> <label>语言类型</label>
<input autocomplete="off" name="type" placeholder="请输入语言类型(英文)"/> <select name="type">
<option value="">- 请选择语言类型 -</option>
<option value="html">HTML</option>
<option value="php">PHP</option>
<option value="javascript">JavaScript</option>
<option value="typescript">TypeScript</option>
<option value="css">Css</option>
<option value="css-extras">Css-Extras</option>
<option value="sass">Sass</option>
<option value="scss">Scss</option>
<option value="less">Less</option>
<option value="go">GO</option>
<option value="java">Java</option>
<option value="json">Json</option>
<option value="bash">Bash</option>
<option value="git">Git</option>
<option value="markup">Markup</option>
<option value="clike">Clike</option>
<option value="batch">Batch</option>
<option value="c">C</option>
<option value="csharp">Csharp</option>
<option value="cpp">Cpp</option>
<option value="diff">Diff</option>
<option value="docker">Docker</option>
<option value="latex">Latex</option>
<option value="markdown">Markdown</option>
<option value="markup-templating">Markup-Templating</option>
<option value="mongodb">Mongodb</option>
<option value="nginx">Nginx</option>
<option value="objectivec">Objectivec</option>
<option value="powershell">PowerShell</option>
<option value="python">Python</option>
<option value="jsx">Jsx</option>
<option value="ruby">Ruby</option>
<option value="sql">SQL</option>
<option value="stylus">Stylus</option>
<option value="swift">Swift</option>
<option value="velocity">Velocity</option>
</select>
</div> </div>
`, `,
confirm: () => { confirm: () => {
const type = $(".cm-modal input[name='type']").val() || 'html'; const type = $(".cm-modal select[name='type']").val() || 'html';
const htmlStr = `\`\`\`${type}\ncode here...\n\`\`\``; const htmlStr = `\`\`\`${type}\ncode here...\n\`\`\``;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n\n' + htmlStr); if (this._getLineCh(cm)) this._replaceSelection(cm, '\n\n' + htmlStr);
else this._replaceSelection(cm, htmlStr); else this._replaceSelection(cm, htmlStr);

View File

@ -82,7 +82,7 @@ export default [
{ {
type: 'emoji', type: 'emoji',
title: '符号表情', title: '符号表情',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M512 56.889A455.111 455.111 0 0 0 56.889 512 455.111 455.111 0 0 0 512 967.111 455.111 455.111 0 0 0 967.111 512 455.111 455.111 0 0 0 512 56.889zm111.047 270.336A69.086 69.086 0 0 1 671.29 307.2c17.863 0 35.67 7.396 48.242 20.025 12.629 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zm-318.578 0a69.086 69.086 0 0 1 48.242-20.025c17.863 0 35.67 7.396 48.242 20.025 12.63 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zM786.375 566.67c-10.24 132.893-118.556 236.544-270.563 235.975-156.331 1.707-264.704-107.178-270.507-235.975a23.324 23.324 0 0 1-2.446-10.41c0-13.597 11.605-24.633 26.282-24.52h493.796c14.336 0 26.055 11.037 26.055 24.52a24.292 24.292 0 0 1-2.617 10.41z"/></svg>' innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="19" height="19"><path d="M512 56.889A455.111 455.111 0 0 0 56.889 512 455.111 455.111 0 0 0 512 967.111 455.111 455.111 0 0 0 967.111 512 455.111 455.111 0 0 0 512 56.889zm111.047 270.336A69.086 69.086 0 0 1 671.29 307.2c17.863 0 35.67 7.396 48.242 20.025 12.629 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zm-318.578 0a69.086 69.086 0 0 1 48.242-20.025c17.863 0 35.67 7.396 48.242 20.025 12.63 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zM786.375 566.67c-10.24 132.893-118.556 236.544-270.563 235.975-156.331 1.707-264.704-107.178-270.507-235.975a23.324 23.324 0 0 1-2.446-10.41c0-13.597 11.605-24.633 26.282-24.52h493.796c14.336 0 26.055 11.037 26.055 24.52a24.292 24.292 0 0 1-2.617 10.41z"/></svg>'
}, },
{ {
type: 'code-block', type: 'code-block',

File diff suppressed because it is too large Load Diff

1
typecho/write/js/joe.parse.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -22,6 +22,12 @@ class Joe extends JoeAction {
this.init_Insert(); this.init_Insert();
} }
_createPreviewHtml(str) {
str = this.parser.makeHtml(str);
$('.cm-preview-content').html(str);
$('.cm-preview-content pre code').each((i, el) => Prism.highlightElement(el));
}
/* 已测 √ */ /* 已测 √ */
init_ViewPort() { init_ViewPort() {
if ($('meta[name="viewport"]').length > 0) $('meta[name="viewport"]').attr('content', 'width=device-width, user-scalable=no, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover'); if ($('meta[name="viewport"]').length > 0) $('meta[name="viewport"]').attr('content', 'width=device-width, user-scalable=no, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover');
@ -35,14 +41,13 @@ class Joe extends JoeAction {
<div class="cm-tools"></div> <div class="cm-tools"></div>
<div class="cm-mainer"> <div class="cm-mainer">
<div class="cm-resize"></div> <div class="cm-resize"></div>
<div class="cm-preview"> <div class="cm-preview"><div class="cm-preview-content"></div></div>
<div class="cm-preview-content">${this.parser.makeHtml($('#text').val())}</div>
</div>
</div> </div>
<div class="cm-progress-left"></div> <div class="cm-progress-left"></div>
<div class="cm-progress-right"></div> <div class="cm-progress-right"></div>
</div> </div>
`); `);
this._createPreviewHtml($('#text').val());
const cm = new EditorView({ const cm = new EditorView({
state: EditorState.create({ state: EditorState.create({
doc: $('#text').val(), doc: $('#text').val(),
@ -51,7 +56,7 @@ class Joe extends JoeAction {
keymap.of([defaultTabBinding, ...defaultKeymap, ...historyKeymap, ...closeBracketsKeymap]), keymap.of([defaultTabBinding, ...defaultKeymap, ...historyKeymap, ...closeBracketsKeymap]),
EditorView.updateListener.of(update => { EditorView.updateListener.of(update => {
if (!update.docChanged) return; if (!update.docChanged) return;
$('.cm-preview-content').html(this.parser.makeHtml(update.state.doc.toString())); this._createPreviewHtml(update.state.doc.toString());
}), }),
EditorView.domEventHandlers({ EditorView.domEventHandlers({
paste: e => { paste: e => {
@ -240,10 +245,10 @@ class Joe extends JoeAction {
super.handleAbout(); super.handleAbout();
break; break;
case 'character': case 'character':
super._createTableLists(this.cm, JoeConfig.characterAPI, '星星符号', '字符大全') super._createTableLists(this.cm, JoeConfig.characterAPI, '星星符号', '字符大全');
break; break;
case 'emoji': case 'emoji':
super._createTableLists(this.cm, JoeConfig.emojiAPI, '表情', '符号表情(需数据库支持)') super._createTableLists(this.cm, JoeConfig.emojiAPI, '表情', '符号表情(需数据库支持)');
break; break;
} }
}); });