Commit Graph

12 Commits (3fef47b41c98392865d13fd21bbcec34236daf4f)

Author SHA1 Message Date
silverwind c2fb27beb4
Improvements for Content Copy ()
It now supports copying Markdown, SVG and Images (not in Firefox
currently because of lacking
[`ClipboardItem`](https://developer.mozilla.org/en-US/docs/Web/API/ClipboardItem)
support, but can be enabled in `about:config` and works). It will fetch
the data if in a rendered view or when it's an image.

Followup to https://github.com/go-gitea/gitea/pull/21629.
silverwind 9db221780f
Ignore line anchor links with leading zeroes ()
Fixes: https://github.com/go-gitea/gitea/issues/21722

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Yarden Shoham e3a7f15791
Add "Copy" button to file view of raw text ()
If a raw text file is displayed, a copy button of the text is enabled.

* Closes 

### Before

![image](https://user-images.githubusercontent.com/20454870/198898628-df1bcb0c-79d7-4ffb-95e4-441d77430827.png)

### After

![image](https://user-images.githubusercontent.com/20454870/199988152-ea1099ad-29e1-4765-a9ca-4c03c1737453.png)

#### Rendered files and binaries have their button disabled

![image](https://user-images.githubusercontent.com/20454870/199988408-73de6327-5e9e-462b-b2b6-8c3f5b878386.png)

![image](https://user-images.githubusercontent.com/20454870/199988563-844f8656-f48d-4929-880e-b6558c1c054a.png)

Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
silverwind 1b2cd4c4e1
Replace fomantic popup module with tippy.js ()
- replace fomantic popup module with tippy.js
- fix chaining and add comment
- add 100ms delay to tooltips
- stopwatch improvments, raise default maxWidth
- update web_src/js/features/common-global.js
- use type=submit instead of js
delvh 5ca224a789
Allow to mark files in a PR as viewed ()
Users can now mark files in PRs as viewed, resulting in them not being shown again by default when they reopen the PR again.
Lunny Xiao 03eba32bd9
Add a new menu in file view to open blame view and fix blame view select range bug ()
CommanderRoot 1ab88da0e4
Replace deprecated String.prototype.substr() with String.prototype.slice() ()
String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with the slice() method which works similarily but isn't deprecated.

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Jimmy Praet 9444135ff5
Fix source code line highlighting ()
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
silverwind 19b017f398
Use explicit jQuery import, remove unused eslint globals ()
- Don't rely on globals (window.$) for jQuery import
- Remove eslint globals no longer in use
silverwind a159c3175f
Add new JS linter rules ()
* Add new JS linter rules

Adds a few useful rules from eslint-plugin-github. Notable changes:

- Forbid dataset usage, its camel-casing behaviour makes it hard to
  grep for attributes.
- Forbid .then() and .catch(), we should generally prefer await for new
  code. For rare cases where they are useful, a eslint-disable-line
  directive can be set.
- Add docs js to linting

* also enable github/array-foreach

* small tweak

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
wxiaoguang 89beceeb9a
Fix a UI error when folding a file content in a commit view ()
wxiaoguang 1a7473ff45
Split `index.js` to separate files ()
* split `index.js` to separate files

* tune clipboard

* fix promise

* fix document

* remove intermediate empty file

* fix async event listener

* use `export function` instead of `export {}`, add more comments

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>