From 72bfa487459337e68776fd3b269ff25203066242 Mon Sep 17 00:00:00 2001 From: jonny <475634114@qq.com> Date: Sun, 31 Jan 2021 21:00:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=95=E7=94=A8=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=20(#61)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 增加引用样式 * 增加引用样式 * 增加引用样式 --- static/editor.md/css/editormd.css | 34 +++++++++++++++++++---- static/editor.md/css/editormd.preview.css | 30 ++++++++++++++++---- static/editor.md/editormd.js | 28 +++++++++++++++++++ 3 files changed, 82 insertions(+), 10 deletions(-) diff --git a/static/editor.md/css/editormd.css b/static/editor.md/css/editormd.css index 1efa4a3..d574a4b 100644 --- a/static/editor.md/css/editormd.css +++ b/static/editor.md/css/editormd.css @@ -3836,12 +3836,36 @@ background-color: #fff; } .editormd-preview-container blockquote, .editormd-html-preview blockquote { - color: #666; - border-left: 4px solid #ddd; - padding-left: 20px; - margin-left: 0; + color: #2C3E50; + border-left: 5px solid #D6DBDF; font-size: 14px; - /* font-style: italic; */ + background: none repeat scroll 0 0 rgba(102,128,153,.05); + margin: 8px 0; + padding: 8px 16px; +} +.editormd-preview-container blockquote.default, .editormd-html-preview blockquote.default { + + +} +.editormd-preview-container blockquote.info, .editormd-html-preview blockquote.info { + border-left-color: #5bc0de; + color: #5bc0de; + background-color: #f4f8fa +} +.editormd-preview-container blockquote.warning, .editormd-html-preview blockquote.warning { + background-color: #fcf8f2; + border-color: #f0ad4e; + color: #f0ad4e +} +.editormd-preview-container blockquote.danger, .editormd-html-preview blockquote.danger { + color: #d9534f; + background-color: #fdf7f7; + border-color: #d9534f +} +.editormd-preview-container blockquote.success, .editormd-html-preview blockquote.success { + background-color: #f3f8f3; + border-color: #50af51; + color: #50af51 } .editormd-preview-container p code, .editormd-html-preview p code { margin-left: 5px; diff --git a/static/editor.md/css/editormd.preview.css b/static/editor.md/css/editormd.preview.css index 6030330..99067d7 100644 --- a/static/editor.md/css/editormd.preview.css +++ b/static/editor.md/css/editormd.preview.css @@ -3120,12 +3120,32 @@ background-color: #fff; } .editormd-preview-container blockquote, .editormd-html-preview blockquote { - color: #666; - border-left: 4px solid #ddd; - padding-left: 20px; - margin-left: 0; + color: #2C3E50; + border-left: 4px solid #D6DBDF; font-size: 14px; - font-style: italic; + background: none repeat scroll 0 0 rgba(102,128,153,.05); + margin: 8px 0; + padding: 8px 16px; +} +.editormd-preview-container blockquote.info, .editormd-html-preview blockquote.info { + border-left-color: #5bc0de; + color: #5bc0de; + background-color: #f4f8fa +} +.editormd-preview-container blockquote.warning, .editormd-html-preview blockquote.warning { + background-color: #fcf8f2; + border-color: #f0ad4e; + color: #f0ad4e +} +.editormd-preview-container blockquote.danger, .editormd-html-preview blockquote.danger { + color: #d9534f; + background-color: #fdf7f7; + border-color: #d9534f +} +.editormd-preview-container blockquote.success, .editormd-html-preview blockquote.success { + background-color: #f3f8f3; + border-color: #50af51; + color: #50af51 } .editormd-preview-container p code, .editormd-html-preview p code { margin-left: 5px; diff --git a/static/editor.md/editormd.js b/static/editor.md/editormd.js index 3bb94e6..79d3e30 100644 --- a/static/editor.md/editormd.js +++ b/static/editor.md/editormd.js @@ -3532,6 +3532,34 @@ var editormdLogoReg = regexs.editormdLogo; var pageBreakReg = regexs.pageBreak; + // 增加引用样式解析规则 + markedRenderer.blockquote = function($quote) { + var quoteBegin = ""; + + var ps = $quote.match(/
/i); + + if(ps !== null) { + quoteBegin = ps[0]; + $quote = $quote.substr(3); + } + var $class = "default"; + + if($quote.indexOf("i") === 0){ + $class = "info"; + $quote = $quote.substr(1); + }else if($quote.indexOf("w") === 0){ + $class = "warning"; + $quote = $quote.substr(1); + }else if($quote.indexOf("s") === 0){ + $class = "success"; + $quote = $quote.substr(1); + }else if($quote.indexOf("d") === 0){ + $class = "danger"; + $quote = $quote.substr(1); + } + + return '
\n' + quoteBegin + $quote + '\n'; + }; // marked 解析图片 markedRenderer.image = function(href,title,text) { var attr = "";