Skip to content

Commit

Permalink
发布1.4.0版本
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoxh committed Oct 28, 2019
1 parent 952d702 commit b8b636f
Show file tree
Hide file tree
Showing 32 changed files with 1,981 additions and 1,770 deletions.
13 changes: 10 additions & 3 deletions .editorconfig
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
indent_size = 4
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Created by .ignore support plugin (hsz.mobi)
src/markdown/font/*.js
src/doc.js
src/markdown/js/hljs.js
22 changes: 22 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"rules": {},
"env": {
"es6": true,
"browser": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"extends": [
"eslint:recommended",
"plugin:vue/essential"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"plugins": [
"vue"
]
}
5 changes: 2 additions & 3 deletions dist/build.js

Large diffs are not rendered by default.

Binary file removed dist/build.js.gz
Binary file not shown.
1 change: 0 additions & 1 deletion dist/build.js.map

This file was deleted.

Binary file removed dist/build.js.map.gz
Binary file not shown.
Binary file modified dist/iconfont.eot
Binary file not shown.
Binary file removed dist/iconfont.eot.gz
Binary file not shown.
9 changes: 9 additions & 0 deletions dist/iconfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed dist/iconfont.svg.gz
Binary file not shown.
Binary file modified dist/iconfont.ttf
Binary file not shown.
Binary file removed dist/iconfont.ttf.gz
Binary file not shown.
Binary file modified dist/iconfont.woff
Binary file not shown.
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vue-meditor",
"description": "一款使用marked和highlight.js开发的一款markdown编辑器",
"version": "1.3.1",
"version": "1.4.1",
"author": "zhaoxuhui<1258835133@qq.com>",
"license": "MIT",
"main": "build/index.js",
Expand All @@ -13,7 +13,10 @@
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
"build:npm": "cross-env NODE_ENV=npm webpack --progress --hide-modules"
"build:npm": "cross-env NODE_ENV=npm webpack --progress --hide-modules",
"analyzer": "cross-env analyzer=true NODE_ENV=npm webpack --progress --hide-modules",
"lint": "eslint --ext .js src ",
"lint:fix": "eslint --fix --ext .js src"
},
"dependencies": {
"highlight.js": "^9.12.0",
Expand All @@ -31,17 +34,23 @@
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"compression-webpack-plugin": "^1.1.11",
"cross-env": "^5.2.0",
"css-loader": "^0.28.11",
"compression-webpack-plugin": "^1.1.11",
"eslint": "^6.6.0",
"eslint-plugin-vue": "^5.2.3",
"file-loader": "^1.1.4",
"less": "^3.0.4",
"less-loader": "^4.1.0",
"vue-loader": "^13.0.5",
"vue-template-compiler": "^2.4.4",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^3.6.0",
"webpack-dev-server": "^2.9.1"
},
"readmeFilename": "README.md",
"files":["build","README.md"]
"files": [
"build",
"README.md"
]
}
149 changes: 82 additions & 67 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,86 +1,101 @@
<template>
<div id="app">
<div class="container">
<h1>vue-markdown编辑器组件</h1>
<a target="_blank" href="https://github.com/zhaoxuhui1122/vue-markdown">使用文档</a>
<div class="content">
<mark-down @on-paste-image="handlePasteImage" @on-save="save" :theme="theme" :initialValue="initialValue" :markedOptions="{baseUrl:'http://smalleyes.oss-cn-shanghai.aliyuncs.com/'}"></mark-down>
</div>
<div id="app">
<div class="container">
<h1>vue-markdown编辑器组件</h1>
<a target="_blank" href="https://github.com/zhaoxuhui1122/vue-markdown">使用文档</a>
<div class="content">
<mark-down
@on-paste-image="handlePasteImage"
@on-save="save"
:theme="theme"
v-model="value"
@on-theme-change="onThemeChange"
:markedOptions="{baseUrl:'http://smalleyes.oss-cn-shanghai.aliyuncs.com/'}"/>
</div>
</div>
</div>
</div>
</template>

<script>
import MarkDown from './markdown/index' // 开发文件
// import MarkDown from "../build"; // 引入打包好的文件
// import MarkDown from 'vue-meditor';
import MarkDown from './markdown/index' // 开发文件
// import MarkDown from "../build"; // 引入打包好的文件
// import MarkDown from 'vue-meditor';
import doc from './doc';
export default {
name: "app",
components: {
MarkDown
},
data() {
return {
initialValue: "",
theme: 'OneDark'
};
},
methods: {
save(res) {
console.log(res);
},
handlePasteImage(res) {
console.log(res);
}
},
mounted() {
setTimeout(() => {
this.initialValue = doc;
}, 1000);
import doc from './doc';
}
};
export default {
name: "app",
components: {
MarkDown
},
data() {
return {
value: "",
theme: 'OneDark'
};
},
methods: {
save(res) {
console.log(res);
},
handlePasteImage(res) {
console.log(res);
},
onThemeChange(theme) {
console.log(theme)
}
},
mounted() {
setTimeout(() => {
this.value = doc;
}, 1000);
},
watch: {
value() {
console.log(this.value)
}
}
};
</script>

<style scoped lang="less">
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
width: 1200px;
margin: 0 auto;
.container {
width: 80vw;
margin: 0 auto;
h1 {
font-size: 26px;
font-weight: 400;
margin: 12px 0;
}
h1 {
font-size: 26px;
font-weight: 400;
margin: 12px 0;
}
a {
display: inline-block;
background-color: #f8f8f9;
border-radius: 4px;
padding: 8px 16px;
border: 1px solid #edeff0;
border-radius: 4px;
margin-bottom: 20px;
text-decoration: none;
color: #2d8cf0;
}
a {
display: inline-block;
background-color: #f8f8f9;
border-radius: 4px;
padding: 8px 16px;
border: 1px solid #edeff0;
border-radius: 4px;
margin-bottom: 20px;
text-decoration: none;
color: #2d8cf0;
}
ul {
list-style: none;
}
ul {
list-style: none;
}
.content {
border: 1px solid #ccc;
.content {
/*border: 1px solid #ccc;*/
}
}
}
</style>
32 changes: 23 additions & 9 deletions src/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,29 +37,34 @@ components:{
...
<template>
<mark-down/>
<mark-down v-model="value"/>
</template>
\`\`\`
### 4.props
名称 | 类型|说明|默认值
---|---|---|---
initialValue|String|编辑器初始化内容
value|Number、String|输入框内的值,支持数据双向绑定(1.4.0新增)|''
width|Number|编辑器宽度|
height|Number|编辑器高度,单位 px|600
theme|String|代码块主题配置,共有四个值,分别为Light、Dark、OneDark、GitHub|Light
autoSave|Boolean|是否自动保存|true
autoSave|Boolean|是否自动保存|false
interval|Number|自动保存频率,单位毫秒|10000
toolbars|Object|工具栏配置,具体功能详见工具栏功能配置表
exportFileName|String|导出文件的名称|未命名文件
bordered|Boolean|是否存在边框(1.4.0新增)|true
isPreview|Boolean|是否是预览模式,预览模式工具栏将不会显示,单纯的用作展示md文件(1.4.0新增)|false
### 5.events
名称 | 说明
---|---
on-save|自动保存或者手动保存时触发,返回当前编辑器内原始输入内容和转以后的内容
on-paste-image|粘贴图片,返回当前粘贴的file文件
on-theme-change|切换主题时触发,返回当前主题名称
on-copy|复制代码后触发|返回复制的内容
### 6.工具栏配置
名称 | 说明 | 默认显示
Expand All @@ -83,20 +88,23 @@ image|image|是
table |表格|是
checked|已完成列表|是
notChecked |未完成列表|是
shift|预览|是
preview|预览|是
split|分屏模式切换|是
print |打印|否
theme|主题切换|是
fullscreen |全屏|是
exportmd|导出为*.md文件|是
importmd|导入本地*.md文件|是
save|保存按钮|否
clear|清空内容|否
### 7.其他说明
**关于保存时返回值**
\`\`\`
value // 编辑器输入的原始内容
html // 右侧现实的问转义后的内容
theme // 保存时的主题名字
{
value, // 编辑器输入的原始内容
theme, // 保存时的主题名字
}
\`\`\`
**标题配置**
Expand Down Expand Up @@ -125,6 +133,13 @@ const config = {
### 更新日志
**1.4.0**
- 支持输入值双向数据绑定
- 支持预览模式
- 支持复制代码块
- 工具栏增加增加清空内容、保存、分屏、预览功能
**1.3.0**
- 支持配置marked的markedOptions,感谢[dkvirus](https://github.com/dkvirus)提出的[issues#12](https://github.com/zhaoxuhui1122/vue-markdown/issues/12)和具体的解决办法
Expand Down Expand Up @@ -159,5 +174,4 @@ const config = {
- 修复主题无法更新的问题
- 修复文档初始化值无法动态切换的问题
`
Loading

0 comments on commit b8b636f

Please sign in to comment.