Commit Graph

38 Commits

Author SHA1 Message Date
zeripath 13b8c0b7ae
Switch from SimpleMDE to EasyMDE (#13333)
* Switch from SimpleMDE to EasyMDE

Signed-off-by: Andrew Thornton <art27@cantab.net>

* use webpack to webpack the easymde css

Signed-off-by: Andrew Thornton <art27@cantab.net>

* move css to only css

Signed-off-by: Andrew Thornton <art27@cantab.net>

* move loading codemirror modes and addons back in to footer.tmpl

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix arc-green

Signed-off-by: Andrew Thornton <art27@cantab.net>

* as per @silverwind

* reinstall codemirror

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-11-10 14:16:30 -05:00
silverwind 2fd78c151e
Move jquery-minicolors to npm/webpack (#12305)
* Move jquery-minicolors to npm/webpack

- Unvendor and add as npm dependency
- Removed unneeded backend variable
- Fixed existing bug where picker would previously initizalize to the
  same green color when editing a label.

There was probably a version bump because the previous version was
over 3 years old but it seems to be compatible.

* use file-loader

* trailing comma and comment update

* misc tweaks

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-07-29 14:44:23 -04:00
silverwind b02d2c3772
Move tributejs to npm/webpack (#11497)
* Move tributejs to npm/webpack

- Move vendored bundle to npm and webpack
- Rewrote initialization to single function
- Restyled it (made it a bit smaller)
- Fixed it for arc-green

* fix mention

* also include emoji on #content

* Update web_src/less/_tribute.less

Co-authored-by: mrsdizzie <info@mrsdizzie.com>

* rewrite to only use one instance of Tribute

* refactor

* fix copy/paste error

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-05-20 22:00:43 -04:00
mrsdizzie 4563eb873d
Support unicode emojis and remove emojify.js (#11032)
* Support unicode emojis and remove emojify.js

This PR replaces all use of emojify.js and adds unicode emoji support to various areas of gitea.

This works in a few ways:

First it adds emoji parsing support into gitea itself. This allows us to

 * Render emojis from valid alias (😄)
 * Detect unicode emojis and let us put them in their own class with proper aria-labels and styling
 * Easily allow for custom "emoji"
 * Support all emoji rendering and features without javascript
 * Uses plain unicode and lets the system render in appropriate emoji font
 * Doesn't leave us relying on external sources for updates/fixes/features

That same list of emoji is also used to create a json file which replaces the part of emojify.js that populates the emoji search tribute. This file is about 35KB with GZIP turned on and I've set it to load after the page renders to not hinder page load time (and this removes loading emojify.js also)

For custom "emoji" it uses a pretty simple scheme of just looking for /emojis/img/name.png where name is something a user has put in the "allowed reactions" setting we already have. The gitea reaction that was previously hard coded into a forked copy of emojify.js is included and works as a custom reaction under this method.

The emoji data sourced here is from https://github.com/github/gemoji which is the gem library Github uses for their emoji rendering (and a data source for other sites). So we should be able to easily render any emoji and :alias: that Github can, removing any errors from migrated content. They also update it as well, so we can sync when there are new unicode emoji lists released.

I've included a slimmed down and slightly modified forked copy of https://github.com/knq/emoji to make up our own emoji module. The code is pretty straight forward and again allows us to have a lot of flexibility in what happens.

I had seen a few comments about performance in some of the other threads if we render this ourselves, but there doesn't seem to be any issue here. In a test it can parse, convert, and render 1,000 emojis inside of a large markdown table in about 100ms on my laptop (which is many more emojis than will ever be in any normal issue). This also prevents any flickering and other weirdness from using javascript to render some things while using go for others.

Not included here are image fall back URLS. I don't really think they are necessary for anything new being written in 2020. However, managing the emoji ourselves would allow us to add these as a feature later on if it seems necessary.

Fixes: https://github.com/go-gitea/gitea/issues/9182
Fixes: https://github.com/go-gitea/gitea/issues/8974
Fixes: https://github.com/go-gitea/gitea/issues/8953
Fixes: https://github.com/go-gitea/gitea/issues/6628
Fixes: https://github.com/go-gitea/gitea/issues/5130

* add new shared function emojiHTML

* don't increase emoji size in issue title

* Update templates/repo/issue/view_content/add_reaction.tmpl

Co-Authored-By: 6543 <6543@obermui.de>

* Support for emoji rendering in various templates

* Render code and review comments as they should be

* Better way to handle mail subjects

* insert unicode from tribute selection

* Add template helper for plain text when needed

* Use existing replace function I forgot about

* Don't include emoji greater than Unicode Version 12

Only include emoji and aliases in JSON

* Update build/generate-emoji.go

* Tweak regex slightly to really match everything including random invisible characters. Run tests for every emoji we have

* final updates

* code review

* code review

* hard code gitea custom emoji to match previous behavior

* Update .eslintrc

Co-Authored-By: silverwind <me@silverwind.io>

* disable preempt

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-28 15:05:39 -03:00
silverwind 85fb33a65f
move jquery-datetimepicker to npm/webpack (#10713)
- update to latest version and move to npm
- adapt for api changes and css class rename
- add specificity to arc-green rules as dependency css now loads later
- use imports-loader to make it load correctly
- fix some wrong paths in librejs

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-03-17 15:08:15 -04:00
silverwind 9d3e69e867
Move dropzone.js to npm/webpack (#10645)
- unvendor dropzone and upgrade it from 4.2.0 to 5.7.0
- make `csrf` available on window.config
2020-03-07 21:06:15 +00:00
silverwind 062f35109d
move vue and vue-calendar-heatmap to webpack (#10188)
- unvendor vue and vue-calendar-heatmap
- remove unused moment.js leftover from previous heatmap version
- ensure webpack loads the full version of vue
- fix vue devmode warning related to 'searchLimit' type

I wanted to name the chunk heatmap.js but adblockers don't like that
filename [1].

[1] 3899d5dff3/easyprivacy/easyprivacy_general.txt (L2095)
2020-02-23 21:34:28 +00:00
silverwind 4721d45c2a
move clipboard.js to npm/webpack (#10183)
- created lazy-loaded webpack chunk for clipboard.js
- upgraded clipboard.js from 1.5.9 to 2.0.4
- parallelize initialization of all lazy-loaded features

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-02-08 00:03:42 +01:00
silverwind 35ada598cc
move jquery.are-you-sure to npm/webpack (#10063) 2020-01-29 21:16:55 +00:00
silverwind b9690d7c0b move highlight.js to npm/webpack (#10011)
- introduced window.config to help with js-based lazy-loading
- adjusted webpack chunk naming to avoid 'vendors~name.js' that webpack
  defaults to for vendor chunks.
- added theme class to html and prefixed all selectors. this is
  neccesary so that the theme styles win over the lazy-loaded ones.

Co-authored-by: zeripath <art27@cantab.net>
2020-01-28 23:57:20 +02:00
silverwind 75a124b449 remove loadCSS and preload woff2 icon fonts (#9976)
loadCSS was used as a polyfill for rel=preload but it seems we only used
it on a single CSS file which did not help much. Changed the icon CSS to
a blocking load and preload the woff2 variants which does work in modern
browsers (Firefox currently needs the network.preload about:config
setting but should gain proper support soon).

Co-authored-by: zeripath <art27@cantab.net>
2020-01-25 20:58:26 +02:00
silverwind 2982afe6b4 move jquery and jquery-migrate to npm/webpack (#9813)
Currently, this needs to be its own chunk because fomantic depends
on jQuery being present. The next step is to move fomantic to webpack
too after which we can combine the index,fomantic and jquery files into
one.

jquery-migrate is still neccessary because our ancient version of Dropzone
seems to break without it. I imagine it can be removed after a Dropzone
upgrade.
2020-01-21 19:32:33 +02:00
Lunny Xiao 5cf241b312
Use npm to manage fomantic and only build needed components (#9561)
* Use npm to manage fomantic

* Only build needed semantic components

* Fix make

* Don't import fonts from google sites since we have loaded

* [misc] devendor fomantic-ui and rebuild upon src or config changes only

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* Change sort alphabetically of semantic components

* Fix trailing slash

* fix makefile

* Remove dependency to gulp from package.json

* Fix something

* Simplife the makefile

* add missed fomantic compnent

Co-authored-by: Jakob Ackermann <das7pad@outlook.com>
2020-01-21 13:17:58 +08:00
silverwind cc2916dc5a remove promise-polyfill (#9812)
promises are polyfilled by babel, it's no longer needed.
2020-01-16 22:52:07 +00:00
techknowlogick 8f31c2fc76
remove google font call (#9668) 2020-01-09 15:48:47 -05:00
techknowlogick 590d56dbb3
switch to fomantic-ui (#9374) 2019-12-17 16:34:11 -05:00
silverwind f8bd90ba60 enable lazy-loading of gitgraph.js (#9036)
- moved gitgraph.js to web_src and made it importable and es6-compatible
- created new webpack chunk for gitgraph
- enabled CSS loader in webpack
- enabled async/await syntax via regenerator-runtime
- added script to ensure webpack chunks are loaded correctly
- disable terser's comment extraction to prevent .LICENCE files

gitgraph.js has many issues:

1. it is incompatible with ES6 because of strict-mode violations
1. it does not export anything
1. it's css has weird styles like for `body`
1. it is not available on npm

I fixed points 1-3 in our version so it's now loadable in webpack. We should eventually consider alternatives.
2019-11-17 23:39:06 +02:00
6543 a3e42bfebd [Feature] Add Gitea Emoji (#8950)
* add gitea emoji

* alphabetic order

* Update emojify.js to 1.1.0

* mv to custom

* add gitea emoji

* minify
2019-11-14 14:44:46 +01:00
oscar.lofwenhamn 1e9b330525 Update CodeMirror to version 5.49.0 (#8381)
* Update CodeMirror to version 5.49.0

* Update CodeMirror versions in librejs and VERSIONS
2019-10-15 11:40:42 +03:00
Antoine GIRARD 26a78fa6b3 vendor: update pdf.js to v2.1.266 (#7834) 2019-08-13 20:09:06 +03:00
techknowlogick efaee46b4d jQuery 3 (#7425)
* jquery 3

* use most recent version of migrate plugin

* Delete .DS_Store

* update service worker in case anyone has old version of jquery cached
2019-07-12 08:21:44 +03:00
silverwind 867ad49091 update highlight.js (#6658) 2019-04-16 19:05:40 -04:00
silverwind 8e266c3193 UI: Fix race in update issue labels and assignees (#6194)
Fix #6191 

* fix issue update race condition
* fix similar race same race when clearing assignee
* always load promise polyfill
* replace es6-promise with promise-polyfill
* move promise-polyfill to <head>
2019-02-28 22:10:08 +00:00
Lauris BH fc14344acb
Fix heatmap and repository menu display in Internet Explorer 9+ (#6117) 2019-02-19 21:26:27 +02:00
Lauris BH e09fe48773 Refactor heatmap to vue component (#5401) 2018-11-27 10:36:54 +01:00
kolaente 6759237eda User action heatmap (#5131)
* Added basic heatmap data

* Added extra case for sqlite

* Built basic heatmap into user profile

* Get contribution data from api & styling

* Fixed lint & added extra group by statements for all database types

* generated swagger spec

* generated swagger spec

* generated swagger spec

* fixed swagger spec

* fmt

* Added tests

* Added setting to enable/disable user heatmap

* Added locale for loading text

* Removed UseTiDB

* Updated librejs & moment.js

* Fixed import order

* Fixed heatmap in postgresql

* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

Co-Authored-By: kolaente <konrad@kola-entertainments.de>

* Added copyright header

* Fixed a bug to show the heatmap for the actual user instead of the currently logged in

* Added integration test for heatmaps

* Added a heatmap on the dashboard

* Fixed timestamp parsing

* Hide heatmap on mobile

* optimized postgresql group by query

* Improved sqlite group by statement
2018-10-23 10:57:42 +08:00
techknowlogick 13e8a0fe56
offline use of fonts (#4872) 2018-09-06 21:15:25 -04:00
techknowlogick 895e538836
Update jQuery to v1.12.4 (#4551)
Fix #4384
2018-07-30 02:04:24 -04:00
Alexey Terentyev ca474af3c6 Added front-end topics validation (#4316) 2018-07-14 20:43:32 -04:00
Alexey Terentyev 7893e5939a Update gitgraph.js to fix "Cannot read property color of undefined" (#4095)
Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
2018-06-02 18:54:40 +03:00
Jonas Franz 951309f76a Add support for FIDO U2F (#3971)
* Add support for U2F

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add vendor library
Add missing translations

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Minor improvements

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add U2F support for Firefox, Chrome (Android) by introducing a custom JS library
Add U2F error handling

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add U2F login page to OAuth

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Move U2F user settings to a separate file

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add unit tests for u2f model
Renamed u2f table name

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Fix problems caused by refactoring

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add U2F documentation

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Remove not needed console.log-s

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add default values to app.ini.sample
Add FIDO U2F to comparison

Signed-off-by: Jonas Franz <info@jonasfranz.software>
2018-05-19 17:12:37 +03:00
Morgan Bazalgette 535445c32e Rework special link parsing in the post-processing of markup (#3354)
* Get rid of autolink

* autolink in markdown

* Replace email addresses with mailto links

* better handling of links

* Remove autolink.js from footer

* Refactor entire html.go

* fix some bugs

* Make tests green, move what we can to html_internal_test, various other changes to processor logic

* Make markdown tests work again

This is just a description to allow me to force push in order to restart
the drone build.

* Fix failing markdown tests in routers/api/v1/misc

* Add license headers, log errors, future-proof <body>

* fix formatting
2018-02-27 09:09:18 +02:00
modmew8 e08b3a592e Emoji Autocomplete (#3433)
* Implemented emoji autocomplete.

* Changed emoji access url.

* Reverted vendor css to default, moved all style changes to _tribute.less

* Made no-results overwriteable, added missing autocomplete to edit issue field.

Signed-off-by: modmew8 <modmew8@gmail.com>
2018-02-03 10:09:35 +02:00
harry 03ec35ed79 Mention completion for issue editor. (#3136)
* new issue mention

* Mention completion on new issue and view issue page.

* Code format.

* Require tribute in pull request page.
2017-12-11 14:03:04 +08:00
Michael Kuhn 42d781a709 Update gitgraph.js to fix blurry commit graph on HiDPI screens (#2957) 2017-11-23 00:08:26 +08:00
Lunny Xiao caa61a2b99
bug fixed 2017-09-04 14:22:07 +08:00
Michael Lustfield 874f9be3e6 Move themes to plugin directory. Fixes #2372 (#2375) 2017-08-24 08:52:42 +03:00
Michael Lustfield a915a09e4f Moved vendored js/css into `public/vendor` and documented sources (#1484) (#2241)
* Cleaning up public/ and documenting js/css libs.

This commit mostly addresses #1484 by moving vendor'ed plugins into a
vendor/ directory and documenting their upstream source and license in
vendor/librejs.html.

This also proves gitea is using only open source js/css libraries which
helps toward reaching #1524.

* Removing unused css file.

The version of this file in use is located at:
  vendor/plugins/highlight/github.css

* Cleaned up librejs.html and added javascript header

A SafeJS function was added to templates/helper.go to allow keeping
comments inside of javascript.

A javascript comment was added in the header of templates/base/head.tmpl
to mark all non-inline source as free.

The librejs.html file was updated to meet the current librejs spec. I
have now verified that the librejs plugin detects most of the scripts
included in gitea and suspect the non-free detections are the result of
a bug in the plugin. I believe this commit is enough to meet the C0.0
requirement of #1534.

* Updating SafeJS function per lint suggestion

* Added VERSIONS file, per request
2017-08-23 16:58:05 +02:00