diff --git a/README.md b/README.md index 1496bc92..f0a5d7ca 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ ```javascript Page({ - onLoad() { + onLoad () { this.setData({ html: '
Hello World!
' }) @@ -91,7 +91,7 @@ components: { mpHtml }, - data() { + data () { return { html: '
Hello World!
' } @@ -120,7 +120,7 @@ components: { mpHtml }, - data() { + data () { return { html: '
Hello World!
' } @@ -194,6 +194,7 @@ | search | 关键词搜索 | | style | 匹配 style 标签中的样式 | | txv-video | 使用腾讯视频 | +| img-cache | 图片缓存 by [@PentaTea](https://github.com/PentaTea) | 查看 [插件](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin) 了解更多 @@ -222,23 +223,24 @@ ![支持](https://gitee.com/jin-yufeng/mp-html/raw/master/docs/assets/sponsor.png) ## 更新日志 +- v2.1.2 (20210424) + 1. `A` 增加了 [img-cache](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#img-cache) 插件,可以在 `uni-app` 的 `app` 端缓存图片 [详细](https://github.com/jin-yufeng/mp-html/issues/292) by [@PentaTea](https://github.com/PentaTea) + 2. `U` 支持通过 `container-style` 属性设置 `white-space` 来保留连续空格和换行符 [详细](https://jin-yufeng.gitee.io/mp-html/#/question/faq#space) + 3. `U` 代码风格符合 [standard](https://standardjs.com) 标准 + 4. `U` `uni-app` 包使用 `editable` 插件编辑状态下支持预览视频 [详细](https://github.com/jin-yufeng/mp-html/issues/286) + 5. `F` 修复了 `svg` 标签内嵌 `svg` 时无法显示的问题 + 6. `F` 修复了微信原生包 `img` 标签的 `style` 中包含 `inline` 时不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/287) + 7. `F` 修复了支付宝和头条小程序部分区域不可复制的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/291) + - v2.1.1 (20210409) - 1. 修复了对 `p` 标签设置 `tag-style` 可能不生效的问题 - 2. 修复了 `svg` 标签中的文本无法显示的问题 - 3. 修复了 `uni-app` 包的 `nvue` 端不设置 `container-style` 可能报错的问题 - 4. 修复了 `uni-app` 包使用 `editable` 插件编辑表格时可能报错的问题 - 5. 修复了 `uni-app` 包使用 `highlight` 插件运行到头条小程序时可能没有样式的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/280) - 6. 修复了 `uni-app` 包使用 `editable` 插件 `editable` 属性为 `false` 时会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/284) - 7. 修复了 `style` 插件连续子选择器失效的问题 - 8. 修复了 `editable` 插件无法修改图片和字体大小的问题 - -- v2.1.0 (20210320) - 1. `A` 增加了 [container-style](https://jin-yufeng.gitee.io/mp-html/#/basic/prop#container-style) 属性 [详细](https://gitee.com/jin-yufeng/mp-html/pulls/1) - 2. `A` 增加支持 `strike` 标签 - 3. `A` `editable` 插件增加 `placeholder` 属性 [详细](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#editable) - 4. `A` `editable` 插件增加 `insertHtml` 方法 [详细](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#editable) - 5. `U` 外部样式支持标签名选择器 [详细](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart#setting) - 6. `F` 修复了 `uni-app` 包 `nvue` 端部分情况下可能不显示的问题 + 1. `F` 修复了对 `p` 标签设置 `tag-style` 可能不生效的问题 + 2. `F` 修复了 `svg` 标签中的文本无法显示的问题 + 3. `F` 修复了 `uni-app` 包的 `nvue` 端不设置 `container-style` 可能报错的问题 + 4. `F` 修复了 `uni-app` 包使用 `editable` 插件编辑表格时可能报错的问题 + 5. `F` 修复了 `uni-app` 包使用 `highlight` 插件运行到头条小程序时可能没有样式的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/280) + 6. `F` 修复了 `uni-app` 包使用 `editable` 插件 `editable` 属性为 `false` 时会报错的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/284) + 7. `F` 修复了 `style` 插件连续子选择器失效的问题 + 8. `F` 修复了 `editable` 插件无法修改图片和字体大小的问题 从 `1.x` 的升级方法可见 [更新指南](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog?id=v200) diff --git a/dist/mp-alipay/index.js b/dist/mp-alipay/index.js index b1370a5b..4e60954d 100644 --- a/dist/mp-alipay/index.js +++ b/dist/mp-alipay/index.js @@ -1,8 +1,8 @@ "use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}/*! - * mp-html v2.1.1 + * mp-html v2.1.2 * https://github.com/jin-yufeng/mp-html - * + * * Released under the MIT license * Author: Jin Yufeng */ -var t=require("./parser"),n=[];Component({data:{nodes:[]},props:{containerStyle:"",content:"",copyLink:!0,domain:"",errorImg:"",lazyLoad:!1,loadingImg:"",pauseVideo:!0,previewImg:!0,scrollTable:!1,setTitle:!0,showImgMenu:!0,tagStyle:{}},didMount:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this));this.props.content&&this.setContent(this.props.content)},didUpdate:function(e){e.content!=this.props.content&&this.setContent(this.props.content)},didUnmount:function(){clearInterval(this._timer),this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var o=this;return new Promise(function(i,r){if(!o.props.useAnchor)return r("Anchor is disabled");var a=my.createSelectorQuery().select((o._in?o._in.selector:"._root")+(t?"".concat(" ","#").concat(t):"")).boundingClientRect();o._in?a.select(o._in.selector).scrollOffset().select(o._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])return r("Label not found");var a=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(o.props.useAnchor)||0);o._in?o._in.page.setData(e({},o._in.scrollTop,a)):my.pageScrollTo({scrollTop:a,duration:300}),i()})})},getText:function(e){var t="";return function e(n){for(var o=0;o"0"&&i.name[1]<"7";r&&t&&"\n"!=t[t.length-1]&&(t+="\n"),i.children&&e(i.children),r&&"\n"!=t[t.length-1]?t+="\n":"td"!=i.name&&"th"!=i.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){return new Promise(function(e,t){my.createSelectorQuery().select("._root").boundingClientRect().exec(function(n){return n[0]?e(n[0]):t("Root label not found")})})},setContent:function(e,n){var o=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var i={},r=new t(this).parse(e);if(n)for(var a=this.data.nodes.length,s=r.length;s--;)i["nodes[".concat(a+s,"]")]=r[s];else i.nodes=r;this.setData(i,function(){o._hook("onLoad"),o.props.onLoad&&o.props.onLoad()});var l;clearInterval(this._timer),this._timer=setInterval(function(){o.getRect().then(function(e){e.height==l&&(o.props.onReady&&o.props.onReady(e),clearInterval(o._timer)),l=e.height}).catch(function(){})},350)},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.root=this}}}); \ No newline at end of file +var t=require("./parser"),n=[];Component({data:{nodes:[]},props:{containerStyle:"",content:"",copyLink:!0,domain:"",errorImg:"",lazyLoad:!1,loadingImg:"",pauseVideo:!0,previewImg:!0,scrollTable:!1,setTitle:!0,showImgMenu:!0,tagStyle:{}},didMount:function(){this.plugins=[];for(var e=n.length;e--;)this.plugins.push(new n[e](this));this.props.content&&this.setContent(this.props.content)},didUpdate:function(e){e.content!==this.props.content&&this.setContent(this.props.content)},didUnmount:function(){clearInterval(this._timer),this._hook("onDetached")},methods:{in:function(e,t,n){e&&t&&n&&(this._in={page:e,selector:t,scrollTop:n})},navigateTo:function(t,n){var o=this;return new Promise(function(r,i){if(!o.props.useAnchor)return void i(Error("Anchor is disabled"));var a=my.createSelectorQuery().select((o._in?o._in.selector:"._root")+(t?"".concat(" ","#").concat(t):"")).boundingClientRect();o._in?a.select(o._in.selector).scrollOffset().select(o._in.selector).boundingClientRect():a.selectViewport().scrollOffset(),a.exec(function(t){if(!t[0])return void i(Error("Label not found"));var a=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(o.props.useAnchor)||0);o._in?o._in.page.setData(e({},o._in.scrollTop,a)):my.pageScrollTo({scrollTop:a,duration:300}),r()})})},getText:function(e){var t="";return function e(n){for(var o=0;o"0"&&r.name[1]<"7";i&&t&&"\n"!==t[t.length-1]&&(t+="\n"),r.children&&e(r.children),i&&"\n"!==t[t.length-1]?t+="\n":"td"!==r.name&&"th"!==r.name||(t+="\t")}}}(e||this.data.nodes),t},getRect:function(){return new Promise(function(e,t){my.createSelectorQuery().select("._root").boundingClientRect().exec(function(n){return n[0]?e(n[0]):t(Error("Root label not found"))})})},setContent:function(e,n){var o=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var r={},i=new t(this).parse(e);if(n)for(var a=this.data.nodes.length,s=i.length;s--;)r["nodes[".concat(a+s,"]")]=i[s];else r.nodes=i;this.setData(r,function(){o._hook("onLoad"),o.props.onLoad&&o.props.onLoad()});var l;clearInterval(this._timer),this._timer=setInterval(function(){o.getRect().then(function(e){e.height===l&&(o.props.onReady&&o.props.onReady(e),clearInterval(o._timer)),l=e.height}).catch(function(){})},350)},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.root=this}}}); \ No newline at end of file diff --git a/dist/mp-alipay/node/node.axml b/dist/mp-alipay/node/node.axml index ed9a707e..89d63543 100644 --- a/dist/mp-alipay/node/node.axml +++ b/dist/mp-alipay/node/node.axml @@ -1 +1 @@ -