Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kerwin612 committed Jan 13, 2025
1 parent dc63b48 commit fe21290
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web_src/js/features/copycontent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import {GET} from '../modules/fetch.ts';
const {i18n} = window.config;

export function initCopyContent() {
const btn = document.querySelector('#copy-content');
initTargetCopyContent(document);
}

export function initTargetCopyContent(target: ParentNode) {
const btn = target.querySelector('#copy-content');
if (!btn || btn.classList.contains('disabled')) return;

btn.addEventListener('click', async () => {
Expand Down
2 changes: 2 additions & 0 deletions web_src/js/features/repo-view-file-tree-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {initTargetDropdown} from './common-page.ts';
import {initTargetRepoEllipsisButton} from './repo-commit.ts';
import {initTargetPdfViewer} from '../render/pdf.ts';
import {initTargetButtons} from './common-button.ts';
import {initTargetCopyContent} from './copycontent.ts';

async function toggleSidebar(visibility, isSigned) {
const sidebarEl = document.querySelector('.repo-view-file-tree-sidebar');
Expand Down Expand Up @@ -62,6 +63,7 @@ function reloadContentScript(contentEl: Element) {
initTargetPdfViewer(contentEl);
initTargetRepoBranchTagSelector(contentEl);
initTargetRepoEllipsisButton(contentEl);
initTargetCopyContent(contentEl);
}

export async function initViewFileTreeSidebar() {
Expand Down

0 comments on commit fe21290

Please sign in to comment.