-
Notifications
You must be signed in to change notification settings - Fork 5
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
Copy notebook exports via nb header #31
base: next
Are you sure you want to change the base?
Conversation
@@ -57,6 +58,9 @@ export const NotebookHeader = (props) => { | |||
const [state, actions] = useNotebook() | |||
const [documentMenuVisible, setDocumentMenuVisible] = useState() | |||
|
|||
let exports = [] |
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.
what's the exports purpose?
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.
Okay, so it has to be declared as an array, so that the exports can be iterated over. I will change it up though
@@ -291,6 +297,57 @@ export const NotebookHeader = (props) => { | |||
// { hasMain, notebook, userProfile, notebookId, isOwner } | |||
// ) | |||
|
|||
const fallbackCopyTextToClipboard = (text) => { |
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.
I'd extract this entire logic into a separate function or a custom hook - and i'd also check if there's a copy-to-clipboard package to use instead of hand-crafting it
} | ||
|
||
const initCopy = () => { | ||
let exportsAsString = '' |
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.
I'd prepare the string in advanced so it can be shown to the user - this can be a large blob of text on some occasions and not necessarily what the user expects.
- Added a modal where you can choose which exports - Now only shows # of exports - Copy is using an NPM package
Same as already approved PR, but much better functionality and looks