@ledvance/group-ui-biz-bundle 1.0.110 → 1.0.111

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/group-ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.0.110",
7
+ "version": "1.0.111",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -57,23 +57,44 @@ const EnergyModal = (props: EnergyModalProps) => {
57
57
  };
58
58
 
59
59
  const getDescription = (string: string) => {
60
- const separators = /[.:]/;
61
- const text = string.split(separators)
62
- const length = text.length - 1
63
- return <View>
64
- <Text style={{ color: props.theme?.global.fontColor }}>{text[length - 6] + '.'}</Text>
65
- <Spacer />
66
- <Text style={{ color: props.theme?.global.fontColor }}>{text[length - 5] + '.'}</Text>
67
- <Spacer />
68
- <Text style={{ color: props.theme?.global.fontColor }}>{text[length - 4] + text[length - 3] + ':'}</Text>
69
- <Spacer />
70
- <Text
71
- style={{ textDecorationLine: 'underline', color: props.theme?.button.primary }}
72
- onPress={() => openLink(`${text[length - 2]}:${text[length - 1]}${text[length]}`)}
73
- >
74
- {`${text[length - 2]}:${text[length - 1]}${text[length]}`}
75
- </Text>
76
- </View>
60
+ // 首先提取URL
61
+ const urlRegex = /(https?:\/\/[^\s]+)$/;
62
+ const urlMatch = string.match(urlRegex);
63
+ const url = urlMatch ? urlMatch[0] : '';
64
+
65
+ // 移除URL部分以处理正文文本
66
+ const textWithoutUrl = urlMatch
67
+ ? string.slice(0, string.lastIndexOf(url)).trim()
68
+ : string;
69
+
70
+ // 分割文本但保留分隔符
71
+ const sentences:string[] = [];
72
+ const parts = textWithoutUrl.split(/([.:])/);
73
+
74
+ for (let i = 0; i < parts.length - 1; i += 2) {
75
+ if (i + 1 < parts.length) {
76
+ sentences.push(parts[i] + parts[i + 1]);
77
+ }
78
+ }
79
+
80
+ return (
81
+ <View>
82
+ {sentences.map((sentence, index) => (
83
+ <View key={index}>
84
+ <Text style={{ color: props.theme?.global.fontColor }}>{sentence.trim()}</Text>
85
+ <Spacer />
86
+ </View>
87
+ ))}
88
+ {url && (
89
+ <Text
90
+ style={{ textDecorationLine: 'underline', color: props.theme?.button.primary }}
91
+ onPress={() => openLink(url)}
92
+ >
93
+ {url}
94
+ </Text>
95
+ )}
96
+ </View>
97
+ );
77
98
  }
78
99
 
79
100
  useUpdateEffect(() =>{