Skip to content

Commit

Permalink
fix: correct editor link validation (#4053)
Browse files Browse the repository at this point in the history
  • Loading branch information
augustlindemer authored Dec 6, 2024
1 parent b398905 commit cb83df3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions editor.planx.uk/src/ui/editor/RichTextInput/RichTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ export const emptyContent = "<p></p>";
const linkSelectionError = (selectionHtml: string): string | null => {
if (selectionHtml.startsWith("<p>") && selectionHtml.endsWith("</p>")) {
const text = selectionHtml.slice(3, -4);
const lowercaseText = text.toLowerCase();
if (lowercaseText.includes("click") || lowercaseText.includes("here")) {
const lowercaseText = text.toLowerCase().trim().replace(/[.,]/g, "");
if (lowercaseText === "click here" || lowercaseText === "clicking here") {
return "Links must be set over text that accurately describes what the link is for. Avoid generic language such as 'click here'.";
}
if (text[0] && text[0] !== text[0].toUpperCase() && text.length < 8) {
Expand Down

0 comments on commit cb83df3

Please sign in to comment.