Skip to content

Commit 668e0bb

Browse files
author
Rajat Saxena
committed
CodeQL fixes
1 parent e3a1b7b commit 668e0bb

3 files changed

Lines changed: 13 additions & 19 deletions

File tree

packages/page-blocks/src/blocks/embed/admin-widget.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,25 @@ import { Theme, ThemeStyle } from "@courselit/page-models";
2525
const hasYouTubeContent = (content: string): boolean => {
2626
const lowerContent = content.toLowerCase();
2727
return (
28-
lowerContent.includes("youtube.com") ||
29-
lowerContent.includes("youtu.be") ||
30-
lowerContent.includes("youtube-nocookie.com") ||
31-
lowerContent.includes("youtube.com/embed/")
28+
lowerContent.startsWith("https://www.youtube.com") ||
29+
lowerContent.startsWith("https://www.youtube-nocookie.com") ||
30+
lowerContent.startsWith("https://youtube.com") ||
31+
lowerContent.startsWith("https://youtube-nocookie.com") ||
32+
lowerContent.startsWith("https://youtu.be") ||
33+
lowerContent.startsWith("https://youtube.com/embed/") ||
34+
lowerContent.startsWith("https://www.youtube.com/embed/") ||
35+
lowerContent.startsWith("https://www.youtube-nocookie.com/embed/") ||
36+
lowerContent.startsWith("https://youtube.com/watch?v=") ||
37+
lowerContent.startsWith("https://www.youtube.com/watch?v=") ||
38+
lowerContent.startsWith("https://www.youtube-nocookie.com/watch?v=")
3239
);
3340
};
3441

3542
const hasVimeoContent = (content: string): boolean => {
3643
const lowerContent = content.toLowerCase();
3744
return (
38-
lowerContent.includes("vimeo.com") ||
39-
lowerContent.includes("player.vimeo.com")
45+
lowerContent.startsWith("https://vimeo.com") ||
46+
lowerContent.startsWith("https://player.vimeo.com")
4047
);
4148
};
4249

packages/page-blocks/src/blocks/grid/admin-widget/item-editor.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,6 @@ export default function ItemEditor({
4545
item.mediaAlignment || "bottom",
4646
);
4747
const [svgText, setSvgText] = useState(item.svgText);
48-
const [deleteConfirmation, setDeleteConfirmation] = useState(false);
49-
50-
const onDeleteItem = () => {
51-
if (deleteConfirmation) {
52-
onDelete();
53-
} else {
54-
setDeleteConfirmation(true);
55-
setTimeout(() => setDeleteConfirmation(false), 2000);
56-
}
57-
};
5848

5949
const itemChanged = () =>
6050
onChange({

packages/page-blocks/src/blocks/marquee/widget/marquee.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ export default function Marquee({
2525
const containerRef = useRef<HTMLDivElement>(null);
2626
const contentRef = useRef<HTMLDivElement>(null);
2727

28-
// Convert children to array
29-
const childrenArray = React.Children.toArray(children);
30-
3128
useEffect(() => {
3229
if (containerRef.current && contentRef.current) {
3330
const calculateWidth = () => {

0 commit comments

Comments
 (0)