Skip to content

Commit 9908ef5

Browse files
author
Ahtesham Quraish
committed
add ckeditor with customization for insering the course in it
1 parent c8eef1f commit 9908ef5

File tree

16 files changed

+2002
-3
lines changed

16 files changed

+2002
-3
lines changed

frontends/api/src/clients.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
ProfilesApi,
2222
TestimonialsApi,
2323
LearningResourcesSearchAdminParamsApi,
24+
CkeditorApi,
2425
} from "./generated/v0/api"
2526

2627
import axiosInstance from "./axios"
@@ -50,6 +51,7 @@ const learningResourcesSearchApi = new LearningResourcesSearchApi(
5051
const learningResourcesSearchAdminParamsApi =
5152
new LearningResourcesSearchAdminParamsApi(undefined, BASE_PATH, axiosInstance)
5253

54+
const ckeditorApi = new CkeditorApi(undefined, BASE_PATH, axiosInstance)
5355
const featuredApi = new FeaturedApi(undefined, BASE_PATH, axiosInstance)
5456

5557
const learningPathsApi = new LearningpathsApi(
@@ -113,4 +115,5 @@ export {
113115
featuredApi,
114116
testimonialsApi,
115117
learningResourcesSearchAdminParamsApi,
118+
ckeditorApi,
116119
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { useQuery } from "@tanstack/react-query"
2+
import { ckeditorApi } from "../../clients"
3+
4+
const useCkeditorParams = (enabled: boolean) =>
5+
useQuery({
6+
queryKey: ["ckeditorParams"],
7+
queryFn: async () => {
8+
const response = await ckeditorApi.ckeditorRetrieve()
9+
return response.data
10+
},
11+
enabled: enabled,
12+
})
13+
14+
export { useCkeditorParams }

frontends/main/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"moment": "^2.30.1",
3232
"next": "^15.5.2",
3333
"next-nprogress-bar": "^2.4.2",
34+
"ol-ckeditor": "0.0.0",
3435
"ol-components": "0.0.0",
3536
"ol-utilities": "0.0.0",
3637
"posthog-js": "^1.157.2",
@@ -43,6 +44,7 @@
4344
},
4445
"devDependencies": {
4546
"@faker-js/faker": "^10.0.0",
47+
"@next/swc-darwin-arm64": "15.5.3",
4648
"@testing-library/jest-dom": "^6.4.8",
4749
"@testing-library/react": "^16.3.0",
4850
"@testing-library/user-event": "^14.5.2",
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"use client"
2+
import React from "react"
3+
import { CKEditorClient } from "ol-ckeditor"
4+
import { ckeditorApi } from "api/clients"
5+
6+
const ArticlesPage: React.FC = () => {
7+
const getCKEditorTokenFetchUrl = async () => {
8+
const response = await ckeditorApi.ckeditorRetrieve()
9+
return response.data.token
10+
}
11+
12+
return (
13+
<div>
14+
<CKEditorClient
15+
value={""}
16+
getCKEditorTokenFetchUrl={getCKEditorTokenFetchUrl}
17+
uploadUrl={process.env.NEXT_PUBLIC_CKEDITOR_UPLOAD_URL || ""}
18+
onChange={() => {}}
19+
/>
20+
</div>
21+
)
22+
}
23+
24+
export { ArticlesPage }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from "react"
2+
import { Metadata } from "next"
3+
import { standardizeMetadata } from "@/common/metadata"
4+
import { ArticlesPage } from "@/app-pages/Articles/ArticlesPage"
5+
6+
export const metadata: Metadata = standardizeMetadata({
7+
title: "Articles",
8+
})
9+
10+
const Page: React.FC<PageProps<"/articles">> = () => {
11+
return <ArticlesPage />
12+
}
13+
14+
export default Page

frontends/ol-ckeditor/package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "ol-ckeditor",
3+
"version": "0.0.0",
4+
"exports": {
5+
".": "./src/index.ts"
6+
},
7+
"dependencies": {
8+
"@ckeditor/ckeditor5-react": "^6.3.0",
9+
"api": "workspace:*",
10+
"ckeditor5": "^42.0.0",
11+
"next": "^15.5.2",
12+
"ol-components": "0.0.0"
13+
},
14+
"peerDependencies": {
15+
"react": ">=18.0.0",
16+
"react-dom": ">=18.0.0"
17+
},
18+
"scripts": {
19+
"build": "tsc -p tsconfig.json"
20+
}
21+
}

0 commit comments

Comments
 (0)