From 56f9986843223392c9074e74f1cb3146deb8c7a2 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Sat, 9 Sep 2023 14:27:14 +0800 Subject: [PATCH] * Fix bug #38497. --- module/repo/js/diff.ui.js | 16 ++++++++-------- module/repo/ui/diffeditor.html.php | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/module/repo/js/diff.ui.js b/module/repo/js/diff.ui.js index 5d9cabee79..33cb89cacf 100644 --- a/module/repo/js/diff.ui.js +++ b/module/repo/js/diff.ui.js @@ -42,17 +42,17 @@ window.afterPageUpdate = function() $('.btn-left').on('click', function() {arrowTabs('monacoTabs', 1);}); $('.btn-right').on('click', function() {arrowTabs('monacoTabs', -2);}); - - $('#repoDownloadCode').on('click', function() - { - var url = $(this).data('link'); - var activeFilePath = $('#monacoTabs .nav-item .active').attr('href').substring(5).replace(/-/g, '='); - window.open(url.replace('{path}', activeFilePath)); - return; - }) }, 300); }; +window.downloadCode = function() +{ + var url = $(this).data('link'); + var activeFilePath = $('#monacoTabs .nav-item .active').attr('href').substring(5).replace(/-/g, '='); + window.open(url.replace('{path}', activeFilePath)); + return; +} + /** * 点击左侧菜单打开详情tab。 * Open new tab when click tree item. diff --git a/module/repo/ui/diffeditor.html.php b/module/repo/ui/diffeditor.html.php index 9160343dbe..b8f4ad162d 100644 --- a/module/repo/ui/diffeditor.html.php +++ b/module/repo/ui/diffeditor.html.php @@ -60,6 +60,7 @@ div( ( set::arrow(false), set::staticMenu(true), + on::click('#repoDownloadCode', 'downloadCode'), set::className('absolute top-0 right-0 z-10 monaco-dropmenu'), btn (