mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-23 09:42:53 +00:00
fix(file-panels): Settings offers Source where the picker does, and review follow-ups
- Settings > Files offers Source on every key except those a built-in panel of another kind (Image) claims, so a plugin that alone claims a text extension shows the same choices as the picker. - Delete the unused isSourceFilePanel. - The Markdown example warns with the file name when its unmount write fails, rather than dropping the edit silently. - Document that PluginFile stat fields are read at render time and that watch or the read hooks are how a panel learns they changed.
This commit is contained in:
@@ -85,7 +85,12 @@ function MarkdownEditor({ file, tab, theme }: PluginFilePanelProps) {
|
||||
unwatch();
|
||||
clearTimeout(saveTimer.current);
|
||||
// Switching panels keeps the edit. Closing the tab asks first and drops it if discarded.
|
||||
if (unsaved.current !== null) void file.writeText(unsaved.current).catch(() => {});
|
||||
// The panel is gone, so a failed write (a conflict, a lost connection) can only be reported.
|
||||
if (unsaved.current !== null) {
|
||||
void file.writeText(unsaved.current).catch((cause) => {
|
||||
console.warn(`Unsaved edits to ${file.name} were not written: ${messageOf(cause)}`);
|
||||
});
|
||||
}
|
||||
};
|
||||
}, [file, load]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user