Zeke Zhang 7d660f5a0f
feat(Link): add 'Open in new window' option (#4898)
* refactor: rename 'useURLAndParamsSchema' to 'useURLAndHTMLSchema' and improve it

* feat: add 'Open in new window' option

* test: add e2e test
2024-07-19 09:07:19 +08:00

26 lines
564 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* This file is part of the NocoBase (R) project.
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
* Authors: NocoBase Team.
*
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
/**
* 是否是完整的 URL带协议的
* @param string
* @returns
*/
export function isURL(string) {
let url: URL;
try {
url = new URL(string);
} catch (e) {
return false;
}
return url.protocol === 'http:' || url.protocol === 'https:';
}