更新
This commit is contained in:
parent
2840f786c0
commit
75e7306f8a
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
@ -1454,6 +1454,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
.joe_gird {
|
||||
display: grid;
|
||||
&__item {
|
||||
*:last-child {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
.joe_checkbox {
|
||||
-webkit-appearance: none;
|
||||
position: relative;
|
||||
|
@ -563,6 +563,35 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
);
|
||||
|
||||
customElements.define(
|
||||
'joe-gird',
|
||||
class JoeGird extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
column: isNaN(this.getAttribute('column')) || !this.getAttribute('column') ? 3 : this.getAttribute('column'),
|
||||
gap: isNaN(this.getAttribute('gap')) || !this.getAttribute('gap') ? 15 : this.getAttribute('gap')
|
||||
};
|
||||
const _temp = getChildren(this, '_temp');
|
||||
let _innerHTML = _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '');
|
||||
let contents = '';
|
||||
_innerHTML.replace(/{gird-item}([\s\S]*?){\/gird-item}/g, function ($0, $1) {
|
||||
contents += `<div class="joe_gird__item">${$1.trim().replace(/^(<br>)|(<br>)$/g, '')}</div>`;
|
||||
});
|
||||
let htmlStr = `<div class="joe_gird" style="gap: ${this.options.gap}px; grid-template-columns: repeat(${this.options.column}, 1fr);">${contents}</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);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
customElements.define(
|
||||
'joe-copy',
|
||||
class JoeCopy extends HTMLElement {
|
||||
|
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') ?>">
|
||||
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=202104261755') ?>">
|
||||
<script>
|
||||
window.JoeConfig = {
|
||||
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
|
||||
@ -66,8 +66,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=20210426') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.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>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* 获取主题当前版本号 */
|
||||
function _getVersion()
|
||||
{
|
||||
return "6.6.9";
|
||||
return "6.7.0";
|
||||
};
|
||||
|
||||
/* 判断是否是手机 */
|
||||
|
@ -81,6 +81,9 @@ function _parseContent($post, $login)
|
||||
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, '{gird') !== false) {
|
||||
$content = preg_replace('/{gird([^}]*)}([\s\S]*?){\/gird}/', '<section style="margin-bottom: 15px"><joe-gird $1><span class="_temp" style="display: none">$2</span></joe-gird></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.9",
|
||||
"version": "6.7.0",
|
||||
"description": "A Theme Of Typecho",
|
||||
"main": "index.php",
|
||||
"keywords": [
|
||||
|
@ -18,7 +18,7 @@
|
||||
<?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=202104251307'); ?>">
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=202104261755'); ?>">
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css?v=20210425'); ?>">
|
||||
<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" />
|
||||
|
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
@ -1215,6 +1215,15 @@ body.fullscreen {
|
||||
}
|
||||
}
|
||||
|
||||
.joe_gird {
|
||||
display: grid;
|
||||
&__item {
|
||||
*:last-child {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.cm-modal__wrapper {
|
||||
width: 90%;
|
||||
|
@ -300,6 +300,29 @@ export default class JoeAction {
|
||||
}
|
||||
});
|
||||
}
|
||||
handleGird(cm) {
|
||||
this._openModal({
|
||||
title: '插入宫格',
|
||||
innerHtml: `
|
||||
<div class="fitem">
|
||||
<label>宫格列数</label>
|
||||
<input value="3" autocomplete="off" name="column" placeholder="请输入宫格列数"/>
|
||||
</div>
|
||||
<div class="fitem">
|
||||
<label>宫格间隔</label>
|
||||
<input value="15" autocomplete="off" name="gap" placeholder="请输入宫格间隔"/>
|
||||
</div>
|
||||
`,
|
||||
confirm: () => {
|
||||
const column = $(".cm-modal input[name='column']").val();
|
||||
const gap = $(".cm-modal input[name='gap']").val();
|
||||
const htmlStr = `{gird column="${column}" gap="${gap}"}\n{gird-item}\n 宫格内容一\n{/gird-item}\n{gird-item}\n 宫格内容二\n{/gird-item}\n{gird-item}\n 宫格内容三\n{/gird-item}\n{/gird}`;
|
||||
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n\n' + htmlStr);
|
||||
else this._replaceSelection(cm, htmlStr);
|
||||
cm.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
handleCodeBlock(cm) {
|
||||
const language = 'rss+atom+ssml+mathml+svg+html+markup+css+clike+javascript+abap+abnf+actionscript+ada+agda+al+antlr4+apacheconf+apex+apl+applescript+aql+arduino+arff+asciidoc+aspnet+asm6502+autohotkey+autoit+bash+basic+batch+bbcode+birb+bison+bnf+brainfuck+brightscript+bro+bsl+c+csharp+cpp+cfscript+chaiscript+cil+clojure+cmake+cobol+coffeescript+concurnas+csp+coq+crystal+css-extras+csv+cypher+d+dart+dataweave+dax+dhall+diff+django+dns-zone-file+docker+dot+ebnf+editorconfig+eiffel+ejs+elixir+elm+etlua+erb+erlang+excel-formula+fsharp+factor+false+firestore-security-rules+flow+fortran+ftl+gml+gcode+gdscript+gedcom+gherkin+git+glsl+go+graphql+groovy+haml+handlebars+haskell+haxe+hcl+hlsl+http+hpkp+hsts+ichigojam+icon+icu-message-format+idris+ignore+inform7+ini+io+j+java+javadoc+javadoclike+javastacktrace+jexl+jolie+jq+jsdoc+js-extras+json+json5+jsonp+jsstacktrace+js-templates+julia+keyman+kotlin+kumir+latex+latte+less+lilypond+liquid+lisp+livescript+llvm+log+lolcode+lua+makefile+markdown+markup-templating+matlab+mel+mizar+mongodb+monkey+moonscript+n1ql+n4js+nand2tetris-hdl+naniscript+nasm+neon+nevod+nginx+nim+nix+nsis+objectivec+ocaml+opencl+openqasm+oz+parigp+parser+pascal+pascaligo+psl+pcaxis+peoplecode+perl+php+phpdoc+php-extras+plsql+powerquery+powershell+processing+prolog+promql+properties+protobuf+pug+puppet+pure+purebasic+purescript+python+qsharp+q+qml+qore+r+racket+jsx+tsx+reason+regex+rego+renpy+rest+rip+roboconf+robotframework+ruby+rust+sas+sass+scss+scala+scheme+shell-session+smali+smalltalk+smarty+sml+solidity+solution-file+soy+sparql+splunk-spl+sqf+sql+squirrel+stan+iecst+stylus+swift+t4-templating+t4-cs+t4-vb+tap+tcl+tt2+textile+toml+turtle+twig+typescript+typoscript+unrealscript+uri+v+vala+vbnet+velocity+verilog+vhdl+vim+visual-basic+warpscript+wasm+wiki+xeora+xml-doc+xojo+xquery+yaml+yang+zig';
|
||||
const languageArr = language.split('+').sort((a, b) => a.localeCompare(b));
|
||||
@ -759,7 +782,7 @@ export default class JoeAction {
|
||||
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()
|
||||
cm.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -811,7 +834,7 @@ export default class JoeAction {
|
||||
const str = `\n{cloud title="${title}" type="${type}" url="${url}" password="${password}"/}\n\n`;
|
||||
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
|
||||
else this._replaceSelection(cm, str);
|
||||
cm.focus()
|
||||
cm.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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('{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>');
|
||||
}
|
||||
|
||||
$('.cm-preview-content').html(str);
|
||||
$('.cm-preview-content p:empty').remove();
|
||||
|
@ -225,6 +225,11 @@ export default [
|
||||
title: '云盘下载',
|
||||
innerHTML: '<svg viewBox="0 0 1462 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M1435.063 668.453a348.891 348.891 0 0 1-102.766 248.246 348.891 348.891 0 0 1-247.003 102.84H377.71a348.891 348.891 0 0 1-247.004-102.84A348.891 348.891 0 0 1 27.941 668.526c0-93.843 36.498-181.98 102.765-248.32a348.672 348.672 0 0 1 210.36-100.937c17.553-69.486 53.54-133.12 105.544-185.125a399.067 399.067 0 0 1 284.16-117.76c130.853 0 253.806 63.927 329.143 171.154a50.25 50.25 0 0 1-82.286 57.71 302.007 302.007 0 0 0-246.71-128.293 302.08 302.08 0 0 0-286.062 206.483c-5.12 15.36-8.997 40.52-11.63 61.805a37.376 37.376 0 0 1-39.058 32.915 257.902 257.902 0 0 0-65.024 4.535 251.1 251.1 0 0 0-200.631 249.782c2.194 135.607 117.467 246.492 253.074 246.492h699.831c136.631 0 249.93-108.252 252.928-244.736a250.88 250.88 0 0 0-250.514-256.512 250.807 250.807 0 0 0-250.514 249.929 51.931 51.931 0 0 1-45.861 50.688 50.322 50.322 0 0 1-54.71-50.03c0-93.842 36.497-182.052 102.765-248.32a348.891 348.891 0 0 1 248.32-102.839c93.842 0 181.98 36.572 248.32 102.84a349.623 349.623 0 0 1 102.912 248.539z"/></svg>'
|
||||
},
|
||||
{
|
||||
type: 'gird',
|
||||
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: 'clean',
|
||||
|
File diff suppressed because one or more lines are too long
@ -336,6 +336,9 @@ class Joe extends JoeAction {
|
||||
case 'cloud':
|
||||
super.handleCloud(this.cm);
|
||||
break;
|
||||
case 'gird':
|
||||
super.handleGird(this.cm);
|
||||
break;
|
||||
case 'preview':
|
||||
el.toggleClass('active');
|
||||
if (el.hasClass('active')) window.JoeConfig.canPreview = true;
|
||||
|
Loading…
Reference in New Issue
Block a user