Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
璃白.
markdown-editor
提交
9216bb56
M
markdown-editor
项目概览
璃白.
/
markdown-editor
上一次同步 接近 2 年
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
markdown-editor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9216bb56
编写于
6月 24, 2021
作者:
璃白.
🌻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update README.md
上级
8b579618
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
107 addition
and
21 deletion
+107
-21
README.md
README.md
+107
-21
未找到文件。
README.md
浏览文件 @
9216bb56
...
...
@@ -8,19 +8,20 @@
2021-06-23 v0.4更新,添加功能:
-
[onLoad事件]
-
[onInput事件]
-
[throttle属性]
-
[zIndex属性]
-
[
maxLength属性
](
#maxLength
)
-
[
showWordLimit属性
](
#showWordLimit
)
-
[
rows属性
](
#rows
)
-
[
filePathRule属性
](
#filePathRule
)
-
[setValue方法]
-
[getValue方法]
-
[focus方法]
-
[blur方法]
-
移除footer,工具栏添加上传文件按钮
-
throttle属性
-
zIndex属性
-
maxLength属性
-
showWordLimit属性
-
rows属性
-
filePathRule属性
-
[
onLoad事件
](
#onload
)
-
[
onInput事件
](
#oninput
)
-
[
setValue方法
](
#setvalue
)
-
[
getValue方法
](
#getvalue
)
-
[
focus方法
](
#focus
)
-
[
blur方法
](
#blur
)
-
**移除canAttachFile属性**
-
**移除footer,工具栏添加上传文件按钮**
-
全屏模式添加工具栏
### v0.3
...
...
@@ -76,17 +77,16 @@ new MdEditor({
| maxLength | 最大字数限制 | String
\|
Number | 1000 | |
| showWordLimit | 是否显示当前字数 | Boolean | false | |
| rows | 编辑区行数 | String
\|
Number | 6 | 'auto' |
| throttle | input事件的节流时间 | Number | 1000 | |
| throttle | input事件的节流时间 | Number | 1000 |
|
| filePathRule | 图片链接的格式限制 | RegExp | | |
| themeOptions | 主题颜色配置 | Object |
[
themeOptions
](
#themeoptions
)
| toolsOptions | 顶部工具栏配置 | Object |
[
toolsOptions
](
#toolsoptions
)
| canAttachFile | 是否可以上传图片 | Boolean | true
| canPreview | 是否开启预览 | Boolean | true
| placeholder | placeholder | String | "请输入内容"
| onLoad | 编辑器实例化 | Function | function(res) {}
[
示例
](
#on
L
oad
)
| onInput | 输入事件 | Function | function(res) {}
[
示例
](
#on
I
nput
)
| onFocus | 获取焦点事件 | Function | function(res) {}
[
示例
](
#on
F
ocus
)
| onBlur | 失去焦点事件 | Function | function(res) {}
[
示例
](
#on
B
lur
)
| onLoad | 编辑器实例化 | Function | function(res) {}
[
示例
](
#on
l
oad
)
| onInput | 输入事件 | Function | function(res) {}
[
示例
](
#on
i
nput
)
| onFocus | 获取焦点事件 | Function | function(res) {}
[
示例
](
#on
f
ocus
)
| onBlur | 失去焦点事件 | Function | function(res) {}
[
示例
](
#on
b
lur
)
| onChange | 获取编辑器markdown及html内容 | Function | function(res) {}
[
示例
](
#onchange
)
| onUpload | 上传文件钩子函数 | Function | function(file, callback) {}
[
示例
](
#onupload
)
| onsubmit | 快捷键函数 | Function | function(file, callback) {}
[
示例
](
#onsubmit
)
...
...
@@ -94,7 +94,7 @@ new MdEditor({
# 方法
| 方法 | 说明 | 类型 | 示例 |
| ------ | ------ | ------ | ------ |
------ |
| ------ | ------ | ------ | ------ |
| focus | 使编辑器获取焦点 | Function |
[
focus
](
#focus
)
|
| blur | 使编辑器失去焦点 | Function |
[
blur
](
#focus
)
|
| getValue | 获取编辑器的内容 | Function |
[
getValue
](
#getvalue
)
|
...
...
@@ -118,15 +118,29 @@ new MdEditor({
| bold | 加粗 | Boolean | true
| italic | 斜体 | Boolean | true
| quote | 引用 | Boolean | true
| code | 代码 | Boolean | true
| code | 代码
块
| Boolean | true
| link | 链接 | Boolean | true
| ul | 无序列表 | Boolean | true
| ol | 有序列表 | Boolean | true
| task | 任务列表 | Boolean | true
| table | 表格 | Boolean | true
| file | 上传文件 | Boolean | true
| fullScreen | 全屏模式 | Boolean | true
# onLoad
编辑器实例化后触发
```
js
new
MdEditor
({
...,
onLoad
:
function
()
{
console
.
log
(
'
ready
'
)
// { text: "...", html: "..." }
}
})
```
# onFocus
编辑器获取焦点时触发
...
...
@@ -153,6 +167,19 @@ new MdEditor({
})
```
# onInput
用于获取markdown内容及编译后的html内容
```
js
new
MdEditor
({
...,
onInput
:
function
(
res
)
{
console
.
log
(
res
)
// { text: "...", html: "..." }
}
})
```
# onChange
用于获取markdown内容及编译后的html内容
...
...
@@ -197,6 +224,65 @@ new MdEditor({
})
```
# getValue
获取编辑器内容
```
js
const
myEditor
=
new
MdEditor
({
...
}
})
const
value
=
myEditor
.
getValue
()
console
.
log
(
value
)
或
myEditor
.
getValue
(
value
=>
{
console
.
log
(
value
)
})
```
# setValue
设置编辑器内容
```
js
const
myEditor
=
new
MdEditor
({
...
}
})
myEditor
.
setValue
(
'
this is new content
'
)
```
# focus
使编辑器获取焦点
```
js
const
myEditor
=
new
MdEditor
({
...
}
})
myEditor
.
focus
()
```
# blur
使编辑器失去焦点
```
js
const
myEditor
=
new
MdEditor
({
...
}
})
myEditor
.
blur
()
```
# Example
```
html
<div
id=
"app"
></div>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录