Skip to content

Commit

Permalink
release v2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jin-yufeng committed Dec 24, 2021
1 parent b201dce commit 8dec06a
Show file tree
Hide file tree
Showing 31 changed files with 173 additions and 89 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@
|:---:|:---:|:---:|:---:|:---:|:---:|
| ![富文本插件](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/富文本插件.jpg) | ![欢喜商城](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/欢喜商城.png) | ![多么生活](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/多么生活.jpg) | ![全品作业小助手](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/全品作业小助手.jpg) | ![米兔旅行](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/米兔旅行.png) | ![食法查](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/食法查.png) |

| 微慕 | 古典文学名著阅读 | 程序员技术之旅 | 典典博客 | APP 比比 | Geek 时代 |
| 微慕 | 古典文学名著阅读 | 程序员技术之旅 | 典典博客 | Geek 时代 | 源创智造 |
|:---:|:---:|:---:|:---:|:---:|:---:|
| ![微慕](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/微慕.jpg) | ![古典文学名著阅读](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/古典文学名著阅读.jpg) | ![程序员技术之旅](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/程序员技术之旅.jpg) | ![典典博客](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/典典博客.jpg) | ![APP比比](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/APP比比.jpg) | ![Geek时代](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/Geek时代.jpg) |
| ![微慕](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/微慕.jpg) | ![古典文学名著阅读](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/古典文学名著阅读.jpg) | ![程序员技术之旅](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/程序员技术之旅.jpg) | ![典典博客](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/典典博客.jpg) | ![Geek时代](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/Geek时代.jpg) | ![源创智造](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/源创智造.png) |

| 源创智造 | 备忘录与记事本 | 优秀笔记 | 365 刷题 | 同城共享书 | 技术源 share |
| 备忘录与记事本 | 优秀笔记 | 365 刷题 | 同城共享书 | 技术源 share | 周仙神 |
|:---:|:---:|:---:|:---:|:---:|:---:|
| ![源创智造](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/源创智造.png) | ![备忘录与记事本](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/备忘录与记事本.jpg) | ![优秀笔记](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/优秀笔记.jpg) | ![365刷题](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/365刷题.jpg) | ![同城共享书](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/同城共享书.jpg) | ![技术源share](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/技术源share.jpg) |
| ![备忘录与记事本](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/备忘录与记事本.jpg) | ![优秀笔记](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/优秀笔记.jpg) | ![365刷题](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/365刷题.jpg) | ![同城共享书](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/同城共享书.jpg) | ![技术源share](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/技术源share.jpg) | ![周仙神](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/case/周仙神.png) |

以上排名不分先后,更多可见 [使用案例收集](https://github.com/jin-yufeng/mp-html/issues/27)(欢迎添加)

Expand All @@ -225,6 +225,14 @@
![支持](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/sponsor.png)

## 更新日志
- v2.2.1 (20211224)
1. `A` `editable` 插件增加上下移动标签功能
2. `U` `editable` 插件支持在文本中间光标处插入内容
3. `F` 修复了 `uni-app``nvue` 端设置 `margin` 后可能导致高度不正确的问题
4. `F` 修复了 `highlight` 插件使用压缩版的 `prism.css` 可能导致背景失效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/367)
5. `F` 修复了 `uni-app` 包编辑状态下使用 `emoji` 插件内容为空时可能报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/371)
6. `F` 修复了使用 `editable` 插件后将 `selectable` 属性设置为 `force` 不生效的问题

- v2.2.0 (20211011)
1. `A` 增加 `customElements` 配置项,便于添加自定义功能性标签 [详细](https://github.com/jin-yufeng/mp-html/issues/350)
2. `A` `editable` 插件增加切换音视频自动播放状态的功能 [详细](https://github.com/jin-yufeng/mp-html/pull/341) by [@leeseett](https://github.com/leeseett)
Expand All @@ -236,14 +244,6 @@
8. `F` 修复了 `uni-app``nvue` 页面运行到非 `app` 平台时可能样式错误的问题
9. `D` 移除了 `ad` 配置项(由 `customElements` 代替)

- v2.1.5 (20210813)
1. `A` 增加支持标签的 `dir` 属性
2. `F` 修复了 `ruby` 标签文字与拼音没有居中对齐的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/325)
3. `F` 修复了音视频标签内有 `a` 标签时可能无法播放的问题
4. `F` 修复了 `externStyle` 中的 `class` 名包含下划线或数字时可能失效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/326)
5. `F` 修复了 `uni-app``h5` 端引入 `externStyle` 可能不生效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/326)
6. `F` 修复了微信原生包 `a` 标签的 `style` 中包含 `inline` 时不响应事件的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/332)

`1.x` 的升级方法可见 [更新指南](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog?id=v200)

查看 [更新日志](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog) 了解更多
2 changes: 1 addition & 1 deletion dist/mp-alipay/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/mp-alipay/parser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mp-baidu/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/mp-baidu/parser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mp-qq/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/mp-qq/parser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mp-toutiao/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/mp-toutiao/parser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/mp-weixin/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/mp-weixin/parser.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/uni-app/components/mp-html/mp-html.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<script>
/**
* mp-html v2.2.0
* mp-html v2.2.1
* @description 富文本组件
* @tutorial https://github.com/jin-yufeng/mp-html
* @property {String} container-style 容器的样式
Expand Down Expand Up @@ -59,7 +59,10 @@ export default {
type: String,
default: ''
},
content: String,
content: {
type: String,
default: ''
},
copyLink: {
type: [Boolean, String],
default: true
Expand Down
4 changes: 2 additions & 2 deletions dist/uni-app/components/mp-html/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ Parser.prototype.onOpenTag = function (selfClose) {
styleObj.width = ''
} else {
node.w = 'T'
if (styleObj.height && !styleObj.height.includes('auto')) {
if (!isNaN(parseInt(styleObj.height))) {
node.h = 'T'
}
}
Expand Down Expand Up @@ -695,7 +695,7 @@ Parser.prototype.popNode = function () {
} else if (size > 7) {
size = 7
}
styleObj['font-size'] = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'][size - 1]
styleObj['font-size'] = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', 'xxx-large'][size - 1]
}
attrs.size = undefined
}
Expand Down
2 changes: 1 addition & 1 deletion dist/uni-app/static/app-plus/mp-html/local.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><style>body,html{width:100%;height:100%;overflow-x:scroll;overflow-y:hidden}body{margin:0}video{width:300px;height:225px}img{max-width:100%;-webkit-touch-callout:none}@keyframes show{0%{opacity:0}100%{opacity:1}}</style></head><body><div id="content"></div><script type="text/javascript" src="./js/uni.webview.min.js"></script><script type="text/javascript" src="./js/handler.js"></script></body>
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><style>body,html{width:100%;height:100%;overflow-x:scroll;overflow-y:hidden}body{margin:0}video{width:300px;height:225px}img{max-width:100%;-webkit-touch-callout:none}</style></head><body><div id="content" style="overflow:hidden"></div><script type="text/javascript" src="./js/uni.webview.min.js"></script><script type="text/javascript" src="./js/handler.js"></script></body>
8 changes: 4 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
|:---:|:---:|:---:|:---:|:---:|:---:|
| ![富文本插件](assets/case/富文本插件.jpg) | ![欢喜商城](assets/case/欢喜商城.png) | ![多么生活](assets/case/多么生活.jpg) | ![全品作业小助手](assets/case/全品作业小助手.jpg) | ![米兔旅行](assets/case/米兔旅行.png) | ![食法查](assets/case/食法查.png) |

| 微慕 | 古典文学名著阅读 | 程序员技术之旅 | 典典博客 | APP 比比 | Geek 时代 |
| 微慕 | 古典文学名著阅读 | 程序员技术之旅 | 典典博客 | Geek 时代 | 源创智造 |
|:---:|:---:|:---:|:---:|:---:|:---:|
| ![微慕](assets/case/微慕.jpg) | ![古典文学名著阅读](assets/case/古典文学名著阅读.jpg) | ![程序员技术之旅](assets/case/程序员技术之旅.jpg) | ![典典博客](assets/case/典典博客.jpg) | ![APP比比](assets/case/APP比比.jpg) | ![Geek时代](assets/case/Geek时代.jpg) |
| ![微慕](assets/case/微慕.jpg) | ![古典文学名著阅读](assets/case/古典文学名著阅读.jpg) | ![程序员技术之旅](assets/case/程序员技术之旅.jpg) | ![典典博客](assets/case/典典博客.jpg) | ![Geek时代](assets/case/Geek时代.jpg) | ![源创智造](assets/case/源创智造.png) |

| 源创智造 | 备忘录与记事本 | 优秀笔记 | 365 刷题 | 同城共享书 | 技术源 share |
| 备忘录与记事本 | 优秀笔记 | 365 刷题 | 同城共享书 | 技术源 share | 周仙神 |
|:---:|:---:|:---:|:---:|:---:|:---:|
| ![源创智造](assets/case/源创智造.png) | ![备忘录与记事本](assets/case/备忘录与记事本.jpg) | ![优秀笔记](assets/case/优秀笔记.jpg) | ![365刷题](assets/case/365刷题.jpg) | ![同城共享书](assets/case/同城共享书.jpg) | ![技术源share](assets/case/技术源share.jpg) |
| ![源创智造](assets/case/源创智造.png) | ![备忘录与记事本](assets/case/备忘录与记事本.jpg) | ![优秀笔记](assets/case/优秀笔记.jpg) | ![365刷题](assets/case/365刷题.jpg) | ![同城共享书](assets/case/同城共享书.jpg) | ![技术源share](assets/case/技术源share.jpg) | ![周仙神](assets/case/周仙神.png) |

以上排名不分先后,更多可见 [使用案例收集](https://github.com/jin-yufeng/mp-html/issues/27)(欢迎添加)

Expand Down
2 changes: 1 addition & 1 deletion docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![logo](assets/logo/logo.png)

# mp-html <small>2.2.0</small>
# mp-html <small>2.2.1</small>

> 一个强大的小程序富文本组件
Expand Down
48 changes: 32 additions & 16 deletions docs/advanced/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@

## editable
功能:富文本编辑
大小:*≈14KB*
下表列出了本插件与原生 *editor* 组件的功能差异,可按需选用

| 组件 | 优点 | 缺点 |
|:---:|:---:|:---:|
| 原生 *editor* | 底层通过 *contenteditable* 实现,编辑流畅 | 支持标签少(不支持音视频、表格以及 *section* 等常用标签)、部分小程序平台不支持或低版本不兼容 |
| 本插件 | 支持标签全面、支持平台全面 | 编辑灵活性不够强 |

大小:*≈17.5KB*
支持平台:

| 微信小程序 | QQ 小程序 | 百度小程序 | 支付宝小程序 | 头条小程序 | uni-app |
Expand Down Expand Up @@ -69,9 +76,11 @@
| 文本 | 修改 |
| 图片 | 更换链接、调整宽度、设置成超链接([2.0.4+](changelog/changelog#v204))、设置预览图链接、禁用预览、删除 |
| 链接 | 更换链接、删除 |
| 音视频 | 设置封面、设置循环播放、设置自动播放([2.2.0+](changelog/changelog#v220))删除 |
| 音视频 | 设置封面、设置循环播放、设置自动播放([2.2.0+](changelog/changelog#v220)删除 |
| 普通标签 | 设置字体大小、斜体、粗体、下划线([2.0.4+](changelog/changelog#v204))、居中、缩进、删除 |

?> [2.2.1](changelog/changelog#v221) 版本起所有标签支持上下移动操作,但仅限同级标签间移动,即在有同级标签且非第一个(或最后一个)时可以上移(或下移)

?> 菜单项可以通过编辑 *plugins/editable/config.js* 进行修改,仅可以删减或调整顺序,添加或更名无效

[组件实例](advanced/api#getCompent) 上提供了以下方法(*editable* 属性为 *true* 时才可以调用):
Expand All @@ -94,6 +103,9 @@
[2.2.0](changelog/changelog#v220) 版本起设置了 [domain](basic/prop#domain) 属性时,返回的地址可以缺省主域名

编辑完成后,通过 *getContent* 方法获取编辑后的 *html*,最后将 *editable* 属性设置为 *false* 即可正常渲染

!> 点击保存按钮时,部分平台 *tap* 事件早于 *blur* 事件触发,直接获取内容可能导致无法获取当前编辑的文本内容,因此建议设置一个小的延时后获取(可参考下方示例,[详细](https://github.com/jin-yufeng/mp-html/issues/368)

示例:
```javascript
Page({
Expand Down Expand Up @@ -138,25 +150,27 @@ Page({
}
},
finishEdit () {
var html = ctx.getContent() // 获取编辑好的 html
// 上传 html
wx.request({
url: 'xxx',
data: {
html
},
success: () => {
this.setData({
editable: false // 结束编辑
})
}
})
setTimeout(() => {
var html = ctx.getContent() // 获取编辑好的 html
// 上传 html
wx.request({
url: 'xxx',
data: {
html
},
success: () => {
this.setData({
editable: false // 结束编辑
})
}
})
}, 50)
}
})
```

##### 示例项目 :id=editable_demo
微信小程序点击 [代码片段](https://developers.weixin.qq.com/s/3kfslXmG7FtU) 即可在微信开发者工具中导入;*uni-app* 下载 [示例项目](https://6874-html-foe72-1259071903.tcb.qcloud.la/editable.zip?sign=cc0017be203fb3dbca62d33a0c15792e&t=1608447445)*HBuilder X* 中打开即可体验;注意示例项目中不一定包含最新版本,仅供参考使用方法
微信小程序点击 [代码片段](https://developers.weixin.qq.com/s/LI0RnNmm77vO) 即可在微信开发者工具中导入;*uni-app* 下载 [示例项目](https://6874-html-foe72-1259071903.tcb.qcloud.la/editable.zip?sign=cc0017be203fb3dbca62d33a0c15792e&t=1608447445)*HBuilder X* 中打开即可体验;注意示例项目中不一定包含最新版本,仅供参考使用方法

注意事项:
不要在 *editable* 属性被设置为 *true* 前通过 [setContent](advanced/api#setContent) 方法(用 [content](basic/prop#content) 属性)设置内容,否则在切换为 *true* 后会变成空白
Expand Down Expand Up @@ -192,6 +206,8 @@ Page({
- *showLanguageName* 是否在代码块右上角显示语言的名称
- *showLineNumber* 是否在左侧显示行号

!> 修改该配置后需要重新 [生成组件包](advanced/develop#pack),在构建后的组件包中修改配置无法生效

引入本插件后,*html* 中符合以下格式的 *pre* 将被高亮处理:
```html
<!-- pre 中内含一个 code,并在 pre 或 code 的 class 中设置 language- -->
Expand Down
Binary file removed docs/assets/case/APP比比.jpg
Binary file not shown.
Binary file added docs/assets/case/周仙神.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/basic/prop.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ white-space: pre-line; /* 保留换行符 */

!> 将本属性的值设置为 *true* 在微信 *iOS* 端可能失效,[2.0.5](changelog/changelog#v205) 版本起支持将本属性设置为 "*force*" 来支持,但会带来以下影响:
1、所有文本块会显示为 *inline-block*(通过 [text](https://developers.weixin.qq.com/miniprogram/dev/component/text.html) 标签的 *user-select* 属性实现),需要自行适配
2、所有文本块都无法被 *rich-text* 包含,一定程度上增加标签数,减慢渲染速度
2、文字下划线、删除线等效果将失效([详细](https://github.com/jin-yufeng/mp-html/issues/382)
3、所有文本块都无法被 *rich-text* 包含,一定程度上增加标签数,减慢渲染速度

## set-title
功能:是否将 *title* 标签的内容设置到页面标题
Expand Down
10 changes: 10 additions & 0 deletions docs/changelog/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# 📖 更新日志 :id=changelog

## v2.2.1
发布时间:*2021-12-24*
主要更新:
1. `A` [editable](advanced/plugin#editable) 插件增加上下移动标签功能
2. `U` [editable](advanced/plugin#editable) 插件支持在文本中间光标处插入内容
3. `F` 修复了 `uni-app``nvue` 端设置 `margin` 后可能导致高度不正确的问题
4. `F` 修复了 [highlight](advanced/plugin#highlight) 插件使用压缩版的 `prism.css` 可能导致背景失效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/367)
5. `F` 修复了 `uni-app` 包编辑状态下使用 [emoji](advanced/plugin#emoji) 插件内容为空时可能报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/371)
6. `F` 修复了使用 [editable](advanced/plugin#editable) 插件后将 [selectable](basic/prop#selectable) 属性设置为 `force` 不生效的问题

## v2.2.0
发布时间:*2021-10-11*
主要更新:
Expand Down
Loading

0 comments on commit 8dec06a

Please sign in to comment.