This commit is contained in:
haoouba
2021-03-28 15:40:48 +08:00
parent d02cfcd81d
commit bd2e97857b
14 changed files with 1489 additions and 53 deletions

File diff suppressed because one or more lines are too long

View File

@@ -203,11 +203,6 @@ body.fullscreen {
color: #606266;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
h1,
h2,
h3,
@@ -217,6 +212,7 @@ body.fullscreen {
color: #303133;
font-size: 18px;
line-height: 24px;
margin: 0;
margin-bottom: 15px;
position: relative;
}
@@ -299,6 +295,7 @@ body.fullscreen {
}
}
hr {
margin: 0;
border: none;
height: 1px;
background-color: #e4e7ed;
@@ -306,9 +303,11 @@ body.fullscreen {
}
p {
line-height: 26px;
margin: 0;
margin-bottom: 15px;
}
blockquote {
margin: 0;
line-height: 26px;
margin-bottom: 15px;
background: #ecf8ff;
@@ -320,7 +319,22 @@ body.fullscreen {
margin: 0;
}
}
code {
pre {
margin: 0;
margin-bottom: 15px;
&::-webkit-scrollbar-track {
background: #fff;
}
&::-webkit-scrollbar {
width: 6px;
height: 6px;
}
&::-webkit-scrollbar-thumb {
border-radius: 3px;
background: #c0c4cc;
}
}
p code {
display: inline-block;
min-height: 26px;
line-height: 26px;
@@ -331,24 +345,9 @@ body.fullscreen {
color: #e6a23c;
vertical-align: top;
}
pre {
background: #f0f0ec;
padding: 15px;
margin-bottom: 15px;
}
pre code {
display: unset;
vertical-align: unset;
min-height: unset;
line-height: unset;
border-radius: unset;
font-size: unset;
background: unset;
padding: unset;
color: unset;
}
ol,
ul {
margin: 0;
margin-bottom: 15px;
padding-left: 36px;
li {
@@ -392,17 +391,13 @@ body.fullscreen {
}
}
}
img:not(.owo_image) {
img {
display: block;
max-width: 100%;
border-radius: 4px;
transition: transform 0.35s, box-shadow 0.35s;
margin: 0 auto;
}
.owo_image {
max-height: 26px;
vertical-align: top;
}
a {
display: inline-block;
line-height: 26px;

View File

@@ -306,11 +306,49 @@ export default class JoeAction {
innerHtml: `
<div class="fitem">
<label>语言类型</label>
<input autocomplete="off" name="type" placeholder="请输入语言类型(英文)"/>
<select name="type">
<option value="">- 请选择语言类型 -</option>
<option value="html">HTML</option>
<option value="php">PHP</option>
<option value="javascript">JavaScript</option>
<option value="typescript">TypeScript</option>
<option value="css">Css</option>
<option value="css-extras">Css-Extras</option>
<option value="sass">Sass</option>
<option value="scss">Scss</option>
<option value="less">Less</option>
<option value="go">GO</option>
<option value="java">Java</option>
<option value="json">Json</option>
<option value="bash">Bash</option>
<option value="git">Git</option>
<option value="markup">Markup</option>
<option value="clike">Clike</option>
<option value="batch">Batch</option>
<option value="c">C</option>
<option value="csharp">Csharp</option>
<option value="cpp">Cpp</option>
<option value="diff">Diff</option>
<option value="docker">Docker</option>
<option value="latex">Latex</option>
<option value="markdown">Markdown</option>
<option value="markup-templating">Markup-Templating</option>
<option value="mongodb">Mongodb</option>
<option value="nginx">Nginx</option>
<option value="objectivec">Objectivec</option>
<option value="powershell">PowerShell</option>
<option value="python">Python</option>
<option value="jsx">Jsx</option>
<option value="ruby">Ruby</option>
<option value="sql">SQL</option>
<option value="stylus">Stylus</option>
<option value="swift">Swift</option>
<option value="velocity">Velocity</option>
</select>
</div>
`,
confirm: () => {
const type = $(".cm-modal input[name='type']").val() || 'html';
const type = $(".cm-modal select[name='type']").val() || 'html';
const htmlStr = `\`\`\`${type}\ncode here...\n\`\`\``;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n\n' + htmlStr);
else this._replaceSelection(cm, htmlStr);

View File

@@ -82,7 +82,7 @@ export default [
{
type: 'emoji',
title: '符号表情',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M512 56.889A455.111 455.111 0 0 0 56.889 512 455.111 455.111 0 0 0 512 967.111 455.111 455.111 0 0 0 967.111 512 455.111 455.111 0 0 0 512 56.889zm111.047 270.336A69.086 69.086 0 0 1 671.29 307.2c17.863 0 35.67 7.396 48.242 20.025 12.629 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zm-318.578 0a69.086 69.086 0 0 1 48.242-20.025c17.863 0 35.67 7.396 48.242 20.025 12.63 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zM786.375 566.67c-10.24 132.893-118.556 236.544-270.563 235.975-156.331 1.707-264.704-107.178-270.507-235.975a23.324 23.324 0 0 1-2.446-10.41c0-13.597 11.605-24.633 26.282-24.52h493.796c14.336 0 26.055 11.037 26.055 24.52a24.292 24.292 0 0 1-2.617 10.41z"/></svg>'
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="19" height="19"><path d="M512 56.889A455.111 455.111 0 0 0 56.889 512 455.111 455.111 0 0 0 512 967.111 455.111 455.111 0 0 0 967.111 512 455.111 455.111 0 0 0 512 56.889zm111.047 270.336A69.086 69.086 0 0 1 671.29 307.2c17.863 0 35.67 7.396 48.242 20.025 12.629 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zm-318.578 0a69.086 69.086 0 0 1 48.242-20.025c17.863 0 35.67 7.396 48.242 20.025 12.63 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zM786.375 566.67c-10.24 132.893-118.556 236.544-270.563 235.975-156.331 1.707-264.704-107.178-270.507-235.975a23.324 23.324 0 0 1-2.446-10.41c0-13.597 11.605-24.633 26.282-24.52h493.796c14.336 0 26.055 11.037 26.055 24.52a24.292 24.292 0 0 1-2.617 10.41z"/></svg>'
},
{
type: 'code-block',

File diff suppressed because it is too large Load Diff

1
typecho/write/js/joe.parse.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -22,6 +22,12 @@ class Joe extends JoeAction {
this.init_Insert();
}
_createPreviewHtml(str) {
str = this.parser.makeHtml(str);
$('.cm-preview-content').html(str);
$('.cm-preview-content pre code').each((i, el) => Prism.highlightElement(el));
}
/* 已测 √ */
init_ViewPort() {
if ($('meta[name="viewport"]').length > 0) $('meta[name="viewport"]').attr('content', 'width=device-width, user-scalable=no, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover');
@@ -35,14 +41,13 @@ class Joe extends JoeAction {
<div class="cm-tools"></div>
<div class="cm-mainer">
<div class="cm-resize"></div>
<div class="cm-preview">
<div class="cm-preview-content">${this.parser.makeHtml($('#text').val())}</div>
</div>
<div class="cm-preview"><div class="cm-preview-content"></div></div>
</div>
<div class="cm-progress-left"></div>
<div class="cm-progress-right"></div>
</div>
`);
this._createPreviewHtml($('#text').val());
const cm = new EditorView({
state: EditorState.create({
doc: $('#text').val(),
@@ -51,7 +56,7 @@ class Joe extends JoeAction {
keymap.of([defaultTabBinding, ...defaultKeymap, ...historyKeymap, ...closeBracketsKeymap]),
EditorView.updateListener.of(update => {
if (!update.docChanged) return;
$('.cm-preview-content').html(this.parser.makeHtml(update.state.doc.toString()));
this._createPreviewHtml(update.state.doc.toString());
}),
EditorView.domEventHandlers({
paste: e => {
@@ -240,10 +245,10 @@ class Joe extends JoeAction {
super.handleAbout();
break;
case 'character':
super._createTableLists(this.cm, JoeConfig.characterAPI, '星星符号', '字符大全')
super._createTableLists(this.cm, JoeConfig.characterAPI, '星星符号', '字符大全');
break;
case 'emoji':
super._createTableLists(this.cm, JoeConfig.emojiAPI, '表情', '符号表情(需数据库支持)')
super._createTableLists(this.cm, JoeConfig.emojiAPI, '表情', '符号表情(需数据库支持)');
break;
}
});