更新
This commit is contained in:
parent
ee09362c4f
commit
61db123164
2
assets/css/joe.global.min.css
vendored
2
assets/css/joe.global.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1920,6 +1920,53 @@
|
||||
transform-origin: left;
|
||||
}
|
||||
}
|
||||
.joe_collapse {
|
||||
&__item {
|
||||
margin-bottom: 10px;
|
||||
color: var(--routine);
|
||||
border: 1px solid var(--classC);
|
||||
&-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: var(--classD);
|
||||
padding: 10px 12px;
|
||||
padding-right: 8px;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
user-select: none;
|
||||
&--label {
|
||||
padding-right: 8px;
|
||||
}
|
||||
&--icon {
|
||||
flex-shrink: 0;
|
||||
margin-left: auto;
|
||||
fill: var(--minor);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
}
|
||||
&-wrapper {
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
transition: max-height .3s ease;
|
||||
&--content {
|
||||
|
||||
padding: 12px;
|
||||
*:last-child {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
&.active {
|
||||
.joe_collapse__item-head--icon {
|
||||
transform: rotate(-180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.joe_detail {
|
||||
background: var(--background);
|
||||
|
@ -341,6 +341,62 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-timeline', JoeTimeline);
|
||||
class JoeCollapse extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
const _temp = getChildren(this, '_temp');
|
||||
let _innerHTML = _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '');
|
||||
let content = '';
|
||||
_innerHTML.replace(/{collapse-item([^}]*)}([\s\S]*?){\/collapse-item}/g, function ($0, $1, $2) {
|
||||
content += `
|
||||
<div class="joe_collapse__item" ${$1}>
|
||||
<div class="joe_collapse__item-head">
|
||||
<div class="joe_collapse__item-head--label"></div>
|
||||
<svg class="joe_collapse__item-head--icon" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24"><path d="M7.406 7.828L12 12.422l4.594-4.594L18 9.234l-6 6-6-6z"/></svg>
|
||||
</div>
|
||||
<div class="joe_collapse__item-wrapper">
|
||||
<div class="joe_collapse__item-wrapper--content">${$2.trim().replace(/^(<br>)|(<br>)$/g, '')}</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
let htmlStr = `<div class="joe_collapse">${content}</div>`;
|
||||
if (getChildren(this, '_content')) {
|
||||
getChildren(this, '_content').innerHTML = htmlStr;
|
||||
} else {
|
||||
const span = document.createElement('span');
|
||||
span.className = '_content';
|
||||
span.style.display = 'block';
|
||||
span.innerHTML = htmlStr;
|
||||
this.appendChild(span);
|
||||
}
|
||||
this.querySelectorAll('.joe_collapse__item-head--label').forEach(item => {
|
||||
const label = item.getAttribute('label') || '折叠标题';
|
||||
item.innerHTML = label;
|
||||
});
|
||||
this.querySelectorAll('.joe_collapse__item').forEach(item => {
|
||||
const head = getChildren(item, 'joe_collapse__item-head');
|
||||
const wrapper = getChildren(item, 'joe_collapse__item-wrapper');
|
||||
const content = getChildren(wrapper, 'joe_collapse__item-wrapper--content');
|
||||
const open = item.getAttribute('open');
|
||||
if (open !== null) {
|
||||
item.classList.add('active');
|
||||
wrapper.style.maxHeight = content.offsetHeight + 'px';
|
||||
}
|
||||
head.addEventListener('click', () => {
|
||||
if (item.classList.contains('active')) {
|
||||
item.classList.remove('active');
|
||||
wrapper.style.maxHeight = 0;
|
||||
} else {
|
||||
item.classList.add('active');
|
||||
wrapper.style.maxHeight = content.offsetHeight + 'px';
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-collapse', JoeCollapse);
|
||||
|
||||
class JoeDplayer extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
|
2
assets/js/joe.short.min.js
vendored
2
assets/js/joe.short.min.js
vendored
File diff suppressed because one or more lines are too long
@ -50,7 +50,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=202104231345') ?>">
|
||||
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=202104231640') ?>">
|
||||
<script>
|
||||
window.JoeConfig = {
|
||||
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
|
||||
@ -65,9 +65,9 @@ class Editor
|
||||
</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?v=202104231345') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=202104231345') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=202104231345') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=202104231640') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=202104231640') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=202104231640') ?>"></script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* 获取主题当前版本号 */
|
||||
function _getVersion()
|
||||
{
|
||||
return "6.6.4";
|
||||
return "6.6.5";
|
||||
};
|
||||
|
||||
/* 判断是否是手机 */
|
||||
|
@ -75,6 +75,9 @@ function _parseContent($post, $login)
|
||||
if (strpos($content, '{timeline') !== false) {
|
||||
$content = preg_replace('/{timeline}([\s\S]*?){\/timeline}/', '<section style="margin-bottom: 15px"><joe-timeline><span class="_temp" style="display: none">$1</span></joe-timeline></section>', $content);
|
||||
}
|
||||
if (strpos($content, '{collapse') !== false) {
|
||||
$content = preg_replace('/{collapse}([\s\S]*?){\/collapse}/', '<section style="margin-bottom: 15px"><joe-collapse><span class="_temp" style="display: none">$1</span></joe-collapse></section>', $content);
|
||||
}
|
||||
if (strpos($content, '{copy') !== false) {
|
||||
$content = preg_replace('/{copy([^}]*)\/}/SU', '<joe-copy $1></joe-copy>', $content);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "typecho-joe-next",
|
||||
"version": "6.6.4",
|
||||
"version": "6.6.5",
|
||||
"description": "A Theme Of Typecho",
|
||||
"main": "index.php",
|
||||
"keywords": [
|
||||
|
@ -18,8 +18,8 @@
|
||||
<?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=202104231345'); ?>">
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css?v=202104231345'); ?>">
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=202104231640'); ?>">
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css?v=202104231640'); ?>">
|
||||
<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" />
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.7.2/animate.min.css" />
|
||||
@ -40,6 +40,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=202104231345'); ?>"></script>
|
||||
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=202104231345'); ?>"></script>
|
||||
<script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js?v=202104231640'); ?>"></script>
|
||||
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=202104231640'); ?>"></script>
|
||||
<?php $this->options->JCustomHeadEnd() ?>
|
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
@ -1086,6 +1086,53 @@ body.fullscreen {
|
||||
transform-origin: left;
|
||||
}
|
||||
}
|
||||
.joe_collapse {
|
||||
&__item {
|
||||
margin-bottom: 10px;
|
||||
color: #606266;
|
||||
&-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #f2f6fc;
|
||||
padding: 10px 12px;
|
||||
padding-right: 8px;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
border: 1px solid #ebeef5;
|
||||
user-select: none;
|
||||
&--label {
|
||||
padding-right: 8px;
|
||||
}
|
||||
&--icon {
|
||||
flex-shrink: 0;
|
||||
margin-left: auto;
|
||||
fill: #909399;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
}
|
||||
&-wrapper {
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
transition: max-height .3s ease;
|
||||
&--content {
|
||||
border: 1px solid #ebeef5;
|
||||
border-top: 0;
|
||||
padding: 12px;
|
||||
*:last-child {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
&.active {
|
||||
.joe_collapse__item-head--icon {
|
||||
transform: rotate(-180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.cm-modal__wrapper {
|
||||
|
@ -768,4 +768,9 @@ export default class JoeAction {
|
||||
this._replaceSelection(cm, str);
|
||||
cm.focus();
|
||||
}
|
||||
handleCollapse(cm) {
|
||||
const str = `${this._getLineCh(cm) ? '\n\n' : '\n'}{collapse}\n{collapse-item label="折叠标题一" open}\n 折叠内容一\n{/collapse-item}\n{collapse-item label="折叠标题二"}\n 折叠内容二\n{/collapse-item}\n{/collapse}\n\n`;
|
||||
this._replaceSelection(cm, str);
|
||||
cm.focus();
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ export default function createPreviewHtml(str) {
|
||||
str = str.replace(/{tabs}([\s\S]*?){\/tabs}/g, '<section style="margin-bottom: 15px"><joe-tabs><span class="_temp" style="display: none">$1</span></joe-tabs></section>');
|
||||
str = str.replace(/{card-list}([\s\S]*?){\/card-list}/g, '<section style="margin-bottom: 15px"><joe-card-list><span class="_temp" style="display: none">$1</span></joe-card-list></section>');
|
||||
str = str.replace(/{timeline}([\s\S]*?){\/timeline}/g, '<section style="margin-bottom: 15px"><joe-timeline><span class="_temp" style="display: none">$1</span></joe-timeline></section>');
|
||||
str = str.replace(/{collapse}([\s\S]*?){\/collapse}/g, '<section style="margin-bottom: 15px"><joe-collapse><span class="_temp" style="display: none">$1</span></joe-collapse></section>');
|
||||
|
||||
$('.cm-preview-content').html(str);
|
||||
$('.cm-preview-content p:empty').remove();
|
||||
|
@ -215,6 +215,11 @@ export default [
|
||||
title: '跑马灯',
|
||||
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M848 432a80.064 80.064 0 0 0-73.216 48H217.216A80.096 80.096 0 0 0 144 432a80.096 80.096 0 0 0-80 80c0 44.128 35.904 80 80 80a80 80 0 0 0 73.216-48h557.536a80 80 0 0 0 73.216 48c44.128 0 80-35.872 80-80A80.032 80.032 0 0 0 848 432z"/></svg>'
|
||||
},
|
||||
{
|
||||
type: 'collapse',
|
||||
title: '折叠面板',
|
||||
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18"><path d="M944 128H80c-8.8 0-16 7.2-16 16v736c0 8.8 7.2 16 16 16h864c8.8 0 16-7.2 16-16V144c0-8.8-7.2-16-16-16zm-48 64v216H128V192h768zM128 832V472h768v360H128z"/><path d="M706 340.8c6.4 7.6 18 7.6 24.4 0l58.8-69.2c8.8-10.4 1.6-26.4-12-26.4H659.6c-13.6 0-21.2 16-12 26.4l58.4 69.2z"/></svg>'
|
||||
},
|
||||
/* --------------------------- 短代码结束 --------------------------- */
|
||||
{
|
||||
type: 'clean',
|
||||
|
File diff suppressed because one or more lines are too long
@ -330,6 +330,9 @@ class Joe extends JoeAction {
|
||||
case 'lamp':
|
||||
super.handleLamp(this.cm);
|
||||
break;
|
||||
case 'collapse':
|
||||
super.handleCollapse(this.cm);
|
||||
break;
|
||||
case 'preview':
|
||||
el.toggleClass('active');
|
||||
if (el.hasClass('active')) window.JoeConfig.canPreview = true;
|
||||
|
Loading…
Reference in New Issue
Block a user