Fix dynamic content loading init problem#33748
Merged
Merged
Conversation
3f1a0ea to
3644e2a
Compare
3644e2a to
62a9254
Compare
Contributor
Author
|
Not too many changes by ignoring spaces: https://github.com/go-gitea/gitea/pull/33748/files?diff=unified&w=1 |
delvh
approved these changes
Feb 28, 2025
| @@ -0,0 +1,89 @@ | |||
| import {isDocumentFragmentOrElementNode} from '../utils/dom.ts'; | |||
|
|
|||
| type DirElement = HTMLInputElement | HTMLTextAreaElement; | |||
Member
There was a problem hiding this comment.
Ah, that's supposed to be direction, not directory.
I was confused for a second.
Contributor
Author
lunny
approved these changes
Feb 28, 2025
Contributor
Author
|
Next: Refactor global init code and add more comments #33755 |
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Mar 3, 2025
* giteaofficial/main: Use pullrequestlist instead of []*pullrequest (go-gitea#33765) Upgrade act to 0.261.4 and actions-proto-go to v0.4.1 (go-gitea#33760) Webhook add X-Gitea-Hook-Installation-Target-Type Header (go-gitea#33752) Fix dynamic content loading init problem (go-gitea#33748) [skip ci] Updated translations via Crowdin Add composor source field (go-gitea#33502) upgrade go-crypto from 1.1.5 to 1.1.6 (go-gitea#33745) Disable go license generation as part of `make tidy` (go-gitea#33747) Refactor repo-diff.ts (go-gitea#33746) Use `git diff-tree` for `DiffFileTree` on diff pages (go-gitea#33514) [skip ci] Updated translations via Crowdin Improve "generate new access token" form (go-gitea#33730) Remove superflous tw-content-center (go-gitea#33741) Clone repository with Tea CLI (go-gitea#33725) allow filtering /repos/{owner}/{repo}/pulls by target base branch queryparam (go-gitea#33684) Show info about maintainers are allowed to edit a PR (go-gitea#33738) Improve admin user view page (go-gitea#33735) [skip ci] Updated translations via Crowdin Align sidebar gears to the right (go-gitea#33721)
GiteaBot
pushed a commit
to lunny/gitea
that referenced
this pull request
Mar 3, 2025
Follow up go-gitea#33748 Now there are 3 "global" functions: * registerGlobalSelectorFunc: for all elements matching the selector, eg: `.ui.dropdown` * registerGlobalInitFunc: for `data-global-init="initInputAutoFocusEnd"` * registerGlobalEventFunc: for `data-global-click="onCommentReactionButtonClick"` And introduce `initGlobalInput` to replace old `initAutoFocusEnd` and `attachDirAuto`, use `data-global-init` to replace fragile `.js-autofocus-end` selector. Another benefit is that by the new approach, no matter how many times `registerGlobalInitFunc` is called, we only need to do one "querySelectorAll" in the last step, it could slightly improve the performance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dirauto.tstoobserver.ts.observeAddedElementto init all non-custom "dropdown".data-global-clickto handle click events from dynamically loaded elements..comment-reaction-button) mechanism is removed..diff-boxselector, it was abused and never really used.A lot of FIXMEs in "repo-diff.ts" are completely fixed, newly loaded contents could work as expected.
data-global-initcode is almost ready, if further readers, when need to use it, add a "registerGlobalInitFunc" then it should work.