-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add-live-reload-docs
- Loading branch information
Showing
28 changed files
with
312 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ yarn-error.log | |
package-lock.json | ||
.cache | ||
internal-links.tap | ||
stats.json | ||
stats.json | ||
printable.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ | ||
"app-shell/index.html", | ||
"appcache/manifest.html" | ||
] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,10 @@ | |
@include break { | ||
right: 1.5em; | ||
} | ||
|
||
@media print { | ||
display: none; | ||
} | ||
} | ||
|
||
.gitter__button { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
// Load Styling | ||
import './Print.scss'; | ||
import icon from '../../assets/icon-print.svg'; | ||
|
||
const PRINTABLE_SECTIONS = [ | ||
'api', | ||
'concepts', | ||
'configuration', | ||
'contribute', | ||
'guides', | ||
'loaders', | ||
'migrate', | ||
'plugins' | ||
]; | ||
|
||
export default function Print (props) { | ||
const { url } = props; | ||
const printUrl = _printPageUrlFromUrl(url); | ||
|
||
// not in a printable section | ||
if (!url) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className="sidebar-item sidebar-item--disabled`"> | ||
<i className="sidebar-item__toggle icon-vertical-bar" /> | ||
<a class="sidebar-item__title sidebar-link__print" href={_printPageUrlFromUrl(url)} | ||
rel="nofollow" | ||
alt="Print" | ||
title="Print" | ||
target="_blank"> | ||
Print Section | ||
<img src={icon} /> | ||
</a> | ||
</div> | ||
); | ||
} | ||
|
||
function _printPageUrlFromUrl(urlRaw) { | ||
// for now support both trailing slash and without it | ||
// when https://github.com/webpack/webpack.js.org/pull/3064 is merged, this is simplified. | ||
let url = urlRaw[urlRaw.length-1] === '/' ? urlRaw.substring(0, urlRaw.length-1) : urlRaw; | ||
let urlSplit = url.split('/'); | ||
|
||
if (!PRINTABLE_SECTIONS.includes(urlSplit[1])) { | ||
return false; | ||
} | ||
|
||
return (urlSplit.length > 2) ? `/${url.split('/')[1]}/printable/` : `${url}/printable/`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.sidebar-link__print { | ||
display: flex; | ||
vertical-align: center; | ||
flex-wrap: nowrap; | ||
|
||
img { | ||
height: 20px; | ||
margin-right: 2px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react'; | ||
|
||
const printScript = ` | ||
window.matchMedia('print').addListener(function(mql) { | ||
if (!mql.matches) { | ||
window.close(); | ||
} | ||
}); | ||
window.print(); | ||
`; | ||
export default function PrintScript () { | ||
return ( | ||
<script dangerouslySetInnerHTML={{ __html: printScript }}></script> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.