Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
我本凡人 一念云泥
uni-app
提交
99ec3fd3
uni-app
项目概览
我本凡人 一念云泥
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
99ec3fd3
编写于
4月 16, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs: 更新 editorContext.insertImage 文档
上级
1a3393ad
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
15 addition
and
9 deletion
+15
-9
docs/api/media/editor-context.md
docs/api/media/editor-context.md
+15
-9
未找到文件。
docs/api/media/editor-context.md
浏览文件 @
99ec3fd3
...
...
@@ -61,18 +61,24 @@ editor 组件对应的 editorContext 实例,可通过 [uni.createSelectorQuery
## editorContext.insertImage(OBJECT)
插入图片
插入图片。
微信小程序平台地址为临时文件时,获取的编辑器html格式内容中
`<img>`
标签增加属性 data-local,delta 格式内容中图片 attributes 属性增加 data-local 字段,该值为传入的临时文件地址。
开发者可选择在提交阶段上传图片到服务器,获取到网络地址后进行替换。替换时对于html内容应替换掉
`<img>`
的 src 值,对于 delta 内容应替换掉
`insert { image: abc }`
值。
**OBJECT 参数说明**
| 属性 | 类型 | 默认值 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| src | String | | 是 | 图片地址 |
| alt | String | | 否 | 图像无法显示时的替代文本 |
| data | Object | | 否 | data 被序列化为 name=value;name1=value2 的格式挂在属性 data-custom 上 |
| success | Function | | 否 | 接口调用成功的回调函数 |
| fail | Function | | 否 | 接口调用失败的回调函数 |
| complete | Function | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
| 属性 | 类型 | 默认值 | 必填 | 说明 |平台差异说明|
| --- | --- | --- | --- | --- | --- |
| src | String | | 是 | 图片地址 | |
| alt | String | | 否 | 图像无法显示时的替代文本 | |
| width | String | | 否 | 图片宽度(pixels/百分比) |仅微信小程序支持|
| height | String | | 否 | 图片高度 (pixels/百分比) |仅微信小程序支持|
| extClass | String | | 否 | 添加到图片 img 标签上的类名 |仅微信小程序支持|
| data | Object | | 否 | data 被序列化为 name=value;name1=value2 的格式挂在属性 data-custom 上 |仅微信小程序支持|
| success | Function | | 否 | 接口调用成功的回调函数 | |
| fail | Function | | 否 | 接口调用失败的回调函数 | |
| complete | Function | | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
## editorContext.insertText(OBJECT)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录