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

@@ -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;