File tree Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Expand file tree Collapse file tree 3 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,23 @@ export default {
95
95
}
96
96
```
97
97
98
- ## [ Editor Theme] ( https://github.com/xcatliu/simplemde-theme-base/wiki/List-of-themes )
98
+ ## Editor Theme ([ simplemde-theme-base] ( https://github.com/xcatliu/simplemde-theme-base/wiki/List-of-themes ) )
99
+ > e.g. 使用simplemde-theme-base主题
100
+
101
+ ### install
102
+ ```
103
+ $ npm install --save simplemde-theme-base
104
+ ```
105
+
106
+ ### use
107
+ ``` html
108
+ <markdown-editor :custom-theme =" true" ></markdown-editor >
109
+ ```
110
+
111
+ ``` javascript
112
+ import ' simplemde-theme-base/dist/simplemde-theme-base.min.css'
113
+ ```
114
+
99
115
100
116
## Markdown style
101
117
> e.g. 使用Github的markdown样式
Original file line number Diff line number Diff line change 6
6
7
7
<script >
8
8
import SimpleMDE from ' simplemde'
9
- import ' simplemde/dist/simplemde.min.css'
10
9
11
10
export default {
12
11
name: ' markdown-editor' ,
13
12
props: {
14
13
value: String ,
15
14
previewClass: String ,
15
+ customTheme: {
16
+ type: Boolean ,
17
+ default () {
18
+ return false
19
+ }
20
+ },
16
21
configs: {
17
22
type: Object ,
18
23
default () {
@@ -32,7 +37,7 @@ export default {
32
37
// 实例化编辑器
33
38
this .simplemde = new SimpleMDE (configs)
34
39
35
- // 开启代码高亮
40
+ // 判断是否开启代码高亮
36
41
if (configs .renderingConfig && configs .renderingConfig .codeSyntaxHighlighting ) {
37
42
require .ensure ([], () => {
38
43
var theme = configs .renderingConfig .highlightingTheme || ' default'
@@ -41,6 +46,11 @@ export default {
41
46
}, ' highlight' )
42
47
}
43
48
49
+ // 判断是否引入样式文件
50
+ if (! this .customTheme ) {
51
+ require (' simplemde/dist/simplemde.min.css' )
52
+ }
53
+
44
54
// 添加自定义 previewClass
45
55
var _class = this .previewClass || ' '
46
56
if (configs .renderingConfig && configs .renderingConfig .codeSyntaxHighlighting ) {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-simplemde" ,
3
- "version" : " 0.2.6 " ,
3
+ "version" : " 0.2.9 " ,
4
4
"description" : " SimpleMDE - Markdown Editor component for Vue.js" ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments