Skip to content
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

Merged
merged 178 commits into from
Oct 22, 2021
Merged

ELN/Labs Feature #950

merged 178 commits into from
Oct 22, 2021

Conversation

thomas-vu
Copy link

No description provided.

}

function useFetchNote(router) {
const [note, setNote] = useState(null);
Copy link
Contributor

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.

Comment on lines 12 to 14
function useFetchNotes(router) {
const [notes, setNotes] = useState([]);
const noteId = router.query.noteId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defined below

Comment on lines 70 to 81
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]);
Copy link
Contributor

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

Comment on lines 60 to 68
//const note = (() => {
// for (const n of notes) {
// if (`${n.id}` === router.query.noteId) {
// return n;
// }
// }
//})();
//console.log("notes", notes);
//console.log("note", note);
Copy link
Contributor

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.

Comment on lines 88 to 92
function saveData(editorData) {
const params = {
full_src: editorData,
plain_text: "",
note: router.query.noteId,
Copy link
Contributor

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.

Comment on lines 143 to 159
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");
}
};
Copy link
Contributor

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.

Comment on lines +29 to +34
Authorization:
"Token " +
(typeof window !== "undefined"
? window.localStorage[AUTH_TOKEN]
: ""),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm

@vercel
Copy link

vercel bot commented Sep 3, 2021

@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.

@vercel vercel bot temporarily deployed to Preview October 21, 2021 16:29 Inactive
@vercel vercel bot temporarily deployed to Preview October 22, 2021 20:13 Inactive
@thomas-vu thomas-vu merged commit 3747c9f into master Oct 22, 2021
@thomas-vu thomas-vu deleted the thomas/eln branch October 22, 2021 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants