Skip to content

Commit 1a380ee

Browse files
committed
Fix wording and add a note explaining the sample
1 parent 0f3b844 commit 1a380ee

File tree

7 files changed

+25
-11
lines changed

7 files changed

+25
-11
lines changed

docs/getting-started/integration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ require(['moment'], function() {
8585
});
8686
```
8787

88-
## Content-Security-Policy
88+
## Content Security Policy
8989

90-
By default, Chart.js injects CSS directly into the DOM. For webpages secured using [Content-Security-Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy), this requires to allow `style-src 'unsafe-inline'`. For stricter CSP environments, where only `style-src 'self'` is allowed, the following CSS file needs to be manually added to your webpage:
90+
By default, Chart.js injects CSS directly into the DOM. For webpages secured using [`Content-Security-Policy` (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy), this requires to allow `style-src 'unsafe-inline'`. For stricter CSP environments, where only `style-src 'self'` is allowed, the following CSS file needs to be manually added to your webpage:
9191

9292
```html
9393
<link rel="stylesheet" type="text/css" href="path/to/chartjs/dist/Chart.min.css">

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = [
2929
}),
3030
optional({
3131
include: ['moment']
32-
}),
32+
})
3333
],
3434
output: {
3535
name: 'Chart',
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
.content {
22
max-width: 640px;
33
margin: auto;
4-
padding: 16px 32px;
4+
padding: 1rem;
5+
}
6+
7+
.note {
8+
font-family: sans-serif;
9+
color: #5050a0;
10+
line-height: 1.4;
11+
margin-bottom: 1rem;
12+
padding: 1rem;
13+
}
14+
15+
code {
16+
background-color: #f5f5ff;
17+
border: 1px solid #d0d0fa;
18+
border-radius: 4px;
19+
padding: 0.05rem 0.25rem;
520
}

samples/advanced/content-security-policy.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
</head>
1515
<body>
1616
<div class="content">
17+
<div class="note">
18+
In order to support a strict content security policy (<code>default-src 'self'</code>),
19+
this page manually loads <code>Chart.min.css</code> and turns off the automatic style
20+
injection by setting <code>Chart.platform.useExternalStylesheet = true;</code>.
21+
</div>
1722
<div class="wrapper">
1823
<canvas id="chart-0"></canvas>
1924
</div>

samples/samples.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@
188188
title: 'Progress bar',
189189
path: 'advanced/progress-bar.html'
190190
}, {
191-
title: 'Content-Security-Policy',
191+
title: 'Content Security Policy',
192192
path: 'advanced/content-security-policy.html'
193193
}]
194194
}];

samples/style.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
@import url('https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900');
32

43
body, html {

src/platforms/platform.dom.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@
22
* DOM element rendering detection
33
* https://davidwalsh.name/detect-node-insertion
44
*/
5-
@-webkit-keyframes chartjs-render-animation {
6-
from { opacity: 0.99; }
7-
to { opacity: 1; }
8-
}
95
@keyframes chartjs-render-animation {
106
from { opacity: 0.99; }
117
to { opacity: 1; }
128
}
139

1410
.chartjs-render-monitor {
15-
-webkit-animation: chartjs-render-animation 0.001s;
1611
animation: chartjs-render-animation 0.001s;
1712
}
1813

0 commit comments

Comments
 (0)