fix: resolve upstream merge build errors
Fix duplicated isGiteaError export in errors.ts and add missing refissue.ts from v1.26.1 merge. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import {queryElems} from '../utils/dom.ts';
|
||||
import {parseIssueHref} from '../utils.ts';
|
||||
import {createApp} from 'vue';
|
||||
import {createTippy, getAttachedTippyInstance} from '../modules/tippy.ts';
|
||||
|
||||
export function initMarkupRefIssue(el: HTMLElement) {
|
||||
queryElems(el, '.ref-issue', (el) => {
|
||||
el.addEventListener('mouseenter', showMarkupRefIssuePopup);
|
||||
el.addEventListener('focus', showMarkupRefIssuePopup);
|
||||
});
|
||||
}
|
||||
|
||||
function showMarkupRefIssuePopup(e: MouseEvent | FocusEvent) {
|
||||
const refIssue = e.currentTarget as HTMLElement;
|
||||
if (getAttachedTippyInstance(refIssue)) return;
|
||||
if (refIssue.classList.contains('ref-external-issue')) return;
|
||||
|
||||
const issuePathInfo = parseIssueHref(refIssue.getAttribute('href')!);
|
||||
if (!issuePathInfo.ownerName) return;
|
||||
|
||||
const el = document.createElement('div');
|
||||
const onShowAsync = async () => {
|
||||
const {default: ContextPopup} = await import('../components/ContextPopup.vue');
|
||||
const view = createApp(ContextPopup, {
|
||||
// backend: GetIssueInfo
|
||||
loadIssueInfoUrl: `${window.config.appSubUrl}/${issuePathInfo.ownerName}/${issuePathInfo.repoName}/issues/${issuePathInfo.indexString}/info`,
|
||||
});
|
||||
view.mount(el);
|
||||
};
|
||||
const tippy = createTippy(refIssue, {
|
||||
theme: 'default',
|
||||
content: el,
|
||||
trigger: 'mouseenter focus',
|
||||
placement: 'top-start',
|
||||
interactive: true,
|
||||
role: 'dialog',
|
||||
interactiveBorder: 5,
|
||||
// onHide() { return false }, // help to keep the popup and debug the layout
|
||||
onShow: () => { onShowAsync() },
|
||||
});
|
||||
tippy.show();
|
||||
}
|
||||
@@ -49,17 +49,6 @@ export function isGiteaError(filename: string, stack: string): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Detect whether an error originated from Gitea's own scripts, not from
|
||||
// browser extensions or other external scripts.
|
||||
const extensionRe = /(chrome|moz|safari(-web)?)-extension:\/\//;
|
||||
export function isGiteaError(filename: string, stack: string): boolean {
|
||||
if (extensionRe.test(filename) || extensionRe.test(stack)) return false;
|
||||
const assetBaseUrl = new URL(`${window.config.assetUrlPrefix}/`, window.location.origin).href;
|
||||
if (filename && !filename.startsWith(assetBaseUrl) && !filename.startsWith(window.location.origin)) return false;
|
||||
if (stack && !stack.includes(assetBaseUrl)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function processWindowErrorEvent({error, reason, message, type, filename, lineno, colno}: ErrorEvent & PromiseRejectionEvent) {
|
||||
const err = error ?? reason;
|
||||
// `error` and `reason` are not guaranteed to be errors. If the value is falsy, it is likely a
|
||||
|
||||
Reference in New Issue
Block a user