mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: hyperlinks html entities (#9063)
This commit is contained in:
parent
52eaf64591
commit
a3e1619635
5 changed files with 15 additions and 30 deletions
|
@ -25,7 +25,7 @@ describe("normalizeLink", () => {
|
|||
expect(normalizeLink("file://")).toBe("file://");
|
||||
expect(normalizeLink("[test](https://test)")).toBe("[test](https://test)");
|
||||
expect(normalizeLink("[[test]]")).toBe("[[test]]");
|
||||
expect(normalizeLink("<test>")).toBe("<test>");
|
||||
expect(normalizeLink("test&")).toBe("test&");
|
||||
expect(normalizeLink("<test>")).toBe("<test>");
|
||||
expect(normalizeLink("test&")).toBe("test&");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { sanitizeUrl } from "@braintree/sanitize-url";
|
||||
import { sanitizeHTMLAttribute } from "../utils";
|
||||
import { escapeDoubleQuotes } from "../utils";
|
||||
|
||||
export const normalizeLink = (link: string) => {
|
||||
link = link.trim();
|
||||
if (!link) {
|
||||
return link;
|
||||
}
|
||||
return sanitizeUrl(sanitizeHTMLAttribute(link));
|
||||
return sanitizeUrl(escapeDoubleQuotes(link));
|
||||
};
|
||||
|
||||
export const isLocalLink = (link: string | null) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue