@alifd/chat 0.3.30-beta.5 → 0.3.31-beta.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/es/index.js +1 -1
- package/es/markdown/index.js +4 -1
- package/lib/index.js +1 -1
- package/lib/markdown/index.js +4 -1
- package/package.json +1 -1
package/es/index.js
CHANGED
|
@@ -31,4 +31,4 @@ export { default as RadioGroup } from './radio-group';
|
|
|
31
31
|
export { default as CheckboxGroup } from './checkbox-group';
|
|
32
32
|
export { default as Select } from './select';
|
|
33
33
|
export { default as Flip } from './flip';
|
|
34
|
-
export const version = '0.3.
|
|
34
|
+
export const version = '0.3.31-beta.0';
|
package/es/markdown/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { PREFIX_DEFAULT, assignSubComponent } from '../utils';
|
|
|
8
8
|
import { init, transformTextWithEmoji } from '@ali/dingtalk-im-emoji';
|
|
9
9
|
import hljs from 'highlight.js'; // 引入 highlight.js
|
|
10
10
|
import 'highlight.js/styles/github.css'; // 引入代码高亮样式
|
|
11
|
+
let displayedContentCache = '';
|
|
11
12
|
const DEFAULT_LOADING_ICON = 'https://img.alicdn.com/imgextra/i1/O1CN01wdlADU1WCvOLNSB3w_!!6000000002753-1-tps-530-255.gif';
|
|
12
13
|
/**
|
|
13
14
|
* @component Markdown
|
|
@@ -24,7 +25,7 @@ const Markdown = forwardRef((_a, ref) => {
|
|
|
24
25
|
onReady === null || onReady === void 0 ? void 0 : onReady();
|
|
25
26
|
}, [onReady]);
|
|
26
27
|
const containerRef = useRef(null);
|
|
27
|
-
const [displayedContent, setDisplayedContent] = useState(() => (others === null || others === void 0 ? void 0 : others.typewriterEffect) ?
|
|
28
|
+
const [displayedContent, setDisplayedContent] = useState(() => (others === null || others === void 0 ? void 0 : others.typewriterEffect) ? displayedContentCache : content);
|
|
28
29
|
const [contentQueue, setContentQueue] = useState(() => (others === null || others === void 0 ? void 0 : others.typewriterEffect) ? content.split('') : []);
|
|
29
30
|
const typeTimeoutRef = useRef(null);
|
|
30
31
|
// 清理定时器函数
|
|
@@ -93,6 +94,8 @@ const Markdown = forwardRef((_a, ref) => {
|
|
|
93
94
|
}, [contentQueue.length, others === null || others === void 0 ? void 0 : others.typewriterEffect]);
|
|
94
95
|
// 处理 HTML 标签
|
|
95
96
|
const processedContent = useMemo(() => {
|
|
97
|
+
// 缓存displayedContent
|
|
98
|
+
displayedContentCache = displayedContent;
|
|
96
99
|
// 使用 Record 类型来定义映射关系
|
|
97
100
|
const sizeTokenToTagMap = {
|
|
98
101
|
common_hypertitle_text_style__font_size: 'h1',
|
package/lib/index.js
CHANGED
|
@@ -68,4 +68,4 @@ var select_1 = require("./select");
|
|
|
68
68
|
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return tslib_1.__importDefault(select_1).default; } });
|
|
69
69
|
var flip_1 = require("./flip");
|
|
70
70
|
Object.defineProperty(exports, "Flip", { enumerable: true, get: function () { return tslib_1.__importDefault(flip_1).default; } });
|
|
71
|
-
exports.version = '0.3.
|
|
71
|
+
exports.version = '0.3.31-beta.0';
|
package/lib/markdown/index.js
CHANGED
|
@@ -10,6 +10,7 @@ const utils_1 = require("../utils");
|
|
|
10
10
|
const dingtalk_im_emoji_1 = require("@ali/dingtalk-im-emoji");
|
|
11
11
|
const highlight_js_1 = tslib_1.__importDefault(require("highlight.js")); // 引入 highlight.js
|
|
12
12
|
require("highlight.js/styles/github.css"); // 引入代码高亮样式
|
|
13
|
+
let displayedContentCache = '';
|
|
13
14
|
const DEFAULT_LOADING_ICON = 'https://img.alicdn.com/imgextra/i1/O1CN01wdlADU1WCvOLNSB3w_!!6000000002753-1-tps-530-255.gif';
|
|
14
15
|
/**
|
|
15
16
|
* @component Markdown
|
|
@@ -26,7 +27,7 @@ const Markdown = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
26
27
|
onReady === null || onReady === void 0 ? void 0 : onReady();
|
|
27
28
|
}, [onReady]);
|
|
28
29
|
const containerRef = (0, react_1.useRef)(null);
|
|
29
|
-
const [displayedContent, setDisplayedContent] = (0, react_1.useState)(() => (others === null || others === void 0 ? void 0 : others.typewriterEffect) ?
|
|
30
|
+
const [displayedContent, setDisplayedContent] = (0, react_1.useState)(() => (others === null || others === void 0 ? void 0 : others.typewriterEffect) ? displayedContentCache : content);
|
|
30
31
|
const [contentQueue, setContentQueue] = (0, react_1.useState)(() => (others === null || others === void 0 ? void 0 : others.typewriterEffect) ? content.split('') : []);
|
|
31
32
|
const typeTimeoutRef = (0, react_1.useRef)(null);
|
|
32
33
|
// 清理定时器函数
|
|
@@ -95,6 +96,8 @@ const Markdown = (0, react_1.forwardRef)((_a, ref) => {
|
|
|
95
96
|
}, [contentQueue.length, others === null || others === void 0 ? void 0 : others.typewriterEffect]);
|
|
96
97
|
// 处理 HTML 标签
|
|
97
98
|
const processedContent = (0, react_1.useMemo)(() => {
|
|
99
|
+
// 缓存displayedContent
|
|
100
|
+
displayedContentCache = displayedContent;
|
|
98
101
|
// 使用 Record 类型来定义映射关系
|
|
99
102
|
const sizeTokenToTagMap = {
|
|
100
103
|
common_hypertitle_text_style__font_size: 'h1',
|