Skip to content

Commit 4cd01d1

Browse files
author
F-loat
committed
fixed F-loat#21
- remove import('highlight.js')
1 parent 3c3225a commit 4cd01d1

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
- vue@^2.0
1313
- webpack@^2.0
1414

15-
## Install vue-simplemde
15+
## Install
1616

1717
``` bash
1818
npm install vue-simplemde --save
@@ -43,7 +43,7 @@ export default {
4343
| 属性 | 类型 | 默认值 | 描述 |
4444
| ----| ----- | ----- | ---- |
4545
| value | String || 初始值,可使用v-model绑定 |
46-
| previewClass | String || 自定义预览样式类 |
46+
| preview-class | String || 自定义预览样式类 |
4747
| autoinit | Boolean | true | 是否自动初始化 |
4848
| highlight | Boolean | false | 是否开启高亮 |
4949
| configs | Object | {} | [SimpleMDE的配置项](#configuration) |
@@ -163,11 +163,24 @@ $ npm install --save github-markdown-css
163163
```
164164

165165
## Highlight
166+
167+
### install
168+
```
169+
$ npm install --save highlight.js
170+
```
171+
172+
### use
166173
``` vue
167174
<template>
168175
<markdown-editor :highlight="true"></markdown-editor>
169176
</template>
170177
178+
<script>
179+
import hljs from 'highlight.js';
180+
181+
window.hljs = hljs;
182+
</script>
183+
171184
<style>
172185
@import '~simplemde/dist/simplemde.min.css';
173186
@import '~highlight.js/styles/atom-one-dark.css';
@@ -200,7 +213,6 @@ $ npm install --save simplemde-theme-base
200213
## Dependencies
201214

202215
* [SimpleMDE](https://github.com/sparksuite/simplemde-markdown-editor)
203-
* [Highlight.js](https://github.com/isagalaev/highlight.js)
204216

205217
## Licence
206218

examples/index.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040

4141
<script>
4242
import markdownEditor from 'vue-simplemde/src/markdown-editor';
43+
import hljs from 'highlight.js';
44+
45+
window.hljs = hljs;
46+
4347
export default {
4448
name: 'index',
4549
components: {

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-simplemde",
3-
"version": "0.4.2",
3+
"version": "0.4.3",
44
"description": "SimpleMDE - Markdown Editor component for Vue.js",
55
"main": "index.js",
66
"scripts": {
@@ -17,7 +17,6 @@
1717
},
1818
"license": "MIT",
1919
"dependencies": {
20-
"highlight.js": "^9.12.0",
2120
"simplemde": "^1.11.2"
2221
},
2322
"repository": {

src/markdown-editor.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ export default {
5252
// 判断是否开启代码高亮
5353
if (this.highlight) {
5454
configs.renderingConfig.codeSyntaxHighlighting = true;
55-
import('highlight.js').then((hljs) => {
56-
window.hljs = hljs;
57-
});
5855
}
5956
6057
// 实例化编辑器

0 commit comments

Comments
 (0)