-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(dialog/export): export to clipboard #8009
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @yzx9, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request implements a highly requested feature that allows users to export the content of a single note directly to their clipboard. This significantly improves the workflow for users who frequently need to copy note content without saving it as a file. The changes include UI updates to the export dialog, new translation strings, and the underlying logic to handle the clipboard operation, making the export process more versatile and user-friendly. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
b84e95c to
c372ba0
Compare
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.
Code Review
This pull request introduces a new "Export to clipboard" feature, which is a valuable addition to the note export dialog. The changes include necessary UI updates, translation keys, and the core logic for copying note content to the clipboard. The use of useState for managing the UI state and disabling the export button during the process contributes to a good user experience. Overall, the implementation is clear and addresses the requested functionality effectively.
| } catch (error) { | ||
| console.error("Failed to copy exported note to clipboard:", error); | ||
| } |
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.
The catch block in exportSingleToClipboard currently only logs the error to the console. It would be beneficial to also provide user-facing feedback, such as a toast message, if the export to clipboard operation fails (e.g., due to network issues during the fetch request). This ensures the user is aware that the action did not complete successfully.
Consider adding a new translation key, for example, export.export_failed_to_clipboard, to apps/client/src/translations/en/translation.json for this error message.
await copyTextWithToast(text);
} catch (error) {
console.error("Failed to copy exported note to clipboard:", error);
toastService.showError(t("export.export_failed_to_clipboard"));
}
| "export_type_single": "Only this note without its descendants", | ||
| "export_to_clipboard": "Export to clipboard", | ||
| "export_to_clipboard_on_tooltip": "Export the note content to clipboard.", | ||
| "export_to_clipboard_off_tooltip": "Download the note as a file.", |
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.
To support the error handling suggested in export.tsx, a new translation key for a failed clipboard export should be added here. For example:
"export_failed_to_clipboard": "Failed to export note content to clipboard."
| "export_to_clipboard_off_tooltip": "Download the note as a file.", | |
| "export_to_clipboard_off_tooltip": "Download the note as a file.", | |
| "export_failed_to_clipboard": "Failed to export note content to clipboard.", |
This pull request adds a new "Export to clipboard" feature to the note export dialog, allowing users to directly copy the content of a single note to their clipboard instead of downloading it as a file. The changes include UI updates, translation additions, and logic to handle clipboard export, along with improvements to the export dialog's usability.
This feature was originally requested in #5645, where it was later changed to “Copy as Markdown.” I’m also interested in adding that feature, but since I’m new to Trilium, I thought implementing this one would be a good starting point as it’s simpler and still potentially useful.
Please feel free to point out any issues or conventions I might have missed.