Skip to content

Commit 3bdf16a

Browse files
committed
Show edit page confirmation dialog on tree view file change
1 parent 01351cc commit 3bdf16a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

web_src/js/components/ViewFileTreeItem.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ const doLoadChildren = async () => {
3737
};
3838
3939
const onItemClick = (e: MouseEvent) => {
40-
// only handle the click event with page partial reloading if the user didn't press any special key
41-
// let browsers handle special keys like "Ctrl+Click"
42-
if (!isPlainClick(e)) return;
40+
// only handle the click event with partial page reloading if both
41+
// - the user didn't press any special key like "Ctrl+Click" (which may have custom browser behavior)
42+
// - the editor/commit form isn't dirty (a full page reload shows a confirmation dialog if the form contains unsaved changes)
43+
if (!isPlainClick(e) || document.querySelector('.repo-view-content .form.dirty')) return;
4344
e.preventDefault();
4445
if (props.item.entryMode === 'tree') doLoadChildren();
4546
store.navigateTreeView(props.item.fullPath);

0 commit comments

Comments
 (0)