Skip to content

Commit 05cc7c4

Browse files
committed
Merge remote-tracking branch 'origin/master' into new-geo-projections
2 parents 645a10a + 4426789 commit 05cc7c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+69150
-281
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ jobs:
204204
echo https://$CIRCLE_BUILD_NUM-$PROJECT_NUM-gh.circle-artifacts.com/0/dist/plotly.js
205205
echo https://$CIRCLE_BUILD_NUM-$PROJECT_NUM-gh.circle-artifacts.com/0/dist/plotly.min.js
206206
echo https://$CIRCLE_BUILD_NUM-$PROJECT_NUM-gh.circle-artifacts.com/0/dist/plot-schema.json
207+
- run:
208+
name: Test plot-schema.json diff - If failed, after (npm start) you could run (npm run schema && git add test/plot-schema.json && git commit -m "update plot-schema diff")
209+
command: diff --unified --color dist/plot-schema.json test/plot-schema.json
207210
- run:
208211
name: Test plotly.min.js import using requirejs
209212
command: npm run test-requirejs

.circleci/env_image.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/sh
2+
# install required fonts
23
sudo apt-get install fonts-liberation2 fonts-open-sans fonts-noto-cjk fonts-noto-color-emoji && \
34
sudo python3 .circleci/download_google_fonts.py && \
45
sudo cp -r .circleci/fonts/ /usr/share/ && \
56
sudo fc-cache -f && \
7+
# install kaleido & plotly
68
sudo python3 -m pip install kaleido==0.2.1 plotly==5.1.0 --progress-bar off

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ Thanks for your interest in plotly.js!
99
### Features, Bug fixes, and others:
1010

1111
Before opening a pull request, developer should:
12+
1. make sure they are not on the `master` branch of their fork as using `master` for a pull request would make it difficult to fetch `upstream` changes.
13+
2. fetch latest changes from `upstream/master` into your fork i.e. `origin/master` then pull `origin/master` from you local `master`.
14+
3. then `git rebase master` their local dev branch off the latest `master` which should be sync with `upstream/master` at this time.
15+
4. make sure to **not** `git add` the `dist/` folder (the `dist/` is updated only on version bumps).
16+
5. make sure to commit changes to the `package-lock.json` file (if any new dependency required).
17+
6. provide a title and write an overview of what the PR attempts to do with a link to the issue they are trying to address.
18+
7. select the _Allow edits from maintainers_ option (see this [article](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) for more details).
1219

13-
- `git rebase` their local branch off the latest `master`,
14-
- make sure to **not** `git add` the `dist/` folder (the `dist/` is updated only on version bumps),
15-
- make sure to commit changes to the `package-lock.json` file (if any new dependency required),
16-
- write an overview of what the PR attempts to do,
17-
- select the _Allow edits from maintainers_ option (see this [article](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) for more details).
18-
19-
Note that it is forbidden to force push (i.e. `git push -f`) to remote branches associated with opened pull requests. Force pushes make it hard for maintainers to keep track of updates. Therefore, if required, please `git merge master` into your PR branch instead of `git rebase master`.
20+
After opening a pull request, developer:
21+
- should create a new small markdown log file using the PR number e.g. `1010_fix.md` or `1010_add.md` inside `draftlogs` folder as described in this [README](https://github.com/plotly/plotly.js/blob/master/draftlogs/README.md), commit it and push.
22+
- should **not** force push (i.e. `git push -f`) to remote branches associated with opened pull requests. Force pushes make it hard for maintainers to keep track of updates. Therefore, if required, please fetch `upstream/master` and "merge" with master instead of "rebase".

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ To see all merged commits on the master branch that will be part of the next plo
99

1010
where X.Y.Z is the semver of most recent plotly.js release.
1111

12+
## [2.2.1] -- 2021-07-06
13+
14+
### Fixed
15+
- Fix to improve sanitizing href inputs for SVG and HTML text elements [[#5803](https://github.com/plotly/plotly.js/pull/5803)]
16+
17+
18+
## [1.58.5] -- 2021-07-06
19+
20+
### Fixed
21+
- Fix to improve sanitizing href inputs for SVG and HTML text elements [[#5803](https://github.com/plotly/plotly.js/pull/5803)]
22+
23+
1224
## [2.2.0] -- 2021-06-28
1325

1426
### Added

CONTRIBUTING.md

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,19 @@ Three additional helpers exist that are refreshed every second:
138138
There is also a search bar in the top right of the dashboard. This fuzzy-searches
139139
image mocks based on their file name and trace type.
140140

141-
#### Alternative to test dashboard
141+
#### Step 5: Regenerate plot-schema in "test" folder then review & commit potential changes
142142

143-
Use the [`plotly-mock-viewer`](https://github.com/rreusser/plotly-mock-viewer)
144-
which has live-reloading and a bunch of other cool features.
145-
An online version of `plotly-mock-viewer` is available at <https://rreusser.github.io/plotly-mock-viewer/>
146-
which uses <https://cdn.plot.ly/plotly-latest.min.js>
143+
```bash
144+
npm run schema
145+
```
146+
147+
#### Step 6: Review & commit potential changes made to test/plot-schema.json
147148

148-
#### Other npm scripts
149+
> If you are editing attribute descriptions or implementing a new feature this file located in the test folder records the proposed changes to the API. Note that there is another plot-schema.json file located in the dist folder, which should only be updated by the maintainers at release time.
150+
151+
**IMPORTANT:** please do not change and commit any files in the "dist" folder
152+
153+
#### Other npm scripts that may be of interest in development
149154

150155
- `npm run preprocess`: pre-processes the css and svg source file in js. This
151156
script must be run manually when updating the css and svg source files.
@@ -207,17 +212,40 @@ npm run test-jasmine -- --help
207212
npm run test-jasmine -- --info
208213
```
209214

210-
### Draft new baseline
211-
Install fonts and tools
215+
### Draft new baselines
216+
#### With docker:
217+
> If you prefer using docker each time you need to
218+
```sh
219+
docker run -it -v "$(pwd)":/plotly.js circleci/python:3.8.9 bash
220+
# then inside the docker
221+
cd plotly.js
222+
sudo bash .circleci/env_image.sh
223+
```
224+
225+
#### Without docker:
226+
> Otherwise you may need to install `python 3.8`
227+
Then upgrade `pip` if needed
212228
```sh
213-
# install required fonts (if missing) on ubuntu
214-
sudo cp -r .circleci/fonts/ /usr/share/ && sudo fc-cache -f
215-
# upgrade pip (if needed)
216229
python3 -m pip install --upgrade pip
217-
# install kaleido
218-
python3 -m pip install kaleido
219-
# install plotly
220-
python3 -m pip install plotly
230+
```
231+
232+
To install required fonts and tools see this [shell script](https://github.com/plotly/plotly.js/blob/master/.circleci/env_image.sh).
233+
234+
#### Scripts to generate/update new baselines with/without docker:
235+
```sh
236+
python3 test/image/make_baseline.py = mock_1 mock_2
237+
```
238+
239+
> Alternatively using npm & node.js (which are not available in the python docker by default)
240+
241+
```sh
242+
npm run baseline mock_1 mock_2
243+
```
244+
245+
Or
246+
247+
```sh
248+
npm run baseline mock_*
221249
```
222250

223251
**IMPORTANT:** the `baseline`, `test-image` and `test-export` scripts do **not** bundle the source files before

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ You may also consider using [`plotly.js-dist`](https://www.npmjs.com/package/plo
5555
5656
```html
5757
<head>
58-
<script src="https://cdn.plot.ly/plotly-2.2.0.min.js"></script>
58+
<script src="https://cdn.plot.ly/plotly-2.2.1.min.js"></script>
5959
</head>
6060
<body>
6161
<div id="gd"></div>
@@ -72,7 +72,7 @@ You may also consider using [`plotly.js-dist`](https://www.npmjs.com/package/plo
7272
Alternatively you may consider using [native ES6 import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) in the script tag.
7373
```html
7474
<script type="module">
75-
import "https://cdn.plot.ly/plotly-2.2.0.min.js"
75+
import "https://cdn.plot.ly/plotly-2.2.1.min.js"
7676
Plotly.newPlot("gd", [{ y: [1, 2, 3] }])
7777
</script>
7878
```
@@ -82,10 +82,10 @@ Fastly supports Plotly.js with free CDN service. Read more at <https://www.fastl
8282
### Un-minified versions are also available on CDN
8383
While non-minified source files may contain characters outside UTF-8, it is recommended that you specify the `charset` when loading those bundles.
8484
```html
85-
<script src="https://cdn.plot.ly/plotly-2.2.0.js" charset="utf-8"></script>
85+
<script src="https://cdn.plot.ly/plotly-2.2.1.js" charset="utf-8"></script>
8686
```
8787

88-
> Please note that as of v2 the "plotly-latest" outputs (e.g. https://cdn.plot.ly/plotly-latest.min.js) will no longer be updated on the CDN, and will stay at the last v1 patch v1.58.4. Therefore, to use the CDN with plotly.js v2 and higher, you must specify an exact plotly.js version.
88+
> Please note that as of v2 the "plotly-latest" outputs (e.g. https://cdn.plot.ly/plotly-latest.min.js) will no longer be updated on the CDN, and will stay at the last v1 patch v1.58.5. Therefore, to use the CDN with plotly.js v2 and higher, you must specify an exact plotly.js version.
8989
9090
To support MathJax, you need to load version two of MathJax e.g. `v2.7.5` files from CDN or npm.
9191
```html

dist/README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ The main plotly.js bundles weight in at:
4646
| 8 MB | 3.4 MB | 1019.6 kB | 8.3 MB |
4747

4848
#### CDN links
49-
> https://cdn.plot.ly/plotly-2.2.0.js
49+
> https://cdn.plot.ly/plotly-2.2.1.js
5050
51-
> https://cdn.plot.ly/plotly-2.2.0.min.js
51+
> https://cdn.plot.ly/plotly-2.2.1.min.js
5252
5353

5454
#### npm packages
@@ -94,9 +94,9 @@ The `basic` partial bundle contains trace modules `bar`, `pie` and `scatter`.
9494
| 2.7 MB | 1007.3 kB | 327.3 kB |
9595

9696
#### CDN links
97-
> https://cdn.plot.ly/plotly-basic-2.2.0.js
97+
> https://cdn.plot.ly/plotly-basic-2.2.1.js
9898
99-
> https://cdn.plot.ly/plotly-basic-2.2.0.min.js
99+
> https://cdn.plot.ly/plotly-basic-2.2.1.min.js
100100
101101

102102
#### npm packages
@@ -114,12 +114,12 @@ The `cartesian` partial bundle contains trace modules `bar`, `box`, `contour`, `
114114

115115
| Raw size | Minified size | Minified + gzip size |
116116
|------|-----------------|------------------------|
117-
| 3.3 MB | 1.2 MB | 398.7 kB |
117+
| 3.3 MB | 1.2 MB | 398.8 kB |
118118

119119
#### CDN links
120-
> https://cdn.plot.ly/plotly-cartesian-2.2.0.js
120+
> https://cdn.plot.ly/plotly-cartesian-2.2.1.js
121121
122-
> https://cdn.plot.ly/plotly-cartesian-2.2.0.min.js
122+
> https://cdn.plot.ly/plotly-cartesian-2.2.1.min.js
123123
124124

125125
#### npm packages
@@ -137,12 +137,12 @@ The `geo` partial bundle contains trace modules `choropleth`, `scatter` and `sca
137137

138138
| Raw size | Minified size | Minified + gzip size |
139139
|------|-----------------|------------------------|
140-
| 2.9 MB | 1 MB | 337.3 kB |
140+
| 2.9 MB | 1 MB | 337.4 kB |
141141

142142
#### CDN links
143-
> https://cdn.plot.ly/plotly-geo-2.2.0.js
143+
> https://cdn.plot.ly/plotly-geo-2.2.1.js
144144
145-
> https://cdn.plot.ly/plotly-geo-2.2.0.min.js
145+
> https://cdn.plot.ly/plotly-geo-2.2.1.min.js
146146
147147

148148
#### npm packages
@@ -163,9 +163,9 @@ The `gl3d` partial bundle contains trace modules `cone`, `isosurface`, `mesh3d`,
163163
| 3.8 MB | 1.5 MB | 482.7 kB |
164164

165165
#### CDN links
166-
> https://cdn.plot.ly/plotly-gl3d-2.2.0.js
166+
> https://cdn.plot.ly/plotly-gl3d-2.2.1.js
167167
168-
> https://cdn.plot.ly/plotly-gl3d-2.2.0.min.js
168+
> https://cdn.plot.ly/plotly-gl3d-2.2.1.min.js
169169
170170

171171
#### npm packages
@@ -183,12 +183,12 @@ The `gl2d` partial bundle contains trace modules `heatmapgl`, `parcoords`, `poin
183183

184184
| Raw size | Minified size | Minified + gzip size |
185185
|------|-----------------|------------------------|
186-
| 3.8 MB | 1.5 MB | 503.1 kB |
186+
| 3.8 MB | 1.5 MB | 503.2 kB |
187187

188188
#### CDN links
189-
> https://cdn.plot.ly/plotly-gl2d-2.2.0.js
189+
> https://cdn.plot.ly/plotly-gl2d-2.2.1.js
190190
191-
> https://cdn.plot.ly/plotly-gl2d-2.2.0.min.js
191+
> https://cdn.plot.ly/plotly-gl2d-2.2.1.min.js
192192
193193

194194
#### npm packages
@@ -209,9 +209,9 @@ The `mapbox` partial bundle contains trace modules `choroplethmapbox`, `densitym
209209
| 4.4 MB | 1.8 MB | 525 kB |
210210

211211
#### CDN links
212-
> https://cdn.plot.ly/plotly-mapbox-2.2.0.js
212+
> https://cdn.plot.ly/plotly-mapbox-2.2.1.js
213213
214-
> https://cdn.plot.ly/plotly-mapbox-2.2.0.min.js
214+
> https://cdn.plot.ly/plotly-mapbox-2.2.1.min.js
215215
216216

217217
#### npm packages
@@ -229,12 +229,12 @@ The `finance` partial bundle contains trace modules `bar`, `candlestick`, `funne
229229

230230
| Raw size | Minified size | Minified + gzip size |
231231
|------|-----------------|------------------------|
232-
| 3 MB | 1.1 MB | 353.5 kB |
232+
| 3 MB | 1.1 MB | 353.6 kB |
233233

234234
#### CDN links
235-
> https://cdn.plot.ly/plotly-finance-2.2.0.js
235+
> https://cdn.plot.ly/plotly-finance-2.2.1.js
236236
237-
> https://cdn.plot.ly/plotly-finance-2.2.0.min.js
237+
> https://cdn.plot.ly/plotly-finance-2.2.1.min.js
238238
239239

240240
#### npm packages
@@ -252,12 +252,12 @@ The `strict` partial bundle contains trace modules `bar`, `barpolar`, `box`, `ca
252252

253253
| Raw size | Minified size | Minified + gzip size |
254254
|------|-----------------|------------------------|
255-
| 6.7 MB | 2.8 MB | 840.4 kB |
255+
| 6.7 MB | 2.8 MB | 840.5 kB |
256256

257257
#### CDN links
258-
> https://cdn.plot.ly/plotly-strict-2.2.0.js
258+
> https://cdn.plot.ly/plotly-strict-2.2.1.js
259259
260-
> https://cdn.plot.ly/plotly-strict-2.2.0.min.js
260+
> https://cdn.plot.ly/plotly-strict-2.2.1.min.js
261261
262262

263263
#### npm packages

dist/plotly-basic.js

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* plotly.js (basic) v2.2.0
2+
* plotly.js (basic) v2.2.1
33
* Copyright 2012-2021, Plotly, Inc.
44
* All rights reserved.
55
* Licensed under the MIT license
@@ -49233,14 +49233,9 @@ function buildSVGText(containerNode, str) {
4923349233
var href = getQuotedMatch(extra, HREFMATCH);
4923449234

4923549235
if(href) {
49236-
// check safe protocols
49237-
var dummyAnchor = document.createElement('a');
49238-
dummyAnchor.href = href;
49239-
if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) {
49240-
// Decode href to allow both already encoded and not encoded
49241-
// URIs. Without decoding prior encoding, an already encoded
49242-
// URI would be encoded twice producing a semantically different URI.
49243-
nodeSpec.href = encodeURI(decodeURI(href));
49236+
var safeHref = sanitizeHref(href);
49237+
if(safeHref) {
49238+
nodeSpec.href = safeHref;
4924449239
nodeSpec.target = getQuotedMatch(extra, TARGETMATCH) || '_blank';
4924549240
nodeSpec.popup = getQuotedMatch(extra, POPUPMATCH);
4924649241
}
@@ -49255,6 +49250,27 @@ function buildSVGText(containerNode, str) {
4925549250
return hasLink;
4925649251
}
4925749252

49253+
function sanitizeHref(href) {
49254+
var decodedHref = encodeURI(decodeURI(href));
49255+
var dummyAnchor1 = document.createElement('a');
49256+
var dummyAnchor2 = document.createElement('a');
49257+
dummyAnchor1.href = href;
49258+
dummyAnchor2.href = decodedHref;
49259+
49260+
var p1 = dummyAnchor1.protocol;
49261+
var p2 = dummyAnchor2.protocol;
49262+
49263+
// check safe protocols
49264+
if(
49265+
PROTOCOLS.indexOf(p1) !== -1 &&
49266+
PROTOCOLS.indexOf(p2) !== -1
49267+
) {
49268+
return decodedHref;
49269+
} else {
49270+
return '';
49271+
}
49272+
}
49273+
4925849274
/*
4925949275
* sanitizeHTML: port of buildSVGText aimed at providing a clean subset of HTML
4926049276
* @param {string} str: the html string to clean
@@ -49289,10 +49305,9 @@ exports.sanitizeHTML = function sanitizeHTML(str) {
4928949305
var href = getQuotedMatch(extra, HREFMATCH);
4929049306

4929149307
if(href) {
49292-
var dummyAnchor = document.createElement('a');
49293-
dummyAnchor.href = href;
49294-
if(PROTOCOLS.indexOf(dummyAnchor.protocol) !== -1) {
49295-
nodeAttrs.href = encodeURI(decodeURI(href));
49308+
var safeHref = sanitizeHref(href);
49309+
if(safeHref) {
49310+
nodeAttrs.href = safeHref;
4929649311
var target = getQuotedMatch(extra, TARGETMATCH);
4929749312
if(target) {
4929849313
nodeAttrs.target = target;
@@ -84237,7 +84252,7 @@ function getSortFunc(opts, d2c) {
8423784252
'use strict';
8423884253

8423984254
// package version injected by `npm run preprocess`
84240-
exports.version = '2.2.0';
84255+
exports.version = '2.2.1';
8424184256

8424284257
},{}]},{},[8])(8)
8424384258
});

dist/plotly-basic.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)