- {{svg "octicon-x" 16 "inside close"}}
-
+
hello, this is the modal dialog content, this is a dangerous operation
{{template "base/modal_actions_confirm" (dict "ModalButtonDangerText" "I know and must do this is dangerous operation")}}
diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl
index e70ac25a469..3cbd020ce75 100644
--- a/templates/repo/header.tmpl
+++ b/templates/repo/header.tmpl
@@ -97,13 +97,14 @@
{{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
diff --git a/web_src/js/features/repo-issue-edit.test.ts b/web_src/js/features/repo-issue-edit.test.ts
new file mode 100644
index 00000000000..76a24a64760
--- /dev/null
+++ b/web_src/js/features/repo-issue-edit.test.ts
@@ -0,0 +1,43 @@
+import {tryShortcutQuoteReply} from './repo-issue-edit.ts';
+
+test('tryShortcutQuoteReply', () => {
+ const container = document.createElement('div');
+ container.innerHTML = `
+
+ `;
+ document.body.append(container);
+ const selection = window.getSelection()!;
+ onTestFinished(() => {
+ selection.removeAllRanges();
+ container.remove();
+ });
+ const button = container.querySelector('button')!;
+ const onClick = vi.fn();
+ button.addEventListener('click', onClick);
+
+ selection.removeAllRanges();
+ expect(tryShortcutQuoteReply()).toBe(false);
+
+ selection.selectAllChildren(container.querySelector('.raw-content')!);
+ expect(tryShortcutQuoteReply()).toBe(false);
+
+ const range = document.createRange();
+ range.selectNodeContents(container.querySelector('.render-content')!.firstChild!);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ selection.collapseToStart();
+ expect(tryShortcutQuoteReply()).toBe(false);
+ expect(onClick).not.toHaveBeenCalled();
+
+ selection.removeAllRanges();
+ selection.addRange(range);
+ expect(tryShortcutQuoteReply()).toBe(true);
+ expect(onClick).toHaveBeenCalledTimes(1);
+
+ button.remove();
+ expect(tryShortcutQuoteReply()).toBe(false);
+});
diff --git a/web_src/js/features/repo-issue-edit.ts b/web_src/js/features/repo-issue-edit.ts
index 1621d5919df..3529f0f9d95 100644
--- a/web_src/js/features/repo-issue-edit.ts
+++ b/web_src/js/features/repo-issue-edit.ts
@@ -7,6 +7,7 @@ import {errorMessage} from '../modules/errors.ts';
import {triggerUploadStateChanged} from './comp/EditorUpload.ts';
import {convertHtmlToMarkdown} from '../markup/html2markdown.ts';
import {applyAreYouSure} from '../modules/are-you-sure.ts';
+import {registerShortcutHandler} from '../modules/shortcut.ts';
async function tryOnEditContent(e: Event) {
const clickTarget = (e.target as HTMLElement).closest('.edit-content');
@@ -150,9 +151,32 @@ async function tryOnQuoteReply(e: Event) {
editor.moveCursorToEnd();
}
+export function tryShortcutQuoteReply(): boolean {
+ const selection = window.getSelection();
+ if (!selection?.rangeCount || selection.isCollapsed) return false;
+ const node = selection.getRangeAt(0).commonAncestorContainer;
+ const el = node instanceof HTMLElement ? node : node.parentElement;
+
+ const commentContainer = el?.closest