aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/features/comp
Commit message (Collapse)AuthorAgeFilesLines
* Improve project & label color picker and image scroll (#34971)wxiaoguang2025-07-061-1/+1
| | | | Fix #34609 Fix #34967
* Refactor frontend unique id & comment (#34958)wxiaoguang2025-07-051-9/+7
| | | | | | | * there is no bug of the "unique element id", but duplicate code, this PR just merges the duplicate "element id" logic and move the function from "fomaintic" to "dom" * improve comments * make "git commit graph" page update pagination links correctly
* Improve html escape (#34911)wxiaoguang2025-07-013-14/+14
| | | drop "escape-goat"
* Fix modal + form abuse (#34921)wxiaoguang2025-07-011-0/+1
| | | | | | | See the comment. And due to the abuse, there is a regression: when the modal is hidden, the form will be reset and it can't submit. This PR fixes all problems: keep the modal with form open, and add "loading" indicator.
* Improve tags list page (#34898)wxiaoguang2025-06-301-13/+22
|
* Fix readme path and markdown link paste (#34755)wxiaoguang2025-06-181-1/+1
|
* fix: prevent double markdown link brackets when pasting URL (#34745)MaxWebZ2025-06-172-7/+26
| | | | | | | | | | | | | | When adding a link using the "Add a link" button in comment editor, pasting a URL resulted in incorrect Markdown formatting (double brackets) instead of replacing the placeholder text. This fix adds a context check to prevent creating a new markdown link when we're already inside an existing one. Fixes #34740 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix various problems (#34708)wxiaoguang2025-06-121-1/+2
| | | | | * Fix #34707 * Fix dropdown filter handling * Fix #27014
* Validate hex colors when creating/editing labels (#34623)Kemal Zebari2025-06-071-1/+1
| | | | | | | | Resolves #34618. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Merge and tweak markup editor expander CSS (#34409)silverwind2025-05-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | - Merge the CSS for the two expanders (text-expander-element and tribute.js) into one file - Fix overflow issues - Remove min-width - Various other tweaks like borders, colors, padding, gaps. text-expander: <img width="645" alt="Screenshot 2025-05-09 at 02 21 24" src="https://github.com/user-attachments/assets/33276dc4-38e8-45e1-8216-2a4baa9bc039" /> tribute: <img width="624" alt="Screenshot 2025-05-09 at 02 21 37" src="https://github.com/user-attachments/assets/91fbcd1a-9bfc-40fd-93f0-a05b4bd4c98d" /> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* feat: Add sorting by exclusive labels (issue priority) (#33206)Thomas E Lackey2025-04-101-0/+10
| | | | | | | | | | | | | Fix #2616 This PR adds a new sort option for exclusive labels. For exclusive labels, a new property is exposed called "order", while in the UI options are populated automatically in the `Sort` column (see screenshot below) for each exclusive label scope. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix dynamic content loading init problem (#33748)wxiaoguang2025-03-011-27/+21
| | | | | | | | | | | | | | | | 1. Rewrite `dirauto.ts` to `observer.ts`. * We have been using MutationObserver for long time, it's proven that it is quite performant. * Now we extend its ability to handle more "init" works. 2. Use `observeAddedElement` to init all non-custom "dropdown". 3. Use `data-global-click` to handle click events from dynamically loaded elements. * By this new approach, the old fragile selector-based (`.comment-reaction-button`) mechanism is removed. 4. By the way, remove unused `.diff-box` selector, 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.
* Add cropping support when modifying the user/org/repo avatar (#33498)Kerwin Bryant2025-02-061-1/+8
| | | | | | | | Fixed #33321 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Update `@github/text-expander-element`, adapt type imports (#33449)silverwind2025-01-311-1/+1
| | | | Followup to https://github.com/go-gitea/gitea/pull/33435, upstream issue is fixed so the imports are clean now.
* Update `@github/text-expander-element` to 2.9.0 (#33435)silverwind2025-01-291-15/+3
| | | | | | | | | Update and use their newly exported types. Tested, works. The import path is a bit suboptimal, to be fixed once https://github.com/github/text-expander-element/pull/75 is merged and released. Co-authored-by: Giteabot <teabot@gitea.io>
* Fix issue suggestion bug (#33389)wxiaoguang2025-01-261-8/+51
| | | Fix #33388
* Enable Typescript `noImplicitAny` (#33322)silverwind2025-01-226-50/+63
| | | | | | | Enable `noImplicitAny` and fix all issues. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Make issue suggestion work for all editors (#33340)wxiaoguang2025-01-212-3/+13
| | | And do not handle special keys when the text-expander popup exists
* Enable Typescript `noImplicitThis` (#33250)silverwind2025-01-161-3/+3
| | | | | | | | | | | | - Enable https://www.typescriptlang.org/tsconfig/#noImplicitThis - Wrap Vue Template-Syntax SFCs in [`defineComponent`](https://vuejs.org/api/general#definecomponent) which makes type inference and linter work better - Move `createApp` calls outside the SFCs into separate files - Use [`PropType`](https://vuejs.org/api/utility-types#proptype-t) where appropriate - Some top-level component properties changed order as dictated by the linter - Fix all tsc and lint issues that popped up during these refactors
* Fix editor markdown not incrementing in a numbered list (#33187)Harry Vince2025-01-102-33/+273
| | | | | | | | | | | | | | | Amended the logic for newPrefix in the MarkdownEditor to resolve incorrect number ordering. Fixes #33184 Attached screenshot of fixed input similar to issue <img width="175" alt="Screenshot 2025-01-09 at 23 59 24" src="https://github.com/user-attachments/assets/dfa23cf1-f3db-4b5e-99d2-a71bbcb289a8" /> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* fix textarea newline handle (#32966)metiftikci2024-12-252-5/+20
| | | | | | | | | | | - Fix cursor position if input newline on middle of lines - ~Increment number if numbered list~ ![image](https://github.com/user-attachments/assets/bcfe2625-11a8-4ea4-9a71-b7ecfe81b2e0) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Enable Typescript `strictFunctionTypes` (#32911)silverwind2024-12-222-4/+5
| | | | | | | | 1. Enable [strictFunctionTypes](https://www.typescriptlang.org/tsconfig/#strictFunctionTypes) 2. Introduce `DOMEvent` helper type which sets `e.target`. Surely not totally correct with that `Partial` but seems to work. 3. Various type-related refactors, change objects in `eventsource.sharedworker.ts` to `Map`.
* Fix remaining typescript issues, enable `tsc` (#32840)silverwind2024-12-164-25/+27
| | | | | | | | | | | | Fixes 79 typescript errors. Discovered at least two bugs in `notifications.ts`, and I'm pretty sure this feature was at least partially broken and may still be, I don't really know how to test it. After this, only like ~10 typescript errors remain in the codebase but those are harder to solve. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix JS error when dropping a file to a editor without dropzone (#32804)wxiaoguang2024-12-121-0/+1
| | | `dropzoneEl` may not exist
* Refactor LabelEdit (#32752)wxiaoguang2024-12-081-76/+61
| | | | | | | | | | | And fix a regression: https://github.com/go-gitea/gitea/pull/30053#discussion_r1874405470 Major changes: * rewrite without jquery * remove the "delete modal", using "link-action" is good enough * merge "new modal" and "edit modal"
* Fix file editor & preview (#32706)wxiaoguang2024-12-041-1/+1
| | | | | | Fix a regression caused by jQuery removal (`renderPreviewPanelContent`) And simplify the file editor, it doesn't need to be that complex. And remove jQuery code.
* Refactor markdown editor and use it for milestone description editor (#32688)wxiaoguang2024-12-041-23/+35
| | | | | | | | | | Refactor markdown editor to clarify its "preview" behavior and remove jQuery code. Close #15045 --------- Co-authored-by: silverwind <me@silverwind.io>
* Fix JS error when reply comment on Conversation page (#32685)wxiaoguang2024-12-021-2/+2
| | | | Fix #32684, regression of #32596 (side-effect of jQuery removal: jQuery could tolerate non-existing elements) And fix another regression bug from #30453 (initCompReactionSelector double-init)
* Allow cropping an avatar before setting it (#32565)Kerwin Bryant2024-11-281-0/+40
| | | | | | | | | | | | Provide a cropping tool on the avatar editing page, allowing users to select the cropping area themselves. This way, users can decide the displayed area of the image, rather than us deciding for them. --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor some frontend problems (#32646)wxiaoguang2024-11-261-1/+3
| | | | | | | | | | | 1. correct the modal usage on "admin email list" page (then `web_src/js/features/admin/emails.ts` is removed) 2. use `addDelegatedEventListener` instead of `jQuery().on` 3. more jQuery related changes and remove jQuery from `web_src/js/features/common-button.ts` 4. improve `confirmModal` to make it support header, and remove incorrect double-escaping 5. fix more typescript related types 6. fine tune devtest pages and add more tests
* Remove jQuery import from some files (#32512)wxiaoguang2024-11-153-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many files do not directly depend on jQuery now. To clarify the usage: use `fomanticQuery` to operate Fomantic components. Then developers could focus on removing the remaining jQuery usages by searching `import $` globally. 21 files now: ``` ./components/RepoBranchTagSelector.vue:3:import $ from 'jquery'; ./features/admin/common.ts:1:import $ from 'jquery'; ./features/admin/emails.ts:1:import $ from 'jquery'; ./features/common-button.ts:1:import $ from 'jquery'; ./features/comp/ComboMarkdownEditor.ts:3:import $ from 'jquery'; (I am working on it, there will be a new PR) ./features/comp/LabelEdit.ts:1:import $ from 'jquery'; ./features/notification.ts:1:import $ from 'jquery'; ./features/org-team.ts:1:import $ from 'jquery'; ./features/repo-code.ts:1:import $ from 'jquery'; ./features/repo-common.ts:1:import $ from 'jquery'; ./features/repo-diff.ts:1:import $ from 'jquery'; ./features/repo-editor.ts:1:import $ from 'jquery'; ./features/repo-issue-content.ts:1:import $ from 'jquery'; ./features/repo-issue-list.ts:1:import $ from 'jquery'; ./features/repo-issue-sidebar.ts:1:import $ from 'jquery'; ./features/repo-issue.ts:1:import $ from 'jquery'; ./features/repo-legacy.ts:1:import $ from 'jquery'; ./features/repo-new.ts:1:import $ from 'jquery'; ./features/repo-projects.ts:1:import $ from 'jquery'; ./features/repo-settings.ts:1:import $ from 'jquery'; ./features/repo-template.ts:1:import $ from 'jquery'; ```
* Refactor render system (#32492)wxiaoguang2024-11-141-3/+0
| | | | | | | | | | | | | | | | | | | There were too many patches to the Render system, it's really difficult to make further improvements. This PR clears the legacy problems and fix TODOs. 1. Rename `RenderContext.Type` to `RenderContext.MarkupType` to clarify its usage. 2. Use `ContentMode` to replace `meta["mode"]` and `IsWiki`, to clarify the rendering behaviors. 3. Use "wiki" mode instead of "mode=gfm + wiki=true" 4. Merge `renderByType` and `renderByFile` 5. Add more comments ---- The problem of "mode=document": in many cases it is not set, so many non-comment places use comment's hard line break incorrectly
* Correctly query the primary button in a form (#32438)wxiaoguang2024-11-071-1/+7
| | | | | | | | | | | | | | | | | The "primary button" is used at many places, but sometimes they might conflict (due to button switch, hidden panel, dropdown menu, etc). Sometimes we could add a special CSS class for the buttons, but sometimes not (see the comment of QuickSubmit) This PR introduces `querySingleVisibleElem` to help to get the correct primary button (the only visible one), and prevent from querying the wrong buttons. Fix #32437 --------- Co-authored-by: silverwind <me@silverwind.io>
* Add some handy markdown editor features (#32400)wxiaoguang2024-11-044-18/+92
| | | | | | | | | There were some missing features from EasyMDE: 1. H1 - H3 style 2. Auto add task list 3. Insert a table And added some tests
* Fix suggestions for issues (#32380)wxiaoguang2024-10-301-23/+13
|
* Suggestions for issues (#32327)Anbraten2024-10-291-3/+41
| | | closes #16872
* Prevent from submitting issue/comment on uploading (#32263)박상철2024-10-233-25/+74
| | | | | | | | fix #32262 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Add `DISABLE_ORGANIZATIONS_PAGE` and `DISABLE_CODE_PAGE` settings for ↵Zettat1232024-10-221-15/+12
| | | | | | | | | | | | explore pages and fix an issue related to user search (#32288) These settings can allow users to only display the repositories explore page. Thanks to yp05327 and wxiaoguang ! --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve textarea paste (#31948)silverwind2024-09-012-8/+6
| | | | | | | | | - When pasting a URL over another URL, replace the URL instead of creating a useless `[url](url)`. This is the 1-line change [here](https://github.com/go-gitea/gitea/pull/31948/files#diff-be8e94d7e3da33b187381f53d28095107bd0cf29ae9a9e997e4f422f4a54479cR122). - Always run `initTextareaEvents`, previously it was not run when `dropzoneEl` was not present like when attachements are disabled on the server. Refactored the function to gracefully handle absent `dropzoneEl` and rename the function to a better name.
* Convert frontend code to typescript (#31559)silverwind2024-07-0712-25/+25
| | | | | | | | | | | None of the frontend js/ts files was touched besides these two commands (edit: no longer true, I touched one file in https://github.com/go-gitea/gitea/pull/31559/commits/61105d0618e285d97e95044bfb64415f364a4526 because of a deprecation that was not showing before the rename). `tsc` currently reports 778 errors, so I have disabled it in CI as planned. Everything appears to work fine.
* Fix JS error with disabled attachment and easymde (#31511)silverwind2024-06-281-1/+3
| | | | | | Not sure if this is a regression from https://github.com/go-gitea/gitea/pull/30513, but when attachments are disabled, `this.dropzone` is null and the code had failed in `initEasyMDEPaste` trying to access `dropzoneEl.dropzone`.
* Improve attachment upload methods (#30513)Tyrone Yeh2024-06-274-62/+94
| | | | | | | | | | | | * Use dropzone to handle file uploading for all cases, including pasting and dragging * Merge duplicate code, use consistent behavior for link generating Close #20130 --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor dropzone (#31482)wxiaoguang2024-06-271-2/+20
| | | Refactor the legacy code and remove some jQuery calls.
* Switch to "Write" tab when edit comment again (#31445)wxiaoguang2024-06-221-12/+16
| | | Fix #19031
* Improve markdown textarea for indentation and lists (#31406)wxiaoguang2024-06-213-18/+121
| | | | | | Almost works like GitHub * use Tab/Shift-Tab to indent/unindent the selected lines * use Enter to insert a new line with the same indentation and prefix
* Use `querySelector` over alternative DOM methods (#31280)silverwind2024-06-102-4/+4
| | | | | | | | | | | | | | | | As per https://github.com/go-gitea/gitea/pull/30115#discussion_r1626060164, prefer `querySelector` by enabling [`unicorn/prefer-query-selector`](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-query-selector.md) and autofixing all except 10 issues. According to [this](https://old.reddit.com/r/learnjavascript/comments/i0f5o8/performance_of_getelementbyid_vs_queryselector/), querySelector may be faster as well, so it's a win-win. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Fix and clean up `ConfirmModal` (#31283)silverwind2024-06-071-12/+13
| | | | | | | | | | | | | | | | Bug: orange button color was removed in https://github.com/go-gitea/gitea/pull/30475, replaced with red Bug: translation text was not html-escaped Refactor: Replaced as much jQuery as possible, added useful `createElementFromHTML` Refactor: Remove colors checks that don't exist on `.link-action` <img width="381" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/5900bf6a-8a86-4a86-b368-0559cbfea66e"> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* Make pasted "img" tag has the same behavior as markdown image (#31235)wxiaoguang2024-06-041-1/+5
| | | | | | | Fix #31230 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix issue/PR title edit (#30858)wxiaoguang2024-05-051-6/+7
| | | | | 1. "enter" doesn't work (I think it is the last enter support for #14843) 2. if a branch name contains something like `&`, then the branch selector doesn't update
* Make Ctrl+Enter work for issue/comment edit (#30720)v1.22.0-rc1wxiaoguang2024-04-271-1/+6
| | | Fix #30710