bhd-components 0.7.42 → 0.8.1

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.
@@ -6,6 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@ice/jsx-runt
6
6
  import React, { useEffect, useState, useRef } from "react";
7
7
  import { Modal, Drawer, Input, Tooltip } from "antd";
8
8
  import ViewImage from "../viewImage";
9
+ // import html2canvas from "html2canvas";
9
10
  import cssStyle from "./index.module.less";
10
11
  import cssStyleOnline from "./index2.module.less";
11
12
  var styles = cssStyle;
@@ -21,7 +22,7 @@ import TeacherList from "./teacherList";
21
22
  import { parseDate } from "../utils/Date";
22
23
  import { Remarkable } from "remarkable";
23
24
  import hljs from "highlight.js";
24
- import "highlight.js/styles/github.css";
25
+ import "highlight.js/styles/default.css";
25
26
  import { render } from "react-dom";
26
27
  import Provider from "../provider";
27
28
  var TextArea = Input.TextArea;
@@ -107,99 +108,6 @@ var CustomerService = function(props) {
107
108
  initShowType
108
109
  ]);
109
110
  useEffect(function() {
110
- var handlerHtml2canvas = function handlerHtml2canvas() {
111
- console.log("kkkkkkkkkkk");
112
- try {
113
- newShowType.current = true;
114
- setImgBese64("");
115
- var plugin = new screenShotPlugin({
116
- clickCutFullScreen: true,
117
- enableWebRtc: true,
118
- loadCrossImg: true,
119
- canvasWidth: window.innerWidth,
120
- canvasHeight: window.innerHeight,
121
- level: -1,
122
- hiddenToolIco: true,
123
- screenShotDom: document.body,
124
- cropBoxInfo: {
125
- x: 0,
126
- y: 0,
127
- w: window.innerWidth,
128
- h: window.innerHeight
129
- },
130
- wrcReplyTime: 500,
131
- wrcWindowMode: false,
132
- hiddenScrollBar: {
133
- state: false
134
- },
135
- completeCallback: function(param) {
136
- var base64 = param.base64;
137
- // console.log(
138
- // "截图组件加载完毕调用此方法来完成框选区域的截图",
139
- // base64
140
- // );
141
- setImgBese64(base64);
142
- },
143
- triggerCallback: function() {
144
- // 截图组件加载完毕调用此方法来完成框选区域的截图
145
- plugin.completeScreenshot();
146
- }
147
- });
148
- // modernScreenshot
149
- // .domToPng(document.querySelector("body"))
150
- // .then((dataUrl:any) => {
151
- // console.log(dataUrl);
152
- // setImgBese64(dataUrl);
153
- // });
154
- // domtoimage
155
- // .toPng(document.body)
156
- // .then(function (dataUrl:any) {
157
- // setImgBese64(dataUrl);
158
- // })
159
- // .catch(function (error:any) {
160
- // console.error("oops, something went wrong!", error);
161
- // });
162
- // //排除
163
- // new screenShotPlugin({
164
- // enableWebRtc: true,
165
- // canvasWidth:window.innerWidth,
166
- // canvasHeight:window.innerHeight,
167
- // level:9999999,
168
- // completeCallback: function (info:any) {
169
- // console.log(info);
170
- // setImgBese64(info.base64);
171
- // },
172
- // closeCallback: function () {
173
- // },
174
- // });
175
- // html2canvas(document.body,{//__docusaurus
176
- // useCORS: true, // 支持跨域图片截图
177
- // allowTaint: true, // 污染处理
178
- // scale: 1 ,// 图片比例
179
- // logging:false,
180
- // // foreignObjectRendering:true,
181
- // ignoreElements:(element: { compareDocumentPosition: (arg0: string) => number; })=>{
182
- // if(element.compareDocumentPosition(screenshotAreaId)===2)return true
183
- // return false
184
- // },
185
- // windowWidth:window.innerWidth,
186
- // windowHeight:window.innerHeight
187
- // })
188
- // .then(function (canvas:any) {
189
- // // document.body.appendChild(canvas);
190
- // // console.log(canvas,99999);
191
- // // var base64URL = canvas.toDataURL('image/jpeg')
192
- // let base64URL = canvas.toDataURL("image/jpg", 1.0)
193
- // // console.log(base64URL);
194
- // setImgBese64(base64URL);
195
- // // svgNodesToRemove.forEach(item=>{
196
- // // item.remove()
197
- // // })
198
- // });
199
- } catch (error) {
200
- console.log(error);
201
- }
202
- };
203
111
  var handleScroll = function handleScroll() {
204
112
  var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
205
113
  var scrollTop = container.scrollTop;
@@ -248,9 +156,30 @@ var CustomerService = function(props) {
248
156
  };
249
157
  //|| showScreenshot
250
158
  if (showType == 5 || showScreenshot) {
251
- console.log("bbbbbbbbbbbbbb");
252
- handlerHtml2canvas();
253
- // window.addEventListener('resize',handlerHtml2canvas)
159
+ try {
160
+ newShowType.current = true;
161
+ setImgBese64("");
162
+ // let dom = document.getElementById(screenshotAreaId);
163
+ html2canvas(screenshotAreaId, {
164
+ useCORS: true,
165
+ // allowTaint: true, // 污染处理
166
+ scale: 1,
167
+ // logging:true,
168
+ ignoreElements: function(element) {
169
+ if (element.compareDocumentPosition(screenshotAreaId) === 2) return true;
170
+ return false;
171
+ }
172
+ }).then(function(canvas) {
173
+ // document.body.appendChild(canvas);
174
+ console.log(canvas, 99999);
175
+ // var base64URL = canvas.toDataURL('image/jpeg')
176
+ var base64URL = canvas.toDataURL("image/jpg", 1.0);
177
+ console.log(base64URL);
178
+ setImgBese64(base64URL);
179
+ });
180
+ } catch (error) {
181
+ console.log(error);
182
+ }
254
183
  }
255
184
  if (showType != 1 && !firstLoad && pageCount > 0) {
256
185
  setFirstLoad(true);
@@ -265,7 +194,6 @@ var CustomerService = function(props) {
265
194
  if (content) {
266
195
  content.removeEventListener("scroll", handleScroll);
267
196
  }
268
- window.removeEventListener("resize", handlerHtml2canvas);
269
197
  };
270
198
  }, [
271
199
  historyMessageList,
@@ -1794,18 +1722,11 @@ var CustomerService = function(props) {
1794
1722
  /*#__PURE__*/ _jsxs("div", {
1795
1723
  className: styles.operate,
1796
1724
  children: [
1797
- /*#__PURE__*/ _jsxs("i", {
1798
- className: styles.popover_main,
1725
+ /*#__PURE__*/ _jsx("i", {
1799
1726
  onClick: function() {
1800
1727
  setShowHistory(true);
1801
1728
  },
1802
- children: [
1803
- /*#__PURE__*/ _jsx(CustomRecord, {}),
1804
- /*#__PURE__*/ _jsx("span", {
1805
- className: styles.popover,
1806
- children: "历史记录"
1807
- })
1808
- ]
1729
+ children: /*#__PURE__*/ _jsx(CustomRecord, {})
1809
1730
  }),
1810
1731
  /*#__PURE__*/ _jsx("span", {
1811
1732
  className: styles.line
@@ -1825,14 +1746,20 @@ var CustomerService = function(props) {
1825
1746
  })
1826
1747
  ]
1827
1748
  }),
1828
- /*#__PURE__*/ _jsx("i", {
1749
+ /*#__PURE__*/ _jsxs("i", {
1829
1750
  className: styles.popover_main,
1830
1751
  onClick: function() {
1831
1752
  onEvent(serverName + serverUrl(), "click_智能问答_退出全屏", "提交");
1832
1753
  setShowType(3);
1833
1754
  setFirstLoad(false); //重启滚动条在最上方
1834
1755
  },
1835
- children: /*#__PURE__*/ _jsx(CloseOutlined, {})
1756
+ children: [
1757
+ /*#__PURE__*/ _jsx(CloseOutlined, {}),
1758
+ /*#__PURE__*/ _jsx("span", {
1759
+ className: styles.popover,
1760
+ children: "退出全屏"
1761
+ })
1762
+ ]
1836
1763
  })
1837
1764
  ]
1838
1765
  })
@@ -1177,8 +1177,8 @@
1177
1177
  max-height: 36px;
1178
1178
  word-break: break-all;
1179
1179
 
1180
- //display: flex;
1181
- //align-items: center;
1180
+ display: flex;
1181
+ align-items: center;
1182
1182
  img{
1183
1183
  margin-right: 8px;
1184
1184
  width: 60px;
@@ -1866,7 +1866,7 @@
1866
1866
  width: 417px;
1867
1867
  height: calc(100% - 48px);
1868
1868
  right: 0;
1869
- top: 38px;
1869
+ top: 48px;
1870
1870
  border-radius: 0;
1871
1871
  background: transparent;
1872
1872
  overflow: visible;
@@ -1918,7 +1918,7 @@
1918
1918
  background-color: transparent !important;
1919
1919
  // background-color: burlywood;
1920
1920
  .ReactCrop{
1921
- cursor: default !important;
1921
+
1922
1922
  }
1923
1923
  :global{
1924
1924
  .ReactCrop__child-wrapper{
@@ -1935,7 +1935,6 @@
1935
1935
  height: 100% !important;
1936
1936
  top: 0 !important;
1937
1937
  left: 0 !important;
1938
- cursor: default !important;
1939
1938
  }
1940
1939
 
1941
1940
  }
@@ -1175,8 +1175,8 @@
1175
1175
  max-height: 36px;
1176
1176
  word-break: break-all;
1177
1177
 
1178
- //display: flex;
1179
- //align-items: center;
1178
+ display: flex;
1179
+ align-items: center;
1180
1180
  img{
1181
1181
  margin-right: 8px;
1182
1182
  width: 60px;
@@ -1860,7 +1860,7 @@
1860
1860
  width: 417px;
1861
1861
  height: calc(100% - 48px);
1862
1862
  right: 0;
1863
- top: 38px;
1863
+ top: 48px;
1864
1864
  border-radius: 0;
1865
1865
  background: transparent;
1866
1866
  overflow: visible;
@@ -1904,7 +1904,7 @@
1904
1904
  background-color: transparent !important;
1905
1905
  // background-color: burlywood;
1906
1906
  .ReactCrop{
1907
- cursor: default !important;
1907
+
1908
1908
  }
1909
1909
  :global{
1910
1910
  .ReactCrop__child-wrapper{
@@ -1912,8 +1912,7 @@
1912
1912
  width: 100% !important;
1913
1913
  height: 100% !important;
1914
1914
  top: 0 !important;
1915
- left: 0 !important;
1916
- cursor: default !important;
1915
+ left: 0 !important
1917
1916
  }
1918
1917
  }
1919
1918
  :global{
@@ -102,9 +102,6 @@ var ScreenshotTool = /*#__PURE__*/ forwardRef(function(props, ref) {
102
102
  minWidth: 100,
103
103
  children: /*#__PURE__*/ _jsx("img", {
104
104
  alt: "Crop me",
105
- style: {
106
- display: "none"
107
- },
108
105
  src: imgBese64,
109
106
  onLoad: onImageLoad
110
107
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.7.42",
3
+ "version": "0.8.1",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",