Skip to content
Snippets Groups Projects
Commit af28cb8a authored by Jacques Erasmus's avatar Jacques Erasmus
Browse files

Merge branch 'master' into 51306-fix-inaccessible-dropdown-for-codeless-projects

parents 16cd5967 28d412e5
No related branches found
No related tags found
No related merge requests found
Showing
with 265 additions and 489 deletions
env:
browser: true
es6: true
extends:
- airbnb-base
- prettier
- plugin:vue/recommended
- '@gitlab'
globals:
__webpack_public_path__: true
gl: false
gon: false
localStorage: false
parserOptions:
parser: babel-eslint
plugins:
- filenames
- import
- html
- promise
settings:
html/html-extensions:
- '.html'
Loading
Loading
@@ -25,38 +16,12 @@ settings:
webpack:
config: './config/webpack.config.js'
rules:
filenames/match-regex:
- error
- '^[a-z0-9_]+$'
import/no-commonjs: error
promise/catch-or-return: error
no-param-reassign:
- error
- props: true
ignorePropertyModificationsFor:
- 'acc' # for reduce accumulators
- 'accumulator' # for reduce accumulators
- 'el' # for DOM elements
- 'element' # for DOM elements
- 'state' # for Vuex mutations
no-underscore-dangle:
- error
- allow:
- __
- _links
no-mixed-operators: off
vue/html-self-closing:
- error
- html:
void: always
normal: never
component: always
svg: always
math: always
camelcase:
- error
- properties: never
ignoreDestructuring: true
# Disabled for now, to make the airbnb-base 12.1.0 -> 13.1.0 update smoother
no-else-return:
- error
Loading
Loading
Loading
Loading
@@ -2,6 +2,14 @@
documentation](doc/development/changelog.md) for instructions on adding your own
entry.
 
## 11.3.5 (2018-10-15)
### Fixed (2 changes)
- Fix loading issue on some merge request discussion. !21982
- Fix project deletion when there is a export available. !22276
## 11.3.3 (2018-10-04)
 
- No changes.
Loading
Loading
Loading
Loading
@@ -64,228 +64,56 @@ As of July 2018, all the documentation for contributing to the GitLab project ha
 
## Contribute to GitLab
 
Thank you for your interest in contributing to GitLab. This guide details how
to contribute to GitLab in a way that is easy for everyone.
For a first-time step-by-step guide to the contribution process, please see
["Contributing to GitLab"](https://about.gitlab.com/contributing/).
Looking for something to work on? Look for issues in the [Backlog (Accepting merge requests) milestone](#i-want-to-contribute).
GitLab comes in two flavors, GitLab Community Edition (CE) our free and open
source edition, and GitLab Enterprise Edition (EE) which is our commercial
edition. Throughout this guide you will see references to CE and EE for
abbreviation.
To get an overview of GitLab community membership including those that would be reviewing or merging your contributions, please visit [the community roles page](doc/development/contributing/community_roles.md).
If you want to know how the GitLab [core team]
operates please see [the GitLab contributing process](PROCESS.md).
[GitLab Inc engineers should refer to the engineering workflow document](https://about.gitlab.com/handbook/engineering/workflow/)
This [documentation](doc/development/contributing/index.md#contribute-to-gitlab) has been moved.
 
## Security vulnerability disclosure
 
Please report suspected security vulnerabilities in private to
`support@gitlab.com`, also see the
[disclosure section on the GitLab.com website](https://about.gitlab.com/disclosure/).
Please do **NOT** create publicly viewable issues for suspected security
vulnerabilities.
This [documentation](doc/development/contributing/index.md#security-vulnerability-disclosure) has been moved.
 
## Code of Conduct
 
### Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
### Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
### Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
### Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
### Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at conduct@gitlab.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
### Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
This [documentation](doc/development/contributing/index.md#code-of-conduct) has been moved.
 
## Closing policy for issues and merge requests
 
GitLab is a popular open source project and the capacity to deal with issues
and merge requests is limited. Out of respect for our volunteers, issues and
merge requests not in line with the guidelines listed in this document may be
closed without notice.
Please treat our volunteers with courtesy and respect, it will go a long way
towards getting your issue resolved.
Issues and merge requests should be in English and contain appropriate language
for audiences of all ages.
If a contributor is no longer actively working on a submitted merge request
we can decide that the merge request will be finished by one of our
[Merge request coaches][team] or close the merge request. We make this decision
based on how important the change is for our product vision. If a Merge request
coach is going to finish the merge request we assign the
~"coach will finish" label.
This [documentation](doc/development/contributing/index.md#closing-policy-for-issues-and-merge-requests) has been moved.
 
## Helping others
 
Please help other GitLab users when you can.
The methods people will use to seek help can be found on the [getting help page][getting-help].
Sign up for the mailing list, answer GitLab questions on StackOverflow or
respond in the IRC channel. You can also sign up on [CodeTriage][codetriage] to help with
the remaining issues on the GitHub issue tracker.
This [documentation](doc/development/contributing/index.md#helping-others) has been moved.
 
## I want to contribute!
 
If you want to contribute to GitLab, [issues in the Backlog (Accepting merge requests)](https://gitlab.com/gitlab-org/gitlab-ce/issues?scope=all&utf8=✓&state=opened&assignee_id=0&milestone_title=Backlog%20(Accepting%20merge%20requests))
are a great place to start. Issues with a lower weight (1 or 2) are deemed
suitable for beginners. These issues will be of reasonable size and challenge,
for anyone to start contributing to GitLab. If you have any questions or need help visit [Getting Help](https://about.gitlab.com/getting-help/#discussion) to
learn how to communicate with GitLab. If you're looking for a Gitter or Slack channel
please consider we favor
[asynchronous communication](https://about.gitlab.com/handbook/communication/#internal-communication) over real time communication. Thanks for your contribution!
This [documentation](doc/development/contributing/index.md#i-want-to-contribute) has been moved.
 
## Contribution Flow
 
When contributing to GitLab, your merge request is subject to review by merge request maintainers of a particular specialty.
When you submit code to GitLab, we really want it to get merged, but there will be times when it will not be merged.
When maintainers are reading through a merge request they may request guidance from other maintainers. If merge request maintainers conclude that the code should not be merged, our reasons will be fully disclosed. If it has been decided that the code quality is not up to GitLab’s standards, the merge request maintainer will refer the author to our docs and code style guides, and provide some guidance.
Sometimes style guides will be followed but the code will lack structural integrity, or the maintainer will have reservations about the code’s overall quality. When there is a reservation the maintainer will inform the author and provide some guidance. The author may then choose to update the merge request. Once the merge request has been updated and reassigned to the maintainer, they will review the code again. Once the code has been resubmitted any number of times, the maintainer may choose to close the merge request with a summary of why it will not be merged, as well as some guidance. If the merge request is closed the maintainer will be open to discussion as to how to improve the code so it can be approved in the future.
GitLab will do its best to review community contributions as quickly as possible. Specially appointed developers review community contributions daily. You may take a look at the [team page](https://about.gitlab.com/team/) for the merge request coach who specializes in the type of code you have written and mention them in the merge request. For example, if you have written some JavaScript in your code then you should mention the frontend merge request coach. If your code has multiple disciplines you may mention multiple merge request coaches.
GitLab receives a lot of community contributions, so if your code has not been reviewed within 4 days of its initial submission feel free to re-mention the appropriate merge request coach.
When submitting code to GitLab, you may feel that your contribution requires the aid of an external library. If your code includes an external library please provide a link to the library, as well as reasons for including it.
When your code contains more than 500 changes, any major breaking changes, or an external library, `@mention` a maintainer in the merge request. If you are not sure who to mention, the reviewer will add one early in the merge request process.
[core team]: https://about.gitlab.com/core-team/
[team]: https://about.gitlab.com/team/
[getting-help]: https://about.gitlab.com/getting-help/
[codetriage]: http://www.codetriage.com/gitlabhq/gitlabhq
[accepting-mrs-weight]: https://gitlab.com/gitlab-org/gitlab-ce/issues?assignee_id=0&label_name[]=Accepting%20Merge%20Requests&sort=weight_asc
[ce-tracker]: https://gitlab.com/gitlab-org/gitlab-ce/issues
[ee-tracker]: https://gitlab.com/gitlab-org/gitlab-ee/issues
[google-group]: https://groups.google.com/forum/#!forum/gitlabhq
[stackoverflow]: https://stackoverflow.com/questions/tagged/gitlab
[fpl]: https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name=feature+proposal
[accepting-mrs-ce]: https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name=Accepting+Merge+Requests
[accepting-mrs-ee]: https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name=Accepting+Merge+Requests
[gitlab-mr-tracker]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests
[gdk]: https://gitlab.com/gitlab-org/gitlab-development-kit
[git-squash]: https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits
[closed-merge-requests]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests?assignee_id=&label_name=&milestone_id=&scope=&sort=&state=closed
[definition-of-done]: http://guide.agilealliance.org/guide/definition-of-done.html
[contributor-covenant]: http://contributor-covenant.org
[rss-source]: https://github.com/bbatsov/ruby-style-guide/blob/master/README.md#source-code-layout
[rss-naming]: https://github.com/bbatsov/ruby-style-guide/blob/master/README.md#naming
[changelog]: doc/development/changelog.md "Generate a changelog entry"
[doc-guidelines]: doc/development/documentation/index.md "Documentation guidelines"
[js-styleguide]: doc/development/fe_guide/style_guide_js.md "JavaScript styleguide"
[scss-styleguide]: doc/development/fe_guide/style_guide_scss.md "SCSS styleguide"
[newlines-styleguide]: doc/development/newlines_styleguide.md "Newlines styleguide"
[UX Guide for GitLab]: http://docs.gitlab.com/ce/development/ux_guide/
[license-finder-doc]: doc/development/licensing.md
[GitLab Inc engineering workflow]: https://about.gitlab.com/handbook/engineering/workflow/#labelling-issues
[polling-etag]: https://docs.gitlab.com/ce/development/polling.html
[testing]: doc/development/testing_guide/index.md
[us-english]: https://en.wikipedia.org/wiki/American_English
This [documentation](doc/development/contributing/index.md) has been moved.
 
## Workflow labels
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Type labels
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Subject labels
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Team labels
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Release Scoping labels
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Priority labels
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Severity labels
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
Loading
Loading
@@ -294,17 +122,14 @@ This [documentation](doc/development/contributing/issue_workflow.md) has been mo
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Label for community contributors
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
## Implement design & UI elements
 
This [documentation](doc/development/contributing/design.md) has been moved.
 
## Issue tracker
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
Loading
Loading
@@ -313,7 +138,6 @@ This [documentation](doc/development/contributing/issue_workflow.md) has been mo
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Feature proposals
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
Loading
Loading
@@ -322,32 +146,26 @@ This [documentation](doc/development/contributing/issue_workflow.md) has been mo
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Issue weight
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Regression issues
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Technical and UX debt
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
### Stewardship
 
This [documentation](doc/development/contributing/issue_workflow.md) has been moved.
 
## Merge requests
 
This [documentation](doc/development/contributing/merge_request_workflow.md) has been moved.
 
### Merge request guidelines
 
This [documentation](doc/development/contributing/merge_request_workflow.md) has been moved.
Loading
Loading
@@ -357,12 +175,10 @@ This [documentation](doc/development/contributing/merge_request_workflow.md) has
 
This [documentation](doc/development/contributing/merge_request_workflow.md) has been moved.
 
## Definition of done
 
This [documentation](doc/development/contributing/merge_request_workflow.md) has been moved.
 
## Style guides
 
This [documentation](doc/development/contributing/design.md) has been moved.
0.125.0
0.125.1
Loading
Loading
@@ -83,9 +83,6 @@ gem 'net-ldap'
# Only used to compute wiki page slugs
gem 'gitlab-gollum-lib', '~> 4.2', require: false
 
# Language detection
gem 'github-linguist', '~> 5.3.3', require: 'linguist'
# API
gem 'grape', '~> 1.1'
gem 'grape-entity', '~> 0.7.1'
Loading
Loading
@@ -146,6 +143,7 @@ gem 'rouge', '~> 3.1'
gem 'truncato', '~> 0.7.9'
gem 'bootstrap_form', '~> 2.7.0'
gem 'nokogiri', '~> 1.8.2'
gem 'escape_utils', '~> 1.1'
 
# Calendar rendering
gem 'icalendar'
Loading
Loading
@@ -421,7 +419,7 @@ end
 
# Gitaly GRPC client
gem 'gitaly-proto', '~> 0.118.1', require: 'gitaly'
gem 'grpc', '~> 1.11.0'
gem 'grpc', '~> 1.15.0'
 
# Locked until https://github.com/google/protobuf/issues/4210 is closed
gem 'google-protobuf', '= 3.5.1'
Loading
Loading
Loading
Loading
@@ -277,11 +277,6 @@ GEM
gitaly-proto (0.118.1)
google-protobuf (~> 3.1)
grpc (~> 1.10)
github-linguist (5.3.3)
charlock_holmes (~> 0.7.5)
escape_utils (~> 1.1.0)
mime-types (>= 1.19)
rugged (>= 0.25.1)
github-markup (1.7.0)
gitlab-flowdock-git-hook (1.0.1)
flowdock (~> 0.7)
Loading
Loading
@@ -328,15 +323,14 @@ GEM
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
google-protobuf (3.5.1)
googleapis-common-protos-types (1.0.1)
googleapis-common-protos-types (1.0.2)
google-protobuf (~> 3.0)
googleauth (0.6.2)
googleauth (0.6.6)
faraday (~> 0.12)
jwt (>= 1.4, < 3.0)
logging (~> 2.0)
memoist (~> 0.12)
multi_json (~> 1.11)
os (~> 0.9)
os (>= 0.9, < 2.0)
signet (~> 0.7)
gpgme (2.0.13)
mini_portile2 (~> 2.1)
Loading
Loading
@@ -360,10 +354,9 @@ GEM
railties
sprockets-rails
graphql (1.8.1)
grpc (1.11.0)
grpc (1.15.0)
google-protobuf (~> 3.1)
googleapis-common-protos-types (~> 1.0.0)
googleauth (>= 0.5.1, < 0.7)
haml (5.0.4)
temple (>= 0.8.0)
tilt
Loading
Loading
@@ -465,11 +458,7 @@ GEM
xml-simple
licensee (8.9.2)
rugged (~> 0.24)
little-plugger (1.1.4)
locale (2.1.2)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
lograge (0.10.0)
actionpack (>= 4)
activesupport (>= 4)
Loading
Loading
@@ -575,7 +564,7 @@ GEM
org-ruby (0.9.12)
rubypants (~> 0.2)
orm_adapter (0.5.0)
os (0.9.6)
os (1.0.0)
parallel (1.12.1)
parser (2.5.1.0)
ast (~> 2.4.0)
Loading
Loading
@@ -843,7 +832,7 @@ GEM
sidekiq-cron (0.6.0)
rufus-scheduler (>= 3.3.0)
sidekiq (>= 4.2.1)
signet (0.8.1)
signet (0.11.0)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5, < 3.0)
Loading
Loading
@@ -1006,6 +995,7 @@ DEPENDENCIES
ed25519 (~> 1.2)
email_reply_trimmer (~> 0.1)
email_spec (~> 2.2.0)
escape_utils (~> 1.1)
factory_bot_rails (~> 4.8.2)
faraday (~> 0.12)
fast_blank
Loading
Loading
@@ -1028,7 +1018,6 @@ DEPENDENCIES
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.3)
gitaly-proto (~> 0.118.1)
github-linguist (~> 5.3.3)
github-markup (~> 1.7.0)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-gollum-lib (~> 4.2)
Loading
Loading
@@ -1046,7 +1035,7 @@ DEPENDENCIES
grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10)
graphql (~> 1.8.0)
grpc (~> 1.11.0)
grpc (~> 1.15.0)
haml_lint (~> 0.26.0)
hamlit (~> 2.8.8)
hangouts-chat (~> 0.0.5)
Loading
Loading
@@ -1187,4 +1176,4 @@ DEPENDENCIES
wikicloth (= 0.8.1)
 
BUNDLED WITH
1.16.4
1.16.6
Loading
Loading
@@ -280,11 +280,6 @@ GEM
gitaly-proto (0.118.1)
google-protobuf (~> 3.1)
grpc (~> 1.10)
github-linguist (5.3.3)
charlock_holmes (~> 0.7.5)
escape_utils (~> 1.1.0)
mime-types (>= 1.19)
rugged (>= 0.25.1)
github-markup (1.7.0)
gitlab-flowdock-git-hook (1.0.1)
flowdock (~> 0.7)
Loading
Loading
@@ -331,15 +326,14 @@ GEM
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
google-protobuf (3.5.1)
googleapis-common-protos-types (1.0.1)
googleapis-common-protos-types (1.0.2)
google-protobuf (~> 3.0)
googleauth (0.6.2)
googleauth (0.6.6)
faraday (~> 0.12)
jwt (>= 1.4, < 3.0)
logging (~> 2.0)
memoist (~> 0.12)
multi_json (~> 1.11)
os (~> 0.9)
os (>= 0.9, < 2.0)
signet (~> 0.7)
gpgme (2.0.13)
mini_portile2 (~> 2.1)
Loading
Loading
@@ -363,10 +357,9 @@ GEM
railties
sprockets-rails
graphql (1.8.1)
grpc (1.11.0)
grpc (1.15.0)
google-protobuf (~> 3.1)
googleapis-common-protos-types (~> 1.0.0)
googleauth (>= 0.5.1, < 0.7)
haml (5.0.4)
temple (>= 0.8.0)
tilt
Loading
Loading
@@ -468,11 +461,7 @@ GEM
xml-simple
licensee (8.9.2)
rugged (~> 0.24)
little-plugger (1.1.4)
locale (2.1.2)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.10)
lograge (0.10.0)
actionpack (>= 4)
activesupport (>= 4)
Loading
Loading
@@ -579,7 +568,7 @@ GEM
org-ruby (0.9.12)
rubypants (~> 0.2)
orm_adapter (0.5.0)
os (0.9.6)
os (1.0.0)
parallel (1.12.1)
parser (2.5.1.0)
ast (~> 2.4.0)
Loading
Loading
@@ -851,7 +840,7 @@ GEM
sidekiq-cron (0.6.0)
rufus-scheduler (>= 3.3.0)
sidekiq (>= 4.2.1)
signet (0.8.1)
signet (0.11.0)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5, < 3.0)
Loading
Loading
@@ -1015,6 +1004,7 @@ DEPENDENCIES
ed25519 (~> 1.2)
email_reply_trimmer (~> 0.1)
email_spec (~> 2.2.0)
escape_utils (~> 1.1)
factory_bot_rails (~> 4.8.2)
faraday (~> 0.12)
fast_blank
Loading
Loading
@@ -1037,7 +1027,6 @@ DEPENDENCIES
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.3)
gitaly-proto (~> 0.118.1)
github-linguist (~> 5.3.3)
github-markup (~> 1.7.0)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-gollum-lib (~> 4.2)
Loading
Loading
@@ -1055,7 +1044,7 @@ DEPENDENCIES
grape_logging (~> 1.7)
graphiql-rails (~> 1.4.10)
graphql (~> 1.8.0)
grpc (~> 1.11.0)
grpc (~> 1.15.0)
haml_lint (~> 0.26.0)
hamlit (~> 2.8.8)
hangouts-chat (~> 0.0.5)
Loading
Loading
@@ -1196,4 +1185,4 @@ DEPENDENCIES
wikicloth (= 0.8.1)
 
BUNDLED WITH
1.16.4
1.16.6
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 14">
<g fill="#d6d7d9">
<path d="M8.7 0L5.3.3l3.2 6.8-3.2 6.6 3.5.3L12 6.9z"/>
<ellipse cx="1.7" cy="11.1" rx="1.7" ry="1.7"/>
<ellipse cx="1.7" cy="5.6" rx="1.7" ry="1.7"/>
</g>
</svg>
\ No newline at end of file
Loading
Loading
@@ -51,7 +51,7 @@ export default function initCopyToClipboard() {
* the last minute to deconstruct this JSON hash and set the `text/plain` and `text/x-gfm` copy
* data types to the intended values.
*/
$(document).on('copy', 'body > textarea[readonly]', (e) => {
$(document).on('copy', 'body > textarea[readonly]', e => {
const { clipboardData } = e.originalEvent;
if (!clipboardData) return;
 
Loading
Loading
Loading
Loading
@@ -2,7 +2,9 @@ import $ from 'jquery';
 
$(() => {
$('body').on('click', '.js-details-target', function target() {
$(this).closest('.js-details-container').toggleClass('open');
$(this)
.closest('.js-details-container')
.toggleClass('open');
});
 
// Show details content. Hides link after click.
Loading
Loading
@@ -13,7 +15,9 @@ $(() => {
//
$('body').on('click', '.js-details-expand', function expand(e) {
e.preventDefault();
$(this).next('.js-details-content').removeClass('hide');
$(this)
.next('.js-details-content')
.removeClass('hide');
$(this).hide();
 
const truncatedItem = $(this).siblings('.js-details-short');
Loading
Loading
Loading
Loading
@@ -34,7 +34,7 @@ const gfmRules = {
},
},
AutolinkFilter: {
'a'(el, text) {
a(el, text) {
// Fallback on the regular MarkdownFilter's `a` handler.
if (text !== el.getAttribute('href')) return false;
 
Loading
Loading
@@ -60,7 +60,7 @@ const gfmRules = {
},
},
ImageLazyLoadFilter: {
'img'(el, text) {
img(el, text) {
return `![${el.getAttribute('alt')}](${el.getAttribute('src')})`;
},
},
Loading
Loading
@@ -71,7 +71,7 @@ const gfmRules = {
 
return CopyAsGFM.nodeToGFM(videoEl);
},
'video'(el) {
video(el) {
return `![${el.dataset.title}](${el.getAttribute('src')})`;
},
},
Loading
Loading
@@ -118,11 +118,14 @@ const gfmRules = {
'a[name]:not([href]):empty'(el) {
return el.outerHTML;
},
'dl'(el, text) {
let lines = text.replace(/\n\n/g, '\n').trim().split('\n');
dl(el, text) {
let lines = text
.replace(/\n\n/g, '\n')
.trim()
.split('\n');
// Add two spaces to the front of subsequent list items lines,
// or leave the line entirely blank.
lines = lines.map((l) => {
lines = lines.map(l => {
const line = l.trim();
if (line.length === 0) return '';
 
Loading
Loading
@@ -151,27 +154,30 @@ const gfmRules = {
 
// Prefixes lines with 4 spaces if the code contains triple backticks
if (lang === '' && text.match(/^```/gm)) {
return text.split('\n').map((l) => {
const line = l.trim();
if (line.length === 0) return '';
return ` ${line}`;
}).join('\n');
return text
.split('\n')
.map(l => {
const line = l.trim();
if (line.length === 0) return '';
return ` ${line}`;
})
.join('\n');
}
 
return `\`\`\`${lang}\n${text}\n\`\`\``;
},
'pre > code'(el, text) {
// Don't wrap code blocks in ``
// Don't wrap code blocks in ``
return text;
},
},
MarkdownFilter: {
'br'(el) {
br(el) {
// Two spaces at the end of a line are turned into a BR
return ' ';
},
'code'(el, text) {
code(el, text) {
let backtickCount = 1;
const backtickMatch = text.match(/`+/);
if (backtickMatch) {
Loading
Loading
@@ -183,27 +189,31 @@ const gfmRules = {
 
return backticks + spaceOrNoSpace + text.trim() + spaceOrNoSpace + backticks;
},
'blockquote'(el, text) {
return text.trim().split('\n').map(s => `> ${s}`.trim()).join('\n');
blockquote(el, text) {
return text
.trim()
.split('\n')
.map(s => `> ${s}`.trim())
.join('\n');
},
'img'(el) {
img(el) {
const imageSrc = el.src;
const imageUrl = imageSrc && imageSrc !== placeholderImage ? imageSrc : (el.dataset.src || '');
const imageUrl = imageSrc && imageSrc !== placeholderImage ? imageSrc : el.dataset.src || '';
return `![${el.getAttribute('alt')}](${imageUrl})`;
},
'a.anchor'(el, text) {
// Don't render a Markdown link for the anchor link inside a heading
return text;
},
'a'(el, text) {
a(el, text) {
return `[${text}](${el.getAttribute('href')})`;
},
'li'(el, text) {
li(el, text) {
const lines = text.trim().split('\n');
const firstLine = `- ${lines.shift()}`;
// Add four spaces to the front of subsequent list items lines,
// or leave the line entirely blank.
const nextLines = lines.map((s) => {
const nextLines = lines.map(s => {
if (s.trim().length === 0) return '';
 
return ` ${s}`;
Loading
Loading
@@ -211,49 +221,49 @@ const gfmRules = {
 
return `${firstLine}\n${nextLines.join('\n')}`;
},
'ul'(el, text) {
ul(el, text) {
return text;
},
'ol'(el, text) {
ol(el, text) {
// LIs get a `- ` prefix by default, which we replace by `1. ` for ordered lists.
return text.replace(/^- /mg, '1. ');
return text.replace(/^- /gm, '1. ');
},
'h1'(el, text) {
h1(el, text) {
return `# ${text.trim()}\n`;
},
'h2'(el, text) {
h2(el, text) {
return `## ${text.trim()}\n`;
},
'h3'(el, text) {
h3(el, text) {
return `### ${text.trim()}\n`;
},
'h4'(el, text) {
h4(el, text) {
return `#### ${text.trim()}\n`;
},
'h5'(el, text) {
h5(el, text) {
return `##### ${text.trim()}\n`;
},
'h6'(el, text) {
h6(el, text) {
return `###### ${text.trim()}\n`;
},
'strong'(el, text) {
strong(el, text) {
return `**${text}**`;
},
'em'(el, text) {
em(el, text) {
return `_${text}_`;
},
'del'(el, text) {
del(el, text) {
return `~~${text}~~`;
},
'hr'(el) {
hr(el) {
// extra leading \n is to ensure that there is a blank line between
// a list followed by an hr, otherwise this breaks old redcarpet rendering
return '\n-----\n';
},
'p'(el, text) {
p(el, text) {
return `${text.trim()}\n`;
},
'table'(el) {
table(el) {
const theadEl = el.querySelector('thead');
const tbodyEl = el.querySelector('tbody');
if (!theadEl || !tbodyEl) return false;
Loading
Loading
@@ -263,8 +273,8 @@ const gfmRules = {
 
return [theadText, tbodyText].join('\n');
},
'thead'(el, text) {
const cells = _.map(el.querySelectorAll('th'), (cell) => {
thead(el, text) {
const cells = _.map(el.querySelectorAll('th'), cell => {
let chars = CopyAsGFM.nodeToGFM(cell).length + 2;
 
let before = '';
Loading
Loading
@@ -296,7 +306,7 @@ const gfmRules = {
 
return [text, separatorRow].join('\n');
},
'tr'(el) {
tr(el) {
const cellEls = el.querySelectorAll('td, th');
if (cellEls.length === 0) return false;
 
Loading
Loading
@@ -315,8 +325,12 @@ export class CopyAsGFM {
const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent);
if (isIOS) return;
 
$(document).on('copy', '.md, .wiki', (e) => { CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection); });
$(document).on('copy', 'pre.code.highlight, .diff-content .line_content', (e) => { CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformCodeSelection); });
$(document).on('copy', '.md, .wiki', e => {
CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection);
});
$(document).on('copy', 'pre.code.highlight, .diff-content .line_content', e => {
CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformCodeSelection);
});
$(document).on('paste', '.js-gfm-input', CopyAsGFM.pasteGFM);
}
 
Loading
Loading
@@ -356,7 +370,7 @@ export class CopyAsGFM {
// This will break down when the actual code block contains an uneven
// number of backticks, but this is a rare edge case.
const backtickMatch = textBefore.match(/`/g);
const insideCodeBlock = backtickMatch && (backtickMatch.length % 2) === 1;
const insideCodeBlock = backtickMatch && backtickMatch.length % 2 === 1;
 
if (insideCodeBlock) {
return text;
Loading
Loading
@@ -393,7 +407,9 @@ export class CopyAsGFM {
let lineSelector = '.line';
 
if (target) {
const lineClass = ['left-side', 'right-side'].filter(name => target.classList.contains(name))[0];
const lineClass = ['left-side', 'right-side'].filter(name =>
target.classList.contains(name),
)[0];
if (lineClass) {
lineSelector = `.line_content.${lineClass} ${lineSelector}`;
}
Loading
Loading
@@ -436,7 +452,8 @@ export class CopyAsGFM {
return node.textContent;
}
 
const respectWhitespace = respectWhitespaceParam || (node.nodeName === 'PRE' || node.nodeName === 'CODE');
const respectWhitespace =
respectWhitespaceParam || (node.nodeName === 'PRE' || node.nodeName === 'CODE');
 
const text = this.innerGFM(node, respectWhitespace);
 
Loading
Loading
Loading
Loading
@@ -32,7 +32,9 @@ export default function renderMath($els) {
Promise.all([
import(/* webpackChunkName: 'katex' */ 'katex'),
import(/* webpackChunkName: 'katex' */ 'katex/dist/katex.min.css'),
]).then(([katex]) => {
renderWithKaTeX($els, katex);
}).catch(() => flash(__('An error occurred while rendering KaTeX')));
])
.then(([katex]) => {
renderWithKaTeX($els, katex);
})
.catch(() => flash(__('An error occurred while rendering KaTeX')));
}
Loading
Loading
@@ -17,41 +17,43 @@ import flash from '~/flash';
export default function renderMermaid($els) {
if (!$els.length) return;
 
import(/* webpackChunkName: 'mermaid' */ 'blackst0ne-mermaid').then((mermaid) => {
mermaid.initialize({
// mermaid core options
mermaid: {
startOnLoad: false,
},
// mermaidAPI options
theme: 'neutral',
});
import(/* webpackChunkName: 'mermaid' */ 'blackst0ne-mermaid')
.then(mermaid => {
mermaid.initialize({
// mermaid core options
mermaid: {
startOnLoad: false,
},
// mermaidAPI options
theme: 'neutral',
});
 
$els.each((i, el) => {
const source = el.textContent;
$els.each((i, el) => {
const source = el.textContent;
 
// Remove any extra spans added by the backend syntax highlighting.
Object.assign(el, { textContent: source });
// Remove any extra spans added by the backend syntax highlighting.
Object.assign(el, { textContent: source });
 
mermaid.init(undefined, el, (id) => {
const svg = document.getElementById(id);
mermaid.init(undefined, el, id => {
const svg = document.getElementById(id);
 
svg.classList.add('mermaid');
svg.classList.add('mermaid');
 
// pre > code > svg
svg.closest('pre').replaceWith(svg);
// pre > code > svg
svg.closest('pre').replaceWith(svg);
 
// We need to add the original source into the DOM to allow Copy-as-GFM
// to access it.
const sourceEl = document.createElement('text');
sourceEl.classList.add('source');
sourceEl.setAttribute('display', 'none');
sourceEl.textContent = source;
// We need to add the original source into the DOM to allow Copy-as-GFM
// to access it.
const sourceEl = document.createElement('text');
sourceEl.classList.add('source');
sourceEl.setAttribute('display', 'none');
sourceEl.textContent = source;
 
svg.appendChild(sourceEl);
svg.appendChild(sourceEl);
});
});
})
.catch(err => {
flash(`Can't load mermaid module: ${err}`);
});
}).catch((err) => {
flash(`Can't load mermaid module: ${err}`);
});
}
Loading
Loading
@@ -26,7 +26,7 @@ MarkdownPreview.prototype.emptyMessage = 'Nothing to preview.';
 
MarkdownPreview.prototype.ajaxCache = {};
 
MarkdownPreview.prototype.showPreview = function ($form) {
MarkdownPreview.prototype.showPreview = function($form) {
var mdText;
var markdownVersion;
var url;
Loading
Loading
@@ -44,34 +44,40 @@ MarkdownPreview.prototype.showPreview = function ($form) {
this.hideReferencedUsers($form);
} else {
preview.addClass('md-preview-loading').text('Loading...');
this.fetchMarkdownPreview(mdText, url, (function (response) {
var body;
if (response.body.length > 0) {
({ body } = response);
} else {
body = this.emptyMessage;
}
preview.removeClass('md-preview-loading').html(body);
preview.renderGFM();
this.renderReferencedUsers(response.references.users, $form);
if (response.references.commands) {
this.renderReferencedCommands(response.references.commands, $form);
}
}).bind(this));
this.fetchMarkdownPreview(
mdText,
url,
function(response) {
var body;
if (response.body.length > 0) {
({ body } = response);
} else {
body = this.emptyMessage;
}
preview.removeClass('md-preview-loading').html(body);
preview.renderGFM();
this.renderReferencedUsers(response.references.users, $form);
if (response.references.commands) {
this.renderReferencedCommands(response.references.commands, $form);
}
}.bind(this),
);
}
};
 
MarkdownPreview.prototype.versionedPreviewPath = function (markdownPreviewPath, markdownVersion) {
MarkdownPreview.prototype.versionedPreviewPath = function(markdownPreviewPath, markdownVersion) {
if (typeof markdownVersion === 'undefined') {
return markdownPreviewPath;
}
 
return `${markdownPreviewPath}${markdownPreviewPath.indexOf('?') === -1 ? '?' : '&'}markdown_version=${markdownVersion}`;
return `${markdownPreviewPath}${
markdownPreviewPath.indexOf('?') === -1 ? '?' : '&'
}markdown_version=${markdownVersion}`;
};
 
MarkdownPreview.prototype.fetchMarkdownPreview = function (text, url, success) {
MarkdownPreview.prototype.fetchMarkdownPreview = function(text, url, success) {
if (!url) {
return;
}
Loading
Loading
@@ -79,24 +85,25 @@ MarkdownPreview.prototype.fetchMarkdownPreview = function (text, url, success) {
success(this.ajaxCache.response);
return;
}
axios.post(url, {
text,
})
.then(({ data }) => {
this.ajaxCache = {
text: text,
response: data,
};
success(data);
})
.catch(() => flash(__('An error occurred while fetching markdown preview')));
axios
.post(url, {
text,
})
.then(({ data }) => {
this.ajaxCache = {
text: text,
response: data,
};
success(data);
})
.catch(() => flash(__('An error occurred while fetching markdown preview')));
};
 
MarkdownPreview.prototype.hideReferencedUsers = function ($form) {
MarkdownPreview.prototype.hideReferencedUsers = function($form) {
$form.find('.referenced-users').hide();
};
 
MarkdownPreview.prototype.renderReferencedUsers = function (users, $form) {
MarkdownPreview.prototype.renderReferencedUsers = function(users, $form) {
var referencedUsers;
referencedUsers = $form.find('.referenced-users');
if (referencedUsers.length) {
Loading
Loading
@@ -109,11 +116,11 @@ MarkdownPreview.prototype.renderReferencedUsers = function (users, $form) {
}
};
 
MarkdownPreview.prototype.hideReferencedCommands = function ($form) {
MarkdownPreview.prototype.hideReferencedCommands = function($form) {
$form.find('.referenced-commands').hide();
};
 
MarkdownPreview.prototype.renderReferencedCommands = function (commands, $form) {
MarkdownPreview.prototype.renderReferencedCommands = function(commands, $form) {
var referencedCommands;
referencedCommands = $form.find('.referenced-commands');
if (commands.length > 0) {
Loading
Loading
@@ -132,14 +139,14 @@ writeButtonSelector = '.js-md-write-button';
lastTextareaPreviewed = null;
const markdownToolbar = $('.md-header-toolbar');
 
$.fn.setupMarkdownPreview = function () {
$.fn.setupMarkdownPreview = function() {
var $form = $(this);
$form.find('textarea.markdown-area').on('input', function () {
$form.find('textarea.markdown-area').on('input', function() {
markdownPreview.hideReferencedUsers($form);
});
};
 
$(document).on('markdown-preview:show', function (e, $form) {
$(document).on('markdown-preview:show', function(e, $form) {
if (!$form) {
return;
}
Loading
Loading
@@ -148,8 +155,14 @@ $(document).on('markdown-preview:show', function (e, $form) {
lastTextareaHeight = lastTextareaPreviewed.height();
 
// toggle tabs
$form.find(writeButtonSelector).parent().removeClass('active');
$form.find(previewButtonSelector).parent().addClass('active');
$form
.find(writeButtonSelector)
.parent()
.removeClass('active');
$form
.find(previewButtonSelector)
.parent()
.addClass('active');
 
// toggle content
$form.find('.md-write-holder').hide();
Loading
Loading
@@ -158,7 +171,7 @@ $(document).on('markdown-preview:show', function (e, $form) {
markdownPreview.showPreview($form);
});
 
$(document).on('markdown-preview:hide', function (e, $form) {
$(document).on('markdown-preview:hide', function(e, $form) {
if (!$form) {
return;
}
Loading
Loading
@@ -169,8 +182,14 @@ $(document).on('markdown-preview:hide', function (e, $form) {
}
 
// toggle tabs
$form.find(writeButtonSelector).parent().addClass('active');
$form.find(previewButtonSelector).parent().removeClass('active');
$form
.find(writeButtonSelector)
.parent()
.addClass('active');
$form
.find(previewButtonSelector)
.parent()
.removeClass('active');
 
// toggle content
$form.find('.md-write-holder').show();
Loading
Loading
@@ -181,7 +200,7 @@ $(document).on('markdown-preview:hide', function (e, $form) {
markdownPreview.hideReferencedCommands($form);
});
 
$(document).on('markdown-preview:toggle', function (e, keyboardEvent) {
$(document).on('markdown-preview:toggle', function(e, keyboardEvent) {
var $target;
$target = $(keyboardEvent.target);
if ($target.is('textarea.markdown-area')) {
Loading
Loading
@@ -194,14 +213,14 @@ $(document).on('markdown-preview:toggle', function (e, keyboardEvent) {
}
});
 
$(document).on('click', previewButtonSelector, function (e) {
$(document).on('click', previewButtonSelector, function(e) {
var $form;
e.preventDefault();
$form = $(this).closest('form');
$(document).triggerHandler('markdown-preview:show', [$form]);
});
 
$(document).on('click', writeButtonSelector, function (e) {
$(document).on('click', writeButtonSelector, function(e) {
var $form;
e.preventDefault();
$form = $(this).closest('form');
Loading
Loading
Loading
Loading
@@ -28,7 +28,7 @@ function keyCodeIs(e, keyCode) {
return e.keyCode === keyCode;
}
 
$(document).on('keydown.quick_submit', '.js-quick-submit', (e) => {
$(document).on('keydown.quick_submit', '.js-quick-submit', e => {
// Enter
if (!keyCodeIs(e, 13)) {
return;
Loading
Loading
@@ -55,23 +55,25 @@ $(document).on('keydown.quick_submit', '.js-quick-submit', (e) => {
 
// If the user tabs to a submit button on a `js-quick-submit` form, display a
// tooltip to let them know they could've used the hotkey
$(document).on('keyup.quick_submit', '.js-quick-submit input[type=submit], .js-quick-submit button[type=submit]', function displayTooltip(e) {
// Tab
if (!keyCodeIs(e, 9)) {
return;
}
$(document).on(
'keyup.quick_submit',
'.js-quick-submit input[type=submit], .js-quick-submit button[type=submit]',
function displayTooltip(e) {
// Tab
if (!keyCodeIs(e, 9)) {
return;
}
 
const $this = $(this);
const title = isMac() ?
'You can also press &#8984;-Enter' :
'You can also press Ctrl-Enter';
const $this = $(this);
const title = isMac() ? 'You can also press &#8984;-Enter' : 'You can also press Ctrl-Enter';
 
$this.tooltip({
container: 'body',
html: 'true',
placement: 'top',
title,
trigger: 'manual',
});
$this.tooltip('show').one('blur click', () => $this.tooltip('hide'));
});
$this.tooltip({
container: 'body',
html: 'true',
placement: 'top',
title,
trigger: 'manual',
});
$this.tooltip('show').one('blur click', () => $this.tooltip('hide'));
},
);
Loading
Loading
@@ -18,7 +18,8 @@ import '../commons/bootstrap';
$.fn.requiresInput = function requiresInput() {
const $form = $(this);
const $button = $('button[type=submit], input[type=submit]', $form);
const fieldSelector = 'input[required=required], select[required=required], textarea[required=required]';
const fieldSelector =
'input[required=required], select[required=required], textarea[required=required]';
 
function requireInput() {
// Collect the input values of *all* required fields
Loading
Loading
Loading
Loading
@@ -32,16 +32,18 @@ export default class SecretValues {
 
updateDom(isRevealed) {
const values = this.container.querySelectorAll(this.valueSelector);
values.forEach((value) => {
values.forEach(value => {
value.classList.toggle('hide', !isRevealed);
});
 
const placeholders = this.container.querySelectorAll(this.placeholderSelector);
placeholders.forEach((placeholder) => {
placeholders.forEach(placeholder => {
placeholder.classList.toggle('hide', isRevealed);
});
 
this.revealButton.textContent = isRevealed ? n__('Hide value', 'Hide values', values.length) : n__('Reveal value', 'Reveal values', values.length);
this.revealButton.textContent = isRevealed
? n__('Hide value', 'Hide values', values.length)
: n__('Reveal value', 'Reveal values', values.length);
this.revealButton.dataset.secretRevealStatus = isRevealed;
}
}
Loading
Loading
@@ -88,22 +88,24 @@ export default class Shortcuts {
return null;
}
 
return axios.get(gon.shortcuts_path, {
responseType: 'text',
}).then(({ data }) => {
$.globalEval(data);
if (location && location.length > 0) {
const results = [];
for (let i = 0, len = location.length; i < len; i += 1) {
results.push($(location[i]).show());
return axios
.get(gon.shortcuts_path, {
responseType: 'text',
})
.then(({ data }) => {
$.globalEval(data);
if (location && location.length > 0) {
const results = [];
for (let i = 0, len = location.length; i < len; i += 1) {
results.push($(location[i]).show());
}
return results;
}
return results;
}
 
$('.hidden-shortcut').show();
return $('.js-more-help-button').remove();
});
$('.hidden-shortcut').show();
return $('.js-more-help-button').remove();
});
}
 
focusFilter(e) {
Loading
Loading
Loading
Loading
@@ -18,9 +18,7 @@ $(() => {
.toggleClass('fa-chevron-up', toggleState)
.toggleClass('fa-chevron-down', toggleState !== undefined ? !toggleState : undefined);
 
$container
.find('.js-toggle-content')
.toggle(toggleState);
$container.find('.js-toggle-content').toggle(toggleState);
}
 
$('body').on('click', '.js-toggle-button', function toggleButton(e) {
Loading
Loading
Loading
Loading
@@ -18,12 +18,7 @@ export default class Renderer {
this.loader = new STLLoader();
 
this.fov = 45;
this.camera = new THREE.PerspectiveCamera(
this.fov,
this.width / this.height,
1,
1000,
);
this.camera = new THREE.PerspectiveCamera(this.fov, this.width / this.height, 1, 1000);
 
this.scene = new THREE.Scene();
 
Loading
Loading
@@ -35,10 +30,7 @@ export default class Renderer {
this.setupLight();
 
// Set up OrbitControls
this.controls = new OrbitControls(
this.camera,
this.renderer.domElement,
);
this.controls = new OrbitControls(this.camera, this.renderer.domElement);
this.controls.minDistance = 5;
this.controls.maxDistance = 30;
this.controls.enableKeys = false;
Loading
Loading
@@ -51,47 +43,32 @@ export default class Renderer {
antialias: true,
});
 
this.renderer.setClearColor(0xFFFFFF);
this.renderer.setClearColor(0xffffff);
this.renderer.setPixelRatio(window.devicePixelRatio);
this.renderer.setSize(
this.width,
this.height,
);
this.renderer.setSize(this.width, this.height);
}
 
setupLight() {
// Point light illuminates the object
const pointLight = new THREE.PointLight(
0xFFFFFF,
2,
0,
);
const pointLight = new THREE.PointLight(0xffffff, 2, 0);
 
pointLight.castShadow = true;
 
this.camera.add(pointLight);
 
// Ambient light illuminates the scene
const ambientLight = new THREE.AmbientLight(
0xFFFFFF,
1,
);
const ambientLight = new THREE.AmbientLight(0xffffff, 1);
this.scene.add(ambientLight);
}
 
setupGrid() {
this.grid = new THREE.GridHelper(
20,
20,
0x000000,
0x000000,
);
this.grid = new THREE.GridHelper(20, 20, 0x000000, 0x000000);
 
this.scene.add(this.grid);
}
 
loadFile() {
this.loader.load(this.container.dataset.endpoint, (geo) => {
this.loader.load(this.container.dataset.endpoint, geo => {
const obj = new MeshObject(geo);
 
this.objects.push(obj);
Loading
Loading
@@ -116,30 +93,23 @@ export default class Renderer {
}
 
render() {
this.renderer.render(
this.scene,
this.camera,
);
this.renderer.render(this.scene, this.camera);
 
requestAnimationFrame(this.renderWrapper);
}
 
changeObjectMaterials(type) {
this.objects.forEach((obj) => {
this.objects.forEach(obj => {
obj.changeMaterial(type);
});
}
 
setDefaultCameraPosition() {
const obj = this.objects[0];
const radius = (obj.geometry.boundingSphere.radius / 1.5);
const dist = radius / (Math.sin((this.fov * (Math.PI / 180)) / 2));
this.camera.position.set(
0,
dist + 1,
dist,
);
const radius = obj.geometry.boundingSphere.radius / 1.5;
const dist = radius / Math.sin((this.fov * (Math.PI / 180)) / 2);
this.camera.position.set(0, dist + 1, dist);
 
this.camera.lookAt(this.grid);
this.controls.update();
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment