Skip to content

Conversation

@yzx9
Copy link

@yzx9 yzx9 commented Dec 10, 2025

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.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 10, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

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

  • New Feature: Export to Clipboard: Introduced a new option in the note export dialog to directly copy the content of a single note to the clipboard, eliminating the need to download it as a file.
  • User Interface Enhancements: Added a toggle switch to the export dialog, allowing users to easily select between downloading a note or exporting its content to the clipboard.
  • Internationalization Support: New translation keys have been added to support the 'Export to clipboard' feature, including specific tooltips for its on and off states.
  • Export Logic Refinement: Modified the export process to conditionally fetch note content and copy it to the clipboard when the 'Export to clipboard' option is selected for single notes, otherwise proceeding with the standard file download.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@yzx9 yzx9 force-pushed the export-to-clipboard branch from b84e95c to c372ba0 Compare December 10, 2025 10:12
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines +168 to +170
} catch (error) {
console.error("Failed to copy exported note to clipboard:", error);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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

Suggested change
"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.",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant