This commit is contained in:
杜恒 2021-04-21 16:07:59 +08:00
parent 8056d8c0e8
commit b57276ffa2
16 changed files with 120 additions and 39 deletions

File diff suppressed because one or more lines are too long

View File

@ -2222,7 +2222,7 @@
height: 12px;
border-radius: 6px;
overflow: hidden;
background: var(--classC);;
background: var(--classC);
min-width: 0;
flex: 1;
margin-right: 10px;
@ -2232,8 +2232,8 @@
height: 100%;
border-radius: 6px;
transition: width 0.35s;
&::before{
content: "";
&::before {
content: '';
opacity: 0;
position: absolute;
top: 0;
@ -2250,6 +2250,17 @@
color: var(--minor);
}
}
&-callout {
display: block;
padding: 12px;
border: 1px solid var(--classB);
border-left-width: 4px;
border-radius: 4px;
color: var(--routine);
*:last-child {
margin-bottom: 0 !important;
}
}
/* 以下未测试 */
&-protected {
@ -3399,12 +3410,12 @@
}
}
@keyframes progress-active {
0% {
opacity: .3;
width: 0
}
to {
opacity: 0;
width: 100%
}
0% {
opacity: 0.3;
width: 0;
}
to {
opacity: 0;
width: 100%;
}
}

View File

@ -197,6 +197,30 @@ document.addEventListener('DOMContentLoaded', () => {
}
}
window.customElements.define('joe-progress', JoeProgress);
class JoeCallout extends HTMLElement {
constructor() {
super();
const _temp = this.querySelector('._temp');
this.options = {
color: this.getAttribute('color') || '#f0ad4e',
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '标注内容'
};
const htmlStr = `
<span class="joe_detail__article-callout" style="border-left-color: ${this.options.color};">
${this.options.content}
</span>
`;
if (this.querySelector('._content')) {
this.querySelector('._content').innerHTML = htmlStr;
} else {
const div = document.createElement('div');
div.className = '_content';
div.innerHTML = htmlStr;
this.appendChild(div);
}
}
}
window.customElements.define('joe-callout', JoeCallout);
const article = document.querySelector('.joe_detail__article');
if (article) article.innerHTML = article.innerHTML.replace(/<p><\/p>/g, '');

File diff suppressed because one or more lines are too long

View File

@ -49,7 +49,7 @@ class Editor
?>
<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=20210421') ?>">
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=2021042116') ?>">
<script>
window.JoeConfig = {
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
@ -62,9 +62,9 @@ class Editor
}
</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?v=20210421') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=20210421') ?>"></script>
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=20210421') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=2021042116') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=2021042116') ?>"></script>
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=2021042116') ?>"></script>
<?php
}
}

View File

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

View File

@ -52,6 +52,9 @@ function _parseContent($post, $login)
if (strpos($content, '{card-default') !== false) {
$content = preg_replace('/{card-default([^}]*)}([\s\S]*?){\/card-default}/', '<section style="margin-bottom: 15px"><joe-card-default $1><span class="_temp" style="display: none">$2</span></joe-card-default></section>', $content);
}
if (strpos($content, '{callout') !== false) {
$content = preg_replace('/{callout([^}]*)}([\s\S]*?){\/callout}/', '<section style="margin-bottom: 15px"><joe-callout $1><span class="_temp" style="display: none">$2</span></joe-callout></section>', $content);
}

View File

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

View File

@ -18,7 +18,7 @@
<?php endif; ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.mode.min.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.normalize.min.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=20210421'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=2021042116'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css'); ?>">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/qmsg/qmsg.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
@ -38,6 +38,6 @@
<?php if ($this->options->JCursorEffects && $this->options->JCursorEffects !== 'off') : ?>
<script src="<?php $this->options->themeUrl('assets/cursor/' . $this->options->JCursorEffects); ?>" async></script>
<?php endif; ?>
<script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js?v=20210421'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=20210421'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js?v=2021042116'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=2021042116'); ?>"></script>
<?php $this->options->JCustomHeadEnd() ?>

File diff suppressed because one or more lines are too long

View File

@ -910,8 +910,8 @@ body.fullscreen {
height: 100%;
border-radius: 6px;
transition: width 0.35s;
&::before{
content: "";
&::before {
content: '';
opacity: 0;
position: absolute;
top: 0;
@ -928,6 +928,17 @@ body.fullscreen {
color: #909399;
}
}
.joe_detail__article-callout {
display: block;
padding: 12px;
border: 1px solid #ebeef5;
border-left-width: 4px;
border-radius: 4px;
color: #606266;
*:last-child {
margin-bottom: 0 !important;
}
}
@media (max-width: 768px) {
.cm-modal__wrapper {
@ -936,12 +947,12 @@ body.fullscreen {
}
@keyframes progress-active {
0% {
opacity: .3;
width: 0
}
to {
opacity: 0;
width: 100%
}
0% {
opacity: 0.3;
width: 0;
}
to {
opacity: 0;
width: 100%;
}
}

View File

@ -661,4 +661,22 @@ export default class JoeAction {
}
});
}
handleCallout(cm) {
this._openModal({
title: '插入标注',
innerHtml: `
<div class="fitem">
<label>边框颜色</label>
<input style="width: 44px;padding: 0 2px;flex: none" autocomplete="off" value="#f0ad4e" name="color" type="color"/>
</div>
`,
confirm: () => {
const color = $(".cm-modal input[name='color']").val();
const str = `\n{callout color="${color}"}\n标注内容\n{/callout}\n\n`;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
else this._replaceSelection(cm, str);
cm.focus();
}
});
}
}

View File

@ -28,6 +28,7 @@ export default function createPreviewHtml(str) {
str = str.replace(/{progress([^}]*)\/}/g, '<joe-progress $1></joe-progress>');
str = str.replace(/{hide[^}]*}([\s\S]*?){\/hide}/g, '<joe-hide></joe-hide>');
str = str.replace(/{card-default([^}]*)}([\s\S]*?){\/card-default}/g, '<section style="margin-bottom: 15px"><joe-card-default $1><span class="_temp" style="display: none">$2</span></joe-card-default></section>');
str = str.replace(/{callout([^}]*)}([\s\S]*?){\/callout}/g, '<section style="margin-bottom: 15px"><joe-callout $1><span class="_temp" style="display: none">$2</span></joe-callout></section>');
const div = document.createElement('div');
div.innerHTML = str;

View File

@ -175,6 +175,11 @@ export default [
title: '进度条',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M757.76 323.482a188.518 188.518 0 0 1 0 377.036H266.24a188.518 188.518 0 1 1 0-377.036h491.52zm0 66.56H502.63l-72.96 243.814H757.71a121.958 121.958 0 0 0 8.397-243.558l-8.397-.308z"/></svg>'
},
{
type: 'callout',
title: '标注',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18"><path d="M842.13 910h-72.36c-19.88 0-36-16.12-36-36s16.12-36 36-36h72.36c19.88 0 36 16.12 36 36s-16.11 36-36 36zm-177.69 0h-72.23c-19.88 0-36-16.12-36-36s16.12-36 36-36h72.23c19.88 0 36 16.12 36 36s-16.12 36-36 36zm-177.57 0h-72.23c-19.88 0-36-16.12-36-36s16.12-36 36-36h72.23c19.88 0 36 16.12 36 36s-16.11 36-36 36zm-177.56 0h-72.23c-19.88 0-36-16.12-36-36s16.12-36 36-36h72.23c19.88 0 36 16.12 36 36s-16.12 36-36 36zM150 878.02c-19.88 0-36-16.1-36-35.98V769.8c0-19.88 16.12-36 36-36s36 16.12 36 36V842c0 19.88-16.12 36.02-36 36.02zm724-55.2c-19.88 0-36-16.12-36-36v-72.23c0-19.88 16.12-36 36-36s36 16.12 36 36v72.23c0 19.88-16.12 36-36 36zM150 700.47c-19.88 0-36-16.12-36-36v-72.23c0-19.88 16.12-36 36-36s36 16.12 36 36v72.23c0 19.88-16.12 36-36 36zm724-55.22c-19.88 0-36-16.12-36-36v-72.23c0-19.88 16.12-36 36-36s36 16.12 36 36v72.23c0 19.89-16.12 36-36 36zM150 522.91c-19.88 0-36-16.12-36-36v-72.23c0-19.88 16.12-36 36-36s36 16.12 36 36v72.23c0 19.88-16.12 36-36 36zm724-55.22c-19.88 0-36-16.12-36-36v-72.23c0-19.88 16.12-36 36-36s36 16.12 36 36v72.23c0 19.88-16.12 36-36 36zM150 345.34c-19.88 0-36-16.12-36-36v-72.23c0-19.88 16.12-36 36-36s36 16.12 36 36v72.23c0 19.89-16.12 36-36 36zm724-55.21c-19.88 0-36-16.12-36-36V182c0-19.88 16.12-36.05 36-36.05s36 16.07 36 35.95v72.23c0 19.88-16.12 36-36 36zM786.85 186h-72.23c-19.88 0-36-16.12-36-36s16.12-36 36-36h72.23c19.88 0 36 16.12 36 36s-16.12 36-36 36zm-177.56 0h-72.23c-19.88 0-36-16.12-36-36s16.12-36 36-36h72.23c19.88 0 36 16.12 36 36s-16.12 36-36 36zm-177.56 0H359.5c-19.88 0-36-16.12-36-36s16.12-36 36-36h72.23c19.88 0 36 16.12 36 36s-16.12 36-36 36zm-177.57 0H182c-19.88 0-36.03-16.12-36.03-36s16.08-36 35.97-36h72.23c19.88 0 36 16.12 36 36s-16.13 36-36.01 36z"/><path d="M213 120v784c0 4.42-3.58 8-8 8h-84c-4.42 0-8-3.58-8-8V120c0-4.42 3.58-8 8-8h84c4.42 0 8 3.58 8 8z"/></svg>'
},
/* --------------------------- 短代码结束 --------------------------- */
{
type: 'clean',

File diff suppressed because one or more lines are too long

View File

@ -301,6 +301,9 @@ class Joe extends JoeAction {
case 'progress':
super.handleProgress(this.cm);
break;
case 'callout':
super.handleCallout(this.cm);
break;
}
});
$('.cm-tools').append(el);