Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43676597
Awesome-Markdown-Editor
提交
df3a5fac
Awesome-Markdown-Editor
项目概览
weixin_43676597
/
Awesome-Markdown-Editor
与 Fork 源项目一致
Fork自
gitcode_dev / Awesome-Markdown-Editor
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Awesome-Markdown-Editor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
df3a5fac
编写于
6月 07, 2021
作者:
璃白.
🌻
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://codechina.csdn.net/codechina_dev/markdown-editor
上级
77c78aa2
8de713b0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
103 addition
and
10 deletion
+103
-10
LICENSE
LICENSE
+21
-0
README.md
README.md
+82
-10
未找到文件。
LICENSE
0 → 100644
浏览文件 @
df3a5fac
MIT License
Copyright (c) 2021 codechina_dev
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
README.md
浏览文件 @
df3a5fac
# C Markdown 编辑器
一款Markdown编辑器组件,支持使用markodwn语法来编写文档,同时支持图片上传等功能(当前版本仅支持单文件上传)
## 更新记录
### v0.1
2021-06-07 v0.1 初版更新,支持功能:
-
自定义主题
-
单张图片/单个附件上传
-
Markdown & Html 内容获取
# 使用
1.
通过script标签引入
```
html
<script
src=
"./markdown-editor.js"
></script>
```
2.
指定需要渲染的容器
```
html
<div
id=
"app"
></div>
```
3.
初始化实例
```
js
new
MdEditor
({
...
options
})
```
# options
| 属性 | 说明 | 类型 | 默认值 |
| ------ | ------ | ------ | ------ |
| el | 编辑器渲染的容器 | String | "#app"
| themeOptions | 主题颜色配置 | Object |
[
themeOptions
](
#themeoptions
)
| canAttachFile | 是否可以上传图片 | Boolean | true
| placeholder | placeholder | String | "请输入内容"
| onChange | 获取编辑器markdown及html内容 | Function | function(res) {}
[
示例
](
#onchange
)
| onUpload | 上传文件钩子函数 | Function | function(file, callback) {}
[
示例
](
#onupload
)
# themeOptions
| 属性 | 说明 | 类型 | 默认值 |
| ------ | ------ | ------ | ------ |
| borderColor | 编辑器边框默认颜色 | String | "#dbdbdb"
| borderColorActive | 编辑器边框激活颜色 | String | "#409eff"
| textColor | 编辑器文字默认颜色 | String | "#303030"
| textColorActive | 编辑器文字激活颜色 | String | "#000"
# onChange
用于获取markdown内容及编译后的html内容
```
js
new
MdEditor
({
...,
onChange
:
function
(
res
)
{
console
.
log
(
res
)
// { text: "...", html: "..." }
}
})
```
# onUpload
上传或粘贴文件时会触发此函数
```
js
new
MdEditor
({
...,
onUpload
:
function
(
file
,
callback
)
{
// do something with file
// ajax
// ...
// 得到图片的url
// 在callback函数中回传图片url,编辑器会将图片链接粘贴到内容里
callback
(
url
)
}
})
```
npm install
npm start
<div id="app"></div>
<script src="./bundle.js"></script>
<script>
new MdEditor({
el: "#app"
});
</script>
# License
```
\ No newline at end of file
[
MIT
](
https://codechina.csdn.net/codechina_dev/markdown-editor/-/blob/master/LICENSE
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录