-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ELN/Labs Feature #950
ELN/Labs Feature #950
Conversation
components/CKEditor/ELNEditor.js
Outdated
} | ||
|
||
function useFetchNote(router) { | ||
const [note, setNote] = useState(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we want to use Note
like this, we dont need it to be a state. Just return note from the fetch.
components/CKEditor/ELNEditor.js
Outdated
function useFetchNotes(router) { | ||
const [notes, setNotes] = useState([]); | ||
const noteId = router.query.noteId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defined below
components/CKEditor/ELNEditor.js
Outdated
useEffect(() => { | ||
editorRef.current = { | ||
CKEditor: require("@ckeditor/ckeditor5-react").CKEditor, | ||
Editor: require("@thomasvu/ckeditor5-custom-build").ELNEditor, | ||
CKEditorInspector: require("@ckeditor/ckeditor5-inspector"), | ||
}; | ||
setEditorLoaded(true); | ||
return () => { | ||
//window.removeEventListener("resize", boundRefreshDisplayMode); | ||
//window.removeEventListener("beforeunload", boundCheckPendingActions); | ||
}; | ||
}, [currentNoteId]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you create a useEffect handler for page-resize in one of the root folders? it might be useful. Then we can give it a callback
components/CKEditor/ELNEditor.js
Outdated
//const note = (() => { | ||
// for (const n of notes) { | ||
// if (`${n.id}` === router.query.noteId) { | ||
// return n; | ||
// } | ||
// } | ||
//})(); | ||
//console.log("notes", notes); | ||
//console.log("note", note); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove these if we're note using it.
components/CKEditor/ELNEditor.js
Outdated
function saveData(editorData) { | ||
const params = { | ||
full_src: editorData, | ||
plain_text: "", | ||
note: router.query.noteId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's take out large functions that do not need to be part of the component. Defining functions like this will trigger functions to be redefined at every rerender.
components/CKEditor/ELNEditor.js
Outdated
const refreshDisplayMode = (editor) => { | ||
const annotationsUIs = editor.plugins.get("AnnotationsUIs"); | ||
const sidebarElement = sidebarElementRef.current; | ||
|
||
if (window.innerWidth < 1070) { | ||
sidebarElement.classList.remove("narrow"); | ||
sidebarElement.classList.add("hidden"); | ||
annotationsUIs.switchTo("inline"); | ||
} else if (window.innerWidth < 1300) { | ||
sidebarElement.classList.remove("hidden"); | ||
sidebarElement.classList.add("narrow"); | ||
annotationsUIs.switchTo("narrowSidebar"); | ||
} else { | ||
sidebarElement.classList.remove("hidden", "narrow"); | ||
annotationsUIs.switchTo("wideSidebar"); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what this is doing?
Understand that code down below is commented out, but wanna be also mindful of manipulating DOM directly like this.
Authorization: | ||
"Token " + | ||
(typeof window !== "undefined" | ||
? window.localStorage[AUTH_TOKEN] | ||
: ""), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm
@thomas-vu is attempting to deploy a commit to the Researchhub Team on Vercel. To accomplish this, @thomas-vu needs to request access to the Team. Afterwards, an owner of the Team is required to accept their membership request. If you're already a member of the respective Vercel Team, make sure that your Personal Vercel Account is connected to your GitHub account. |
* fixed some bugs, initially setting currentNote to null when switching to make it more responsive * removed unnecessary code
[ELN] Org placeholder, removing "personal notes" section
…-demo [ELN] Minor ELN fixes before demo
No description provided.