bhd-components 0.10.34 → 0.10.36
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/dist/index.esm.es5.development.js +42 -34
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +1 -1
- package/dist/vendor.esm.es5.production.js +1 -1
- package/es2017/customerService/function.js +1 -1
- package/es2017/customerService/index.js +41 -33
- package/esm/customerService/function.js +1 -1
- package/esm/customerService/index.js +41 -33
- package/package.json +1 -1
|
@@ -199,7 +199,7 @@ const removeMermaidBlockComments = (markdownContent)=>{
|
|
|
199
199
|
return markdownContent.replace(mermaidBlockRegex, (match, prefix, content, suffix)=>{
|
|
200
200
|
// 清理块内注释的正则(同之前逻辑,优先保留字符串)
|
|
201
201
|
const commentRegex = /(".*?"|'.*?')|(\/\*[\s\S]*?\*\/)|(\/\/.*?$)/gm;
|
|
202
|
-
const cleanContent = content.replace(commentRegex, (m, stringPart)=>stringPart || '');
|
|
202
|
+
const cleanContent = content.replace(commentRegex, (m, stringPart)=>stringPart || '').replace(/<br>/g, '').replace(/\\n/g, '');
|
|
203
203
|
// 拼接回完整代码块(保留 ```mermaid 和 ``` 标识)
|
|
204
204
|
return `${prefix}${cleanContent}${suffix}`;
|
|
205
205
|
});
|
|
@@ -433,38 +433,44 @@ const CustomerService = (props)=>{
|
|
|
433
433
|
setVisible(true);
|
|
434
434
|
}
|
|
435
435
|
function openViewMemaid(id) {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
436
|
+
try {
|
|
437
|
+
var _document_querySelector, _svgDomClone;
|
|
438
|
+
console.log('openViewMemaid');
|
|
439
|
+
const svgDomClone = (_document_querySelector = document.querySelector(`#${id} svg`)) === null || _document_querySelector === void 0 ? void 0 : _document_querySelector.cloneNode(true);
|
|
440
|
+
if (!svgDomClone) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
svgDomClone.style.backgroundColor = '#fafafa';
|
|
444
|
+
svgDomClone.style.width = "auto";
|
|
445
|
+
svgDomClone.style.height = "auto";
|
|
446
|
+
const viewBox = svgDomClone.getAttribute('viewBox');
|
|
447
|
+
let [x, y, width, height] = viewBox ? viewBox.split(' ').map(Number) : [
|
|
448
|
+
0,
|
|
449
|
+
0,
|
|
450
|
+
0,
|
|
451
|
+
0
|
|
452
|
+
];
|
|
453
|
+
x -= 10;
|
|
454
|
+
y -= 10;
|
|
455
|
+
width += 20;
|
|
456
|
+
height += 20;
|
|
457
|
+
svgDomClone.setAttribute('viewBox', `${x} ${y} ${width} ${height}`);
|
|
458
|
+
let svgString = ((_svgDomClone = svgDomClone) === null || _svgDomClone === void 0 ? void 0 : _svgDomClone.outerHTML.toString()) || "";
|
|
459
|
+
const blob = new Blob([
|
|
460
|
+
svgString
|
|
461
|
+
], {
|
|
462
|
+
type: 'image/svg+xml;charset=utf-8'
|
|
463
|
+
});
|
|
464
|
+
console.log('blob', blob);
|
|
465
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
466
|
+
console.log('blobUrl', blobUrl);
|
|
467
|
+
setViewBase64(blobUrl);
|
|
468
|
+
setVisible(true);
|
|
469
|
+
// setMemaidContent(id);
|
|
470
|
+
// setShowMemaid(true);
|
|
471
|
+
} catch (error) {
|
|
472
|
+
console.log('error', error);
|
|
441
473
|
}
|
|
442
|
-
svgDomClone.style.backgroundColor = '#fafafa';
|
|
443
|
-
svgDomClone.style.width = "auto";
|
|
444
|
-
svgDomClone.style.height = "auto";
|
|
445
|
-
const viewBox = svgDomClone.getAttribute('viewBox');
|
|
446
|
-
let [x, y, width, height] = viewBox ? viewBox.split(' ').map(Number) : [
|
|
447
|
-
0,
|
|
448
|
-
0,
|
|
449
|
-
0,
|
|
450
|
-
0
|
|
451
|
-
];
|
|
452
|
-
x -= 10;
|
|
453
|
-
y -= 10;
|
|
454
|
-
width += 20;
|
|
455
|
-
height += 20;
|
|
456
|
-
svgDomClone.setAttribute('viewBox', `${x} ${y} ${width} ${height}`);
|
|
457
|
-
const svgString = ((_svgDomClone = svgDomClone) === null || _svgDomClone === void 0 ? void 0 : _svgDomClone.outerHTML.toString()) || "";
|
|
458
|
-
const blob = new Blob([
|
|
459
|
-
svgString
|
|
460
|
-
], {
|
|
461
|
-
type: 'image/svg+xml;charset=utf-8'
|
|
462
|
-
});
|
|
463
|
-
const blobUrl = URL.createObjectURL(blob);
|
|
464
|
-
setViewBase64(blobUrl);
|
|
465
|
-
setVisible(true);
|
|
466
|
-
// setMemaidContent(id);
|
|
467
|
-
// setShowMemaid(true);
|
|
468
474
|
}
|
|
469
475
|
window.openViewBase64 = openViewBase64;
|
|
470
476
|
window.openViewMemaid = openViewMemaid;
|
|
@@ -2319,8 +2325,10 @@ const CustomerService = (props)=>{
|
|
|
2319
2325
|
// let code = message.split("```");
|
|
2320
2326
|
// code = code[1];
|
|
2321
2327
|
// console.log(code,888888888);
|
|
2322
|
-
|
|
2323
|
-
|
|
2328
|
+
if (finishedRef.current || i != historyMessageList.length - 1) {
|
|
2329
|
+
message = removeMermaidBlockComments(message);
|
|
2330
|
+
}
|
|
2331
|
+
message = handleRenderSyntaxBlock(message, finishedRef.current || i != historyMessageList.length - 1);
|
|
2324
2332
|
if (lastId == item.id && keyWordProblem != "") {
|
|
2325
2333
|
//点击历史记录时,找到关键字,防止关键字和标签名重复
|
|
2326
2334
|
// let key_sign = 'sign_'+new Date().getTime();+'sign';
|
|
@@ -205,7 +205,7 @@ var removeMermaidBlockComments = function(markdownContent) {
|
|
|
205
205
|
var commentRegex = /(".*?"|'.*?')|(\/\*[\s\S]*?\*\/)|(\/\/.*?$)/gm;
|
|
206
206
|
var cleanContent = content.replace(commentRegex, function(m, stringPart) {
|
|
207
207
|
return stringPart || "";
|
|
208
|
-
});
|
|
208
|
+
}).replace(/<br>/g, "").replace(/\\n/g, "");
|
|
209
209
|
// 拼接回完整代码块(保留 ```mermaid 和 ``` 标识)
|
|
210
210
|
return "".concat(prefix).concat(cleanContent).concat(suffix);
|
|
211
211
|
});
|
|
@@ -425,38 +425,44 @@ var CustomerService = function(props) {
|
|
|
425
425
|
setVisible(true);
|
|
426
426
|
};
|
|
427
427
|
var openViewMemaid = function openViewMemaid(id) {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
428
|
+
try {
|
|
429
|
+
var _document_querySelector, _svgDomClone;
|
|
430
|
+
console.log("openViewMemaid");
|
|
431
|
+
var svgDomClone = (_document_querySelector = document.querySelector("#".concat(id, " svg"))) === null || _document_querySelector === void 0 ? void 0 : _document_querySelector.cloneNode(true);
|
|
432
|
+
if (!svgDomClone) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
svgDomClone.style.backgroundColor = "#fafafa";
|
|
436
|
+
svgDomClone.style.width = "auto";
|
|
437
|
+
svgDomClone.style.height = "auto";
|
|
438
|
+
var viewBox = svgDomClone.getAttribute("viewBox");
|
|
439
|
+
var _ref = _sliced_to_array(viewBox ? viewBox.split(" ").map(Number) : [
|
|
440
|
+
0,
|
|
441
|
+
0,
|
|
442
|
+
0,
|
|
443
|
+
0
|
|
444
|
+
], 4), x = _ref[0], y = _ref[1], width = _ref[2], height = _ref[3];
|
|
445
|
+
x -= 10;
|
|
446
|
+
y -= 10;
|
|
447
|
+
width += 20;
|
|
448
|
+
height += 20;
|
|
449
|
+
svgDomClone.setAttribute("viewBox", "".concat(x, " ").concat(y, " ").concat(width, " ").concat(height));
|
|
450
|
+
var svgString = ((_svgDomClone = svgDomClone) === null || _svgDomClone === void 0 ? void 0 : _svgDomClone.outerHTML.toString()) || "";
|
|
451
|
+
var blob = new Blob([
|
|
452
|
+
svgString
|
|
453
|
+
], {
|
|
454
|
+
type: "image/svg+xml;charset=utf-8"
|
|
455
|
+
});
|
|
456
|
+
console.log("blob", blob);
|
|
457
|
+
var blobUrl = URL.createObjectURL(blob);
|
|
458
|
+
console.log("blobUrl", blobUrl);
|
|
459
|
+
setViewBase64(blobUrl);
|
|
460
|
+
setVisible(true);
|
|
461
|
+
// setMemaidContent(id);
|
|
462
|
+
// setShowMemaid(true);
|
|
463
|
+
} catch (error) {
|
|
464
|
+
console.log("error", error);
|
|
433
465
|
}
|
|
434
|
-
svgDomClone.style.backgroundColor = "#fafafa";
|
|
435
|
-
svgDomClone.style.width = "auto";
|
|
436
|
-
svgDomClone.style.height = "auto";
|
|
437
|
-
var viewBox = svgDomClone.getAttribute("viewBox");
|
|
438
|
-
var _ref = _sliced_to_array(viewBox ? viewBox.split(" ").map(Number) : [
|
|
439
|
-
0,
|
|
440
|
-
0,
|
|
441
|
-
0,
|
|
442
|
-
0
|
|
443
|
-
], 4), x = _ref[0], y = _ref[1], width = _ref[2], height = _ref[3];
|
|
444
|
-
x -= 10;
|
|
445
|
-
y -= 10;
|
|
446
|
-
width += 20;
|
|
447
|
-
height += 20;
|
|
448
|
-
svgDomClone.setAttribute("viewBox", "".concat(x, " ").concat(y, " ").concat(width, " ").concat(height));
|
|
449
|
-
var svgString = ((_svgDomClone = svgDomClone) === null || _svgDomClone === void 0 ? void 0 : _svgDomClone.outerHTML.toString()) || "";
|
|
450
|
-
var blob = new Blob([
|
|
451
|
-
svgString
|
|
452
|
-
], {
|
|
453
|
-
type: "image/svg+xml;charset=utf-8"
|
|
454
|
-
});
|
|
455
|
-
var blobUrl = URL.createObjectURL(blob);
|
|
456
|
-
setViewBase64(blobUrl);
|
|
457
|
-
setVisible(true);
|
|
458
|
-
// setMemaidContent(id);
|
|
459
|
-
// setShowMemaid(true);
|
|
460
466
|
};
|
|
461
467
|
//|| showScreenshot
|
|
462
468
|
if (showType == 5 || showScreenshot) {
|
|
@@ -2440,8 +2446,10 @@ var CustomerService = function(props) {
|
|
|
2440
2446
|
// let code = message.split("```");
|
|
2441
2447
|
// code = code[1];
|
|
2442
2448
|
// console.log(code,888888888);
|
|
2443
|
-
|
|
2444
|
-
|
|
2449
|
+
if (finishedRef.current || i != historyMessageList.length - 1) {
|
|
2450
|
+
message = removeMermaidBlockComments(message);
|
|
2451
|
+
}
|
|
2452
|
+
message = handleRenderSyntaxBlock(message, finishedRef.current || i != historyMessageList.length - 1);
|
|
2445
2453
|
if (lastId == item.id && keyWordProblem != "") {
|
|
2446
2454
|
//点击历史记录时,找到关键字,防止关键字和标签名重复
|
|
2447
2455
|
// let key_sign = 'sign_'+new Date().getTime();+'sign';
|