Skip to content

Commit c33b459

Browse files
committed
fine tune
1 parent 2af3952 commit c33b459

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

web_src/fomantic/build/fomantic.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// Hard-forked from Fomantic UI 2.8.7, patches are commented with "GITEA-PATCH"
2-
import jquery from 'jquery';
31
import './components/api.js';
42
import './components/dropdown.js';
53
import './components/modal.js';
64
import './components/search.js';
75

8-
window.$ = window.jQuery = jquery;
6+
// Hard-forked from Fomantic UI 2.8.7, patches are commented with "GITEA-PATCH"

web_src/js/bootstrap.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ function shouldIgnoreError(err: Error) {
2020

2121
export function showGlobalErrorMessage(msg: string, msgType: Intent = 'error') {
2222
const msgContainer = document.querySelector('.page-content') ?? document.body;
23+
if (!msgContainer) {
24+
alert(`${msgType}: ${msg}`);
25+
return;
26+
}
2327
const msgCompact = msg.replace(/\W/g, '').trim(); // compact the message to a data attribute to avoid too many duplicated messages
2428
let msgDiv = msgContainer.querySelector<HTMLDivElement>(`.js-global-error[data-global-error-msg-compact="${msgCompact}"]`);
2529
if (!msgDiv) {

web_src/js/globals.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import jquery from 'jquery';
2+
window.$ = window.jQuery = jquery; // only for Fomantic UI

web_src/js/index-domready.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import './globals.ts';
12
import '../fomantic/build/fomantic.js';
23
import '../../node_modules/easymde/dist/easymde.min.css'; // TODO: lazy load in "switchToEasyMDE"
34

web_src/js/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {onDomReady} from './utils/dom.ts';
55

66
// TODO: There is a bug in htmx, it incorrectly checks "readyState === 'complete'" when the DOM tree is ready and won't trigger DOMContentLoaded
77
// Then importing the htmx in our onDomReady will make htmx skip its initialization.
8-
// If the bug would be fixed, then we can move this import to "onDomReady"
8+
// If the bug would be fixed (https://github.com/bigskysoftware/htmx/pull/3365), then we can only import htmx in "onDomReady"
99
import 'htmx.org';
1010

1111
onDomReady(async () => {

0 commit comments

Comments
 (0)