bhd-components 0.7.40 → 0.7.42

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,7 +6,6 @@ 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";
10
9
  import cssStyle from "./index.module.less";
11
10
  import cssStyleOnline from "./index2.module.less";
12
11
  var styles = cssStyle;
@@ -22,7 +21,7 @@ import TeacherList from "./teacherList";
22
21
  import { parseDate } from "../utils/Date";
23
22
  import { Remarkable } from "remarkable";
24
23
  import hljs from "highlight.js";
25
- import "highlight.js/styles/default.css";
24
+ import "highlight.js/styles/github.css";
26
25
  import { render } from "react-dom";
27
26
  import Provider from "../provider";
28
27
  var TextArea = Input.TextArea;
@@ -108,6 +107,99 @@ var CustomerService = function(props) {
108
107
  initShowType
109
108
  ]);
110
109
  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
+ };
111
203
  var handleScroll = function handleScroll() {
112
204
  var container = document.getElementById(showType == 1 || showType == 3 ? "chat_content" : "chat_content_modal");
113
205
  var scrollTop = container.scrollTop;
@@ -156,30 +248,9 @@ var CustomerService = function(props) {
156
248
  };
157
249
  //|| showScreenshot
158
250
  if (showType == 5 || showScreenshot) {
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
- }
251
+ console.log("bbbbbbbbbbbbbb");
252
+ handlerHtml2canvas();
253
+ // window.addEventListener('resize',handlerHtml2canvas)
183
254
  }
184
255
  if (showType != 1 && !firstLoad && pageCount > 0) {
185
256
  setFirstLoad(true);
@@ -194,6 +265,7 @@ var CustomerService = function(props) {
194
265
  if (content) {
195
266
  content.removeEventListener("scroll", handleScroll);
196
267
  }
268
+ window.removeEventListener("resize", handlerHtml2canvas);
197
269
  };
198
270
  }, [
199
271
  historyMessageList,
@@ -1722,11 +1794,18 @@ var CustomerService = function(props) {
1722
1794
  /*#__PURE__*/ _jsxs("div", {
1723
1795
  className: styles.operate,
1724
1796
  children: [
1725
- /*#__PURE__*/ _jsx("i", {
1797
+ /*#__PURE__*/ _jsxs("i", {
1798
+ className: styles.popover_main,
1726
1799
  onClick: function() {
1727
1800
  setShowHistory(true);
1728
1801
  },
1729
- children: /*#__PURE__*/ _jsx(CustomRecord, {})
1802
+ children: [
1803
+ /*#__PURE__*/ _jsx(CustomRecord, {}),
1804
+ /*#__PURE__*/ _jsx("span", {
1805
+ className: styles.popover,
1806
+ children: "历史记录"
1807
+ })
1808
+ ]
1730
1809
  }),
1731
1810
  /*#__PURE__*/ _jsx("span", {
1732
1811
  className: styles.line
@@ -1746,20 +1825,14 @@ var CustomerService = function(props) {
1746
1825
  })
1747
1826
  ]
1748
1827
  }),
1749
- /*#__PURE__*/ _jsxs("i", {
1828
+ /*#__PURE__*/ _jsx("i", {
1750
1829
  className: styles.popover_main,
1751
1830
  onClick: function() {
1752
1831
  onEvent(serverName + serverUrl(), "click_智能问答_退出全屏", "提交");
1753
1832
  setShowType(3);
1754
1833
  setFirstLoad(false); //重启滚动条在最上方
1755
1834
  },
1756
- children: [
1757
- /*#__PURE__*/ _jsx(CloseOutlined, {}),
1758
- /*#__PURE__*/ _jsx("span", {
1759
- className: styles.popover,
1760
- children: "退出全屏"
1761
- })
1762
- ]
1835
+ children: /*#__PURE__*/ _jsx(CloseOutlined, {})
1763
1836
  })
1764
1837
  ]
1765
1838
  })
@@ -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: 48px;
1869
+ top: 38px;
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
-
1921
+ cursor: default !important;
1922
1922
  }
1923
1923
  :global{
1924
1924
  .ReactCrop__child-wrapper{
@@ -1935,6 +1935,7 @@
1935
1935
  height: 100% !important;
1936
1936
  top: 0 !important;
1937
1937
  left: 0 !important;
1938
+ cursor: default !important;
1938
1939
  }
1939
1940
 
1940
1941
  }
@@ -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: 48px;
1863
+ top: 38px;
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
-
1907
+ cursor: default !important;
1908
1908
  }
1909
1909
  :global{
1910
1910
  .ReactCrop__child-wrapper{
@@ -1912,7 +1912,8 @@
1912
1912
  width: 100% !important;
1913
1913
  height: 100% !important;
1914
1914
  top: 0 !important;
1915
- left: 0 !important
1915
+ left: 0 !important;
1916
+ cursor: default !important;
1916
1917
  }
1917
1918
  }
1918
1919
  :global{
@@ -102,6 +102,9 @@ 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
+ },
105
108
  src: imgBese64,
106
109
  onLoad: onImageLoad
107
110
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.7.40",
3
+ "version": "0.7.42",
4
4
  "description": "组件功能描述",
5
5
  "files": [
6
6
  "esm",