Skip to content

Merge index.js #34963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fine tune
  • Loading branch information
wxiaoguang committed Jul 5, 2025
commit c33b45960d11afdb19a4b7df8d850c40dd5bcf52
4 changes: 1 addition & 3 deletions web_src/fomantic/build/fomantic.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Hard-forked from Fomantic UI 2.8.7, patches are commented with "GITEA-PATCH"
import jquery from 'jquery';
import './components/api.js';
import './components/dropdown.js';
import './components/modal.js';
import './components/search.js';

window.$ = window.jQuery = jquery;
// Hard-forked from Fomantic UI 2.8.7, patches are commented with "GITEA-PATCH"
4 changes: 4 additions & 0 deletions web_src/js/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ function shouldIgnoreError(err: Error) {

export function showGlobalErrorMessage(msg: string, msgType: Intent = 'error') {
const msgContainer = document.querySelector('.page-content') ?? document.body;
if (!msgContainer) {
alert(`${msgType}: ${msg}`);
return;
}
const msgCompact = msg.replace(/\W/g, '').trim(); // compact the message to a data attribute to avoid too many duplicated messages
let msgDiv = msgContainer.querySelector<HTMLDivElement>(`.js-global-error[data-global-error-msg-compact="${msgCompact}"]`);
if (!msgDiv) {
Expand Down
2 changes: 2 additions & 0 deletions web_src/js/globals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import jquery from 'jquery';
window.$ = window.jQuery = jquery; // only for Fomantic UI
1 change: 1 addition & 0 deletions web_src/js/index-domready.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './globals.ts';
import '../fomantic/build/fomantic.js';
import '../../node_modules/easymde/dist/easymde.min.css'; // TODO: lazy load in "switchToEasyMDE"

Expand Down
2 changes: 1 addition & 1 deletion web_src/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {onDomReady} from './utils/dom.ts';

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

onDomReady(async () => {
Expand Down