@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,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview emoji 插件
|
|
3
|
+
*/
|
|
4
|
+
const reg = /\[(\S+?)\]/g
|
|
5
|
+
const data = {
|
|
6
|
+
笑脸: '😄',
|
|
7
|
+
生病: '😷',
|
|
8
|
+
破涕为笑: '😂',
|
|
9
|
+
吐舌: '😝',
|
|
10
|
+
脸红: '😳',
|
|
11
|
+
恐惧: '😱',
|
|
12
|
+
失望: '😔',
|
|
13
|
+
无语: '😒',
|
|
14
|
+
眨眼: '😉',
|
|
15
|
+
酷: '😎',
|
|
16
|
+
哭: '😭',
|
|
17
|
+
痴迷: '😍',
|
|
18
|
+
吻: '😘',
|
|
19
|
+
思考: '🤔',
|
|
20
|
+
困惑: '😕',
|
|
21
|
+
颠倒: '🙃',
|
|
22
|
+
钱: '🤑',
|
|
23
|
+
惊讶: '😲',
|
|
24
|
+
白眼: '🙄',
|
|
25
|
+
叹气: '😤',
|
|
26
|
+
睡觉: '😴',
|
|
27
|
+
书呆子: '🤓',
|
|
28
|
+
愤怒: '😡',
|
|
29
|
+
面无表情: '😑',
|
|
30
|
+
张嘴: '😮',
|
|
31
|
+
量体温: '🤒',
|
|
32
|
+
呕吐: '🤮',
|
|
33
|
+
光环: '😇',
|
|
34
|
+
幽灵: '👻',
|
|
35
|
+
外星人: '👽',
|
|
36
|
+
机器人: '🤖',
|
|
37
|
+
捂眼镜: '🙈',
|
|
38
|
+
捂耳朵: '🙉',
|
|
39
|
+
捂嘴: '🙊',
|
|
40
|
+
婴儿: '👶',
|
|
41
|
+
男孩: '👦',
|
|
42
|
+
女孩: '👧',
|
|
43
|
+
男人: '👨',
|
|
44
|
+
女人: '👩',
|
|
45
|
+
老人: '👴',
|
|
46
|
+
老妇人: '👵',
|
|
47
|
+
警察: '👮',
|
|
48
|
+
王子: '🤴',
|
|
49
|
+
公主: '🤴',
|
|
50
|
+
举手: '🙋',
|
|
51
|
+
跑步: '🏃',
|
|
52
|
+
家庭: '👪',
|
|
53
|
+
眼睛: '👀',
|
|
54
|
+
鼻子: '👃',
|
|
55
|
+
耳朵: '👂',
|
|
56
|
+
舌头: '👅',
|
|
57
|
+
嘴: '👄',
|
|
58
|
+
心: '❤️',
|
|
59
|
+
心碎: '💔',
|
|
60
|
+
雪人: '☃️',
|
|
61
|
+
情书: '💌',
|
|
62
|
+
大便: '💩',
|
|
63
|
+
闹钟: '⏰',
|
|
64
|
+
眼镜: '👓',
|
|
65
|
+
雨伞: '☂️',
|
|
66
|
+
音乐: '🎵',
|
|
67
|
+
话筒: '🎤',
|
|
68
|
+
游戏机: '🎮',
|
|
69
|
+
喇叭: '📢',
|
|
70
|
+
耳机: '🎧',
|
|
71
|
+
礼物: '🎁',
|
|
72
|
+
电话: '📞',
|
|
73
|
+
电脑: '💻',
|
|
74
|
+
打印机: '🖨️',
|
|
75
|
+
手电筒: '🔦',
|
|
76
|
+
灯泡: '💡',
|
|
77
|
+
书本: '📖',
|
|
78
|
+
信封: '✉️',
|
|
79
|
+
药丸: '💊',
|
|
80
|
+
口红: '💄',
|
|
81
|
+
手机: '📱',
|
|
82
|
+
相机: '📷',
|
|
83
|
+
电视: '📺',
|
|
84
|
+
中: '🀄',
|
|
85
|
+
垃圾桶: '🚮',
|
|
86
|
+
厕所: '🚾',
|
|
87
|
+
感叹号: '❗',
|
|
88
|
+
禁: '🈲',
|
|
89
|
+
可: '🉑',
|
|
90
|
+
彩虹: '🌈',
|
|
91
|
+
旋风: '🌀',
|
|
92
|
+
雷电: '⚡',
|
|
93
|
+
雪花: '❄️',
|
|
94
|
+
星星: '⭐',
|
|
95
|
+
水滴: '💧',
|
|
96
|
+
玫瑰: '🌹',
|
|
97
|
+
加油: '💪',
|
|
98
|
+
左: '👈',
|
|
99
|
+
右: '👉',
|
|
100
|
+
上: '👆',
|
|
101
|
+
下: '👇',
|
|
102
|
+
手掌: '🖐️',
|
|
103
|
+
好的: '👌',
|
|
104
|
+
好: '👍',
|
|
105
|
+
差: '👎',
|
|
106
|
+
胜利: '✌',
|
|
107
|
+
拳头: '👊',
|
|
108
|
+
挥手: '👋',
|
|
109
|
+
鼓掌: '👏',
|
|
110
|
+
猴子: '🐒',
|
|
111
|
+
狗: '🐶',
|
|
112
|
+
狼: '🐺',
|
|
113
|
+
猫: '🐱',
|
|
114
|
+
老虎: '🐯',
|
|
115
|
+
马: '🐎',
|
|
116
|
+
独角兽: '🦄',
|
|
117
|
+
斑马: '🦓',
|
|
118
|
+
鹿: '🦌',
|
|
119
|
+
牛: '🐮',
|
|
120
|
+
猪: '🐷',
|
|
121
|
+
羊: '🐏',
|
|
122
|
+
长颈鹿: '🦒',
|
|
123
|
+
大象: '🐘',
|
|
124
|
+
老鼠: '🐭',
|
|
125
|
+
蝙蝠: '🦇',
|
|
126
|
+
刺猬: '🦔',
|
|
127
|
+
熊猫: '🐼',
|
|
128
|
+
鸽子: '🕊️',
|
|
129
|
+
鸭子: '🦆',
|
|
130
|
+
兔子: '🐇',
|
|
131
|
+
老鹰: '🦅',
|
|
132
|
+
青蛙: '🐸',
|
|
133
|
+
蛇: '🐍',
|
|
134
|
+
龙: '🐉',
|
|
135
|
+
鲸鱼: '🐳',
|
|
136
|
+
海豚: '🐬',
|
|
137
|
+
足球: '⚽',
|
|
138
|
+
棒球: '⚾',
|
|
139
|
+
篮球: '🏀',
|
|
140
|
+
排球: '🏐',
|
|
141
|
+
橄榄球: '🏉',
|
|
142
|
+
网球: '🎾',
|
|
143
|
+
骰子: '🎲',
|
|
144
|
+
鸡腿: '🍗',
|
|
145
|
+
蛋糕: '🎂',
|
|
146
|
+
啤酒: '🍺',
|
|
147
|
+
饺子: '🥟',
|
|
148
|
+
汉堡: '🍔',
|
|
149
|
+
薯条: '🍟',
|
|
150
|
+
意大利面: '🍝',
|
|
151
|
+
干杯: '🥂',
|
|
152
|
+
筷子: '🥢',
|
|
153
|
+
糖果: '🍬',
|
|
154
|
+
奶瓶: '🍼',
|
|
155
|
+
爆米花: '🍿',
|
|
156
|
+
邮局: '🏤',
|
|
157
|
+
医院: '🏥',
|
|
158
|
+
银行: '🏦',
|
|
159
|
+
酒店: '🏨',
|
|
160
|
+
学校: '🏫',
|
|
161
|
+
城堡: '🏰',
|
|
162
|
+
火车: '🚂',
|
|
163
|
+
高铁: '🚄',
|
|
164
|
+
地铁: '🚇',
|
|
165
|
+
公交: '🚌',
|
|
166
|
+
救护车: '🚑',
|
|
167
|
+
消防车: '🚒',
|
|
168
|
+
警车: '🚓',
|
|
169
|
+
出租车: '🚕',
|
|
170
|
+
汽车: '🚗',
|
|
171
|
+
货车: '🚛',
|
|
172
|
+
自行车: '🚲',
|
|
173
|
+
摩托: '🛵',
|
|
174
|
+
红绿灯: '🚥',
|
|
175
|
+
帆船: '⛵',
|
|
176
|
+
游轮: '🛳️',
|
|
177
|
+
轮船: '⛴️',
|
|
178
|
+
飞机: '✈️',
|
|
179
|
+
直升机: '🚁',
|
|
180
|
+
缆车: '🚠',
|
|
181
|
+
警告: '⚠️',
|
|
182
|
+
禁止: '⛔'
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function Emoji () {
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
Emoji.prototype.onUpdate = function (content) {
|
|
190
|
+
return content.replace(reg, ($, $1) => {
|
|
191
|
+
if (data[$1]) return data[$1]
|
|
192
|
+
return $
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
Emoji.prototype.onGetContent = function (content) {
|
|
197
|
+
for (const item in data) {
|
|
198
|
+
content = content.replace(new RegExp(data[item], 'g'), '[' + item + ']')
|
|
199
|
+
}
|
|
200
|
+
return content
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
module.exports = Emoji
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# highlight
|
|
2
|
+
功能:代码块高亮显示
|
|
3
|
+
支持平台:
|
|
4
|
+
|
|
5
|
+
| 微信小程序 | QQ 小程序 | 百度小程序 | 支付宝小程序 | 头条小程序 | uni-app |
|
|
6
|
+
|:---:|:---:|:---:|:---:|:---:|:---:|
|
|
7
|
+
| √ | √ | √ | √ | √ | √ |
|
|
8
|
+
|
|
9
|
+
说明:
|
|
10
|
+
大小:*≈16KB*
|
|
11
|
+
编辑 *plugins/highlight/config.js* 顶部的选项,可以选择是否需要以下功能:
|
|
12
|
+
- *copyByLongPress* 是否需要长按代码块时显示复制代码内容菜单(*uni-app nvue* 暂不支持)
|
|
13
|
+
- *showLanguageName* 是否在代码块右上角显示语言的名称
|
|
14
|
+
- *showLineNumber* 是否在左侧显示行号
|
|
15
|
+
|
|
16
|
+
> 修改该配置后需要重新生成组件包,在构建后的组件包中修改配置无法生效
|
|
17
|
+
|
|
18
|
+
引入本插件后,*html* 中符合以下格式的 *pre* 将被高亮处理:
|
|
19
|
+
```html
|
|
20
|
+
<!-- pre 中内含一个 code,并在 pre 或 code 的 class 中设置 language- -->
|
|
21
|
+
<pre><code class="language-css">p { color: red }</code></pre>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
> 与 *editable* 插件共用时,编辑状态下,不会进行高亮,可以直接修改代码文本
|
|
25
|
+
|
|
26
|
+
> 本插件的高亮功能依赖于 [prismjs](https://prismjs.com/),默认配置中仅支持 *html*、*css*、*c-like*、*javascript* 语言和 *Tomorrow Night* 主题,如果需要更多语言或更换主题请前往 [官网](https://prismjs.com/download.html) 下载对应的 *prism.min.js* 和 *prism.css* 并替换 *plugins/highlight/* 目录下的文件
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview highlight 插件
|
|
3
|
+
* Include prismjs (https://prismjs.com)
|
|
4
|
+
*/
|
|
5
|
+
const prism = require('./prism.min')
|
|
6
|
+
const config = require('./config')
|
|
7
|
+
const Parser = require('../parser')
|
|
8
|
+
|
|
9
|
+
function Highlight (vm) {
|
|
10
|
+
this.vm = vm
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
Highlight.prototype.onParse = function (node, vm) {
|
|
14
|
+
if (node.name === 'pre') {
|
|
15
|
+
if (vm.options.editable) {
|
|
16
|
+
node.attrs.class = (node.attrs.class || '') + ' hl-pre'
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
let i
|
|
20
|
+
for (i = node.children.length; i--;) {
|
|
21
|
+
if (node.children[i].name === 'code') break
|
|
22
|
+
}
|
|
23
|
+
if (i === -1) return
|
|
24
|
+
const code = node.children[i]
|
|
25
|
+
let className = code.attrs.class + ' ' + node.attrs.class
|
|
26
|
+
i = className.indexOf('language-')
|
|
27
|
+
if (i === -1) {
|
|
28
|
+
i = className.indexOf('lang-')
|
|
29
|
+
if (i === -1) {
|
|
30
|
+
className = 'language-text'
|
|
31
|
+
i = 9
|
|
32
|
+
} else {
|
|
33
|
+
i += 5
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
i += 9
|
|
37
|
+
}
|
|
38
|
+
let j
|
|
39
|
+
for (j = i; j < className.length; j++) {
|
|
40
|
+
if (className[j] === ' ') break
|
|
41
|
+
}
|
|
42
|
+
const lang = className.substring(i, j)
|
|
43
|
+
if (code.children.length) {
|
|
44
|
+
const text = this.vm.getText(code.children).replace(/&/g, '&')
|
|
45
|
+
if (!text) return
|
|
46
|
+
if (node.c) {
|
|
47
|
+
node.c = undefined
|
|
48
|
+
}
|
|
49
|
+
if (prism.languages[lang]) {
|
|
50
|
+
code.children = (new Parser(this.vm).parse(
|
|
51
|
+
// 加一层 pre 保留空白符
|
|
52
|
+
'<pre>' + prism.highlight(text, prism.languages[lang], lang).replace(/token /g, 'hl-') + '</pre>'))[0].children
|
|
53
|
+
}
|
|
54
|
+
node.attrs.class = 'hl-pre'
|
|
55
|
+
code.attrs.class = 'hl-code'
|
|
56
|
+
if (config.showLanguageName) {
|
|
57
|
+
node.children.push({
|
|
58
|
+
name: 'div',
|
|
59
|
+
attrs: {
|
|
60
|
+
class: 'hl-language',
|
|
61
|
+
style: 'user-select:none'
|
|
62
|
+
},
|
|
63
|
+
children: [{
|
|
64
|
+
type: 'text',
|
|
65
|
+
text: lang
|
|
66
|
+
}]
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
if (config.copyByLongPress) {
|
|
70
|
+
node.attrs.style += (node.attrs.style || '') + ';user-select:none'
|
|
71
|
+
node.attrs['data-content'] = text
|
|
72
|
+
vm.expose()
|
|
73
|
+
}
|
|
74
|
+
if (config.showLineNumber) {
|
|
75
|
+
const line = text.split('\n').length; const children = []
|
|
76
|
+
for (let k = line; k--;) {
|
|
77
|
+
children.push({
|
|
78
|
+
name: 'span',
|
|
79
|
+
attrs: {
|
|
80
|
+
class: 'span'
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
node.children.push({
|
|
85
|
+
name: 'span',
|
|
86
|
+
attrs: {
|
|
87
|
+
class: 'line-numbers-rows'
|
|
88
|
+
},
|
|
89
|
+
children
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
module.exports = Highlight
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const config = require('../config')
|
|
2
|
+
|
|
3
|
+
const build = {
|
|
4
|
+
import: 'prism.css',
|
|
5
|
+
handler (file) {
|
|
6
|
+
if (file.path.includes('prism.css')) {
|
|
7
|
+
// 将标签名选择器和属性选择器转为 class 选择器(组件内仅支持 class 选择器)
|
|
8
|
+
file.contents = Buffer.from(file.contents.toString().replace(/pre([[)])/g, '.hl-pre$1').replace(/code/g, '.hl-code').replace(/\[class\*="?language-"?\]/g, '').replace(/:not[^,}]+[,}]*/g, '').replace(/\.token\./g, '.hl-'))
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (config.showLanguageName || config.showLineNumber) {
|
|
14
|
+
// pre 内部的 code 进行滚动,避免行号和语言名称跟随滚动
|
|
15
|
+
build.style = `.hl-pre {
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
.hl-code {
|
|
19
|
+
overflow: auto;
|
|
20
|
+
display: block;
|
|
21
|
+
}`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (config.copyByLongPress) {
|
|
25
|
+
build.template = '<rich-text wx:if="{{n.attrs[\'data-content\']}}" nodes="{{[n]}}" data-content="{{n.attrs[\'data-content\']}}" data-lang="{{n.attrs[\'data-lang\']}}" bindlongpress="copyCode" />'
|
|
26
|
+
build.methods = {
|
|
27
|
+
copyCode (e) {
|
|
28
|
+
wx.showActionSheet({
|
|
29
|
+
itemList: ['复制代码'],
|
|
30
|
+
success: () =>
|
|
31
|
+
wx.setClipboardData({
|
|
32
|
+
data: e.currentTarget.dataset.content
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (config.showLanguageName) {
|
|
40
|
+
build.style = (build.style || '') +
|
|
41
|
+
`.hl-language {
|
|
42
|
+
font-size: 12px;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
position: absolute;
|
|
45
|
+
right: 8px;
|
|
46
|
+
text-align: right;
|
|
47
|
+
top: 3px;
|
|
48
|
+
}
|
|
49
|
+
.hl-pre {
|
|
50
|
+
padding-top: 1.5em;
|
|
51
|
+
}`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (config.showLineNumber) {
|
|
55
|
+
build.style = (build.style || '') +
|
|
56
|
+
`.hl-pre {
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
padding-left: 3.8em;
|
|
59
|
+
counter-reset: linenumber;
|
|
60
|
+
}
|
|
61
|
+
.line-numbers-rows {
|
|
62
|
+
position: absolute;
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
top: ${config.showLanguageName ? 1.5 : 1}em;
|
|
65
|
+
font-size: 100%;
|
|
66
|
+
left: 0;
|
|
67
|
+
width: 3em; /* works for line-numbers below 1000 lines */
|
|
68
|
+
letter-spacing: -1px;
|
|
69
|
+
border-right: 1px solid #999;
|
|
70
|
+
-webkit-user-select: none;
|
|
71
|
+
-moz-user-select: none;
|
|
72
|
+
-ms-user-select: none;
|
|
73
|
+
user-select: none;
|
|
74
|
+
}
|
|
75
|
+
.line-numbers-rows .span {
|
|
76
|
+
display: block;
|
|
77
|
+
counter-increment: linenumber;
|
|
78
|
+
}
|
|
79
|
+
.line-numbers-rows .span:before {
|
|
80
|
+
content: counter(linenumber);
|
|
81
|
+
color: #999;
|
|
82
|
+
display: block;
|
|
83
|
+
padding-right: 0.8em;
|
|
84
|
+
text-align: right;
|
|
85
|
+
}`
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = build
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/* PrismJS 1.22.0
|
|
2
|
+
https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript */
|
|
3
|
+
/**
|
|
4
|
+
* prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML
|
|
5
|
+
* Based on https://github.com/chriskempson/tomorrow-theme
|
|
6
|
+
* @author Rose Pritchard
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
code[class*="language-"],
|
|
10
|
+
pre[class*="language-"] {
|
|
11
|
+
color: #ccc;
|
|
12
|
+
background: none;
|
|
13
|
+
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
14
|
+
font-size: 1em;
|
|
15
|
+
text-align: left;
|
|
16
|
+
white-space: pre;
|
|
17
|
+
word-spacing: normal;
|
|
18
|
+
word-break: normal;
|
|
19
|
+
word-wrap: normal;
|
|
20
|
+
line-height: 1.5;
|
|
21
|
+
|
|
22
|
+
-moz-tab-size: 4;
|
|
23
|
+
-o-tab-size: 4;
|
|
24
|
+
tab-size: 4;
|
|
25
|
+
|
|
26
|
+
-webkit-hyphens: none;
|
|
27
|
+
-moz-hyphens: none;
|
|
28
|
+
-ms-hyphens: none;
|
|
29
|
+
hyphens: none;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/* Code blocks */
|
|
34
|
+
pre[class*="language-"] {
|
|
35
|
+
padding: 1em;
|
|
36
|
+
margin: .5em 0;
|
|
37
|
+
overflow: auto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:not(pre) > code[class*="language-"],
|
|
41
|
+
pre[class*="language-"] {
|
|
42
|
+
background: #2d2d2d;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Inline code */
|
|
46
|
+
:not(pre) > code[class*="language-"] {
|
|
47
|
+
padding: .1em;
|
|
48
|
+
border-radius: .3em;
|
|
49
|
+
white-space: normal;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.token.comment,
|
|
53
|
+
.token.block-comment,
|
|
54
|
+
.token.prolog,
|
|
55
|
+
.token.doctype,
|
|
56
|
+
.token.cdata {
|
|
57
|
+
color: #999;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.token.punctuation {
|
|
61
|
+
color: #ccc;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.token.tag,
|
|
65
|
+
.token.attr-name,
|
|
66
|
+
.token.namespace,
|
|
67
|
+
.token.deleted {
|
|
68
|
+
color: #e2777a;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.token.function-name {
|
|
72
|
+
color: #6196cc;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.token.boolean,
|
|
76
|
+
.token.number,
|
|
77
|
+
.token.function {
|
|
78
|
+
color: #f08d49;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.token.property,
|
|
82
|
+
.token.class-name,
|
|
83
|
+
.token.constant,
|
|
84
|
+
.token.symbol {
|
|
85
|
+
color: #f8c555;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.token.selector,
|
|
89
|
+
.token.important,
|
|
90
|
+
.token.atrule,
|
|
91
|
+
.token.keyword,
|
|
92
|
+
.token.builtin {
|
|
93
|
+
color: #cc99cd;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.token.string,
|
|
97
|
+
.token.char,
|
|
98
|
+
.token.attr-value,
|
|
99
|
+
.token.regex,
|
|
100
|
+
.token.variable {
|
|
101
|
+
color: #7ec699;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.token.operator,
|
|
105
|
+
.token.entity,
|
|
106
|
+
.token.url {
|
|
107
|
+
color: #67cdcc;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.token.important,
|
|
111
|
+
.token.bold {
|
|
112
|
+
font-weight: bold;
|
|
113
|
+
}
|
|
114
|
+
.token.italic {
|
|
115
|
+
font-style: italic;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.token.entity {
|
|
119
|
+
cursor: help;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.token.inserted {
|
|
123
|
+
color: green;
|
|
124
|
+
}
|
|
125
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*! PrismJS 1.22.0
|
|
2
|
+
https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript */
|
|
3
|
+
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(u){var c=/\blang(?:uage)?-([\w-]+)\b/i,n=0,M={manual:u.Prism&&u.Prism.manual,disableWorkerMessageHandler:u.Prism&&u.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof W?new W(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function t(e,r){var a,n;switch(r=r||{},M.util.type(e)){case"Object":if(n=M.util.objId(e),r[n])return r[n];for(var i in a={},r[n]=a,e)e.hasOwnProperty(i)&&(a[i]=t(e[i],r));return a;case"Array":return n=M.util.objId(e),r[n]?r[n]:(a=[],r[n]=a,e.forEach(function(e,n){a[n]=t(e,r)}),a);default:return e}},getLanguage:function(e){for(;e&&!c.test(e.className);)e=e.parentElement;return e?(e.className.match(c)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(e){var n=(/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(e.stack)||[])[1];if(n){var t=document.getElementsByTagName("script");for(var r in t)if(t[r].src==n)return t[r]}return null}},isActive:function(e,n,t){for(var r="no-"+n;e;){var a=e.classList;if(a.contains(n))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!t}},languages:{extend:function(e,n){var t=M.util.clone(M.languages[e]);for(var r in n)t[r]=n[r];return t},insertBefore:function(t,e,n,r){var a=(r=r||M.languages)[t],i={};for(var l in a)if(a.hasOwnProperty(l)){if(l==e)for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o]);n.hasOwnProperty(l)||(i[l]=a[l])}var s=r[t];return r[t]=i,M.languages.DFS(M.languages,function(e,n){n===s&&e!=t&&(this[e]=i)}),i},DFS:function e(n,t,r,a){a=a||{};var i=M.util.objId;for(var l in n)if(n.hasOwnProperty(l)){t.call(n,l,n[l],r||l);var o=n[l],s=M.util.type(o);"Object"!==s||a[i(o)]?"Array"!==s||a[i(o)]||(a[i(o)]=!0,e(o,t,l,a)):(a[i(o)]=!0,e(o,t,null,a))}}},plugins:{},highlightAll:function(e,n){M.highlightAllUnder(document,e,n)},highlightAllUnder:function(e,n,t){var r={callback:t,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};M.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),M.hooks.run("before-all-elements-highlight",r);for(var a,i=0;a=r.elements[i++];)M.highlightElement(a,!0===n,r.callback)},highlightElement:function(e,n,t){var r=M.util.getLanguage(e),a=M.languages[r];e.className=e.className.replace(c,"").replace(/\s+/g," ")+" language-"+r;var i=e.parentElement;i&&"pre"===i.nodeName.toLowerCase()&&(i.className=i.className.replace(c,"").replace(/\s+/g," ")+" language-"+r);var l={element:e,language:r,grammar:a,code:e.textContent};function o(e){l.highlightedCode=e,M.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,M.hooks.run("after-highlight",l),M.hooks.run("complete",l),t&&t.call(l.element)}if(M.hooks.run("before-sanity-check",l),!l.code)return M.hooks.run("complete",l),void(t&&t.call(l.element));if(M.hooks.run("before-highlight",l),l.grammar)if(n&&u.Worker){var s=new Worker(M.filename);s.onmessage=function(e){o(e.data)},s.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else o(M.highlight(l.code,l.grammar,l.language));else o(M.util.encode(l.code))},highlight:function(e,n,t){var r={code:e,grammar:n,language:t};return M.hooks.run("before-tokenize",r),r.tokens=M.tokenize(r.code,r.grammar),M.hooks.run("after-tokenize",r),W.stringify(M.util.encode(r.tokens),r.language)},tokenize:function(e,n){var t=n.rest;if(t){for(var r in t)n[r]=t[r];delete n.rest}var a=new i;return I(a,a.head,e),function e(n,t,r,a,i,l){for(var o in r)if(r.hasOwnProperty(o)&&r[o]){var s=r[o];s=Array.isArray(s)?s:[s];for(var u=0;u<s.length;++u){if(l&&l.cause==o+","+u)return;var c=s[u],g=c.inside,f=!!c.lookbehind,h=!!c.greedy,d=0,v=c.alias;if(h&&!c.pattern.global){var p=c.pattern.toString().match(/[imsuy]*$/)[0];c.pattern=RegExp(c.pattern.source,p+"g")}for(var m=c.pattern||c,y=a.next,k=i;y!==t.tail&&!(l&&k>=l.reach);k+=y.value.length,y=y.next){var b=y.value;if(t.length>n.length)return;if(!(b instanceof W)){var x=1;if(h&&y!=t.tail.prev){m.lastIndex=k;var w=m.exec(n);if(!w)break;var A=w.index+(f&&w[1]?w[1].length:0),P=w.index+w[0].length,S=k;for(S+=y.value.length;S<=A;)y=y.next,S+=y.value.length;if(S-=y.value.length,k=S,y.value instanceof W)continue;for(var E=y;E!==t.tail&&(S<P||"string"==typeof E.value);E=E.next)x++,S+=E.value.length;x--,b=n.slice(k,S),w.index-=k}else{m.lastIndex=0;var w=m.exec(b)}if(w){f&&(d=w[1]?w[1].length:0);var A=w.index+d,O=w[0].slice(d),P=A+O.length,L=b.slice(0,A),N=b.slice(P),j=k+b.length;l&&j>l.reach&&(l.reach=j);var C=y.prev;L&&(C=I(t,C,L),k+=L.length),z(t,C,x);var _=new W(o,g?M.tokenize(O,g):O,v,O);y=I(t,C,_),N&&I(t,y,N),1<x&&e(n,t,r,y.prev,k,{cause:o+","+u,reach:j})}}}}}}(e,a,n,a.head,0),function(e){var n=[],t=e.head.next;for(;t!==e.tail;)n.push(t.value),t=t.next;return n}(a)},hooks:{all:{},add:function(e,n){var t=M.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=M.hooks.all[e];if(t&&t.length)for(var r,a=0;r=t[a++];)r(n)}},Token:W};function W(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=0|(r||"").length}function i(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function I(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function z(e,n,t){for(var r=n.next,a=0;a<t&&r!==e.tail;a++)r=r.next;(n.next=r).prev=n,e.length-=a}if(u.Prism=M,W.stringify=function n(e,t){if("string"==typeof e)return e;if(Array.isArray(e)){var r="";return e.forEach(function(e){r+=n(e,t)}),r}var a={type:e.type,content:n(e.content,t),tag:"span",classes:["token",e.type],attributes:{},language:t},i=e.alias;i&&(Array.isArray(i)?Array.prototype.push.apply(a.classes,i):a.classes.push(i)),M.hooks.run("wrap",a);var l="";for(var o in a.attributes)l+=" "+o+'="'+(a.attributes[o]||"").replace(/"/g,""")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+l+">"+a.content+"</"+a.tag+">"},!u.document)return u.addEventListener&&(M.disableWorkerMessageHandler||u.addEventListener("message",function(e){var n=JSON.parse(e.data),t=n.language,r=n.code,a=n.immediateClose;u.postMessage(M.highlight(r,M.languages[t],t)),a&&u.close()},!1)),M;var e=M.util.currentScript();function t(){M.manual||M.highlightAll()}if(e&&(M.filename=e.src,e.hasAttribute("data-manual")&&(M.manual=!0)),!M.manual){var r=document.readyState;"loading"===r||"interactive"===r&&e&&e.defer?document.addEventListener("DOMContentLoaded",t):window.requestAnimationFrame?window.requestAnimationFrame(t):window.setTimeout(t,16)}return M}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
|
|
4
|
+
Prism.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(a,e){var s={};s["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};n["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var t={};t[a]={pattern:RegExp("(<__[^]*?>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])*?(?=</__>)".replace(/__/g,function(){return a}),"i"),lookbehind:!0,greedy:!0,inside:n},Prism.languages.insertBefore("markup","cdata",t)}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml;
|
|
5
|
+
!function(e){var t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+[\s\S]*?(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\((?!\s*\))\s*)(?:[^()]|\((?:[^()]|\([^()]*\))*\))+?(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|(?:[^\\\\\r\n()\"']|\\\\[^])*)\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:RegExp("[^{}\\s](?:[^{};\"']|"+t.source+")*?(?=\\s*\\{)"),string:{pattern:t,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var s=e.languages.markup;s&&(s.tag.addInlined("style","css"),e.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/(^|["'\s])style\s*=\s*(?:"[^"]*"|'[^']*')/i,lookbehind:!0,inside:{"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{style:{pattern:/(["'])[\s\S]+(?=["']$)/,lookbehind:!0,alias:"language-css",inside:e.languages.css},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},"attr-name":/^style/i}}},s.tag))}(Prism);
|
|
6
|
+
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};
|
|
7
|
+
Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|(?:get|set)(?=\s*[\[$\w\xA0-\uFFFF])|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,function:/#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-flags":/[a-z]+$/,"regex-delimiter":/^\/|\/$/}},"function-variable":{pattern:/#?[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.js=Prism.languages.javascript;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const config = require('../config')
|
|
2
|
+
|
|
3
|
+
const build = {
|
|
4
|
+
import: 'prism.css',
|
|
5
|
+
handler (file) {
|
|
6
|
+
if (file.path.includes('prism.css')) {
|
|
7
|
+
// 将标签名选择器和属性选择器转为 class 选择器(组件内仅支持 class 选择器)
|
|
8
|
+
file.contents = Buffer.from(file.contents.toString().replace(/pre([[)])/g, '.hl-pre$1').replace(/code/g, '.hl-code').replace(/\[class\*="?language-"?\]/g, '').replace(/:not[^,}]+[,}]*/g, '').replace(/\.token\./g, '.hl-'))
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (config.showLanguageName || config.showLineNumber) {
|
|
14
|
+
// pre 内部的 code 进行滚动,避免行号和语言名称跟随滚动
|
|
15
|
+
build.style = `.hl-pre {
|
|
16
|
+
position: relative;
|
|
17
|
+
}
|
|
18
|
+
.hl-code {
|
|
19
|
+
overflow: auto;
|
|
20
|
+
display: block;
|
|
21
|
+
}`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (config.copyByLongPress) {
|
|
25
|
+
build.template = '<rich-text v-if="n.attrs&&n.attrs[\'data-content\']" :nodes="[n]" :data-content="n.attrs[\'data-content\']" :data-lang="n.attrs[\'data-lang\']" @longpress="copyCode" />'
|
|
26
|
+
build.methods = {
|
|
27
|
+
copyCode (e) {
|
|
28
|
+
uni.showActionSheet({
|
|
29
|
+
itemList: ['复制代码'],
|
|
30
|
+
success: () =>
|
|
31
|
+
uni.setClipboardData({
|
|
32
|
+
data: e.currentTarget.dataset.content
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (config.showLanguageName) {
|
|
40
|
+
build.style = (build.style || '') +
|
|
41
|
+
`.hl-language {
|
|
42
|
+
font-size: 12px;
|
|
43
|
+
font-weight: 600;
|
|
44
|
+
position: absolute;
|
|
45
|
+
right: 8px;
|
|
46
|
+
text-align: right;
|
|
47
|
+
top: 3px;
|
|
48
|
+
}
|
|
49
|
+
.hl-pre {
|
|
50
|
+
padding-top: 1.5em;
|
|
51
|
+
}`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (config.showLineNumber) {
|
|
55
|
+
build.style = (build.style || '') +
|
|
56
|
+
`.hl-pre {
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
padding-left: 3.8em;
|
|
59
|
+
counter-reset: linenumber;
|
|
60
|
+
}
|
|
61
|
+
.line-numbers-rows {
|
|
62
|
+
position: absolute;
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
top: ${config.showLanguageName ? 1.5 : 1}em;
|
|
65
|
+
font-size: 100%;
|
|
66
|
+
left: 0;
|
|
67
|
+
width: 3em; /* works for line-numbers below 1000 lines */
|
|
68
|
+
letter-spacing: -1px;
|
|
69
|
+
border-right: 1px solid #999;
|
|
70
|
+
-webkit-user-select: none;
|
|
71
|
+
-moz-user-select: none;
|
|
72
|
+
-ms-user-select: none;
|
|
73
|
+
user-select: none;
|
|
74
|
+
}
|
|
75
|
+
.line-numbers-rows .span {
|
|
76
|
+
display: block;
|
|
77
|
+
counter-increment: linenumber;
|
|
78
|
+
}
|
|
79
|
+
.line-numbers-rows .span:before {
|
|
80
|
+
content: counter(linenumber);
|
|
81
|
+
color: #999;
|
|
82
|
+
display: block;
|
|
83
|
+
padding-right: 0.8em;
|
|
84
|
+
text-align: right;
|
|
85
|
+
}`
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = build
|