Skip to content

Commit

Permalink
Fix not loading add activity doenetML editor Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharles committed Apr 6, 2023
1 parent 8353e5d commit 78b0c65
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Tools/_framework/ToolPanels/EditorViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function EditorViewer() {
const setEditorInit = useSetRecoilState(editorPageIdInitAtom);
const refreshNumber = useRecoilValue(refreshNumberAtom);
const setIsInErrorState = useSetRecoilState(editorViewerErrorStateAtom);
const pageObj = useRecoilValue(itemByDoenetId(effectivePageId))
const [pageObj,setPageObj] = useRecoilState(itemByDoenetId(effectivePageId))
const activityObj = useRecoilValue(itemByDoenetId(doenetId))
const setSuppressMenus = useSetRecoilState(suppressMenusAtom);
const { canUpload } = useRecoilValue(profileAtom);
Expand Down Expand Up @@ -133,11 +133,19 @@ export default function EditorViewer() {
useEffect(() => {
if (effectivePageId !== '' && pageInitiated) {
initDoenetML(effectivePageId)
}else if(loaderPageId){
//Add Activity from Portfolio so init pageObj
setPageObj({containingDoenetId : loaderDoenetId,
doenetId : loaderPageId,
isSelected : false,
label : "Untitled",
parentDoenetId : loaderDoenetId,
type : "page"});
}
return () => {
setEditorInit("");
}
}, [effectivePageId, pageInitiated]);
}, [initDoenetML,setEditorInit,loaderPageId,effectivePageId, pageInitiated]);

useEventListener("keydown", e => {
if ((e.keyCode === 83 && e.metaKey) || (e.keyCode === 83 && e.ctrlKey)) {
Expand Down

0 comments on commit 78b0c65

Please sign in to comment.