Skip to content

Commit fb15354

Browse files
author
Rajat
committed
Script based embeds for pages and lessons
1 parent 246b5bd commit fb15354

File tree

21 files changed

+247
-55
lines changed

21 files changed

+247
-55
lines changed
147 KB
Loading
150 KB
Loading
633 KB
Loading
609 KB
Loading
106 KB
Loading

apps/docs/src/pages/en/courses/add-content.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ A lesson is a container for the actual learning material. CourseLit supports mul
4242

4343
For embedding HTML or iframe based content.
4444

45+
See the [guide to add an embed](/en/lessons/embed).
46+
4547
7. Quiz
4648

4749
For quizzing your students. You can create graded and non-graded quizzes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Add an embed to a course
3+
description: Add an embed to a course
4+
layout: ../../../layouts/MainLayout.astro
5+
---
6+
7+
You can easily add embeds to your online courses in CourseLit. This article will show you how.
8+
9+
## Add an embed to a course
10+
11+
1. Go to the `Products` page and click on the course you want to add SCORM content to. Click on `Edit content`.
12+
13+
2. Click on `Add lesson` in any section.
14+
15+
3. On the New Lesson screen, you'll see a row of lesson type cards. Click on the `Embed` card to select it.
16+
17+
![Embed card](/assets/lessons/embed/create.png)
18+
19+
4. Enter the title and the embed code.
20+
21+
![Embed details](/assets/lessons/embed/details.png)
22+
23+
5. The preview of the embeddable content will show up below the embed code.
24+
25+
![Embed preview](/assets/lessons/embed/preview.png)
26+
27+
6. Hit `Save` to save changes to your lesson.
28+
29+
![Embed Save](/assets/lessons/embed/save.png)
30+
31+
## What embeds are supported
32+
33+
You can see the list of platforms [here](/en/website/blocks#what-embeds-are-supported).
34+
35+
## Stuck somewhere?
36+
37+
We are always there for you. Come chat with us in our <a href="https://discord.com/invite/GR4bQsN" target="_blank">Discord</a> channel or send a tweet at <a href="https://twitter.com/courselit" target="_blank">@CourseLit</a>.

apps/docs/src/pages/en/website/blocks.md

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ You will also see the newly added link on the header itself.
3636
3. Click on the pencil icon against the newly added link to edit it as shown above.
3737
4. Change the label (displayed as text on the header block) and the URL (where the user should be taken upon clicking the label on the header) and click `Done` to save.
3838
![Header edit link](/assets/pages/header-edit-link.png)
39-
</details>
39+
</details>
4040

4141
### [Rich Text](#rich-text)
4242

@@ -69,7 +69,7 @@ The rich text block uses the same text editor available elsewhere on the platfor
6969
2. Click on the floating `link` icon to reveal a text input.
7070
3. In the popup text input, enter the URL as shown below and press <kbd>Enter</kbd>.
7171
![Create a hyperlink in rich text block](/assets/pages/courselit-text-editor-create-links.gif)
72-
</details>
72+
</details>
7373

7474
### [Hero](#hero)
7575

@@ -95,7 +95,7 @@ Following is how it looks on a page.
9595
4. In the button action, enter the URL the user should be taken to upon clicking.
9696
a. If the URL is from your own school, use its relative form, i.e., `/courses`.
9797
b. If the URL is from some external website, use the absolute (complete) URL, i.e., `https://website.com/courses`.
98-
</details>
98+
</details>
9999

100100
### [Grid](#grid)
101101

@@ -140,7 +140,7 @@ A grid block comes in handy when you want to show some sort of list, for example
140140
4. In the button action, enter the URL the user should be taken to upon clicking.
141141
a. If the URL is from your own school, use its relative form, i.e., `/courses`.
142142
b. If the URL is from some external website, use the absolute (complete) URL, i.e., `https://website.com/courses`.
143-
</details>
143+
</details>
144144

145145
### [Featured](#featured)
146146

@@ -250,6 +250,52 @@ Following is an animation that shows the entire flow.
250250

251251
</details>
252252

253+
### [Embed](#embed)
254+
255+
<details>
256+
<summary>Expand to see Embed block details</summary>
257+
258+
Embedding content from other websites is a common requirement. CourseLit offers a dedicated block that lets you embed content from other websites.
259+
260+
You can embed websites (using `URL` type) or widgets (using `Script` type).
261+
262+
The height of the content in case of `Script` type embed is automatically calculated. The `Height` property in the builder has no effect.
263+
264+
Following is how it looks while displaying a Cal.com calendar.
265+
266+
## What embeds are supported
267+
268+
Although, CourseLit platform should support any embed code, we have tested with the following platforms:
269+
<br />
270+
<br />
271+
272+
- YouTube
273+
- Vimeo
274+
- Google Docs
275+
- Microsoft Word
276+
- Google Forms
277+
- Typeform
278+
- Microsoft Forms
279+
- Google Calendar
280+
- GitHub Gist
281+
- Apple Podcasts
282+
- SoundCloud
283+
- Spotify
284+
- Senja
285+
- Addcal
286+
<br />
287+
<br />
288+
289+
Here is [Cal.com](https://cal.com/)'s embed looks on a page.
290+
<br />
291+
<br />
292+
293+
![Embed block](/assets/pages/embed-block.png)
294+
295+
> Embed code not working? Please reach out to us on <a href="https://discord.com/invite/GR4bQsN" target="_blank">Discord</a>.
296+
297+
</details>
298+
253299
### [Footer](#footer)
254300

255301
<details>
@@ -276,7 +322,7 @@ In the `Design` panel, you can customize:
276322
- Maximum width
277323
- Vertical padding
278324
- Social media links (Facebook, Twitter, Instagram, LinkedIn, YouTube, Discord, GitHub)
279-
</details>
325+
</details>
280326

281327
## [Shared blocks](#shared-blocks)
282328

apps/web/components/public/lesson-viewer/embed-viewer.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import { UIConstants } from "@courselit/common-models";
3+
import { SandboxedEmbed } from "@courselit/page-blocks";
34

45
const YouTubeEmbed = ({ content }: { content: string }) => {
56
const match = content.match(UIConstants.YOUTUBE_REGEX);
@@ -22,11 +23,16 @@ interface LessonEmbedViewerProps {
2223
}
2324

2425
const LessonEmbedViewer = ({ content }: LessonEmbedViewerProps) => {
26+
const isYouTube =
27+
content.value.includes("youtube") || content.value.includes("youtu.be");
28+
const hasScript = content.value.includes("<script");
29+
2530
return (
2631
<>
27-
{content.value.includes("youtube") ||
28-
content.value.includes("youtu.be") ? (
32+
{isYouTube ? (
2933
<YouTubeEmbed content={content.value} />
34+
) : hasScript ? (
35+
<SandboxedEmbed content={content.value} />
3036
) : (
3137
<div
3238
dangerouslySetInnerHTML={{

apps/web/ui-config/strings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,5 +726,5 @@ export const PRODUCTS_LIST_EMPTY_DESCRIPTION_PRIVATE =
726726
"You have not added any products yet.";
727727
export const LOGIN_CODE_SENT_MESSAGE =
728728
"We have emailed you a one time password.";
729-
export const LESSON_EMBED_URL_LABEL = "URL or Iframe Code";
729+
export const LESSON_EMBED_URL_LABEL = "Embed code";
730730
export const LESSON_CONTENT_LABEL = "Content";

0 commit comments

Comments
 (0)