diff options
author | Hester Gong <hestergong@gmail.com> | 2023-04-12 11:03:23 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-11 23:03:23 -0400 |
commit | b43ad51a3dd28b747f7135f081d8812dedd89879 (patch) | |
tree | 33ec9a920e4c59aab5af240c7ee3b1875e63efc6 /web_src/js/features/repo-editor.js | |
parent | 6892e2b8efff4465acd702e702d16f7aadd07187 (diff) | |
download | gitea-b43ad51a3dd28b747f7135f081d8812dedd89879.tar.gz gitea-b43ad51a3dd28b747f7135f081d8812dedd89879.zip |
Add popup to hashed comments/pull requests/issues in file editing/adding preview tab (#24040)
#23734 didn't add popups(tippy) to ref issues for the preview tab when
adding/editing a file
The location of the preview tab:
<img width="1214" alt="截屏2023-04-10 13 55 38"
src="https://user-images.githubusercontent.com/17645053/230836213-a73f0cee-378c-4a21-93db-583ba2c72f77.png">
This PR resues the logic in `ComboMarkdownEditor.js` to also add popup
to hashed comments/pull requests/issues in file editing/adding preview
tab.
After - On hover:
<img width="1222" alt="截屏2023-04-10 13 55 42"
src="https://user-images.githubusercontent.com/17645053/230836250-527ca7d0-6ec4-4c68-89ab-4f1b57b09239.png">
---------
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'web_src/js/features/repo-editor.js')
-rw-r--r-- | web_src/js/features/repo-editor.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/web_src/js/features/repo-editor.js b/web_src/js/features/repo-editor.js index a7c59fb039..b7937cf006 100644 --- a/web_src/js/features/repo-editor.js +++ b/web_src/js/features/repo-editor.js @@ -1,8 +1,9 @@ import $ from 'jquery'; import {htmlEscape} from 'escape-goat'; -import {initMarkupContent} from '../markup/content.js'; import {createCodeEditor} from './codeeditor.js'; import {hideElem, showElem} from '../utils/dom.js'; +import {initMarkupContent} from '../markup/content.js'; +import {attachRefIssueContextPopup} from './contextpopup.js'; const {csrfToken} = window.config; @@ -28,8 +29,7 @@ function initEditPreviewTab($form) { file_path: treePathEl.val(), }, (data) => { const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`); - $previewPanel.html(data); - initMarkupContent(); + renderPreviewPanelContent($previewPanel, data); }); }); } @@ -191,3 +191,11 @@ export function initRepoEditor() { }); })(); } + +export function renderPreviewPanelContent($panelPreviewer, data) { + $panelPreviewer.html(data); + initMarkupContent(); + + const refIssues = $panelPreviewer.find('p .ref-issue'); + attachRefIssueContextPopup(refIssues); +} |