This commit is contained in:
杜恒 2021-04-23 09:34:22 +08:00
parent 5b490ca519
commit f217f02207
14 changed files with 401 additions and 380 deletions

File diff suppressed because one or more lines are too long

View File

@ -1795,7 +1795,7 @@
border: 1px solid #19be6b; border: 1px solid #19be6b;
} }
&-content { &-content {
padding: 1px 1px 10px 24px; padding-left: 24px;
position: relative; position: relative;
top: -3px; top: -3px;
*:last-child { *:last-child {
@ -1803,6 +1803,7 @@
} }
} }
&:last-child { &:last-child {
padding-bottom: 0;
.joe_timeline__item-tail { .joe_timeline__item-tail {
display: none; display: none;
} }
@ -1868,9 +1869,6 @@
height: 500px; height: 500px;
} }
.joe_detail { .joe_detail {
background: var(--background); background: var(--background);
border-radius: var(--radius-wrap); border-radius: var(--radius-wrap);
@ -2284,7 +2282,6 @@
} }
} }
} }
&-video { &-video {
margin-bottom: 18px; margin-bottom: 18px;
.play, .play,
@ -2364,8 +2361,6 @@
} }
} }
} }
/* 以下未测试 */
&-protected { &-protected {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -2402,10 +2397,6 @@
} }
} }
} }
&-copy {
cursor: pointer;
user-select: none;
}
} }
&__agree { &__agree {
display: flex; display: flex;

View File

@ -384,33 +384,23 @@ document.addEventListener('DOMContentLoaded', () => {
} }
} }
window.customElements.define('joe-tabs', JoeTabs); window.customElements.define('joe-tabs', JoeTabs);
$('.joe_detail__article p:empty').remove();
/*
------------------------以下未测试------------------------------------------
*/
/* 点击复制 */
class JoeCopy extends HTMLElement { class JoeCopy extends HTMLElement {
constructor() { constructor() {
super(); super();
this.options = { this.options = {
text: this.getAttribulte('text') || '默认文本', showText: this.getAttribute('showText') || '点击复制',
content: this.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '点击复制' copyText: this.getAttribute('copyText') || '默认文本'
}; };
this.render(); this.innerHTML = `<span class="joe_copy" style="cursor: pointer; user-select: none;">${this.options.showText}</span>`;
const button = getChildren(this, 'joe_copy');
if (typeof ClipboardJS !== 'undefined' && typeof Qmsg !== 'undefined') {
new ClipboardJS(button, { text: () => this.options.copyText }).on('success', () => Qmsg.success('复制成功!'));
} else {
button.addEventListener('click', () => alert('该功能请前往前台查看!'));
} }
get template() {
return `<span class="joe_detail__article-copy">${this.options.content}</span>`;
}
render() {
this.innerHTML = this.template;
this.event();
}
event() {
this.$copy = this.querySelector('.joe_detail__article-copy');
new ClipboardJS(this.$copy, { text: () => this.options.text }).on('success', () => Qmsg.success('复制成功!'));
} }
} }
window.customElements.define('joe-copy', JoeCopy); window.customElements.define('joe-copy', JoeCopy);
$('.joe_detail__article p:empty').remove();
}); });

File diff suppressed because one or more lines are too long

View File

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

View File

@ -65,16 +65,15 @@ function _parseContent($post, $login)
$content = preg_replace('/{card-list}([\s\S]*?){\/card-list}/', '<section style="margin-bottom: 15px"><joe-card-list><span class="_temp" style="display: none">$1</span></joe-card-list></section>', $content); $content = preg_replace('/{card-list}([\s\S]*?){\/card-list}/', '<section style="margin-bottom: 15px"><joe-card-list><span class="_temp" style="display: none">$1</span></joe-card-list></section>', $content);
} }
if (strpos($content, '{timeline') !== false) { if (strpos($content, '{timeline') !== false) {
$content = preg_replace('/{timeline}([\s\S]*?){\/timeline}/', '<section><joe-timeline><span class="_temp" style="display: none">$1</span></joe-timeline></section>', $content); $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, '{copy') !== false) { if (strpos($content, '{copy') !== false) {
$content = preg_replace('/{copy(.*)}/SU', '<joe-copy $1>', $content); $content = preg_replace('/{copy([^}]*)\/}/SU', '<joe-copy $1></joe-copy>', $content);
$content = preg_replace('/{\/copy}/SU', '</joe-copy>', $content);
} }
echo $content; echo $content;
} }

View File

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

File diff suppressed because one or more lines are too long

View File

@ -962,7 +962,7 @@ body.fullscreen {
border: 1px solid #19be6b; border: 1px solid #19be6b;
} }
&-content { &-content {
padding: 1px 1px 10px 24px; padding-left: 24px;
position: relative; position: relative;
top: -3px; top: -3px;
*:last-child { *:last-child {

View File

@ -735,4 +735,27 @@ export default class JoeAction {
this._replaceSelection(cm, str); this._replaceSelection(cm, str);
cm.focus(); cm.focus();
} }
handleCopy(cm) {
this._openModal({
title: '插入音乐',
innerHtml: `
<div class="fitem">
<label>显示文案</label>
<input autocomplete="off" name="showText" placeholder="请输入显示文案"/>
</div>
<div class="fitem" style="align-items: flex-start">
<label>复制内容</label>
<textarea autocomplete="off" name="copyText" placeholder="请输入需要复制的内容"></textarea>
</div>
`,
confirm: () => {
const showText = $(".cm-modal input[name='showText']").val();
const copyText = $(".cm-modal textarea[name='copyText']").val();
const str = `\n{copy showText="${showText}" copyText="${copyText}"/}\n\n`;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
else this._replaceSelection(cm, str);
cm.focus()
}
});
}
} }

View File

@ -26,6 +26,7 @@ export default function createPreviewHtml(str) {
str = str.replace(/{mp3([^}]*)\/}/g, '<joe-mp3 $1></joe-mp3>'); str = str.replace(/{mp3([^}]*)\/}/g, '<joe-mp3 $1></joe-mp3>');
str = str.replace(/{abtn([^}]*)\/}/g, '<joe-abtn $1></joe-abtn>'); str = str.replace(/{abtn([^}]*)\/}/g, '<joe-abtn $1></joe-abtn>');
str = str.replace(/{anote([^}]*)\/}/g, '<joe-anote $1></joe-anote>'); str = str.replace(/{anote([^}]*)\/}/g, '<joe-anote $1></joe-anote>');
str = str.replace(/{copy([^}]*)\/}/g, '<joe-copy $1></joe-copy>');
str = str.replace(/{dotted([^}]*)\/}/g, '<joe-dotted $1></joe-dotted>'); str = str.replace(/{dotted([^}]*)\/}/g, '<joe-dotted $1></joe-dotted>');
str = str.replace(/{message([^}]*)\/}/g, '<joe-message $1></joe-message>'); str = str.replace(/{message([^}]*)\/}/g, '<joe-message $1></joe-message>');
str = str.replace(/{progress([^}]*)\/}/g, '<joe-progress $1></joe-progress>'); str = str.replace(/{progress([^}]*)\/}/g, '<joe-progress $1></joe-progress>');
@ -34,7 +35,7 @@ export default function createPreviewHtml(str) {
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>'); 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>');
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(/{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(/{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><joe-timeline><span class="_temp" style="display: none">$1</span></joe-timeline></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>');
$('.cm-preview-content').html(str); $('.cm-preview-content').html(str);
$('.cm-preview-content p:empty').remove(); $('.cm-preview-content p:empty').remove();

View File

@ -200,6 +200,11 @@ export default [
title: '时间轴', title: '时间轴',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M365.714 329.143c0-47.543-29.257-87.772-73.143-102.4V36.57C292.571 14.63 277.943 0 256 0s-36.571 14.629-36.571 36.571v190.172c-43.886 14.628-73.143 54.857-73.143 102.4 0 47.543 29.257 87.771 73.143 102.4V588.8c-43.886 14.629-73.143 54.857-73.143 102.4 0 47.543 29.257 87.771 73.143 102.4v193.829c0 21.942 14.628 36.571 36.571 36.571s36.571-14.629 36.571-36.571V797.257c43.886-14.628 73.143-54.857 73.143-102.4 0-47.543-29.257-87.771-73.143-102.4V435.2c43.886-18.286 73.143-58.514 73.143-106.057zM256 731.429c-21.943 0-36.571-14.629-36.571-36.572s14.628-36.571 36.571-36.571 36.571 14.628 36.571 36.571S277.943 731.43 256 731.43zm0-365.715c-21.943 0-36.571-14.628-36.571-36.571S234.057 292.57 256 292.57s36.571 14.629 36.571 36.572-14.628 36.571-36.571 36.571zM768 731.43H475.429c-18.286 0-36.572 14.628-36.572 36.571s14.629 36.571 36.572 36.571H768c18.286 0 36.571-14.628 36.571-36.571S789.943 731.429 768 731.429zm73.143-512H475.429c-18.286 0-36.572 14.628-36.572 36.571s14.629 36.571 36.572 36.571h365.714c18.286 0 36.571-14.628 36.571-36.571s-14.628-36.571-36.571-36.571zM768 438.857c18.286 0 36.571-14.628 36.571-36.571S789.943 365.714 768 365.714H475.429c-18.286 0-36.572 14.629-36.572 36.572s14.629 36.571 36.572 36.571H768zm73.143 146.286H475.429c-18.286 0-36.572 14.628-36.572 36.571s14.629 36.572 36.572 36.572h365.714c18.286 0 36.571-14.629 36.571-36.572s-14.628-36.571-36.571-36.571z"/></svg>' innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M365.714 329.143c0-47.543-29.257-87.772-73.143-102.4V36.57C292.571 14.63 277.943 0 256 0s-36.571 14.629-36.571 36.571v190.172c-43.886 14.628-73.143 54.857-73.143 102.4 0 47.543 29.257 87.771 73.143 102.4V588.8c-43.886 14.629-73.143 54.857-73.143 102.4 0 47.543 29.257 87.771 73.143 102.4v193.829c0 21.942 14.628 36.571 36.571 36.571s36.571-14.629 36.571-36.571V797.257c43.886-14.628 73.143-54.857 73.143-102.4 0-47.543-29.257-87.771-73.143-102.4V435.2c43.886-18.286 73.143-58.514 73.143-106.057zM256 731.429c-21.943 0-36.571-14.629-36.571-36.572s14.628-36.571 36.571-36.571 36.571 14.628 36.571 36.571S277.943 731.43 256 731.43zm0-365.715c-21.943 0-36.571-14.628-36.571-36.571S234.057 292.57 256 292.57s36.571 14.629 36.571 36.572-14.628 36.571-36.571 36.571zM768 731.43H475.429c-18.286 0-36.572 14.628-36.572 36.571s14.629 36.571 36.572 36.571H768c18.286 0 36.571-14.628 36.571-36.571S789.943 731.429 768 731.429zm73.143-512H475.429c-18.286 0-36.572 14.628-36.572 36.571s14.629 36.571 36.572 36.571h365.714c18.286 0 36.571-14.628 36.571-36.571s-14.628-36.571-36.571-36.571zM768 438.857c18.286 0 36.571-14.628 36.571-36.571S789.943 365.714 768 365.714H475.429c-18.286 0-36.572 14.629-36.572 36.572s14.629 36.571 36.572 36.571H768zm73.143 146.286H475.429c-18.286 0-36.572 14.628-36.572 36.571s14.629 36.572 36.572 36.572h365.714c18.286 0 36.571-14.629 36.571-36.572s-14.628-36.571-36.571-36.571z"/></svg>'
}, },
{
type: 'copy',
title: '复制文本',
innerHTML: '<svg t="1619140348056" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3613" width="20" height="20"><path d="M731.682 676.057V183.323c0-30.233-24.512-54.746-54.748-54.746H184.216c-30.233 0-54.747 24.513-54.747 54.746v492.734c0 30.208 24.514 54.747 54.747 54.747h492.718c30.235 0 54.748-24.539 54.748-54.747z m-109.493 0H238.963c-30.234 0-54.747-24.538-54.747-54.745V238.07c0-30.233 24.513-54.747 54.747-54.747h383.226c30.234 0 54.745 24.513 54.745 54.747v383.243c0 30.206-24.512 54.744-54.745 54.744z m218.986-383.24h-54.746v54.747c30.232 0 54.746 24.513 54.746 54.76V785.55c0 30.207-24.514 54.746-54.746 54.746H403.202c-30.234 0-54.747-24.539-54.747-54.746h-54.747v54.746c0 30.208 24.513 54.748 54.747 54.748h492.72c30.234 0 54.747-24.54 54.747-54.748V347.564c0-30.235-24.514-54.747-54.747-54.747z" p-id="3614"></path></svg>'
},
/* --------------------------- 短代码结束 --------------------------- */ /* --------------------------- 短代码结束 --------------------------- */
{ {
type: 'clean', type: 'clean',

File diff suppressed because one or more lines are too long

View File

@ -321,6 +321,9 @@ class Joe extends JoeAction {
case 'timeline': case 'timeline':
super.handleTimeline(this.cm); super.handleTimeline(this.cm);
break; break;
case 'copy':
super.handleCopy(this.cm);
break;
case 'preview': case 'preview':
el.toggleClass('active'); el.toggleClass('active');
if (el.hasClass('active')) window.JoeConfig.canPreview = true; if (el.hasClass('active')) window.JoeConfig.canPreview = true;