Skip to content

Commit cb1e538

Browse files
author
Tim Wundenberg
committed
Revert "Warn on navigation if currently editing comment or title (#32223)"
This reverts commit 228fec8.
1 parent 228fec8 commit cb1e538

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

web_src/js/features/repo-issue-edit.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ async function tryOnEditContent(e) {
2424
e.preventDefault();
2525
showElem(renderContent);
2626
hideElem(editContentZone);
27-
window.removeEventListener('beforeunload', showUserHintOnNavigate);
2827
comboMarkdownEditor.dropzoneReloadFiles();
2928
};
3029

@@ -33,7 +32,6 @@ async function tryOnEditContent(e) {
3332
renderContent.classList.add('is-loading');
3433
showElem(renderContent);
3534
hideElem(editContentZone);
36-
window.removeEventListener('beforeunload', showUserHintOnNavigate);
3735
try {
3836
const params = new URLSearchParams({
3937
content: comboMarkdownEditor.value(),
@@ -84,7 +82,6 @@ async function tryOnEditContent(e) {
8482
// Show write/preview tab and copy raw content as needed
8583
showElem(editContentZone);
8684
hideElem(renderContent);
87-
window.addEventListener('beforeunload', showUserHintOnNavigate);
8885

8986
comboMarkdownEditor = getComboMarkdownEditor(editContentZone.querySelector('.combo-markdown-editor'));
9087
if (!comboMarkdownEditor) {
@@ -151,11 +148,6 @@ async function tryOnQuoteReply(e) {
151148
editor.moveCursorToEnd();
152149
}
153150

154-
// Show a warning message when the user tries to navigate, even though he is currently editing
155-
function showUserHintOnNavigate(e: BeforeUnloadEvent) {
156-
e.preventDefault();
157-
}
158-
159151
export function initRepoIssueCommentEdit() {
160152
document.addEventListener('click', (e) => {
161153
tryOnEditContent(e); // Edit issue or comment content

web_src/js/features/repo-issue.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -546,15 +546,12 @@ export function initRepoIssueTitleEdit() {
546546
issueTitleInput.value = oldTitle;
547547
}
548548
issueTitleInput.focus();
549-
550-
window.addEventListener('beforeunload', showUserHintOnNavigate);
551549
});
552550
issueTitleEditor.querySelector('.ui.cancel.button').addEventListener('click', () => {
553551
hideElem(issueTitleEditor);
554552
hideElem('#pull-desc-editor');
555553
showElem(issueTitleDisplay);
556554
showElem('#pull-desc-display');
557-
window.removeEventListener('beforeunload', showUserHintOnNavigate);
558555
});
559556

560557
const pullDescEditor = document.querySelector('#pull-desc-editor'); // it may not exist for a merged PR
@@ -580,7 +577,6 @@ export function initRepoIssueTitleEdit() {
580577
}
581578
}
582579
}
583-
window.removeEventListener('beforeunload', showUserHintOnNavigate);
584580
window.location.reload();
585581
} catch (error) {
586582
console.error(error);
@@ -589,11 +585,6 @@ export function initRepoIssueTitleEdit() {
589585
});
590586
}
591587

592-
// Show a warning message when the user tries to navigate, even though he is currently editing
593-
function showUserHintOnNavigate(e: BeforeUnloadEvent) {
594-
e.preventDefault();
595-
}
596-
597588
export function initRepoIssueBranchSelect() {
598589
document.querySelector('#branch-select')?.addEventListener('click', (e: MouseEvent & {target: HTMLElement}) => {
599590
const el = e.target.closest('.item[data-branch]');

0 commit comments

Comments
 (0)