mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 04:27:15 +03:00
Add better UI for warnings allowing you to accept without chatting
This commit is contained in:
@@ -36,12 +36,31 @@ class NoticeTextSelectionComponent extends React.Component<NoticeTextSelectionPr
|
||||
: null}
|
||||
|
||||
<span>
|
||||
{this.props.text}
|
||||
{this.getTextElements(this.props.text)}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
|
||||
private getTextElements(text: string): Array<string | React.ReactElement> {
|
||||
const elements: Array<string | React.ReactElement> = [];
|
||||
const textParts = text.split(/(?=\s+)/);
|
||||
for (const textPart of textParts) {
|
||||
if (textPart.match(/^\s*http/)) {
|
||||
elements.push(
|
||||
<a href={textPart} target="_blank" rel="noreferrer">
|
||||
{textPart}
|
||||
</a>
|
||||
);
|
||||
} else {
|
||||
elements.push(textPart);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return elements;
|
||||
}
|
||||
}
|
||||
|
||||
export default NoticeTextSelectionComponent;
|
||||
Reference in New Issue
Block a user