@blocklet/ui-react 2.12.42 → 2.12.44

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.
@@ -10,20 +10,12 @@ import { useMemoizedFn } from "ahooks";
10
10
  import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
11
11
  import LinkIcon from "@arcblock/icons/lib/Link";
12
12
  import { mergeSx } from "@arcblock/ux/lib/Util/style";
13
- import { joinURL, parseURL } from "ufo";
13
+ import { joinURL, withoutProtocol } from "ufo";
14
14
  import { isValidUrl } from "./utils.js";
15
15
  import { translations } from "../../libs/locales.js";
16
16
  import { commonInputStyle, inputFieldStyle } from "../editable-field.js";
17
17
  function formatLinkDisplay(link) {
18
- try {
19
- const url = parseURL(link);
20
- if (url.protocol === "http:" || url.protocol === "https:") {
21
- return url.host || link;
22
- }
23
- return link;
24
- } catch {
25
- return link;
26
- }
18
+ return withoutProtocol(link);
27
19
  }
28
20
  function LinkInput({
29
21
  value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.12.42",
3
+ "version": "2.12.44",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -33,10 +33,10 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@abtnode/constant": "^1.16.40",
36
- "@arcblock/bridge": "^2.12.42",
37
- "@arcblock/react-hooks": "^2.12.42",
36
+ "@arcblock/bridge": "^2.12.44",
37
+ "@arcblock/react-hooks": "^2.12.44",
38
38
  "@arcblock/ws": "^1.19.15",
39
- "@blocklet/did-space-react": "^1.0.35",
39
+ "@blocklet/did-space-react": "^1.0.36",
40
40
  "@iconify-icons/logos": "^1.2.36",
41
41
  "@iconify-icons/material-symbols": "^1.2.58",
42
42
  "@iconify/react": "^5.2.0",
@@ -87,5 +87,5 @@
87
87
  "jest": "^29.7.0",
88
88
  "unbuild": "^2.0.0"
89
89
  },
90
- "gitHead": "744430cb09820799f4b3c6f811cbfbbb08015453"
90
+ "gitHead": "78451bd982cb2946053c74989a593c858bafe9b1"
91
91
  }
@@ -11,7 +11,7 @@ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
11
11
  // eslint-disable-next-line import/no-extraneous-dependencies
12
12
  import LinkIcon from '@arcblock/icons/lib/Link';
13
13
  import { mergeSx } from '@arcblock/ux/lib/Util/style';
14
- import { joinURL, parseURL } from 'ufo';
14
+ import { joinURL, withoutProtocol } from 'ufo';
15
15
  import { isValidUrl } from './utils';
16
16
  import { translations } from '../../libs/locales';
17
17
  import { commonInputStyle, inputFieldStyle } from '../editable-field';
@@ -21,17 +21,7 @@ import { commonInputStyle, inputFieldStyle } from '../editable-field';
21
21
  * 对于 http/https 协议只显示域名,其他协议显示完整链接
22
22
  */
23
23
  function formatLinkDisplay(link: string): string {
24
- try {
25
- const url = parseURL(link);
26
- // 如果是 http 或 https 协议,只显示域名
27
- if (url.protocol === 'http:' || url.protocol === 'https:') {
28
- return url.host || link;
29
- }
30
- // 其他协议显示完整链接
31
- return link;
32
- } catch {
33
- return link;
34
- }
24
+ return withoutProtocol(link);
35
25
  }
36
26
 
37
27
  /**