This commit is contained in:
杜恒 2021-04-29 10:24:08 +08:00
parent 6147a800cb
commit 5e30646b2f
16 changed files with 160 additions and 41 deletions

File diff suppressed because one or more lines are too long

View File

@ -1540,6 +1540,26 @@
}
}
.joe_alert {
padding: 12px;
border-radius: var(--radius-inner);
line-height: 26px;
&.info {
border: 1px solid #abdcff;
}
&.success {
border: 1px solid #8ce6b0;
}
&.warning {
border: 1px solid #ffd77a;
}
&.error {
border: 1px solid #ffb08f;
}
*:last-child {
margin-bottom: 0 !important;
}
}
.joe_gird {
display: grid;
&__item {

View File

@ -152,15 +152,15 @@ document.addEventListener('DOMContentLoaded', () => {
content: this.getAttribute('content') || '标签按钮'
};
this.innerHTML = `
<a class="joe_anote ${this.options.type}" href="${this.options.href}" target="_blank" rel="noopener noreferrer nofollow">
<span class="joe_anote__icon">
<i class="fa ${this.options.icon}"></i>
</span>
<span class="joe_anote__content">
${this.options.content}
</span>
</a>
`;
<a class="joe_anote ${this.options.type}" href="${this.options.href}" target="_blank" rel="noopener noreferrer nofollow">
<span class="joe_anote__icon">
<i class="fa ${this.options.icon}"></i>
</span>
<span class="joe_anote__content">
${this.options.content}
</span>
</a>
`;
}
}
);
@ -173,8 +173,8 @@ document.addEventListener('DOMContentLoaded', () => {
this.startColor = this.getAttribute('startColor') || '#ff6c6c';
this.endColor = this.getAttribute('endColor') || '#1989fa';
this.innerHTML = `
<span class="joe_dotted" style="background-image: repeating-linear-gradient(-45deg, ${this.startColor} 0, ${this.startColor} 20%, transparent 0, transparent 25%, ${this.endColor} 0, ${this.endColor} 45%, transparent 0, transparent 50%)"></span>
`;
<span class="joe_dotted" style="background-image: repeating-linear-gradient(-45deg, ${this.startColor} 0, ${this.startColor} 20%, transparent 0, transparent 25%, ${this.endColor} 0, ${this.endColor} 45%, transparent 0, transparent 50%)"></span>
`;
}
}
);
@ -277,11 +277,11 @@ document.addEventListener('DOMContentLoaded', () => {
content: this.getAttribute('content') || '消息内容'
};
this.innerHTML = `
<span class="joe_message ${this.options.type}">
<span class="joe_message__icon"></span>
<span class="joe_message__content">${this.options.content}</span>
</span>
`;
<span class="joe_message ${this.options.type}">
<span class="joe_message__icon"></span>
<span class="joe_message__content">${this.options.content}</span>
</span>
`;
}
}
);
@ -318,10 +318,10 @@ document.addEventListener('DOMContentLoaded', () => {
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '标注内容'
};
const htmlStr = `
<div class="joe_callout" style="border-left-color: ${this.options.color};">
${this.options.content}
</div>
`;
<div class="joe_callout" style="border-left-color: ${this.options.color};">
${this.options.content}
</div>
`;
if (getChildren(this, '_content')) {
getChildren(this, '_content').innerHTML = htmlStr;
} else {
@ -346,11 +346,11 @@ document.addEventListener('DOMContentLoaded', () => {
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '卡片内容'
};
const htmlStr = `
<div class="joe_card__describe">
<div class="joe_card__describe-title">${this.options.title}</div>
<div class="joe_card__describe-content">${this.options.content}</div>
</div>
`;
<div class="joe_card__describe">
<div class="joe_card__describe-title">${this.options.title}</div>
<div class="joe_card__describe-content">${this.options.content}</div>
</div>
`;
if (getChildren(this, '_content')) {
getChildren(this, '_content').innerHTML = htmlStr;
} else {
@ -389,6 +389,34 @@ document.addEventListener('DOMContentLoaded', () => {
}
);
customElements.define(
'joe-alert',
class JoeAlert extends HTMLElement {
constructor() {
super();
const _temp = getChildren(this, '_temp');
this.options = {
type: /^success$|^info$|^warning$|^error$/.test(this.getAttribute('type')) ? this.getAttribute('type') : 'info',
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '警告提示'
}
const htmlStr = `
<div class="joe_alert ${this.options.type}">
${this.options.content}
</div>
`;
if (getChildren(this, '_content')) {
getChildren(this, '_content').innerHTML = htmlStr;
} else {
const span = document.createElement('span');
span.style.display = 'block';
span.className = '_content';
span.innerHTML = htmlStr;
this.appendChild(span);
}
}
}
);
customElements.define(
'joe-timeline',
class JoeTimeline extends HTMLElement {

File diff suppressed because one or more lines are too long

View File

@ -51,7 +51,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=202104261755') ?>">
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=20210429') ?>">
<script>
window.JoeConfig = {
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
@ -67,8 +67,8 @@ 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=202104261755') ?>"></script>
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=202104261755') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=20210429') ?>"></script>
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=20210429') ?>"></script>
<?php
}
}

View File

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

View File

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

View File

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

View File

@ -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=20210428'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css?v=20210428'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=20210429'); ?>">
<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" />
<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=20210428'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=20210428'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js?v=20210429'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=20210429'); ?>"></script>
<?php $this->options->JCustomHeadEnd() ?>

File diff suppressed because one or more lines are too long

View File

@ -1217,6 +1217,7 @@ body.fullscreen {
.joe_gird {
display: grid;
line-height: 26px;
&__item {
*:last-child {
margin-bottom: 0 !important;
@ -1224,6 +1225,29 @@ body.fullscreen {
}
}
.joe_alert {
padding: 12px;
border-radius: 4px;
line-height: 26px;
background: transparent;
color: #606266;
&.info {
border: 1px solid #abdcff;
}
&.success {
border: 1px solid #8ce6b0;
}
&.warning {
border: 1px solid #ffd77a;
}
&.error {
border: 1px solid #ffb08f;
}
*:last-child {
margin-bottom: 0 !important;
}
}
@media (max-width: 768px) {
.cm-modal__wrapper {
width: 90%;

View File

@ -796,6 +796,29 @@ export default class JoeAction {
this._replaceSelection(cm, str);
cm.focus();
}
handleAlert(cm) {
this._openModal({
title: '警告提示',
innerHtml: `
<div class="fitem">
<label>提示类型</label>
<select name="type">
<option value="info" selected>info</option>
<option value="success">success</option>
<option value="warning">warning</option>
<option value="error">error</option>
</select>
</div>
`,
confirm: () => {
const type = $(".cm-modal select[name='type']").val();
const str = `\n{alert type="${type}"}\n警告提示\n{/alert}\n\n`;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
else this._replaceSelection(cm, str);
cm.focus();
}
});
}
handleCloud(cm) {
this._openModal({
title: '网盘下载',

View File

@ -93,6 +93,9 @@ export default function createPreviewHtml(str) {
if (str.indexOf('{collapse') !== -1) {
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>');
}
if (str.indexOf('{alert') !== -1) {
str = str.replace(/{alert([^}]*)}([\s\S]*?){\/alert}/g, '<section style="margin-bottom: 15px"><joe-alert $1><span class="_temp" style="display: none">$2</span></joe-alert></section>');
}
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>');
}

View File

@ -230,6 +230,11 @@ export default [
title: '宫格',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M156.16 896.512h711.168c15.872 0 28.672-12.8 28.672-28.672V156.16c0-15.872-12.8-28.672-28.672-28.672H156.16c-15.872 0-28.672 12.8-28.672 28.672v711.168c0 16.384 12.8 29.184 28.672 29.184zm35.328-352.256h288.768v288.256H191.488V544.256zm352.768 288.256V544.256h288.768v288.256H544.256zm288.768-352.768H544.256V191.488h288.768v288.256zm-353.28-288.256v288.256H191.488V191.488h288.256z"/></svg>'
},
{
type: 'alert',
title: '提示',
innerHTML: '<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M193.024 795.99c0 17.692 14.222 32.028 31.972 32.028h574.008a31.972 31.972 0 0 0 31.972-32.029V562.972a318.976 318.976 0 1 0-637.952 0V795.99zm71.964-233.018a247.012 247.012 0 0 1 494.024 0v193.024H404.025V584.988a10.012 10.012 0 0 0-10.013-10.012H349.98a10.012 10.012 0 0 0-9.955 10.012v171.008h-75.037V562.972zM216.918 310.5l39.594-39.595a8.021 8.021 0 0 0 0-11.321l-67.925-67.868a8.021 8.021 0 0 0-11.264 0l-39.595 39.594a8.021 8.021 0 0 0 0 11.264l67.868 67.926a8.021 8.021 0 0 0 11.321 0zM886.5 231.31l-39.595-39.594a8.021 8.021 0 0 0-11.321 0l-67.868 67.868a8.021 8.021 0 0 0 0 11.32L807.31 310.5a8.021 8.021 0 0 0 11.264 0l67.926-67.926a8.021 8.021 0 0 0 0-11.264zM832 892.018H192a31.972 31.972 0 0 0-32.028 31.971v24.007c0 4.38 3.64 7.965 8.02 7.965h688.015c4.38 0 7.965-3.584 7.965-7.965V923.99A31.972 31.972 0 0 0 832 892.018zM484.01 179.996h55.98a7.951 7.951 0 0 0 7.964-7.964V75.947a8.021 8.021 0 0 0-7.965-7.965h-55.978a8.021 8.021 0 0 0-7.965 7.965v95.971c0 4.438 3.527 8.022 7.965 8.022z"/></svg>'
},
/* --------------------------- 短代码结束 --------------------------- */
{
type: 'clean',

File diff suppressed because one or more lines are too long

View File

@ -339,6 +339,9 @@ class Joe extends JoeAction {
case 'gird':
super.handleGird(this.cm);
break;
case 'alert':
super.handleAlert(this.cm);
break;
case 'preview':
el.toggleClass('active');
if (el.hasClass('active')) window.JoeConfig.canPreview = true;