whyuzeim 1.1.56 → 1.1.58
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/cjs/HighlyCustomChat/CodeMsg/index.d.ts +2 -1
- package/cjs/HighlyCustomChat/CodeMsg/index.js +18 -24
- package/cjs/HighlyCustomChat/CodeMsg/style/index.moduel.scss +202 -0
- package/cjs/HighlyCustomChat/QuestionButton/index.js +1 -1
- package/es/HighlyCustomChat/CodeMsg/index.d.ts +2 -1
- package/es/HighlyCustomChat/CodeMsg/index.js +18 -24
- package/es/HighlyCustomChat/CodeMsg/style/index.moduel.scss +202 -0
- package/es/HighlyCustomChat/QuestionButton/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NoticeMessageBody } from "agora-chat-uikit/types/module/noticeMessage/NoticeMessage";
|
|
2
2
|
import { ChatSDK } from "agora-chat-uikit/types/module/SDK";
|
|
3
|
-
import 'highlight.js/styles/
|
|
3
|
+
import 'highlight.js/styles/default.css';
|
|
4
4
|
import React from "react";
|
|
5
|
+
import "./style/index.moduel.scss";
|
|
5
6
|
interface ICodeMsg {
|
|
6
7
|
msg: ChatSDK.MessageBody | NoticeMessageBody;
|
|
7
8
|
isMySelf: boolean;
|
|
@@ -4,12 +4,13 @@ var _slicedToArray = require('@babel/runtime-corejs3/helpers/esm/slicedToArray')
|
|
|
4
4
|
var _setTimeout = require('@babel/runtime-corejs3/core-js-stable/set-timeout');
|
|
5
5
|
var agoraChatUikit = require('agora-chat-uikit');
|
|
6
6
|
var hljs = require('highlight.js');
|
|
7
|
-
require('highlight.js/styles/
|
|
7
|
+
require('highlight.js/styles/default.css');
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var copy = require('copy-to-clipboard');
|
|
10
|
+
require('./style/index.moduel.scss');
|
|
10
11
|
|
|
11
12
|
var CodeMsg = function CodeMsg(props) {
|
|
12
|
-
var _msg$customExts, _msg$customExts2;
|
|
13
|
+
var _msg$customExts, _msg$customExts2, _msg$customExts3;
|
|
13
14
|
var msg = props.msg,
|
|
14
15
|
isMySelf = props.isMySelf,
|
|
15
16
|
avatar = props.avatar,
|
|
@@ -18,10 +19,11 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
18
19
|
_useState2 = _slicedToArray(_useState, 2),
|
|
19
20
|
copyStatus = _useState2[0],
|
|
20
21
|
setCopyStatus = _useState2[1];
|
|
21
|
-
|
|
22
|
+
var codeType = ((_msg$customExts = msg.customExts) === null || _msg$customExts === void 0 ? void 0 : _msg$customExts.code_type) || "python";
|
|
23
|
+
if (!((_msg$customExts2 = msg.customExts) !== null && _msg$customExts2 !== void 0 && _msg$customExts2.code)) {
|
|
22
24
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
23
25
|
}
|
|
24
|
-
var rawCode = (_msg$
|
|
26
|
+
var rawCode = (_msg$customExts3 = msg.customExts) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.code) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.replace(/\\n/g, "\n")) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.replace(/\\"/g, '"')) === null || _msg$customExts3 === void 0 ? void 0 : _msg$customExts3.replace(/\\\\/g, "\\");
|
|
25
27
|
// 复制代码到剪贴板
|
|
26
28
|
var copyToClipboard = function copyToClipboard() {
|
|
27
29
|
if (!rawCode) return;
|
|
@@ -65,13 +67,13 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
65
67
|
}, /*#__PURE__*/React.createElement("div", {
|
|
66
68
|
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? "items-end" : "items-start")
|
|
67
69
|
}, /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: "inline-block w-full rounded-lg overflow-hidden relative mb-2",
|
|
68
71
|
style: {
|
|
69
72
|
background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)",
|
|
70
73
|
borderRadius: "9px",
|
|
71
74
|
padding: "10px 12px",
|
|
72
75
|
color: isMySelf ? "var(--im-msg-bubble-right-font-color)" : "var(--im-msg-bubble-font-color)"
|
|
73
|
-
}
|
|
74
|
-
className: "inline-block w-full"
|
|
76
|
+
}
|
|
75
77
|
}, /*#__PURE__*/React.createElement("div", {
|
|
76
78
|
className: "flex-1 flex justify-between items-center"
|
|
77
79
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -88,8 +90,8 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
88
90
|
d: "M8 0.0214844H2.58333V2.5396H0.0214844V8.01198H2.58333V10.5301H8V8.01198H10.5618V2.5396H8V0.0214844Z",
|
|
89
91
|
fill: "#0083FF"
|
|
90
92
|
})), /*#__PURE__*/React.createElement("span", {
|
|
91
|
-
className: "text
|
|
92
|
-
},
|
|
93
|
+
className: "filename-text"
|
|
94
|
+
}, codeType)), /*#__PURE__*/React.createElement("button", {
|
|
93
95
|
onClick: function onClick() {
|
|
94
96
|
onApply && onApply(msg.customExts.code);
|
|
95
97
|
!onApply && copyToClipboard();
|
|
@@ -101,28 +103,20 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
101
103
|
className: "code-scroll-container w-full max-h-[300px] overflow-y-auto"
|
|
102
104
|
}, /*#__PURE__*/React.createElement("pre", {
|
|
103
105
|
className: "bg-transparent w-full h-full"
|
|
104
|
-
}, /*#__PURE__*/React.createElement("
|
|
105
|
-
className: "
|
|
106
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
107
|
+
className: "code-block-container",
|
|
106
108
|
style: {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
lineHeight: "1.5",
|
|
112
|
-
fontFamily: "Monaco, Consolas, monospace",
|
|
113
|
-
whiteSpace: "pre-wrap",
|
|
114
|
-
wordWrap: "break-word",
|
|
115
|
-
width: "100%",
|
|
116
|
-
maxWidth: "100%",
|
|
117
|
-
padding: "0.5rem"
|
|
118
|
-
},
|
|
109
|
+
border: "none"
|
|
110
|
+
}
|
|
111
|
+
}, /*#__PURE__*/React.createElement("code", {
|
|
112
|
+
className: "language-".concat(codeType, " hljs"),
|
|
119
113
|
dangerouslySetInnerHTML: {
|
|
120
114
|
__html: hljs.highlight(rawCode, {
|
|
121
|
-
language:
|
|
115
|
+
language: codeType,
|
|
122
116
|
ignoreIllegals: true
|
|
123
117
|
}).value
|
|
124
118
|
}
|
|
125
|
-
})))))));
|
|
119
|
+
}))))))));
|
|
126
120
|
};
|
|
127
121
|
|
|
128
122
|
module.exports = CodeMsg;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/* 代码高亮样式,支持暗色和亮色主题 */
|
|
2
|
+
|
|
3
|
+
/* 通用样式 */
|
|
4
|
+
.code-block-container {
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
margin: 4px 0;
|
|
7
|
+
padding: 8px 4px;
|
|
8
|
+
background: transparent !important;
|
|
9
|
+
border: none !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* 通用代码样式 */
|
|
13
|
+
code.hljs {
|
|
14
|
+
display: block;
|
|
15
|
+
overflow: auto;
|
|
16
|
+
background: transparent !important;
|
|
17
|
+
font-size: 13px;
|
|
18
|
+
line-height: 1.4;
|
|
19
|
+
font-family: Monaco, Consolas, 'Courier New', monospace;
|
|
20
|
+
white-space: pre-wrap;
|
|
21
|
+
word-wrap: break-word;
|
|
22
|
+
width: 100%;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
padding: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* 深色主题下的代码高亮 - 适用于深蓝/黑色背景 */
|
|
28
|
+
.im-dark, .im-custom {
|
|
29
|
+
/* 基础文本颜色 */
|
|
30
|
+
.hljs {
|
|
31
|
+
color: #f8f8f2 !important;
|
|
32
|
+
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* 关键字 */
|
|
36
|
+
.hljs-keyword,
|
|
37
|
+
.hljs-selector-tag,
|
|
38
|
+
.hljs-tag,
|
|
39
|
+
.hljs-name {
|
|
40
|
+
color: #ff79c6 !important;
|
|
41
|
+
font-weight: bold;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* 字符串 */
|
|
45
|
+
.hljs-string,
|
|
46
|
+
.hljs-title,
|
|
47
|
+
.hljs-section,
|
|
48
|
+
.hljs-attribute,
|
|
49
|
+
.hljs-literal,
|
|
50
|
+
.hljs-template-tag,
|
|
51
|
+
.hljs-template-variable,
|
|
52
|
+
.hljs-type,
|
|
53
|
+
.hljs-addition {
|
|
54
|
+
color: #f1fa8c !important;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* 数字、布尔值 */
|
|
58
|
+
.hljs-number,
|
|
59
|
+
.hljs-selector-attr,
|
|
60
|
+
.hljs-selector-pseudo,
|
|
61
|
+
.hljs-meta-string,
|
|
62
|
+
.hljs-built_in {
|
|
63
|
+
color: #bd93f9 !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* 属性、变量 */
|
|
67
|
+
.hljs-attr,
|
|
68
|
+
.hljs-variable,
|
|
69
|
+
.hljs-property,
|
|
70
|
+
.hljs-params,
|
|
71
|
+
.hljs-class .hljs-title {
|
|
72
|
+
color: #8be9fd !important;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* 注释 */
|
|
76
|
+
.hljs-comment,
|
|
77
|
+
.hljs-quote,
|
|
78
|
+
.hljs-doctag {
|
|
79
|
+
color: #6272a4 !important;
|
|
80
|
+
font-style: italic;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* 函数 */
|
|
84
|
+
.hljs-function .hljs-title {
|
|
85
|
+
color: #50fa7b !important;
|
|
86
|
+
font-weight: bold;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* 操作符 */
|
|
90
|
+
.hljs-operator,
|
|
91
|
+
.hljs-entity,
|
|
92
|
+
.hljs-url,
|
|
93
|
+
.language-css .hljs-string,
|
|
94
|
+
.style .hljs-string {
|
|
95
|
+
color: #ff79c6 !important;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* 浅色主题下的代码高亮 - 适用于浅色/蓝色背景 */
|
|
100
|
+
.im-light {
|
|
101
|
+
/* 基础文本颜色 */
|
|
102
|
+
.hljs {
|
|
103
|
+
color: #24292e !important;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* 关键字 */
|
|
107
|
+
.hljs-keyword,
|
|
108
|
+
.hljs-selector-tag,
|
|
109
|
+
.hljs-tag,
|
|
110
|
+
.hljs-name {
|
|
111
|
+
color: #d73a49 !important;
|
|
112
|
+
font-weight: bold;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* 字符串 */
|
|
116
|
+
.hljs-string,
|
|
117
|
+
.hljs-title,
|
|
118
|
+
.hljs-section,
|
|
119
|
+
.hljs-attribute,
|
|
120
|
+
.hljs-literal,
|
|
121
|
+
.hljs-template-tag,
|
|
122
|
+
.hljs-template-variable,
|
|
123
|
+
.hljs-type,
|
|
124
|
+
.hljs-addition {
|
|
125
|
+
color: #032f62 !important;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* 数字、布尔值 */
|
|
129
|
+
.hljs-number,
|
|
130
|
+
.hljs-selector-attr,
|
|
131
|
+
.hljs-selector-pseudo,
|
|
132
|
+
.hljs-meta-string,
|
|
133
|
+
.hljs-built_in {
|
|
134
|
+
color: #005cc5 !important;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* 属性、变量 */
|
|
138
|
+
.hljs-attr,
|
|
139
|
+
.hljs-variable,
|
|
140
|
+
.hljs-property,
|
|
141
|
+
.hljs-params,
|
|
142
|
+
.hljs-class .hljs-title {
|
|
143
|
+
color: #6f42c1 !important;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* 注释 */
|
|
147
|
+
.hljs-comment,
|
|
148
|
+
.hljs-quote,
|
|
149
|
+
.hljs-doctag {
|
|
150
|
+
color: #6a737d !important;
|
|
151
|
+
font-style: italic;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* 函数 */
|
|
155
|
+
.hljs-function .hljs-title {
|
|
156
|
+
color: #6f42c1 !important;
|
|
157
|
+
font-weight: bold;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* 操作符 */
|
|
161
|
+
.hljs-operator,
|
|
162
|
+
.hljs-entity,
|
|
163
|
+
.hljs-url,
|
|
164
|
+
.language-css .hljs-string,
|
|
165
|
+
.style .hljs-string {
|
|
166
|
+
color: #d73a49 !important;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* 强调 */
|
|
171
|
+
.hljs-emphasis {
|
|
172
|
+
font-style: italic;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.hljs-strong {
|
|
176
|
+
font-weight: bold;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* 确保pre元素和其他容器也没有边框 */
|
|
180
|
+
pre, .code-scroll-container {
|
|
181
|
+
border: none !important;
|
|
182
|
+
outline: none !important;
|
|
183
|
+
background: transparent !important;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* 文件名样式,根据主题自动调整颜色 */
|
|
187
|
+
.filename-text {
|
|
188
|
+
font-size: 10px;
|
|
189
|
+
font-weight: 500;
|
|
190
|
+
|
|
191
|
+
/* 深色模式 - 白色文本 */
|
|
192
|
+
.im-dark &, .im-custom & {
|
|
193
|
+
color: white;
|
|
194
|
+
text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* 浅色模式 - 黑色文本 */
|
|
198
|
+
.im-light & {
|
|
199
|
+
color: #000000;
|
|
200
|
+
text-shadow: 0px 0px 1px rgba(255, 255, 255, 0.5);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -46,7 +46,7 @@ var QustionButtonMsg = function QustionButtonMsg(props) {
|
|
|
46
46
|
}, _mapInstanceProperty(_context = msg.customExts.guidance_list).call(_context, function (text) {
|
|
47
47
|
return /*#__PURE__*/React.createElement(antd.Button, {
|
|
48
48
|
key: text,
|
|
49
|
-
className: "max-w-full w-[400px] !h-[
|
|
49
|
+
className: "max-w-full w-[400px] !h-[40px] !bg-[#2c7cf5]",
|
|
50
50
|
onClick: function onClick() {
|
|
51
51
|
onSelectAnswer && onSelectAnswer({
|
|
52
52
|
text: text,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NoticeMessageBody } from "agora-chat-uikit/types/module/noticeMessage/NoticeMessage";
|
|
2
2
|
import { ChatSDK } from "agora-chat-uikit/types/module/SDK";
|
|
3
|
-
import 'highlight.js/styles/
|
|
3
|
+
import 'highlight.js/styles/default.css';
|
|
4
4
|
import React from "react";
|
|
5
|
+
import "./style/index.moduel.scss";
|
|
5
6
|
interface ICodeMsg {
|
|
6
7
|
msg: ChatSDK.MessageBody | NoticeMessageBody;
|
|
7
8
|
isMySelf: boolean;
|
|
@@ -2,12 +2,13 @@ import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
|
2
2
|
import _setTimeout from '@babel/runtime-corejs3/core-js-stable/set-timeout';
|
|
3
3
|
import { BaseMessage } from 'agora-chat-uikit';
|
|
4
4
|
import hljs from 'highlight.js';
|
|
5
|
-
import 'highlight.js/styles/
|
|
5
|
+
import 'highlight.js/styles/default.css';
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
import copy from 'copy-to-clipboard';
|
|
8
|
+
import './style/index.moduel.scss';
|
|
8
9
|
|
|
9
10
|
var CodeMsg = function CodeMsg(props) {
|
|
10
|
-
var _msg$customExts, _msg$customExts2;
|
|
11
|
+
var _msg$customExts, _msg$customExts2, _msg$customExts3;
|
|
11
12
|
var msg = props.msg,
|
|
12
13
|
isMySelf = props.isMySelf,
|
|
13
14
|
avatar = props.avatar,
|
|
@@ -16,10 +17,11 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
16
17
|
_useState2 = _slicedToArray(_useState, 2),
|
|
17
18
|
copyStatus = _useState2[0],
|
|
18
19
|
setCopyStatus = _useState2[1];
|
|
19
|
-
|
|
20
|
+
var codeType = ((_msg$customExts = msg.customExts) === null || _msg$customExts === void 0 ? void 0 : _msg$customExts.code_type) || "python";
|
|
21
|
+
if (!((_msg$customExts2 = msg.customExts) !== null && _msg$customExts2 !== void 0 && _msg$customExts2.code)) {
|
|
20
22
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
21
23
|
}
|
|
22
|
-
var rawCode = (_msg$
|
|
24
|
+
var rawCode = (_msg$customExts3 = msg.customExts) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.code) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.replace(/\\n/g, "\n")) === null || _msg$customExts3 === void 0 || (_msg$customExts3 = _msg$customExts3.replace(/\\"/g, '"')) === null || _msg$customExts3 === void 0 ? void 0 : _msg$customExts3.replace(/\\\\/g, "\\");
|
|
23
25
|
// 复制代码到剪贴板
|
|
24
26
|
var copyToClipboard = function copyToClipboard() {
|
|
25
27
|
if (!rawCode) return;
|
|
@@ -63,13 +65,13 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
63
65
|
}, /*#__PURE__*/React.createElement("div", {
|
|
64
66
|
className: "text-[var(--im-main-fontColor)] flex flex-col gap-1 ".concat(isMySelf ? "items-end" : "items-start")
|
|
65
67
|
}, /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "inline-block w-full rounded-lg overflow-hidden relative mb-2",
|
|
66
69
|
style: {
|
|
67
70
|
background: isMySelf ? "var(--im-msg-bubble-color-right)" : "var(--im-msg-bubble-color-left)",
|
|
68
71
|
borderRadius: "9px",
|
|
69
72
|
padding: "10px 12px",
|
|
70
73
|
color: isMySelf ? "var(--im-msg-bubble-right-font-color)" : "var(--im-msg-bubble-font-color)"
|
|
71
|
-
}
|
|
72
|
-
className: "inline-block w-full"
|
|
74
|
+
}
|
|
73
75
|
}, /*#__PURE__*/React.createElement("div", {
|
|
74
76
|
className: "flex-1 flex justify-between items-center"
|
|
75
77
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -86,8 +88,8 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
86
88
|
d: "M8 0.0214844H2.58333V2.5396H0.0214844V8.01198H2.58333V10.5301H8V8.01198H10.5618V2.5396H8V0.0214844Z",
|
|
87
89
|
fill: "#0083FF"
|
|
88
90
|
})), /*#__PURE__*/React.createElement("span", {
|
|
89
|
-
className: "text
|
|
90
|
-
},
|
|
91
|
+
className: "filename-text"
|
|
92
|
+
}, codeType)), /*#__PURE__*/React.createElement("button", {
|
|
91
93
|
onClick: function onClick() {
|
|
92
94
|
onApply && onApply(msg.customExts.code);
|
|
93
95
|
!onApply && copyToClipboard();
|
|
@@ -99,28 +101,20 @@ var CodeMsg = function CodeMsg(props) {
|
|
|
99
101
|
className: "code-scroll-container w-full max-h-[300px] overflow-y-auto"
|
|
100
102
|
}, /*#__PURE__*/React.createElement("pre", {
|
|
101
103
|
className: "bg-transparent w-full h-full"
|
|
102
|
-
}, /*#__PURE__*/React.createElement("
|
|
103
|
-
className: "
|
|
104
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
className: "code-block-container",
|
|
104
106
|
style: {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
lineHeight: "1.5",
|
|
110
|
-
fontFamily: "Monaco, Consolas, monospace",
|
|
111
|
-
whiteSpace: "pre-wrap",
|
|
112
|
-
wordWrap: "break-word",
|
|
113
|
-
width: "100%",
|
|
114
|
-
maxWidth: "100%",
|
|
115
|
-
padding: "0.5rem"
|
|
116
|
-
},
|
|
107
|
+
border: "none"
|
|
108
|
+
}
|
|
109
|
+
}, /*#__PURE__*/React.createElement("code", {
|
|
110
|
+
className: "language-".concat(codeType, " hljs"),
|
|
117
111
|
dangerouslySetInnerHTML: {
|
|
118
112
|
__html: hljs.highlight(rawCode, {
|
|
119
|
-
language:
|
|
113
|
+
language: codeType,
|
|
120
114
|
ignoreIllegals: true
|
|
121
115
|
}).value
|
|
122
116
|
}
|
|
123
|
-
})))))));
|
|
117
|
+
}))))))));
|
|
124
118
|
};
|
|
125
119
|
|
|
126
120
|
export { CodeMsg as default };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/* 代码高亮样式,支持暗色和亮色主题 */
|
|
2
|
+
|
|
3
|
+
/* 通用样式 */
|
|
4
|
+
.code-block-container {
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
margin: 4px 0;
|
|
7
|
+
padding: 8px 4px;
|
|
8
|
+
background: transparent !important;
|
|
9
|
+
border: none !important;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* 通用代码样式 */
|
|
13
|
+
code.hljs {
|
|
14
|
+
display: block;
|
|
15
|
+
overflow: auto;
|
|
16
|
+
background: transparent !important;
|
|
17
|
+
font-size: 13px;
|
|
18
|
+
line-height: 1.4;
|
|
19
|
+
font-family: Monaco, Consolas, 'Courier New', monospace;
|
|
20
|
+
white-space: pre-wrap;
|
|
21
|
+
word-wrap: break-word;
|
|
22
|
+
width: 100%;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
padding: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* 深色主题下的代码高亮 - 适用于深蓝/黑色背景 */
|
|
28
|
+
.im-dark, .im-custom {
|
|
29
|
+
/* 基础文本颜色 */
|
|
30
|
+
.hljs {
|
|
31
|
+
color: #f8f8f2 !important;
|
|
32
|
+
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* 关键字 */
|
|
36
|
+
.hljs-keyword,
|
|
37
|
+
.hljs-selector-tag,
|
|
38
|
+
.hljs-tag,
|
|
39
|
+
.hljs-name {
|
|
40
|
+
color: #ff79c6 !important;
|
|
41
|
+
font-weight: bold;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* 字符串 */
|
|
45
|
+
.hljs-string,
|
|
46
|
+
.hljs-title,
|
|
47
|
+
.hljs-section,
|
|
48
|
+
.hljs-attribute,
|
|
49
|
+
.hljs-literal,
|
|
50
|
+
.hljs-template-tag,
|
|
51
|
+
.hljs-template-variable,
|
|
52
|
+
.hljs-type,
|
|
53
|
+
.hljs-addition {
|
|
54
|
+
color: #f1fa8c !important;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* 数字、布尔值 */
|
|
58
|
+
.hljs-number,
|
|
59
|
+
.hljs-selector-attr,
|
|
60
|
+
.hljs-selector-pseudo,
|
|
61
|
+
.hljs-meta-string,
|
|
62
|
+
.hljs-built_in {
|
|
63
|
+
color: #bd93f9 !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* 属性、变量 */
|
|
67
|
+
.hljs-attr,
|
|
68
|
+
.hljs-variable,
|
|
69
|
+
.hljs-property,
|
|
70
|
+
.hljs-params,
|
|
71
|
+
.hljs-class .hljs-title {
|
|
72
|
+
color: #8be9fd !important;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* 注释 */
|
|
76
|
+
.hljs-comment,
|
|
77
|
+
.hljs-quote,
|
|
78
|
+
.hljs-doctag {
|
|
79
|
+
color: #6272a4 !important;
|
|
80
|
+
font-style: italic;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* 函数 */
|
|
84
|
+
.hljs-function .hljs-title {
|
|
85
|
+
color: #50fa7b !important;
|
|
86
|
+
font-weight: bold;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* 操作符 */
|
|
90
|
+
.hljs-operator,
|
|
91
|
+
.hljs-entity,
|
|
92
|
+
.hljs-url,
|
|
93
|
+
.language-css .hljs-string,
|
|
94
|
+
.style .hljs-string {
|
|
95
|
+
color: #ff79c6 !important;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* 浅色主题下的代码高亮 - 适用于浅色/蓝色背景 */
|
|
100
|
+
.im-light {
|
|
101
|
+
/* 基础文本颜色 */
|
|
102
|
+
.hljs {
|
|
103
|
+
color: #24292e !important;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* 关键字 */
|
|
107
|
+
.hljs-keyword,
|
|
108
|
+
.hljs-selector-tag,
|
|
109
|
+
.hljs-tag,
|
|
110
|
+
.hljs-name {
|
|
111
|
+
color: #d73a49 !important;
|
|
112
|
+
font-weight: bold;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* 字符串 */
|
|
116
|
+
.hljs-string,
|
|
117
|
+
.hljs-title,
|
|
118
|
+
.hljs-section,
|
|
119
|
+
.hljs-attribute,
|
|
120
|
+
.hljs-literal,
|
|
121
|
+
.hljs-template-tag,
|
|
122
|
+
.hljs-template-variable,
|
|
123
|
+
.hljs-type,
|
|
124
|
+
.hljs-addition {
|
|
125
|
+
color: #032f62 !important;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* 数字、布尔值 */
|
|
129
|
+
.hljs-number,
|
|
130
|
+
.hljs-selector-attr,
|
|
131
|
+
.hljs-selector-pseudo,
|
|
132
|
+
.hljs-meta-string,
|
|
133
|
+
.hljs-built_in {
|
|
134
|
+
color: #005cc5 !important;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* 属性、变量 */
|
|
138
|
+
.hljs-attr,
|
|
139
|
+
.hljs-variable,
|
|
140
|
+
.hljs-property,
|
|
141
|
+
.hljs-params,
|
|
142
|
+
.hljs-class .hljs-title {
|
|
143
|
+
color: #6f42c1 !important;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/* 注释 */
|
|
147
|
+
.hljs-comment,
|
|
148
|
+
.hljs-quote,
|
|
149
|
+
.hljs-doctag {
|
|
150
|
+
color: #6a737d !important;
|
|
151
|
+
font-style: italic;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* 函数 */
|
|
155
|
+
.hljs-function .hljs-title {
|
|
156
|
+
color: #6f42c1 !important;
|
|
157
|
+
font-weight: bold;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* 操作符 */
|
|
161
|
+
.hljs-operator,
|
|
162
|
+
.hljs-entity,
|
|
163
|
+
.hljs-url,
|
|
164
|
+
.language-css .hljs-string,
|
|
165
|
+
.style .hljs-string {
|
|
166
|
+
color: #d73a49 !important;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* 强调 */
|
|
171
|
+
.hljs-emphasis {
|
|
172
|
+
font-style: italic;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.hljs-strong {
|
|
176
|
+
font-weight: bold;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* 确保pre元素和其他容器也没有边框 */
|
|
180
|
+
pre, .code-scroll-container {
|
|
181
|
+
border: none !important;
|
|
182
|
+
outline: none !important;
|
|
183
|
+
background: transparent !important;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* 文件名样式,根据主题自动调整颜色 */
|
|
187
|
+
.filename-text {
|
|
188
|
+
font-size: 10px;
|
|
189
|
+
font-weight: 500;
|
|
190
|
+
|
|
191
|
+
/* 深色模式 - 白色文本 */
|
|
192
|
+
.im-dark &, .im-custom & {
|
|
193
|
+
color: white;
|
|
194
|
+
text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* 浅色模式 - 黑色文本 */
|
|
198
|
+
.im-light & {
|
|
199
|
+
color: #000000;
|
|
200
|
+
text-shadow: 0px 0px 1px rgba(255, 255, 255, 0.5);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -44,7 +44,7 @@ var QustionButtonMsg = function QustionButtonMsg(props) {
|
|
|
44
44
|
}, _mapInstanceProperty(_context = msg.customExts.guidance_list).call(_context, function (text) {
|
|
45
45
|
return /*#__PURE__*/React.createElement(Button, {
|
|
46
46
|
key: text,
|
|
47
|
-
className: "max-w-full w-[400px] !h-[
|
|
47
|
+
className: "max-w-full w-[400px] !h-[40px] !bg-[#2c7cf5]",
|
|
48
48
|
onClick: function onClick() {
|
|
49
49
|
onSelectAnswer && onSelectAnswer({
|
|
50
50
|
text: text,
|