Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@YUDONGLING
Copy link
Member

@YUDONGLING YUDONGLING commented Dec 17, 2025

Fixed to cloudreve/cloudreve#3069.

& i18n item for Polish given by AI: You have unsaved changes. Still discard?Niezapisane zmiany. Czy na pewno zamknąć?, would this be ok? @LukaszOn.

Close cloudreve/cloudreve#3069.

@LukaszOn
Copy link

A more correct translation to "You have unsaved changes. Still discard?" would be "Masz niezapisane zmiany. Czy na pewno chcesz je odrzucić?"

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an unsaved changes confirmation dialog when users attempt to close the Markdown or Code viewer with unsaved modifications. The feature prevents accidental data loss by prompting users to confirm before discarding their changes when closing via backdrop click or ESC key.

Key Changes:

  • Implements handleDialogClose handlers in both MarkdownViewer and CodeViewer that check for unsaved changes before closing
  • Modifies ViewerDialog to pass a custom close reason when the X button is clicked
  • Adds the discardUnsavedConfirm i18n key across 11 language locales

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/component/Viewers/ViewerDialog.tsx Modified close button handler to pass custom "closeButtonClick" reason instead of standard "backdropClick"
src/component/Viewers/MarkdownEditor/MarkdownViewer.tsx Added handleDialogClose that shows confirmation dialog when closing with unsaved changes via backdrop/ESC
src/component/Viewers/CodeViewer/CodeViewer.tsx Added handleDialogClose that shows confirmation dialog when closing with unsaved changes via backdrop/ESC
public/locales/zh-TW/application.json Added Traditional Chinese translation for unsaved changes confirmation
public/locales/zh-CN/application.json Added Simplified Chinese translation for unsaved changes confirmation
public/locales/ru-RU/application.json Added Russian translation for unsaved changes confirmation
public/locales/pt-BR/application.json Added Brazilian Portuguese translation for unsaved changes confirmation
public/locales/ko-KR/application.json Added Korean translation for unsaved changes confirmation
public/locales/ja-JP/application.json Added Japanese translation for unsaved changes confirmation
public/locales/it-IT/application.json Added Italian translation for unsaved changes confirmation
public/locales/fr-FR/application.json Added French translation for unsaved changes confirmation
public/locales/es-ES/application.json Added Spanish translation for unsaved changes confirmation
public/locales/en-US/application.json Added English translation for unsaved changes confirmation
public/locales/de-DE/application.json Added German translation for unsaved changes confirmation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

public/locales/ko-KR/application.json Outdated Show resolved Hide resolved
public/locales/ja-JP/application.json Outdated Show resolved Hide resolved
const [fullScreen, setFullScreen] = useState(props.fullScreen || isMobile);
const onClose = useCallback(() => {
props.dialogProps.onClose && props.dialogProps.onClose({}, "backdropClick");
props.dialogProps.onClose && props.dialogProps.onClose({}, "closeButtonClick" as any);
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

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

The custom "closeButtonClick" reason bypasses the unsaved changes confirmation dialog. This means users clicking the X button will lose unsaved changes without warning, while clicking the backdrop or pressing ESC shows the confirmation. For better UX and data protection, the X button should also trigger the confirmation when there are unsaved changes. Consider removing this custom reason and letting the X button trigger the standard confirmation flow.

Suggested change
props.dialogProps.onClose && props.dialogProps.onClose({}, "closeButtonClick" as any);
if (props.dialogProps.onClose) {
props.dialogProps.onClose({}, "backdropClick");
}

Copilot uses AI. Check for mistakes.
@YUDONGLING
Copy link
Member Author

A more correct translation to "You have unsaved changes. Still discard?" would be "Masz niezapisane zmiany. Czy na pewno chcesz je odrzucić?"

Great, i will update the translate later.

YUDONGLING and others added 2 commits December 17, 2025 22:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

在线编辑后退出应当询问用户是否保存更改

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.