This commit is contained in:
杜恒
2021-04-19 15:18:29 +08:00
parent 3bcf16d512
commit 6f625826ad
15 changed files with 328 additions and 249 deletions

File diff suppressed because one or more lines are too long

View File

@@ -653,11 +653,33 @@ body.fullscreen {
}
}
}
.joe_detail__article-card_default {
display: block;
margin: 0 auto;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px;
border: 1px solid #ebeef5;
background: #fff;
> .title {
display: block;
padding: 8px 10px;
border-bottom: 1px solid #ebeef5;
color: #303133;
user-select: none;
}
> .content {
display: block;
padding: 10px;
color: #606266;
*:last-child {
margin-bottom: 0 !important;
}
}
}
.joe_detail__article-mtitle {
display: flex;
justify-content: center;
.text {
> .text {
position: relative;
color: #909399;
padding: 0 12px;
@@ -679,20 +701,33 @@ body.fullscreen {
}
}
}
.joe_detail__article-player {
width: 100%;
height: 180px;
border: none;
}
.joe_detail__article-hide {
display: block;
background: repeating-linear-gradient(145deg, #f2f6fc, #f2f6fc 15px, #fff 0, #fff 25px);
padding: 15px 0;
text-align: center;
position: relative;
user-select: none;
line-height: normal;
> i {
position: relative;
font-style: normal;
cursor: pointer;
color: #409eff;
}
}
.joe_detail__article-abtn {
display: inline-block;
color: #fff;
height: 35px;
line-height: 35px;
padding: 0 15px;
.icon {
> .icon {
display: inline-block;
vertical-align: top;
text-align: center;
@@ -703,7 +738,7 @@ body.fullscreen {
margin-right: 8px;
}
}
.content {
> .content {
color: #fff;
display: inline-block;
vertical-align: top;
@@ -716,14 +751,13 @@ body.fullscreen {
color: #fff;
}
}
.joe_detail__article-anote {
position: relative;
display: inline-block;
color: #fff;
height: 35px;
line-height: 35px;
.icon {
> .icon {
display: inline-block;
vertical-align: top;
width: 35px;
@@ -734,7 +768,7 @@ body.fullscreen {
color: #fff;
}
}
.content {
> .content {
display: inline-block;
vertical-align: top;
padding: 0 12px;
@@ -763,27 +797,15 @@ body.fullscreen {
color: #fff;
}
}
.joe_detail__article-dotted {
display: block;
width: 100%;
height: 2px;
background-size: 80px;
}
.joe_detail__article-hide {
background: repeating-linear-gradient(145deg, #f2f6fc, #f2f6fc 15px, #fff 0, #fff 25px);
padding: 15px 0;
text-align: center;
position: relative;
user-select: none;
line-height: normal;
i {
position: relative;
font-style: normal;
cursor: pointer;
color: #409eff;
}
}
@media (max-width: 768px) {
.cm-modal__wrapper {

View File

@@ -477,10 +477,10 @@ export default class JoeAction {
cm.focus();
}
handleHide(cm) {
const str = `${this._getLineCh(cm) ? '\n' : ''}{hide}\n需要隐藏的内容\n{/hide}\n`;
const str = `${this._getLineCh(cm) ? '\n\n' : '\n'}{hide}\n需要隐藏的内容\n{/hide}\n\n`;
this._replaceSelection(cm, str);
cm.focus();
}
}
handleAbtn(cm) {
this._openModal({
title: '多彩按钮',
@@ -587,4 +587,27 @@ export default class JoeAction {
}
});
}
handleCardDefault(cm) {
this._openModal({
title: '默认卡片',
innerHtml: `
<div class="fitem">
<label>卡片标题</label>
<input autocomplete="off" name="label" placeholder="请输入卡片标题"/>
</div>
<div class="fitem">
<label>卡片宽度</label>
<input autocomplete="off" name="width" placeholder="请输入卡片宽度例如100%"/>
</div>
`,
confirm: () => {
const label = $(".cm-modal input[name='label']").val();
const width = $(".cm-modal input[name='width']").val();
const str = `\n{card-default label="${label}" width="${width}"}\n卡片内容\n{/card-default}\n\n`;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
else this._replaceSelection(cm, str);
cm.focus();
}
});
}
}

View File

@@ -25,7 +25,12 @@ export default function createPreviewHtml(str) {
str = str.replace(/{anote([^}]*)\/}/g, '<joe-anote $1></joe-anote>');
str = str.replace(/{dotted([^}]*)\/}/g, '<joe-dotted $1></joe-dotted>');
str = str.replace(/{hide[^}]*}(.*?){\/hide}/g, '<joe-hide></joe-hide>');
str = str.replace(/{card-default([^}]*)}(.*?){\/card-default}/g, '<section style="margin-bottom: 15px"><joe-card-default $1><span class="_temp" style="display: none">$2</span></joe-card-default></section>');
$('.cm-preview-content').html(str);
const div = document.createElement('div');
div.innerHTML = str;
div.innerHTML = div.innerHTML.replace(/<p><\/p>/g, '');
const _ = div.innerHTML;
$('.cm-preview-content').html(_);
$('.cm-preview-content pre code').each((i, el) => Prism.highlightElement(el));
}

View File

@@ -160,6 +160,11 @@ export default [
title: '回复可见',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M342.016 640.512a483.328 483.328 0 0 1-126.976-63.488l-104.96 102.4a51.2 51.2 0 0 1-71.168-74.24l102.4-96.256a419.328 419.328 0 0 1-84.48-133.12 51.2 51.2 0 1 1 95.744-34.816 278.016 278.016 0 0 0 15.872 32.256 378.88 378.88 0 0 0 55.808 77.312A381.952 381.952 0 0 0 512 563.2a382.464 382.464 0 0 0 286.208-112.64 378.88 378.88 0 0 0 58.368-77.312 278.016 278.016 0 0 0 13.824-32.256 51.2 51.2 0 1 1 95.744 34.816 419.328 419.328 0 0 1-84.48 133.12l102.4 96.256a51.2 51.2 0 0 1-71.168 73.216L807.936 576a460.8 460.8 0 0 1-125.952 62.976l58.368 102.4a51.2 51.2 0 0 1-88.576 51.2l-74.752-130.048A521.728 521.728 0 0 1 512 665.6q-32.256 0-62.976-3.072l-76.8 129.536a51.2 51.2 0 0 1-88.576-51.2z"/></svg>'
},
{
type: 'card-default',
title: '默认卡片',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M928 160H96a32 32 0 0 0-32 32v672a32 32 0 0 0 32 32h832a32 32 0 0 0 32-32V192a32 32 0 0 0-32-32zm-32 672H128V224h768v608zM230.592 448.096H544a32 32 0 1 0 0-64H230.592a32 32 0 0 0 0 64zm0 192H544a32 32 0 1 0 0-64H230.592a32 32 0 1 0 0 64zM768 704a32 32 0 0 0 32-32V350.016a32 32 0 1 0-64 0V672a32 32 0 0 0 32 32z"/></svg>'
},
/* --------------------------- 短代码结束 --------------------------- */
{
type: 'clean',

File diff suppressed because one or more lines are too long

View File

@@ -292,6 +292,9 @@ class Joe extends JoeAction {
case 'hide':
super.handleHide(this.cm);
break;
case 'card-default':
super.handleCardDefault(this.cm);
break;
}
});
$('.cm-tools').append(el);