@tencentcloud/ai-desk-customer-vue 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.code.yml +17 -0
- package/.eslintignore +6 -0
- package/.stylelintrc.json +40 -0
- package/CHANGELOG.md +5 -0
- package/README.md +12 -0
- package/adapter-vue-web.ts +73 -0
- package/adapter-vue.ts +10 -0
- package/assets/audio-before-delete.svg +4 -0
- package/assets/audio-blue.png +0 -0
- package/assets/audio-bubble-blue.svg +3 -0
- package/assets/audio-bubble-red.svg +3 -0
- package/assets/audio-delete.svg +10 -0
- package/assets/audio.svg +6 -0
- package/assets/back.svg +16 -0
- package/assets/background_mobile.png +0 -0
- package/assets/camera-uni.png +0 -0
- package/assets/close-quote-icon.svg +3 -0
- package/assets/customer_avatar.png +0 -0
- package/assets/customer_avatar_mobile.png +0 -0
- package/assets/dialog-close.png +0 -0
- package/assets/double-arrow.svg +1 -0
- package/assets/download.svg +6 -0
- package/assets/emoji.png +0 -0
- package/assets/face-uni.png +0 -0
- package/assets/face.png +0 -0
- package/assets/file-h5.png +0 -0
- package/assets/files.png +0 -0
- package/assets/form-dialog-bg.png +0 -0
- package/assets/icon-arrow-left.svg +7 -0
- package/assets/icon-close.svg +6 -0
- package/assets/iconRight.svg +3 -0
- package/assets/icon_form.png +0 -0
- package/assets/icon_form_filled.png +0 -0
- package/assets/icon_question.png +0 -0
- package/assets/icon_refresh.png +0 -0
- package/assets/icon_success.png +0 -0
- package/assets/imRobotGuess.svg +4 -0
- package/assets/image-uni.png +0 -0
- package/assets/image.png +0 -0
- package/assets/keyboard_icon.png +0 -0
- package/assets/loading.png +0 -0
- package/assets/more-uni.png +0 -0
- package/assets/more_tools.png +0 -0
- package/assets/msg-audio.svg +1 -0
- package/assets/msg-copy.svg +30 -0
- package/assets/msg-del.svg +33 -0
- package/assets/msg-quote.svg +8 -0
- package/assets/msg-revoke.svg +29 -0
- package/assets/radio-check.png +0 -0
- package/assets/radio-uncheck.png +0 -0
- package/assets/radio.svg +6 -0
- package/assets/refresh.svg +4 -0
- package/assets/rotate-left.svg +7 -0
- package/assets/rotate-right.svg +7 -0
- package/assets/star.png +0 -0
- package/assets/starLine.png +0 -0
- package/assets/translate.svg +12 -0
- package/assets/video-play.png +0 -0
- package/assets/video-uni.png +0 -0
- package/assets/video.png +0 -0
- package/assets/zoom-in.svg +9 -0
- package/assets/zoom-out.svg +9 -0
- package/components/CustomerServiceChat/chat-header/index-web.vue +141 -0
- package/components/CustomerServiceChat/emoji-config/custom-emoji.ts +15 -0
- package/components/CustomerServiceChat/emoji-config/default-emoji.ts +114 -0
- package/components/CustomerServiceChat/emoji-config/index.ts +140 -0
- package/components/CustomerServiceChat/emoji-config/locales/en.ts +66 -0
- package/components/CustomerServiceChat/emoji-config/locales/zh_cn.ts +66 -0
- package/components/CustomerServiceChat/index-web.vue +250 -0
- package/components/CustomerServiceChat/message-input/index-web.vue +214 -0
- package/components/CustomerServiceChat/message-input/index.ts +2 -0
- package/components/CustomerServiceChat/message-input/message-input-button.vue +95 -0
- package/components/CustomerServiceChat/message-input/message-input-editor-web.vue +884 -0
- package/components/CustomerServiceChat/message-input/message-input-file-web.ts +38 -0
- package/components/CustomerServiceChat/message-input/message-input-quote/index.vue +204 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue +145 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +180 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/index.vue +90 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/h5.scss +26 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/index.scss +4 -0
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/style/web.scss +55 -0
- package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +77 -0
- package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +185 -0
- package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +191 -0
- package/components/CustomerServiceChat/message-input-toolbar/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/style/uni.scss +111 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/index.vue +149 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/color.scss +6 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/h5.scss +20 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/index.scss +5 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/uni.scss +36 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/web.scss +19 -0
- package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.ts +2 -0
- package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +146 -0
- package/components/CustomerServiceChat/message-list/index-web.vue +712 -0
- package/components/CustomerServiceChat/message-list/link/index.ts +23 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-audio-web.vue +223 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-bubble-web.vue +504 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-custom.vue +5 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-face.vue +45 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-file.vue +151 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-image-web.vue +97 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-location.vue +34 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-quote/index-web.vue +286 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-quote/interface.ts +60 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-record/index.vue +139 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-text.vue +94 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-timestamp.vue +76 -0
- package/components/CustomerServiceChat/message-list/message-elements/message-video-web.vue +319 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/index.ts +9 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/index.ts +5 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/message-customer-service.vue +22 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-layout-web.vue +133 -0
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-plugin-web.vue +83 -0
- package/components/CustomerServiceChat/message-list/message-elements/read-status/index.vue +193 -0
- package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/index.vue +462 -0
- package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/message-container.vue +105 -0
- package/components/CustomerServiceChat/message-list/message-elements/video-play.vue +59 -0
- package/components/CustomerServiceChat/message-list/message-tool/index-web.vue +312 -0
- package/components/CustomerServiceChat/message-list/message-tool/message-revoked.vue +63 -0
- package/components/CustomerServiceChat/message-list/scroll-button/index.vue +201 -0
- package/components/CustomerServiceChat/message-list/style/color.scss +32 -0
- package/components/CustomerServiceChat/message-list/style/h5.scss +16 -0
- package/components/CustomerServiceChat/message-list/style/index.scss +11 -0
- package/components/CustomerServiceChat/message-list/style/web.scss +180 -0
- package/components/CustomerServiceChat/style/common.scss +59 -0
- package/components/CustomerServiceChat/style/h5.scss +51 -0
- package/components/CustomerServiceChat/style/index.scss +12 -0
- package/components/CustomerServiceChat/style/uni.scss +13 -0
- package/components/CustomerServiceChat/style/web.scss +46 -0
- package/components/CustomerServiceChat/style/wx.scss +5 -0
- package/components/CustomerServiceChat/utils/conversationDraft.ts +86 -0
- package/components/CustomerServiceChat/utils/sendMessage.ts +140 -0
- package/components/common/Avatar/index.vue +148 -0
- package/components/common/BottomPopup/index.ts +3 -0
- package/components/common/BottomPopup/index.vue +160 -0
- package/components/common/BottomPopup/style/h5.scss +62 -0
- package/components/common/BottomPopup/style/index.scss +3 -0
- package/components/common/BottomPopup/style/modal.scss +5 -0
- package/components/common/Dialog/index.ts +3 -0
- package/components/common/Dialog/index.vue +120 -0
- package/components/common/Dialog/style/color.scss +43 -0
- package/components/common/Dialog/style/dialog.scss +4 -0
- package/components/common/Dialog/style/h5.scss +56 -0
- package/components/common/Dialog/style/web.scss +61 -0
- package/components/common/Drawer/index.vue +164 -0
- package/components/common/Icon.vue +83 -0
- package/components/common/ImagePreviewer/image-item-web.vue +42 -0
- package/components/common/ImagePreviewer/index-web.vue +682 -0
- package/components/common/ImagePreviewer/index.ts +3 -0
- package/components/common/Overlay/index.vue +126 -0
- package/components/common/ProgressMessage/index.vue +95 -0
- package/components/common/RadioSelect/index.vue +59 -0
- package/components/common/RichText/LICENSE +21 -0
- package/components/common/RichText/README.md +244 -0
- package/components/common/RichText/dist/mp-alipay/index.acss +1 -0
- package/components/common/RichText/dist/mp-alipay/index.axml +1 -0
- package/components/common/RichText/dist/mp-alipay/index.js +8 -0
- package/components/common/RichText/dist/mp-alipay/index.json +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.acss +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.axml +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.js +1 -0
- package/components/common/RichText/dist/mp-alipay/node/node.json +1 -0
- package/components/common/RichText/dist/mp-alipay/parser.js +1 -0
- package/components/common/RichText/dist/mp-baidu/index.css +1 -0
- package/components/common/RichText/dist/mp-baidu/index.js +8 -0
- package/components/common/RichText/dist/mp-baidu/index.json +1 -0
- package/components/common/RichText/dist/mp-baidu/index.swan +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.css +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.js +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.json +1 -0
- package/components/common/RichText/dist/mp-baidu/node/node.swan +1 -0
- package/components/common/RichText/dist/mp-baidu/parser.js +1 -0
- package/components/common/RichText/dist/mp-qq/index.js +8 -0
- package/components/common/RichText/dist/mp-qq/index.json +1 -0
- package/components/common/RichText/dist/mp-qq/index.qml +1 -0
- package/components/common/RichText/dist/mp-qq/index.qss +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.js +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.json +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.qml +1 -0
- package/components/common/RichText/dist/mp-qq/node/node.qss +1 -0
- package/components/common/RichText/dist/mp-qq/parser.js +1 -0
- package/components/common/RichText/dist/mp-toutiao/index.js +8 -0
- package/components/common/RichText/dist/mp-toutiao/index.json +1 -0
- package/components/common/RichText/dist/mp-toutiao/index.ttml +1 -0
- package/components/common/RichText/dist/mp-toutiao/index.ttss +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.js +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.json +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.ttml +1 -0
- package/components/common/RichText/dist/mp-toutiao/node/node.ttss +1 -0
- package/components/common/RichText/dist/mp-toutiao/parser.js +1 -0
- package/components/common/RichText/dist/mp-weixin/index.js +8 -0
- package/components/common/RichText/dist/mp-weixin/index.json +1 -0
- package/components/common/RichText/dist/mp-weixin/index.wxml +1 -0
- package/components/common/RichText/dist/mp-weixin/index.wxss +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.js +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.json +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.wxml +1 -0
- package/components/common/RichText/dist/mp-weixin/node/node.wxss +1 -0
- package/components/common/RichText/dist/mp-weixin/parser.js +1 -0
- package/components/common/RichText/dist/uni-app/components/mp-html/mp-html.vue +498 -0
- package/components/common/RichText/dist/uni-app/components/mp-html/node/node.vue +587 -0
- package/components/common/RichText/dist/uni-app/components/mp-html/parser.js +1393 -0
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/handler.js +1 -0
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/local.html +1 -0
- package/components/common/RichText/docs/.nojekyll +0 -0
- package/components/common/RichText/docs/index.html +50 -0
- package/components/common/RichText/docs/lib/docsify.min.js +1 -0
- package/components/common/RichText/docs/lib/prism-bash.min.js +1 -0
- package/components/common/RichText/docs/lib/search.min.js +1 -0
- package/components/common/RichText/docs/lib/vue.css +858 -0
- package/components/common/RichText/gulpfile.js +113 -0
- package/components/common/RichText/lint.js +63 -0
- package/components/common/RichText/package.json +74 -0
- package/components/common/RichText/plugins/README.md +2 -0
- package/components/common/RichText/plugins/audio/README.md +25 -0
- package/components/common/RichText/plugins/audio/build.js +11 -0
- package/components/common/RichText/plugins/audio/context.js +7 -0
- package/components/common/RichText/plugins/audio/index.js +34 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.js +189 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.json +3 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.wxml +17 -0
- package/components/common/RichText/plugins/audio/miniprogram/audio.wxss +127 -0
- package/components/common/RichText/plugins/audio/miniprogram/build.js +3 -0
- package/components/common/RichText/plugins/audio/uni-app/audio.vue +269 -0
- package/components/common/RichText/plugins/audio/uni-app/build.js +3 -0
- package/components/common/RichText/plugins/card/README.md +30 -0
- package/components/common/RichText/plugins/card/build.js +14 -0
- package/components/common/RichText/plugins/card/index.js +7 -0
- package/components/common/RichText/plugins/card/miniprogram/build.js +3 -0
- package/components/common/RichText/plugins/card/miniprogram/card.js +26 -0
- package/components/common/RichText/plugins/card/miniprogram/card.json +3 -0
- package/components/common/RichText/plugins/card/miniprogram/card.wxml +9 -0
- package/components/common/RichText/plugins/card/miniprogram/card.wxss +55 -0
- package/components/common/RichText/plugins/card/uni-app/build.js +3 -0
- package/components/common/RichText/plugins/card/uni-app/card.vue +122 -0
- package/components/common/RichText/plugins/editable/README.md +137 -0
- package/components/common/RichText/plugins/editable/config.js +15 -0
- package/components/common/RichText/plugins/editable/miniprogram/build.js +813 -0
- package/components/common/RichText/plugins/editable/miniprogram/index.js +551 -0
- package/components/common/RichText/plugins/editable/uni-app/build.js +744 -0
- package/components/common/RichText/plugins/editable/uni-app/index.js +553 -0
- package/components/common/RichText/plugins/emoji/README.md +15 -0
- package/components/common/RichText/plugins/emoji/index.js +203 -0
- package/components/common/RichText/plugins/highlight/README.md +26 -0
- package/components/common/RichText/plugins/highlight/config.js +5 -0
- package/components/common/RichText/plugins/highlight/index.js +96 -0
- package/components/common/RichText/plugins/highlight/miniprogram/build.js +88 -0
- package/components/common/RichText/plugins/highlight/prism.css +125 -0
- package/components/common/RichText/plugins/highlight/prism.min.js +7 -0
- package/components/common/RichText/plugins/highlight/uni-app/build.js +88 -0
- package/components/common/RichText/plugins/img-cache/README.md +24 -0
- package/components/common/RichText/plugins/img-cache/build.js +16 -0
- package/components/common/RichText/plugins/img-cache/index.js +138 -0
- package/components/common/RichText/plugins/latex/README.md +16 -0
- package/components/common/RichText/plugins/latex/build.js +14 -0
- package/components/common/RichText/plugins/latex/index.js +77 -0
- package/components/common/RichText/plugins/latex/katex.css +1070 -0
- package/components/common/RichText/plugins/latex/katex.min.js +1 -0
- package/components/common/RichText/plugins/markdown/README.md +17 -0
- package/components/common/RichText/plugins/markdown/index.js +34 -0
- package/components/common/RichText/plugins/markdown/marked.min.js +6 -0
- package/components/common/RichText/plugins/markdown/miniprogram/build.js +70 -0
- package/components/common/RichText/plugins/markdown/uni-app/build.js +68 -0
- package/components/common/RichText/plugins/search/README.md +46 -0
- package/components/common/RichText/plugins/search/miniprogram/index.js +137 -0
- package/components/common/RichText/plugins/search/uni-app/index.js +132 -0
- package/components/common/RichText/plugins/style/README.md +30 -0
- package/components/common/RichText/plugins/style/index.js +129 -0
- package/components/common/RichText/plugins/style/parser.js +175 -0
- package/components/common/RichText/plugins/template/README.md +2 -0
- package/components/common/RichText/plugins/template/build.js +65 -0
- package/components/common/RichText/plugins/template/index.js +67 -0
- package/components/common/RichText/plugins/txv-video/README.md +18 -0
- package/components/common/RichText/plugins/txv-video/build.js +3 -0
- package/components/common/RichText/plugins/txv-video/index.js +46 -0
- package/components/common/RichText/plugins/txv-video/miniprogram/build.js +6 -0
- package/components/common/RichText/plugins/txv-video/uni-app/build.js +3 -0
- package/components/common/RichText/src/miniprogram/index.js +396 -0
- package/components/common/RichText/src/miniprogram/index.json +6 -0
- package/components/common/RichText/src/miniprogram/index.wxml +7 -0
- package/components/common/RichText/src/miniprogram/index.wxss +13 -0
- package/components/common/RichText/src/miniprogram/node/node.js +247 -0
- package/components/common/RichText/src/miniprogram/node/node.json +6 -0
- package/components/common/RichText/src/miniprogram/node/node.wxml +112 -0
- package/components/common/RichText/src/miniprogram/node/node.wxss +164 -0
- package/components/common/RichText/src/miniprogram/parser.js +1269 -0
- package/components/common/RichText/src/uni-app/components/mp-html/mp-html.vue +498 -0
- package/components/common/RichText/src/uni-app/components/mp-html/node/node.vue +585 -0
- package/components/common/RichText/src/uni-app/components/mp-html/parser.js +1393 -0
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/handler.js +254 -0
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +1 -0
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/local.html +33 -0
- package/components/common/RichText/tools/config.js +82 -0
- package/components/common/RichText/tools/converter.js +205 -0
- package/components/common/RichText/tools/ifdef.js +115 -0
- package/components/common/RichText/tools/minifier.js +40 -0
- package/components/common/RichText/tools/plugin.js +248 -0
- package/components/common/Toast/index-web.ts +122 -0
- package/components/common/Toast/index-web.vue +178 -0
- package/components/common/Toast/type.ts +8 -0
- package/components/common/common.scss +59 -0
- package/components/customer-icon.vue +56 -0
- package/components/message-branch.vue +120 -0
- package/components/message-customer-service.vue +114 -0
- package/components/message-form/form-branch.vue +68 -0
- package/components/message-form/form-input.vue +242 -0
- package/components/message-form/index.vue +80 -0
- package/components/message-multi-branch/branch-pc.vue +79 -0
- package/components/message-multi-branch/index.vue +60 -0
- package/components/message-multi-form/component-mobile/form-popup.vue +37 -0
- package/components/message-multi-form/component-mobile/input-mobile.vue +102 -0
- package/components/message-multi-form/component-mobile/label-mobile.vue +32 -0
- package/components/message-multi-form/component-mobile/radios-mobile.vue +161 -0
- package/components/message-multi-form/component-pc/input-pc.vue +93 -0
- package/components/message-multi-form/component-pc/label-pc.vue +33 -0
- package/components/message-multi-form/component-pc/radio-pc.vue +98 -0
- package/components/message-multi-form/form-mobile.vue +385 -0
- package/components/message-multi-form/form-pc.vue +184 -0
- package/components/message-multi-form/index.vue +61 -0
- package/components/message-product-card.vue +129 -0
- package/components/message-rating/index.vue +56 -0
- package/components/message-rating/message-rating-number.vue +247 -0
- package/components/message-rating/message-rating-star.vue +237 -0
- package/components/message-rich-text.vue +155 -0
- package/components/message-robot-welcome.vue +181 -0
- package/components/message-stream.vue +109 -0
- package/constant.ts +122 -0
- package/excluded-list.txt +6 -0
- package/index.ts +30 -0
- package/index.vue +60 -0
- package/interface.ts +176 -0
- package/logger/index.ts +12 -0
- package/logger/main.ts +120 -0
- package/package.json +62 -0
- package/script/fileCopy.js +60 -0
- package/script/syncVersion.js +35 -0
- package/server.ts +128 -0
- package/styles/common.scss +116 -0
- package/tsconfig.json +34 -0
- package/typings.d.ts +20 -0
- package/utils/chatStorage.ts +70 -0
- package/utils/copy-web.ts +141 -0
- package/utils/enableSampleTaskStatus.ts +8 -0
- package/utils/env.ts +15 -0
- package/utils/index.ts +59 -0
- package/utils/utils.ts +162 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="isOverlayShow"
|
|
4
|
+
ref="overlayDomRef"
|
|
5
|
+
class="overlay-container"
|
|
6
|
+
:style="{
|
|
7
|
+
position: props.isFullScreen ? 'fixed' : 'absolute',
|
|
8
|
+
zIndex: props.zIndex,
|
|
9
|
+
}"
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
v-if="props.useMask"
|
|
13
|
+
:class="{
|
|
14
|
+
'overlay-mask': true,
|
|
15
|
+
'fade-in': props.visible,
|
|
16
|
+
}"
|
|
17
|
+
:style="{
|
|
18
|
+
backgroundColor: props.maskColor,
|
|
19
|
+
}"
|
|
20
|
+
@click="onOverlayClick"
|
|
21
|
+
@touchstart.prevent.stop="onOverlayClick"
|
|
22
|
+
/>
|
|
23
|
+
<div
|
|
24
|
+
:class="{
|
|
25
|
+
'overlay-content': true,
|
|
26
|
+
'full-screen': props.isFullScreen,
|
|
27
|
+
}"
|
|
28
|
+
>
|
|
29
|
+
<slot />
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup lang="ts">
|
|
35
|
+
import vue from '../../../adapter-vue';
|
|
36
|
+
const { ref, watch, withDefaults } = vue;
|
|
37
|
+
export interface IOverlayProps {
|
|
38
|
+
visible?: boolean;
|
|
39
|
+
zIndex?: number | undefined;
|
|
40
|
+
useMask?: boolean | undefined;
|
|
41
|
+
maskColor?: string | undefined;
|
|
42
|
+
isFullScreen?: boolean | undefined;
|
|
43
|
+
width?: string;
|
|
44
|
+
height?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const emits = defineEmits(['onOverlayClick']);
|
|
48
|
+
|
|
49
|
+
const props = withDefaults(defineProps<IOverlayProps>(), {
|
|
50
|
+
visible: true,
|
|
51
|
+
zIndex: 9999,
|
|
52
|
+
useMask: true,
|
|
53
|
+
isFullScreen: true,
|
|
54
|
+
maskColor: 'rgba(0, 0, 0, 0.6)',
|
|
55
|
+
width: 'auto',
|
|
56
|
+
height: 'auto',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const overlayDomRef = ref<HTMLElement>();
|
|
60
|
+
const isOverlayShow = ref<boolean>(props.visible);
|
|
61
|
+
|
|
62
|
+
watch(
|
|
63
|
+
() => props.visible,
|
|
64
|
+
(visible: boolean) => {
|
|
65
|
+
if (visible) {
|
|
66
|
+
isOverlayShow.value = true;
|
|
67
|
+
} else {
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
isOverlayShow.value = false;
|
|
70
|
+
}, 150);
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
immediate: true,
|
|
75
|
+
},
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
function onOverlayClick() {
|
|
79
|
+
emits('onOverlayClick');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
defineExpose({
|
|
83
|
+
overlayDomRef,
|
|
84
|
+
});
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<style scoped lang="scss">
|
|
88
|
+
.overlay-container {
|
|
89
|
+
position: fixed;
|
|
90
|
+
top: 0;
|
|
91
|
+
bottom: 0;
|
|
92
|
+
left: 0;
|
|
93
|
+
right: 0;
|
|
94
|
+
z-index: 9999;
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
|
|
99
|
+
.overlay-mask {
|
|
100
|
+
z-index: -1;
|
|
101
|
+
position: absolute;
|
|
102
|
+
top: 0;
|
|
103
|
+
left: 0;
|
|
104
|
+
right: 0;
|
|
105
|
+
bottom: 0;
|
|
106
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
107
|
+
opacity: 0;
|
|
108
|
+
transition: opacity 0.15s linear;
|
|
109
|
+
animation: fade-in 0.15s linear;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.overlay-mask.fade-in {
|
|
114
|
+
opacity: 1;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes fade-in {
|
|
118
|
+
0% {
|
|
119
|
+
opacity: 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
100% {
|
|
123
|
+
opacity: 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
</style>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="progress-message">
|
|
3
|
+
<slot />
|
|
4
|
+
<div
|
|
5
|
+
v-if="
|
|
6
|
+
props.messageItem.status === 'unSend' && props.messageItem.progress < 1
|
|
7
|
+
"
|
|
8
|
+
class="progress-container"
|
|
9
|
+
>
|
|
10
|
+
<progress
|
|
11
|
+
v-if="!isUniFrameWork"
|
|
12
|
+
class="progress"
|
|
13
|
+
:value="props.messageItem.progress"
|
|
14
|
+
max="1"
|
|
15
|
+
/>
|
|
16
|
+
<progress
|
|
17
|
+
v-else
|
|
18
|
+
activeColor="#006EFF"
|
|
19
|
+
class="progress-common"
|
|
20
|
+
:percent="Math.round(props.messageItem.progress * 100)"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
import type { IMessageModel } from '@tencentcloud/chat-uikit-engine';
|
|
28
|
+
import vue from '../../../adapter-vue';
|
|
29
|
+
import { isUniFrameWork } from '../../../utils/env';
|
|
30
|
+
import type { IImageMessageContent } from '../../../interface';
|
|
31
|
+
const { withDefaults } = vue;
|
|
32
|
+
|
|
33
|
+
const props = withDefaults(
|
|
34
|
+
defineProps<{
|
|
35
|
+
content: IImageMessageContent;
|
|
36
|
+
messageItem: IMessageModel;
|
|
37
|
+
}>(),
|
|
38
|
+
{
|
|
39
|
+
content: () => ({}),
|
|
40
|
+
messageItem: () => ({} as IMessageModel),
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<style lang="scss" scoped>
|
|
46
|
+
$primary-progress-color: #006eff;
|
|
47
|
+
$primary-progress-bg-color: #fff;
|
|
48
|
+
|
|
49
|
+
.progress-message {
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
|
|
52
|
+
.progress-container {
|
|
53
|
+
position: absolute;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: 100%;
|
|
57
|
+
padding: 0 15%;
|
|
58
|
+
left: 0;
|
|
59
|
+
top: 0;
|
|
60
|
+
background: rgba(#000, 0.5);
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
|
|
64
|
+
.progress-common {
|
|
65
|
+
appearance: none;
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 0.5rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.progress {
|
|
71
|
+
@extend .progress-common;
|
|
72
|
+
|
|
73
|
+
color: $primary-progress-color;
|
|
74
|
+
border-radius: 0.25rem;
|
|
75
|
+
background: $primary-progress-bg-color;
|
|
76
|
+
|
|
77
|
+
&::-webkit-progress-value {
|
|
78
|
+
background-color: $primary-progress-color;
|
|
79
|
+
border-radius: 0.25rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&::-webkit-progress-bar {
|
|
83
|
+
border-radius: 0.25rem;
|
|
84
|
+
background: $primary-progress-bg-color;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&::-moz-progress-bar {
|
|
88
|
+
color: $primary-progress-color;
|
|
89
|
+
background: $primary-progress-color;
|
|
90
|
+
border-radius: 0.25rem;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="radio-select"
|
|
4
|
+
@click="toggleSelect"
|
|
5
|
+
>
|
|
6
|
+
<div
|
|
7
|
+
v-if="!props.isSelected"
|
|
8
|
+
class="radio-no-select"
|
|
9
|
+
/>
|
|
10
|
+
<Icon
|
|
11
|
+
v-else
|
|
12
|
+
:file="radioIcon"
|
|
13
|
+
:size="'20px'"
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script lang="ts" setup>
|
|
19
|
+
import Icon from '../Icon.vue';
|
|
20
|
+
import radioIcon from '../../../assets/radio.svg';
|
|
21
|
+
|
|
22
|
+
interface IProps {
|
|
23
|
+
isSelected: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface IEmits {
|
|
27
|
+
(e: 'onChange', value: boolean): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const emits = defineEmits<IEmits>();
|
|
31
|
+
const props = withDefaults(defineProps<IProps>(), {});
|
|
32
|
+
|
|
33
|
+
function toggleSelect() {
|
|
34
|
+
emits('onChange', !props.isSelected);
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
<style lang="scss" scoped>
|
|
38
|
+
:not(not) {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
min-width: 0;
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.radio-select {
|
|
46
|
+
flex: 1;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
-webkit-tap-highlight-color: transparent;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
|
|
52
|
+
.radio-no-select {
|
|
53
|
+
height: 20px;
|
|
54
|
+
width: 20px;
|
|
55
|
+
border-radius: 50%;
|
|
56
|
+
border: 2px solid #ddd;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019-present Jin Yufeng
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# mp-html
|
|
2
|
+
|
|
3
|
+
> 一个强大的小程序富文本组件
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
[](https://www.npmjs.com/package/mp-html)
|
|
8
|
+

|
|
9
|
+
[](https://coveralls.io/github/jin-yufeng/mp-html?branch=master)
|
|
10
|
+

|
|
11
|
+
[](https://standardjs.com)
|
|
12
|
+
|
|
13
|
+
## 功能介绍
|
|
14
|
+
- 支持在多个主流的小程序平台和 `uni-app` 中使用
|
|
15
|
+
- 支持丰富的标签(包括 `table`、`video`、`svg` 等)
|
|
16
|
+
- 支持丰富的事件效果(自动预览图片、链接处理等)
|
|
17
|
+
- 支持设置占位图(加载中、出错时、预览时)
|
|
18
|
+
- 支持锚点跳转、长按复制等丰富功能
|
|
19
|
+
- 支持大部分 *html* 实体
|
|
20
|
+
- 丰富的插件(关键词搜索、内容编辑、`latex` 公式等)
|
|
21
|
+
- 效率高、容错性强且轻量化(`≈25KB`,`9KB gzipped`)
|
|
22
|
+
|
|
23
|
+
查看 [功能介绍](https://jin-yufeng.gitee.io/mp-html/#/overview/feature) 了解更多
|
|
24
|
+
|
|
25
|
+
## 使用方法
|
|
26
|
+
### 原生平台
|
|
27
|
+
- `npm` 方式
|
|
28
|
+
1. 在项目目录下安装组件包
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install mp-html
|
|
32
|
+
```
|
|
33
|
+
2. 开发者工具中勾选 `使用 npm 模块`(若没有此选项则不需要)并点击 `工具 - 构建 npm`
|
|
34
|
+
3. 在需要使用页面的 `json` 文件中添加
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"usingComponents": {
|
|
39
|
+
"mp-html": "mp-html"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
4. 在需要使用页面的 `wxml` 文件中添加
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<mp-html content="{{html}}" />
|
|
47
|
+
```
|
|
48
|
+
5. 在需要使用页面的 `js` 文件中添加
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
Page({
|
|
52
|
+
onLoad () {
|
|
53
|
+
this.setData({
|
|
54
|
+
html: '<div>Hello World!</div>'
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
- 源码方式
|
|
60
|
+
1. 将源码中对应平台的代码包(`dist/platform`)拷贝到 `components` 目录下,更名为 `mp-html`
|
|
61
|
+
2. 在需要使用页面的 `json` 文件中添加
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"usingComponents": {
|
|
66
|
+
"mp-html": "/components/mp-html/index"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
后续步骤同上
|
|
72
|
+
|
|
73
|
+
查看 [快速开始](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart) 了解更多
|
|
74
|
+
|
|
75
|
+
### uni-app
|
|
76
|
+
- 源码方式
|
|
77
|
+
1. 将源码中 `dist/uni-app` 内的内容拷贝到项目根目录下
|
|
78
|
+
可以直接通过 [插件市场](https://ext.dcloud.net.cn/plugin?id=805) 引入
|
|
79
|
+
2. 在需要使用页面的 `vue` 文件中添加
|
|
80
|
+
|
|
81
|
+
```vue
|
|
82
|
+
<template>
|
|
83
|
+
<view>
|
|
84
|
+
<mp-html :content="html" />
|
|
85
|
+
</view>
|
|
86
|
+
</template>
|
|
87
|
+
<script>
|
|
88
|
+
import mpHtml from '@/components/mp-html/mp-html'
|
|
89
|
+
export default {
|
|
90
|
+
// HBuilderX 2.5.5+ 可以通过 easycom 自动引入
|
|
91
|
+
components: {
|
|
92
|
+
mpHtml
|
|
93
|
+
},
|
|
94
|
+
data () {
|
|
95
|
+
return {
|
|
96
|
+
html: '<div>Hello World!</div>'
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</script>
|
|
101
|
+
```
|
|
102
|
+
- `npm` 方式
|
|
103
|
+
1. 在项目目录下安装组件包
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npm install mp-html
|
|
107
|
+
```
|
|
108
|
+
2. 在需要使用页面的 `vue` 文件中添加
|
|
109
|
+
|
|
110
|
+
```vue
|
|
111
|
+
<template>
|
|
112
|
+
<view>
|
|
113
|
+
<mp-html :content="html" />
|
|
114
|
+
</view>
|
|
115
|
+
</template>
|
|
116
|
+
<script>
|
|
117
|
+
import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html'
|
|
118
|
+
export default {
|
|
119
|
+
// 不可省略
|
|
120
|
+
components: {
|
|
121
|
+
mpHtml
|
|
122
|
+
},
|
|
123
|
+
data () {
|
|
124
|
+
return {
|
|
125
|
+
html: '<div>Hello World!</div>'
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
</script>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
使用 `cli` 方式运行的项目,通过 `npm` 方式引入时,需要在 `vue.config.js` 中配置 `transpileDependencies`,详情可见 [#330](https://github.com/jin-yufeng/mp-html/issues/330#issuecomment-913617687)
|
|
133
|
+
如果在 `nvue` 中使用还要将 `dist/uni-app/static` 目录下的内容拷贝到项目的 `static` 目录下,否则无法运行
|
|
134
|
+
|
|
135
|
+
查看 [快速开始](https://jin-yufeng.gitee.io/mp-html/#/overview/quickstart) 了解更多
|
|
136
|
+
|
|
137
|
+
## 组件属性
|
|
138
|
+
|
|
139
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
140
|
+
|:---:|:---:|:---:|---|
|
|
141
|
+
| container-style | String | | 容器的样式([2.1.0+](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog#v210)) |
|
|
142
|
+
| content | String | | 用于渲染的 html 字符串 |
|
|
143
|
+
| copy-link | Boolean | true | 是否允许外部链接被点击时自动复制 |
|
|
144
|
+
| domain | String | | 主域名(用于链接拼接) |
|
|
145
|
+
| error-img | String | | 图片出错时的占位图链接 |
|
|
146
|
+
| lazy-load | Boolean | false | 是否开启图片懒加载 |
|
|
147
|
+
| loading-img | String | | 图片加载过程中的占位图链接 |
|
|
148
|
+
| pause-video | Boolean | true | 是否在播放一个视频时自动暂停其他视频 |
|
|
149
|
+
| preview-img | Boolean | true | 是否允许图片被点击时自动预览 |
|
|
150
|
+
| scroll-table | Boolean | false | 是否给每个表格添加一个滚动层使其能单独横向滚动 |
|
|
151
|
+
| selectable | Boolean | false | 是否开启文本长按复制 |
|
|
152
|
+
| set-title | Boolean | true | 是否将 title 标签的内容设置到页面标题 |
|
|
153
|
+
| show-img-menu | Boolean | true | 是否允许图片被长按时显示菜单 |
|
|
154
|
+
| tag-style | Object | | 设置标签的默认样式 |
|
|
155
|
+
| use-anchor | Boolean | false | 是否使用锚点链接 |
|
|
156
|
+
|
|
157
|
+
查看 [属性](https://jin-yufeng.gitee.io/mp-html/#/basic/prop) 了解更多
|
|
158
|
+
|
|
159
|
+
## 组件事件
|
|
160
|
+
|
|
161
|
+
| 名称 | 触发时机 |
|
|
162
|
+
|:---:|---|
|
|
163
|
+
| load | dom 树加载完毕时 |
|
|
164
|
+
| ready | 图片加载完毕时 |
|
|
165
|
+
| error | 发生渲染错误时 |
|
|
166
|
+
| imgtap | 图片被点击时 |
|
|
167
|
+
| linktap | 链接被点击时 |
|
|
168
|
+
|
|
169
|
+
查看 [事件](https://jin-yufeng.gitee.io/mp-html/#/basic/event) 了解更多
|
|
170
|
+
|
|
171
|
+
## api
|
|
172
|
+
组件实例上提供了一些 `api` 方法可供调用
|
|
173
|
+
|
|
174
|
+
| 名称 | 作用 |
|
|
175
|
+
|:---:|---|
|
|
176
|
+
| in | 将锚点跳转的范围限定在一个 scroll-view 内 |
|
|
177
|
+
| navigateTo | 锚点跳转 |
|
|
178
|
+
| getText | 获取文本内容 |
|
|
179
|
+
| getRect | 获取富文本内容的位置和大小 |
|
|
180
|
+
| setContent | 设置富文本内容 |
|
|
181
|
+
| imgList | 获取所有图片的数组 |
|
|
182
|
+
| pauseMedia | 暂停播放音视频([2.2.2+](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog#v222)) |
|
|
183
|
+
| setPlaybackRate | 设置音视频播放速率([2.4.0+](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog#v240)) |
|
|
184
|
+
|
|
185
|
+
查看 [api](https://jin-yufeng.gitee.io/mp-html/#/advanced/api) 了解更多
|
|
186
|
+
|
|
187
|
+
## 插件扩展
|
|
188
|
+
除基本功能外,本组件还提供了丰富的扩展,可按照需要选用
|
|
189
|
+
|
|
190
|
+
| 名称 | 作用 |
|
|
191
|
+
|:---:|---|
|
|
192
|
+
| audio | 音乐播放器 |
|
|
193
|
+
| editable | 富文本编辑 |
|
|
194
|
+
| emoji | 解析 emoji |
|
|
195
|
+
| highlight | 代码块高亮显示 |
|
|
196
|
+
| markdown | 渲染 markdown |
|
|
197
|
+
| search | 关键词搜索 |
|
|
198
|
+
| style | 匹配 style 标签中的样式 |
|
|
199
|
+
| txv-video | 使用腾讯视频 |
|
|
200
|
+
| img-cache | 图片缓存 by [@PentaTea](https://github.com/PentaTea) |
|
|
201
|
+
| latex | 渲染 latex 公式 by [@Zeng-J](https://github.com/Zeng-J) |
|
|
202
|
+
| card | 卡片展示 by [@whoooami](https://github.com/whoooami) |
|
|
203
|
+
|
|
204
|
+
查看 [插件](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin) 了解更多
|
|
205
|
+
|
|
206
|
+
## 许可与支持
|
|
207
|
+
- 许可
|
|
208
|
+
您可以免费的使用(包括商用)、复制或修改本组件 [MIT License](https://github.com/jin-yufeng/mp-html/blob/master/LICENSE)
|
|
209
|
+
在用于生产环境前务必经过充分测试,由插件 `bug` 带来的损失概不负责(可以自行修改源码)
|
|
210
|
+
|
|
211
|
+
- 联系
|
|
212
|
+
欢迎加入 `QQ` 交流群:
|
|
213
|
+
群1(已满):`699734691`
|
|
214
|
+
群2(已满):`778239129`
|
|
215
|
+
群3:`960265313`
|
|
216
|
+
|
|
217
|
+
## 更新日志
|
|
218
|
+
- v2.5.0 (20240422)
|
|
219
|
+
1. `U` `play` 事件增加返回 `src` 等信息 [详细](https://github.com/jin-yufeng/mp-html/issues/526)
|
|
220
|
+
2. `U` `preview-img` 属性支持设置为 `all` 开启 `base64` 图片预览 [详细](https://github.com/jin-yufeng/mp-html/issues/536)
|
|
221
|
+
3. `U` `editable` 插件增加简易模式(点击文字直接编辑)
|
|
222
|
+
4. `U` `latex` 插件支持块级公式 [详细](https://github.com/jin-yufeng/mp-html/issues/582)
|
|
223
|
+
5. `F` 修复了表格部分情况下背景丢失的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/587)
|
|
224
|
+
6. `F` 修复了部分 `svg` 无法显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/591)
|
|
225
|
+
7. `F` 修复了 `uni-app` 包 `h5` 和 `app` 端部分情况下样式无法识别的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/518)
|
|
226
|
+
8. `F` 修复了 `latex` 插件部分情况下显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/580)
|
|
227
|
+
9. `F` 修复了 `editable` 插件表格无法删除的问题
|
|
228
|
+
10. `F` 修复了 `editable` 插件 `uni-app` 包 `vue3` `h5` 端点击图片报错的问题
|
|
229
|
+
11. `F` 修复了 `editable` 插件 `uni-app` 包点击表格没有菜单栏的问题
|
|
230
|
+
|
|
231
|
+
- v2.4.3 (20240121)
|
|
232
|
+
1. `A` 增加 [card](https://jin-yufeng.gitee.io/mp-html/#/advanced/plugin#card) 插件 [详细](https://github.com/jin-yufeng/mp-html/pull/533) by [@whoooami](https://github.com/whoooami)
|
|
233
|
+
2. `F` 修复了 `svg` 中包含 `foreignobject` 可能不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/523)
|
|
234
|
+
3. `F` 修复了合并单元格的表格部分情况下显示不正确的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/561)
|
|
235
|
+
4. `F` 修复了 `img` 标签设置 `object-fit` 无效的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/567)
|
|
236
|
+
5. `F` 修复了 `latex` 插件公式会换行的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/540)
|
|
237
|
+
6. `F` 修复了 `uni-app` 包 `editable` 和 `audio` 插件共用时点击 `audio` 无法编辑的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/529) by [@whoooami](https://github.com/whoooami)
|
|
238
|
+
7. `F` 修复了支付宝小程序设置了宽高的图片可能显示不正常的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/544)
|
|
239
|
+
8. `F` 修复了 `uni-app` 包微信小程序部分情况下图片会报错 `replace of undefined` 的问题
|
|
240
|
+
9. `F` 修复了 `uni-app` 包快手小程序图片不显示的问题 [详细](https://github.com/jin-yufeng/mp-html/issues/571)
|
|
241
|
+
|
|
242
|
+
从 `1.x` 的升级方法可见 [更新指南](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog?id=v200)
|
|
243
|
+
|
|
244
|
+
查看 [更新日志](https://jin-yufeng.gitee.io/mp-html/#/changelog/changelog) 了解更多
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<view class="_root {{selectable?'_select':''}}" style="{{containerStyle}}"><slot a:if="{{!nodes[0]}}"/><node id="_root" childs="{{nodes}}" opts="{{[lazyLoad,loadingImg,errorImg,showImgMenu,selectable]}}" onAdd="_add"/></view>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"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}/*!
|
|
2
|
+
* mp-html v2.5.0
|
|
3
|
+
* https://github.com/jin-yufeng/mp-html
|
|
4
|
+
*
|
|
5
|
+
* Released under the MIT license
|
|
6
|
+
* Author: Jin Yufeng
|
|
7
|
+
*/
|
|
8
|
+
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(){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 i=this;return new Promise(function(o,r){if(!i.props.useAnchor)return void r(Error("Anchor is disabled"));var s=my.createSelectorQuery().select((i._in?i._in.selector:"._root")+(t?"".concat(" ","#").concat(t):"")).boundingClientRect();i._in?s.select(i._in.selector).scrollOffset().select(i._in.selector).boundingClientRect():s.selectViewport().scrollOffset(),s.exec(function(t){if(!t[0])return void r(Error("Label not found"));var s=t[1].scrollTop+t[0].top-(t[2]?t[2].top:0)+(n||parseInt(i.props.useAnchor)||0);i._in?i._in.page.setData(e({},i._in.scrollTop,s)):my.pageScrollTo({scrollTop:s,duration:300}),o()})})},getText:function(e){var t="";return function e(n){for(var i=0;i<n.length;i++){var o=n[i];if("text"===o.type)t+=o.text.replace(/&/g,"&");else if("br"===o.name)t+="\n";else{var r="p"===o.name||"div"===o.name||"tr"===o.name||"li"===o.name||"h"===o.name[0]&&o.name[1]>"0"&&o.name[1]<"7";r&&t&&"\n"!==t[t.length-1]&&(t+="\n"),o.children&&e(o.children),r&&"\n"!==t[t.length-1]?t+="\n":"td"!==o.name&&"th"!==o.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"))})})},pauseMedia:function(){for(var e=(this._videos||[]).length;e--;)this._videos[e].pause()},setPlaybackRate:function(e){this.playbackRate=e;for(var t=(this._videos||[]).length;t--;)this._videos[t].playbackRate(e)},setContent:function(e,n){var i=this;this.imgList&&n||(this.imgList=[]),this._videos=[];var o={},r=new t(this).parse(e);if(n)for(var s=this.data.nodes.length,a=r.length;a--;)o["nodes[".concat(s+a,"]")]=r[a];else o.nodes=r;if(this.setData(o,function(){i._hook("onLoad"),i.props.onLoad&&i.props.onLoad()}),this.props.lazyLoad||this.imgList._unloadimgs<this.imgList.length/2){var l=0,c=function e(t){t&&t.height||(t={}),t.height===l?i.props.onReady&&i.props.onReady(t):(l=t.height,setTimeout(function(){i.getRect().then(e).catch(e)},350))};this.getRect().then(c).catch(c)}else this.imgList._unloadimgs||this.getRect().then(function(e){i.props.onReady&&i.props.onReady(e)}).catch(function(){i.props.onReady&&i.props.onReady({})})},_hook:function(e){for(var t=n.length;t--;)this.plugins[t][e]&&this.plugins[t][e]()},_add:function(e){e.root=this}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"component":true,"usingComponents":{"node":"./node/node"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._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}._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}._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}._tbody,._tfoot,._thead{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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template name="el"><block a:if="{{n.name==='img'}}"><rich-text a:if="{{n.t}}" style="display:{{n.t}}" nodes="<img class='_img' style='{{n.attrs.style}}' src='{{n.attrs.src}}'>" data-i="{{i}}" catchTap="imgTap"/><block a:else><image a:if="{{(opts[1]&&!ctrl[i])||ctrl[i]<0}}" class="_img" style="{{n.attrs.style}}" src="{{ctrl[i]<0?opts[2]:opts[1]}}" mode="widthFix"/><image id="{{n.attrs.id}}" class="_img {{n.attrs.class}}" style="{{ctrl[i]===-1?'display:none;':''}}width:{{ctrl[i]||1}}px;height:1px;{{n.attrs.style}}" src="{{n.attrs.src}}" mode="{{!n.h?'widthFix':(!n.w?'heightFix':(n.m||'scaleToFill'))}}" lazy-load="{{opts[0]}}" data-i="{{i}}" onLoad="imgLoad" onError="mediaError" catchTap="imgTap" onLongTap="noop"/></block></block><text a:elif="{{n.name==='br'}}">\n</text><view a:elif="{{n.name==='a'}}" id="{{n.attrs.id}}" class="{{n.attrs.href?'_a ':''}}{{n.attrs.class}}" hover-class="_hover" style="display:inline;{{n.attrs.style}}" data-i="{{i}}" catchTap="linkTap"><template is="node" data="{{childs:n.children,path:i+'_',opts:opts,ctrl:ctrl}}"></template></view><video a:elif="{{n.name==='video'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" autoplay="{{n.attrs.autoplay}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" muted="{{n.attrs.muted}}" object-fit="{{n.attrs['object-fit']}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" onPlay="play" onError="mediaError"/><audio a:elif="{{n.name==='audio'}}" id="{{n.attrs.id}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" author="{{n.attrs.author}}" controls="{{n.attrs.controls}}" loop="{{n.attrs.loop}}" name="{{n.attrs.name}}" poster="{{n.attrs.poster}}" src="{{n.src[ctrl[i]||0]}}" data-i="{{i}}" onPlay="play" onError="mediaError"/><rich-text a:else id="{{n.attrs.id}}" style="display:inline;{{n.f}}" nodes="{{[n]}}"/></template><template name="node"><block a:for="{{childs}}" a:for-item="n" a:for-index="i" a:key="i"><template a:if="{{!n.c}}" is="el" data="{{n:n,i:path+i,opts:opts,ctrl:ctrl}}"/><view a:else id="{{n.attrs.id}}" class="_{{n.name}} {{n.attrs.class}}" style="{{n.attrs.style}}"><template is="node" data="{{childs:n.children,path:path+i+'_',opts:opts,ctrl:ctrl}}"></template></view></block></template><template is="node" data="{{childs:childs,path:'',opts:opts,ctrl:ctrl}}"></template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function t(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 e(e){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}function r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Component({data:{ctrl:{}},props:{childs:[],opts:[]},options:{addGlobalClass:!0},didMount:function(){this.props.onAdd(this)},methods:{noop:function(){},getNode:function(t){try{for(var e=t.split("_"),r=this.props.childs[e[0]],i=1;i<e.length;i++)r=r.children[e[i]];return r}catch(t){return{text:"",attrs:{},children:[]}}},play:function(t){var r=t.target.dataset.i,i=this.getNode(r);if(this.root.props.onPlay&&this.root.props.onPlay({source:i.name,attrs:e(e({},i.attrs),{},{src:i.src[this.data.ctrl[r]||0]})}),this.root.props.pauseVideo){for(var o=!1,a=t.target.id,s=this.root._videos.length;s--;)this.root._videos[s].id===a?o=!0:this.root._videos[s].pause();if(!o){var n=my.createVideoContext(a,this);n.id=a,this.root.playbackRate&&n.playbackRate(this.root.playbackRate),this.root._videos.push(n)}}},imgTap:function(t){var e=this.getNode(t.target.dataset.i);if(e.a)return this.linkTap(e.a);if(!e.attrs.ignore&&(this.root.props.onImgtap&&this.root.props.onImgtap(e.attrs),this.root.props.previewImg)){var r=e.i;my.previewImage({enablesavephoto:this.root.props.showImgMenu,enableShowPhotoDownload:this.root.props.showImgMenu,current:r,urls:this.root.imgList})}},imgLoad:function(t){var e,i=t.target.dataset.i,o=this.getNode(i);o.w?(this.props.opts[1]&&!this.data.ctrl[i]||-1===this.data.ctrl[i])&&(e=1):e=t.detail.width,e&&this.setData(r({},"ctrl."+i,e)),this.checkReady()},checkReady:function(){var t=this;this.root.props.lazyLoad||(this.root.imgList._unloadimgs-=1,this.root.imgList._unloadimgs||setTimeout(function(){t.root.getRect().then(function(e){t.root.props.onReady&&t.root.props.onReady(e)}).catch(function(){t.root.props.onReady&&t.root.props.onReady({})})},350))},linkTap:function(t){var e=t.currentTarget?this.getNode(t.currentTarget.dataset.i):{},r=e.attrs||t,i=r.href;this.root.props.onLinktap&&this.root.props.onLinktap(Object.assign({innerText:this.root.getText(e.children||[])},r)),i&&("#"===i[0]?this.root.navigateTo(i.substring(1)).catch(function(){}):i.split("?")[0].includes("://")?this.root.props.copyLink&&my.setClipboard({text:i,success:function(){return my.showToast({content:"链接已复制"})}}):my.navigateTo({url:i,fail:function(){my.switchTab({url:i,fail:function(){}})}}))},mediaError:function(t){var e=t.target.dataset.i,i=this.getNode(e);if("video"===i.name||"audio"===i.name){var o=(this.data.ctrl[e]||0)+1;if(o>i.src.length&&(o=0),o<i.src.length)return this.setData(r({},"ctrl."+e,o))}else"img"===i.name&&(this.props.opts[2]&&this.setData(r({},"ctrl."+e,-1)),this.checkReady());this.root&&this.root.props.onError&&this.root.props.onError({source:i.name,attrs:i.attrs,errMsg:t.detail.errMsg})}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"component":true,"usingComponents":{"node":"./node"}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function t(t,e){var s;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(s=i(t))||e&&t&&"number"==typeof t.length){s&&(t=s);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,o=!0,l=!1;return{s:function(){s=t[Symbol.iterator]()},n:function(){var t=s.next();return o=t.done,t},e:function(t){l=!0,r=t},f:function(){try{o||null==s.return||s.return()}finally{if(l)throw r}}}}function i(t,i){if(t){if("string"==typeof t)return e(t,i);var s=Object.prototype.toString.call(t).slice(8,-1);return"Object"===s&&t.constructor&&(s=t.constructor.name),"Map"===s||"Set"===s?Array.from(t):"Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?e(t,i):void 0}}function e(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=new Array(i);e<i;e++)s[e]=t[e];return s}function s(t){for(var i=Object.create(null),e=t.split(","),s=e.length;s--;)i[e[s]]=!0;return i}function n(t,i){for(var e=t.indexOf("&");-1!==e;){var s=t.indexOf(";",e+3),n=void 0;if(-1===s)break;"#"===t[e+1]?(n=parseInt(("x"===t[e+2]?"0":"")+t.substring(e+2,s)),isNaN(n)||(t=t.substr(0,e)+String.fromCharCode(n)+t.substr(s+1))):(n=t.substring(e+1,s),(l.entities[n]||"amp"===n&&i)&&(t=t.substr(0,e)+(l.entities[n]||"&")+t.substr(s+1))),e=t.indexOf("&",e+1)}return t}function a(t){for(var i=t.length-1,e=i;e>=-1;e--)(-1===e||t[e].c||!t[e].name||"div"!==t[e].name&&"p"!==t[e].name&&"h"!==t[e].name[0]||(t[e].attrs.style||"").includes("inline"))&&(i-e>=5&&t.splice(e+1,i-e,{name:"div",attrs:{},children:t.slice(e+1,i+1)}),i=e-1)}function r(t){this.options=t.props||{},this.tagStyle=Object.assign({},l.tagStyle,this.options.tagStyle),this.imgList=t.imgList||[],this.imgList._unloadimgs=0,this.plugins=t.plugins||[],this.attrs=Object.create(null),this.stack=[],this.nodes=[],this.pre=(this.options.containerStyle||"").includes("white-space")&&this.options.containerStyle.includes("pre")?2:0}function o(t){this.handler=t}var l={trustTags:s("a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,ruby,rt,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video"),blockTags:s("address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section"),ignoreTags:s("area,base,canvas,embed,frame,head,iframe,input,link,map,meta,param,rp,script,source,style,textarea,title,track,wbr"),voidTags:s("area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr"),entities:{lt:"<",gt:">",quot:'"',apos:"'",ensp:" ",emsp:" ",nbsp:" ",semi:";",ndash:"–",mdash:"—",middot:"·",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",bull:"•",hellip:"…",larr:"←",uarr:"↑",rarr:"→",darr:"↓"},tagStyle:{address:"font-style:italic",big:"display:inline;font-size:1.2em",caption:"display:table-caption;text-align:center",center:"text-align:center",cite:"font-style:italic",dd:"margin-left:40px",mark:"background-color:yellow",pre:"font-family:monospace;white-space:pre",s:"text-decoration:line-through",small:"display:inline;font-size:0.8em",strike:"text-decoration:line-through",u:"text-decoration:underline"},svgDict:{animatetransform:"animateTransform",lineargradient:"linearGradient",viewbox:"viewBox",attributename:"attributeName",repeatcount:"repeatCount",repeatdur:"repeatDur",foreignobject:"foreignObject"}},h={},c=my.getSystemInfoSync(),d=c.windowWidth,p=s(" ,\r,\n,\t,\f"),u=0;r.prototype.parse=function(t){for(var i=this.plugins.length;i--;)this.plugins[i].onUpdate&&(t=this.plugins[i].onUpdate(t,l)||t);for(new o(this).parse(t);this.stack.length;)this.popNode();return this.nodes.length>50&&a(this.nodes),this.nodes},r.prototype.expose=function(){for(var t=this.stack.length;t--;){var i=this.stack[t];if(i.c||"a"===i.name||"video"===i.name||"audio"===i.name)return;i.c=1}},r.prototype.hook=function(t){for(var i=this.plugins.length;i--;)if(this.plugins[i].onParse&&!1===this.plugins[i].onParse(t,this))return!1;return!0},r.prototype.getUrl=function(t){var i=this.options.domain;return"/"===t[0]?"/"===t[1]?t=(i?i.split("://")[0]:"http")+":"+t:i&&(t=i+t):!i||t.includes("data:")||t.includes("://")||(t=i+"/"+t),t},r.prototype.parseStyle=function(t){var i=t.attrs,e=(this.tagStyle[t.name]||"").split(";").concat((i.style||"").split(";")),s={},n="";i.id&&!this.xml&&(this.options.useAnchor?this.expose():"img"!==t.name&&"a"!==t.name&&"video"!==t.name&&"audio"!==t.name&&(i.id=void 0)),i.width&&(s.width=parseFloat(i.width)+(i.width.includes("%")?"%":"px"),i.width=void 0),i.height&&(s.height=parseFloat(i.height)+(i.height.includes("%")?"%":"px"),i.height=void 0);for(var a=0,r=e.length;a<r;a++){var o=e[a].split(":");if(!(o.length<2)){var l=o.shift().trim().toLowerCase(),h=o.join(":").trim();if("-"===h[0]&&h.lastIndexOf("-")>0||h.includes("safe"))n+=";".concat(l,":").concat(h);else if(!s[l]||h.includes("import")||!s[l].includes("import")){if(h.includes("url")){var c=h.indexOf("(")+1;if(c){for(;'"'===h[c]||"'"===h[c]||p[h[c]];)c++;h=h.substr(0,c)+this.getUrl(h.substr(c))}}else h.includes("rpx")&&(h=h.replace(/[0-9.]+\s*rpx/g,function(t){return parseFloat(t)*d/750+"px"}));s[l]=h}}}return t.attrs.style=n,s},r.prototype.onTagName=function(t){this.tagName=this.xml?t:t.toLowerCase(),"svg"===this.tagName&&(this.xml=(this.xml||0)+1,l.ignoreTags.style=void 0)},r.prototype.onAttrName=function(t){t=this.xml?t:t.toLowerCase(),"data-"===t.substr(0,5)?"data-src"!==t||this.attrs.src?"img"===this.tagName||"a"===this.tagName?this.attrName=t:this.attrName=void 0:this.attrName="src":(this.attrName=t,this.attrs[t]="T")},r.prototype.onAttrVal=function(t){var i=this.attrName||"";"style"===i||"href"===i?this.attrs[i]=n(t,!0):i.includes("src")?this.attrs[i]=this.getUrl(n(t,!0)):i&&(this.attrs[i]=t)},r.prototype.onOpenTag=function(t){var i=Object.create(null);i.name=this.tagName,i.attrs=this.attrs,this.attrs=Object.create(null);var e=i.attrs,s=this.stack[this.stack.length-1],n=s?s.children:this.nodes,a=this.xml?t:l.voidTags[i.name];if(h[i.name]&&(e.class=h[i.name]+(e.class?" "+e.class:"")),"embed"===i.name){var r=e.src||"";r.includes(".mp4")||r.includes(".3gp")||r.includes(".m3u8")||(e.type||"").includes("video")?i.name="video":(r.includes(".mp3")||r.includes(".wav")||r.includes(".aac")||r.includes(".m4a")||(e.type||"").includes("audio"))&&(i.name="audio"),e.autostart&&(e.autoplay="T"),e.controls="T"}if("video"!==i.name&&"audio"!==i.name||("video"!==i.name||e.id||(e.id="v"+u++),e.controls||e.autoplay||(e.controls="T"),i.src=[],e.src&&(i.src.push(e.src),e.src=void 0),this.expose()),a){if(!this.hook(i)||l.ignoreTags[i.name])return void("base"!==i.name||this.options.domain?"source"===i.name&&s&&("video"===s.name||"audio"===s.name)&&e.src&&s.src.push(e.src):this.options.domain=e.href);var o=this.parseStyle(i);if("img"===i.name){if(e.src&&(e.src.includes("webp")&&(i.webp="T"),e.src.includes("data:")&&"all"!==this.options.previewImg&&!e["original-src"]&&(e.ignore="T"),!e.ignore||i.webp||e.src.includes("cloud://"))){for(var c=this.stack.length;c--;){var p=this.stack[c];"table"!==p.name||i.webp||e.src.includes("cloud://")||(!o.display||o.display.includes("inline")?i.t="inline-block":i.t=o.display,o.display=void 0);var f=p.attrs.style||"";if(!f.includes("flex:")||f.includes("flex:0")||f.includes("flex: 0")||o.width&&!(parseInt(o.width)>100))if(f.includes("flex")&&"100%"===o.width)for(var g=c+1;g<this.stack.length;g++){var m=this.stack[g].attrs.style||"";if(!m.includes(";width")&&!m.includes(" width")&&0!==m.indexOf("width")){o.width="";break}}else f.includes("inline-block")&&(o.width&&"%"===o.width[o.width.length-1]?(p.attrs.style+=";max-width:"+o.width,o.width=""):p.attrs.style+=";max-width:100%");else{o.width="100% !important",o.height="";for(var v=c+1;v<this.stack.length;v++)this.stack[v].attrs.style=(this.stack[v].attrs.style||"").replace("inline-","")}"a"===p.name?i.a=p.attrs:p.c=1}i.i=this.imgList.length;var y=e["original-src"]||e.src;this.imgList.push(y),i.t||(this.imgList._unloadimgs+=1)}"inline"===o.display&&(o.display=""),e.ignore&&(o["max-width"]=o["max-width"]||"100%",e.style+=";-webkit-touch-callout:none"),parseInt(o.width)>d&&(o.height=void 0),isNaN(parseInt(o.width))||(i.w="T"),!isNaN(parseInt(o.height))&&(!o.height.includes("%")||s&&(s.attrs.style||"").includes("height"))&&(i.h="T"),i.w&&i.h&&o["object-fit"]&&("contain"===o["object-fit"]?i.m="aspectFit":"cover"===o["object-fit"]&&(i.m="aspectFill"))}else if("svg"===i.name)return n.push(i),this.stack.push(i),void this.popNode();for(var b in o)o[b]&&(e.style+=";".concat(b,":").concat(o[b].replace(" !important","")));e.style=e.style.substr(1)||void 0}else("pre"===i.name||(e.style||"").includes("white-space")&&e.style.includes("pre"))&&2!==this.pre&&(this.pre=i.pre=1),i.children=[],this.stack.push(i);n.push(i)},r.prototype.onCloseTag=function(t){t=this.xml?t:t.toLowerCase();var i;for(i=this.stack.length;i--&&this.stack[i].name!==t;);if(-1!==i)for(;this.stack.length>i;)this.popNode();else if("p"===t||"br"===t){var e=this.stack.length?this.stack[this.stack.length-1].children:this.nodes;e.push({name:t,attrs:{class:h[t],style:this.tagStyle[t]}})}},r.prototype.popNode=function(){var i=this.stack.pop(),e=i.attrs,s=i.children,n=this.stack[this.stack.length-1],r=n?n.children:this.nodes;if(!this.hook(i)||l.ignoreTags[i.name])return"title"===i.name&&s.length&&"text"===s[0].type&&this.options.setTitle&&my.setNavigationBar({title:s[0].text}),void r.pop();if(i.pre&&2!==this.pre){this.pre=i.pre=void 0;for(var o=this.stack.length;o--;)this.stack[o].pre&&(this.pre=1)}if("svg"===i.name){if(this.xml>1)return void this.xml--;var h="",c=e.style;return e.style="",e.xmlns="http://www.w3.org/2000/svg",function i(e){if("text"===e.type)return void(h+=e.text);var s=l.svgDict[e.name]||e.name;if("foreignObject"===s){var n,a=t(e.children||[]);try{for(a.s();!(n=a.n()).done;){var r=n.value;if(r.attrs&&!r.attrs.xmlns){r.attrs.xmlns="http://www.w3.org/1999/xhtml";break}}}catch(t){a.e(t)}finally{a.f()}}h+="<"+s;for(var o in e.attrs){var c=e.attrs[o];c&&(h+=" ".concat(l.svgDict[o]||o,'="').concat(c.replace(/"/g,""),'"'))}if(e.children){h+=">";for(var d=0;d<e.children.length;d++)i(e.children[d]);h+="</"+s+">"}else h+="/>"}(i),i.name="img",i.attrs={src:"data:image/svg+xml;utf8,"+h.replace(/#/g,"%23"),style:c,ignore:"T"},i.children=void 0,this.xml=!1,void(l.ignoreTags.style=!0)}var p={};if(e.align&&("table"===i.name?"center"===e.align?p["margin-inline-start"]=p["margin-inline-end"]="auto":p.float=e.align:p["text-align"]=e.align,e.align=void 0),e.dir&&(p.direction=e.dir,e.dir=void 0),"font"===i.name&&(e.color&&(p.color=e.color,e.color=void 0),e.face&&(p["font-family"]=e.face,e.face=void 0),e.size)){var u=parseInt(e.size);isNaN(u)||(u<1?u=1:u>7&&(u=7),p["font-size"]=["x-small","small","medium","large","x-large","xx-large","xxx-large"][u-1]),e.size=void 0}if((e.class||"").includes("align-center")&&(p["text-align"]="center"),Object.assign(p,this.parseStyle(i)),"table"!==i.name&&parseInt(p.width)>d&&(p["max-width"]="100%",p["box-sizing"]="border-box"),l.blockTags[i.name])i.name="div";else if(l.trustTags[i.name]||this.xml)if("a"===i.name||"ad"===i.name)this.expose();else if("video"===i.name||"audio"===i.name)(p.height||"").includes("auto")&&(p.height=void 0),i.children=void 0;else if("ul"!==i.name&&"ol"!==i.name||!i.c)if("table"===i.name){var f=parseFloat(e.cellpadding),g=parseFloat(e.cellspacing),m=parseFloat(e.border),v=p["border-color"],y=p["border-style"];if(i.c&&(isNaN(f)&&(f=2),isNaN(g)&&(g=2)),m&&(e.style+=";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")),i.flag&&i.c){i.flag=void 0,p.display="grid","collapse"===p["border-collapse"]&&(p["border-collapse"]=void 0,g=0),g?(p["grid-gap"]=g+"px",p.padding=g+"px"):m&&(e.style+=";border-left:0;border-top:0");var b=[],x=[],w=[],k={};!function i(e){for(var s=0;s<e.length;s++)if("tr"===e[s].name)x.push(e[s]);else if("colgroup"===e[s].name){var n,a=1,r=t(e[s].children||[]);try{for(r.s();!(n=r.n()).done;){var o=n.value;if("col"===o.name){var l=o.attrs.style||"",h=l.indexOf("width")?l.indexOf(";width"):0;if(-1!==h){var c=l.indexOf(";",h+6);-1===c&&(c=l.length),b[a]=l.substring(h?h+7:6,c)}a+=1}}}catch(t){r.e(t)}finally{r.f()}}else i(e[s].children||[])}(s);for(var N=1;N<=x.length;N++){for(var T=1,O=0;O<x[N-1].children.length;O++){var j=x[N-1].children[O];if("td"===j.name||"th"===j.name){for(;k[N+"."+T];)T++;j.c=1;var S=j.attrs.style||"",A=S.indexOf("width")?S.indexOf(";width"):0;if(-1!==A){var C=S.indexOf(";",A+6);-1===C&&(C=S.length),j.attrs.colspan||(b[T]=S.substring(A?A+7:6,C)),S=S.substr(0,A)+S.substr(C)}if(S+=";display:flex;flex-direction:column",-1!==(A=S.indexOf("vertical-align"))){var I=S.substr(A+15,10);I.includes("middle")?S+=";justify-content:center":I.includes("bottom")&&(S+=";justify-content:flex-end")}else S+=";justify-content:center";if(-1!==(A=S.indexOf("text-align"))){var z=S.substr(A+11,10);z.includes("center")?S+=";justify-content: center":z.includes("right")&&(S+=";justify-content: right")}if(S=(m?";border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray")+(g?"":";border-right:0;border-bottom:0"):"")+(f?";padding:".concat(f,"px"):"")+";"+S,j.attrs.colspan&&(S+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+parseInt(j.attrs.colspan)),j.attrs.rowspan||(S+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+1)),T+=parseInt(j.attrs.colspan)-1),j.attrs.rowspan){S+=";grid-row-start:".concat(N,";grid-row-end:").concat(N+parseInt(j.attrs.rowspan)),j.attrs.colspan||(S+=";grid-column-start:".concat(T,";grid-column-end:").concat(T+1));for(var L=1;L<j.attrs.rowspan;L++)for(var F=0;F<(j.attrs.colspan||1);F++)k[N+L+"."+(T-F)]=1}S&&(j.attrs.style=S),w.push(j),T++}}if(1===N){for(var q="",U=1;U<T;U++)q+=(b[U]?b[U]:"auto")+" ";p["grid-template-columns"]=q}}i.children=w}else i.c&&(p.display="table"),isNaN(g)||(p["border-spacing"]=g+"px"),(m||f||i.c)&&function t(e){for(var s=0;s<e.length;s++){var n=e[s];i.c&&(n.c=1),"th"===n.name||"td"===n.name?(m&&(n.attrs.style="border:".concat(m,"px ").concat(y||"solid"," ").concat(v||"gray",";").concat(n.attrs.style||"")),f&&(n.attrs.style="padding:".concat(f,"px;").concat(n.attrs.style||""))):n.children&&t(n.children)}}(s);if(this.options.scrollTable&&!(e.style||"").includes("inline")){var V=Object.assign({},i);i.name="div",i.attrs={style:"overflow-x:auto;padding:1px"},i.children=[V],e=V.attrs}}else if(("tbody"===i.name||"tr"===i.name)&&i.flag&&i.c)i.flag=void 0,function t(i){for(var e=0;e<i.length;e++)if("td"===i[e].name)for(var s=0,n=["color","background","background-color"];s<n.length;s++){var a=n[s];p[a]&&(i[e].attrs.style=a+":"+p[a]+";"+(i[e].attrs.style||""))}else t(i[e].children||[])}(s);else if("td"!==i.name&&"th"!==i.name||!e.colspan&&!e.rowspan){if("ruby"===i.name){i.name="span";for(var D=0;D<s.length-1;D++)"text"===s[D].type&&"rt"===s[D+1].name&&(s[D]={name:"span",attrs:{style:"display:inline-block;text-align:center"},children:[{name:"div",attrs:{style:"font-size:50%;"+(s[D+1].attrs.style||"")},children:s[D+1].children},s[D]]},s.splice(D+1,1))}}else for(var B=this.stack.length;B--;)"table"!==this.stack[B].name&&"tbody"!==this.stack[B].name&&"tr"!==this.stack[B].name||(this.stack[B].flag=1);else{var P={a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"};P[e.type]&&(e.style+=";list-style-type:"+P[e.type],e.type=void 0),i.c=1;for(var Z=s.length;Z--;)"li"===s[Z].name&&(s[Z].c=1)}else i.name="span";if((p.display||"").includes("flex")&&!i.c)for(var _=s.length;_--;){var E=s[_];E.f&&(E.attrs.style=(E.attrs.style||"")+E.f,E.f=void 0)}var G=n&&((n.attrs.style||"").includes("flex")||(n.attrs.style||"").includes("grid"))&&!i.c;G&&(i.f=";max-width:100%"),s.length>=50&&i.c&&!(p.display||"").includes("flex")&&a(s);for(var M in p)if(p[M]){var W=";".concat(M,":").concat(p[M].replace(" !important",""));G&&(M.includes("flex")&&"flex-direction"!==M||"align-self"===M||M.includes("grid")||"-"===p[M][0]||M.includes("width")&&W.includes("%"))?(i.f+=W,"width"===M&&(e.style+=";width:100%")):e.style+=W}e.style=e.style.substr(1)||void 0},r.prototype.onText=function(t){if(!this.pre){for(var i,e="",s=0,a=t.length;s<a;s++)p[t[s]]?(" "!==e[e.length-1]&&(e+=" "),"\n"!==t[s]||i||(i=!0)):e+=t[s];if(" "===e&&i)return;t=e}var r=Object.create(null);if(r.type="text",r.text=n(t),this.hook(r)){(this.stack.length?this.stack[this.stack.length-1].children:this.nodes).push(r)}},o.prototype.parse=function(t){this.content=t||"",this.i=0,this.start=0,this.state=this.text;for(var i=this.content.length;-1!==this.i&&this.i<i;)this.state()},o.prototype.checkClose=function(t){var i="/"===this.content[this.i];return!!(">"===this.content[this.i]||i&&">"===this.content[this.i+1])&&(t&&this.handler[t](this.content.substring(this.start,this.i)),this.i+=i?2:1,this.start=this.i,this.handler.onOpenTag(i),"script"===this.handler.tagName?(this.i=this.content.indexOf("</",this.i),-1!==this.i&&(this.i+=2,this.start=this.i),this.state=this.endTag):this.state=this.text,!0)},o.prototype.text=function(){if(this.i=this.content.indexOf("<",this.i),-1===this.i)return void(this.start<this.content.length&&this.handler.onText(this.content.substring(this.start,this.content.length)));var t=this.content[this.i+1];if(t>="a"&&t<="z"||t>="A"&&t<="Z")this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i)),this.start=++this.i,this.state=this.tagName;else if("/"===t||"!"===t||"?"===t){this.start!==this.i&&this.handler.onText(this.content.substring(this.start,this.i));var i=this.content[this.i+2];if("/"===t&&(i>="a"&&i<="z"||i>="A"&&i<="Z"))return this.i+=2,this.start=this.i,void(this.state=this.endTag);var e="--\x3e";"!"===t&&"-"===this.content[this.i+2]&&"-"===this.content[this.i+3]||(e=">"),this.i=this.content.indexOf(e,this.i),-1!==this.i&&(this.i+=e.length,this.start=this.i)}else this.i++},o.prototype.tagName=function(){if(p[this.content[this.i]]){for(this.handler.onTagName(this.content.substring(this.start,this.i));p[this.content[++this.i]];);this.i<this.content.length&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)}else this.checkClose("onTagName")||this.i++},o.prototype.attrName=function(){var t=this.content[this.i];if(p[t]||"="===t){this.handler.onAttrName(this.content.substring(this.start,this.i));for(var i="="===t,e=this.content.length;++this.i<e;)if(t=this.content[this.i],!p[t]){if(this.checkClose())return;if(i)return this.start=this.i,void(this.state=this.attrVal);if("="!==this.content[this.i])return this.start=this.i,void(this.state=this.attrName);i=!0}}else this.checkClose("onAttrName")||this.i++},o.prototype.attrVal=function(){var t=this.content[this.i],i=this.content.length;if('"'===t||"'"===t){if(this.start=++this.i,this.i=this.content.indexOf(t,this.i),-1===this.i)return;this.handler.onAttrVal(this.content.substring(this.start,this.i))}else for(;this.i<i;this.i++){if(p[this.content[this.i]]){this.handler.onAttrVal(this.content.substring(this.start,this.i));break}if(this.checkClose("onAttrVal"))return}for(;p[this.content[++this.i]];);this.i<i&&!this.checkClose()&&(this.start=this.i,this.state=this.attrName)},o.prototype.endTag=function(){var t=this.content[this.i];if(p[t]||">"===t||"/"===t){if(this.handler.onCloseTag(this.content.substring(this.start,this.i)),">"!==t&&(this.i=this.content.indexOf(">",this.i),-1===this.i))return;this.start=++this.i,this.state=this.text}else this.i++},module.exports=r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._root{padding:1px 0;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}._select{-webkit-user-select:text;user-select:text}
|