Skip to content

Commit

Permalink
Merge pull request #172 from rajnishdargan/release-1.1.0
Browse files Browse the repository at this point in the history
Issue #PS-3678 feat: Passing userSpecificBoard values to Editors
  • Loading branch information
itsvick authored Jan 28, 2025
2 parents bcf425b + 41a3d99 commit ea0ef98
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/components/CollectionEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ const CollectionEditor: React.FC = () => {
},
config: {
mode: mode || "edit", // edit / review / read / sourcingReview
userSpecificFrameworkField: {
code: "board",
value: localStorage.getItem('userSpecificBoard') ? localStorage.getItem('userSpecificBoard') : []
},
maxDepth: 4,
objectType: "Collection",
primaryCategory: "Course", // Professional Development Course, Curriculum Course
Expand Down Expand Up @@ -150,6 +154,8 @@ const CollectionEditor: React.FC = () => {
},
};

console.log('editorConfig ====>', editorConfig)

const editorRef = useRef<HTMLDivElement | null>(null);
const isAppendedRef = useRef(false);
const [assetsLoaded, setAssetsLoaded] = useState(false);
Expand All @@ -162,7 +168,7 @@ const CollectionEditor: React.FC = () => {

script.id = "collection-editor-js";
script.src =
"https://cdn.jsdelivr.net/npm/@tekdi/[email protected].1/sunbird-collection-editor.js";
"https://cdn.jsdelivr.net/npm/@tekdi/[email protected].2/sunbird-collection-editor.js";
script.async = true;
script.onload = () => setAssetsLoaded(true);
document.body.appendChild(script);
Expand All @@ -177,7 +183,7 @@ const CollectionEditor: React.FC = () => {
link.id = "collection-editor-css";
link.rel = "stylesheet";
link.href =
"https://cdn.jsdelivr.net/npm/@tekdi/[email protected].1/styles.css";
"https://cdn.jsdelivr.net/npm/@tekdi/[email protected].2/styles.css";
document.head.appendChild(link);
}

Expand Down
10 changes: 8 additions & 2 deletions src/components/QuestionSetEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ const QuestionSetEditor: React.FC = () => {
},
config: {
mode: mode || "edit",
userSpecificFrameworkField: {
code: "board",
value: localStorage.getItem('userSpecificBoard') ? localStorage.getItem('userSpecificBoard') : []
},
enableQuestionCreation: true,
enableAddFromLibrary: true,
editableFields: {
Expand Down Expand Up @@ -137,6 +141,8 @@ const QuestionSetEditor: React.FC = () => {
},
};

console.log('questionSetEditorConfig ====>', questionSetEditorConfig)

const editorRef = useRef<HTMLDivElement | null>(null);
const isAppendedRef = useRef(false);
const [assetsLoaded, setAssetsLoaded] = useState(false);
Expand All @@ -148,15 +154,15 @@ const QuestionSetEditor: React.FC = () => {
link.id = "sunbird-editor-css";
link.rel = "stylesheet";
link.href =
"https://cdn.jsdelivr.net/npm/@tekdi/[email protected].1/styles.css";
"https://cdn.jsdelivr.net/npm/@tekdi/[email protected].2/styles.css";
document.head.appendChild(link);
}

if (!document.getElementById("sunbird-editor-js")) {
const script = document.createElement("script");
script.id = "sunbird-editor-js";
script.src =
"https://cdn.jsdelivr.net/npm/@tekdi/[email protected].1/sunbird-questionset-editor.js";
"https://cdn.jsdelivr.net/npm/@tekdi/[email protected].2/sunbird-questionset-editor.js";
script.async = true;
script.onload = () => setAssetsLoaded(true);
document.body.appendChild(script);
Expand Down

0 comments on commit ea0ef98

Please sign in to comment.