init
This commit is contained in:
10
uni_modules/mp-html/components/mp-html/mp-html.js
Normal file
10
uni_modules/mp-html/components/mp-html/mp-html.js
Normal file
@@ -0,0 +1,10 @@
|
||||
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["uni_modules/mp-html/components/mp-html/mp-html"],{"0eb3":function(t,e,n){"use strict";n.r(e);var i=n("670c"),o=n("44ff");for(var a in o)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(a);n("2efd");var r=n("828b"),c=Object(r["a"])(o["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],void 0);e["default"]=c.exports},"1ac2":function(t,e,n){"use strict";(function(t){var i=n("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=i(n("834a")),a=[],r={name:"mp-html",data:function(){return{nodes:[]}},props:{containerStyle:{type:String,default:""},content:{type:String,default:""},copyLink:{type:[Boolean,String],default:!0},domain:String,errorImg:{type:String,default:""},lazyLoad:{type:[Boolean,String],default:!1},loadingImg:{type:String,default:""},pauseVideo:{type:[Boolean,String],default:!0},previewImg:{type:[Boolean,String],default:!0},scrollTable:[Boolean,String],selectable:[Boolean,String],setTitle:{type:[Boolean,String],default:!0},showImgMenu:{type:[Boolean,String],default:!0},tagStyle:Object,useAnchor:[Boolean,Number]},components:{node:function(){n.e("uni_modules/mp-html/components/mp-html/node/node").then(function(){return resolve(n("9cce"))}.bind(null,n)).catch(n.oe)}},watch:{content:function(t){this.setContent(t)}},created:function(){this.plugins=[];for(var t=a.length;t--;)this.plugins.push(new a[t](this))},mounted:function(){this.content&&!this.nodes.length&&this.setContent(this.content)},beforeDestroy:function(){this._hook("onDetached")},methods:{in:function(t,e,n){t&&e&&n&&(this._in={page:t,selector:e,scrollTop:n})},navigateTo:function(e,n){var i=this;return new Promise((function(o,a){if(i.useAnchor){n=n||parseInt(i.useAnchor)||0;">>>";var r=t.createSelectorQuery().in(i._in?i._in.page:i).select((i._in?i._in.selector:"._root")+(e?"".concat(">>>","#").concat(e):"")).boundingClientRect();i._in?r.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():r.selectViewport().scrollOffset(),r.exec((function(e){if(e[0]){var r=e[1].scrollTop+e[0].top-(e[2]?e[2].top:0)+n;i._in?i._in.page[i._in.scrollTop]=r:t.pageScrollTo({scrollTop:r,duration:300}),o()}else a(Error("Label not found"))}))}else a(Error("Anchor is disabled"))}))},getText:function(t){var e="";return function t(n){for(var i=0;i<n.length;i++){var o=n[i];if("text"===o.type)e+=o.text.replace(/&/g,"&");else if("br"===o.name)e+="\n";else{var a="p"===o.name||"div"===o.name||"tr"===o.name||"li"===o.name||"h"===o.name[0]&&o.name[1]>"0"&&o.name[1]<"7";a&&e&&"\n"!==e[e.length-1]&&(e+="\n"),o.children&&t(o.children),a&&"\n"!==e[e.length-1]?e+="\n":"td"!==o.name&&"th"!==o.name||(e+="\t")}}}(t||this.nodes),e},getRect:function(){var e=this;return new Promise((function(n,i){t.createSelectorQuery().in(e).select("#_root").boundingClientRect().exec((function(t){return t[0]?n(t[0]):i(Error("Root label not found"))}))}))},pauseMedia:function(){for(var t=(this._videos||[]).length;t--;)this._videos[t].pause()},setPlaybackRate:function(t){this.playbackRate=t;for(var e=(this._videos||[]).length;e--;)this._videos[e].playbackRate(t)},setContent:function(t,e){var n=this;e&&this.imgList||(this.imgList=[]);var i=new o.default(this).parse(t);if(this.$set(this,"nodes",e?(this.nodes||[]).concat(i):i),this._videos=[],this.$nextTick((function(){n._hook("onLoad"),n.$emit("load")})),this.lazyLoad||this.imgList._unloadimgs<this.imgList.length/2){var a=0,r=function t(e){e&&e.height||(e={}),e.height===a?n.$emit("ready",e):(a=e.height,setTimeout((function(){n.getRect().then(t).catch(t)}),350))};this.getRect().then(r).catch(r)}else this.imgList._unloadimgs||this.getRect().then((function(t){n.$emit("ready",t)})).catch((function(){n.$emit("ready",{})}))},_hook:function(t){for(var e=a.length;e--;)this.plugins[e][t]&&this.plugins[e][t]()}}};e.default=r}).call(this,n("df3c")["default"])},"2efd":function(t,e,n){"use strict";var i=n("517c"),o=n.n(i);o.a},"44ff":function(t,e,n){"use strict";n.r(e);var i=n("1ac2"),o=n.n(i);for(var a in i)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(a);e["default"]=o.a},"517c":function(t,e,n){},"670c":function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){}));var i=function(){var t=this.$createElement;this._self._c},o=[]}}]);
|
||||
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
|
||||
'uni_modules/mp-html/components/mp-html/mp-html-create-component',
|
||||
{
|
||||
'uni_modules/mp-html/components/mp-html/mp-html-create-component':(function(module, exports, __webpack_require__){
|
||||
__webpack_require__('df3c')['createComponent'](__webpack_require__("0eb3"))
|
||||
})
|
||||
},
|
||||
[['uni_modules/mp-html/components/mp-html/mp-html-create-component']]
|
||||
]);
|
||||
6
uni_modules/mp-html/components/mp-html/mp-html.json
Normal file
6
uni_modules/mp-html/components/mp-html/mp-html.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"node": "/uni_modules/mp-html/components/mp-html/node/node"
|
||||
}
|
||||
}
|
||||
1
uni_modules/mp-html/components/mp-html/mp-html.wxml
Normal file
1
uni_modules/mp-html/components/mp-html/mp-html.wxml
Normal file
@@ -0,0 +1 @@
|
||||
<view class="{{[(selectable?'_select ':'')+'_root']}}" style="{{(containerStyle)}}" id="_root"><block wx:if="{{!nodes[0]}}"><slot></slot></block><block wx:else><node vue-id="da9eaef6-1" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}" name="span" bind:__l="__l"></node></block></view>
|
||||
1
uni_modules/mp-html/components/mp-html/mp-html.wxss
Normal file
1
uni_modules/mp-html/components/mp-html/mp-html.wxss
Normal file
@@ -0,0 +1 @@
|
||||
._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text}
|
||||
10
uni_modules/mp-html/components/mp-html/node/node.js
Normal file
10
uni_modules/mp-html/components/mp-html/node/node.js
Normal file
@@ -0,0 +1,10 @@
|
||||
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["uni_modules/mp-html/components/mp-html/node/node"],{"05be":function(t,e,r){"use strict";r.r(e);var i=r("de62"),o=r.n(i);for(var n in i)["default"].indexOf(n)<0&&function(t){r.d(e,t,(function(){return i[t]}))}(n);e["default"]=o.a},4052:function(t,e,r){"use strict";r.d(e,"b",(function(){return i})),r.d(e,"c",(function(){return o})),r.d(e,"a",(function(){}));var i=function(){var t=this.$createElement;this._self._c},o=[]},"9cce":function(t,e,r){"use strict";r.r(e);var i=r("4052"),o=r("05be");for(var n in o)["default"].indexOf(n)<0&&function(t){r.d(e,t,(function(){return o[t]}))}(n);r("fcc6");var s=r("828b"),a=r("e74c"),c=Object(s["a"])(o["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],void 0);"function"===typeof a["a"]&&Object(a["a"])(c),e["default"]=c.exports},a53c:function(t,e,r){},de62:function(t,e,r){"use strict";(function(t){var i=r("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=i(r("7ca3"));function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){(0,o.default)(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var a={name:"node",options:{virtualHost:!0},data:function(){return{ctrl:{},isiOS:t.getSystemInfoSync().system.includes("iOS")}},props:{name:String,attrs:{type:Object,default:function(){return{}}},childs:Array,opts:Array},components:{node:function(){Promise.resolve().then(function(){return resolve(r("9cce"))}.bind(null,r)).catch(r.oe)}},mounted:function(){var t=this;this.$nextTick((function(){for(t.root=t.$parent;"mp-html"!==t.root.$options.name;t.root=t.root.$parent);}))},beforeDestroy:function(){},methods:{toJSON:function(){return this},play:function(e){var r=e.currentTarget.dataset.i,i=this.childs[r];if(this.root.$emit("play",{source:i.name,attrs:s(s({},i.attrs),{},{src:i.src[this.ctrl[r]||0]})}),this.root.pauseVideo){for(var o=!1,n=e.target.id,a=this.root._videos.length;a--;)this.root._videos[a].id===n?o=!0:this.root._videos[a].pause();if(!o){var c=t.createVideoContext(n,this);c.id=n,this.root.playbackRate&&c.playbackRate(this.root.playbackRate),this.root._videos.push(c)}}},imgTap:function(e){var r=this.childs[e.currentTarget.dataset.i];r.a?this.linkTap(r.a):r.attrs.ignore||(this.root.$emit("imgtap",r.attrs),this.root.previewImg&&t.previewImage({showmenu:this.root.showImgMenu,current:parseInt(r.attrs.i),urls:this.root.imgList}))},imgLongTap:function(t){},imgLoad:function(t){var e=t.currentTarget.dataset.i;this.childs[e].w?(this.opts[1]&&!this.ctrl[e]||-1===this.ctrl[e])&&this.$set(this.ctrl,e,1):this.$set(this.ctrl,e,t.detail.width),this.checkReady()},checkReady:function(){var t=this;this.root&&!this.root.lazyLoad&&(this.root._unloadimgs-=1,this.root._unloadimgs||setTimeout((function(){t.root.getRect().then((function(e){t.root.$emit("ready",e)})).catch((function(){t.root.$emit("ready",{})}))}),350))},linkTap:function(e){var r=e.currentTarget?this.childs[e.currentTarget.dataset.i]:{},i=r.attrs||e,o=i.href;this.root.$emit("linktap",Object.assign({innerText:this.root.getText(r.children||[])},i)),o&&("#"===o[0]?this.root.navigateTo(o.substring(1)).catch((function(){})):o.split("?")[0].includes("://")?this.root.copyLink&&t.setClipboardData({data:o,success:function(){return t.showToast({title:"链接已复制"})}}):t.navigateTo({url:o,fail:function(){t.switchTab({url:o,fail:function(){}})}}))},mediaError:function(t){var e=t.currentTarget.dataset.i,r=this.childs[e];if("video"===r.name||"audio"===r.name){var i=(this.ctrl[e]||0)+1;if(i>r.src.length&&(i=0),i<r.src.length)return void this.$set(this.ctrl,e,i)}else"img"===r.name&&(this.opts[2]&&this.$set(this.ctrl,e,-1),this.checkReady());this.root&&this.root.$emit("error",{source:r.name,attrs:r.attrs,errMsg:t.detail.errMsg})}}};e.default=a}).call(this,r("df3c")["default"])},e74c:function(t,e,r){"use strict";e["a"]=function(t){t.options.wxsCallMethods||(t.options.wxsCallMethods=[])}},fcc6:function(t,e,r){"use strict";var i=r("a53c"),o=r.n(i);o.a}}]);
|
||||
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
|
||||
'uni_modules/mp-html/components/mp-html/node/node-create-component',
|
||||
{
|
||||
'uni_modules/mp-html/components/mp-html/node/node-create-component':(function(module, exports, __webpack_require__){
|
||||
__webpack_require__('df3c')['createComponent'](__webpack_require__("9cce"))
|
||||
})
|
||||
},
|
||||
[['uni_modules/mp-html/components/mp-html/node/node-create-component']]
|
||||
]);
|
||||
6
uni_modules/mp-html/components/mp-html/node/node.json
Normal file
6
uni_modules/mp-html/components/mp-html/node/node.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"node": "/uni_modules/mp-html/components/mp-html/node/node"
|
||||
}
|
||||
}
|
||||
29
uni_modules/mp-html/components/mp-html/node/node.wxml
Normal file
29
uni_modules/mp-html/components/mp-html/node/node.wxml
Normal file
File diff suppressed because one or more lines are too long
24
uni_modules/mp-html/components/mp-html/node/node.wxss
Normal file
24
uni_modules/mp-html/components/mp-html/node/node.wxss
Normal file
@@ -0,0 +1,24 @@
|
||||
._a{padding:1.5px 0 1.5px 0;color:#366092;word-break:break-all}._hover{text-decoration:underline;opacity:.7}._img{max-width:100%;-webkit-touch-callout:none}._block{display:block}._b,
|
||||
._strong{font-weight:700}._code{font-family:monospace}._del{text-decoration:line-through}._em,
|
||||
._i{font-style:italic}._h1{font-size:2em}._h2{font-size:1.5em}._h3{font-size:1.17em}._h5{font-size:.83em}._h6{font-size:.67em}._h1,
|
||||
._h2,
|
||||
._h3,
|
||||
._h4,
|
||||
._h5,
|
||||
._h6{display:block;font-weight:700}._image{height:1px}._ins{text-decoration:underline}._li{display:list-item}._ol{list-style-type:decimal}._ol,
|
||||
._ul{display:block;padding-left:40px;margin:1em 0}._q::before{content:'"'}._q::after{content:'"'}._sub{font-size:smaller;vertical-align:sub}._sup{font-size:smaller;vertical-align:super}._thead,
|
||||
._tbody,
|
||||
._tfoot{display:table-row-group}._tr{display:table-row}._td,
|
||||
._th{display:table-cell;vertical-align:middle}._th{font-weight:700;text-align:center}._ul{list-style-type:disc}._ul ._ul{margin:0;list-style-type:circle}._ul ._ul ._ul{list-style-type:square}._abbr,
|
||||
._b,
|
||||
._code,
|
||||
._del,
|
||||
._em,
|
||||
._i,
|
||||
._ins,
|
||||
._label,
|
||||
._q,
|
||||
._span,
|
||||
._strong,
|
||||
._sub,
|
||||
._sup{display:inline}
|
||||
Reference in New Issue
Block a user