Bläddra i källkod

SONAR-12368 Fix documentation in IE11

tags/8.0
Wouter Admiraal 4 år sedan
förälder
incheckning
b9d1c53b68

+ 6
- 0
server/sonar-docs/gatsby-config.js Visa fil

@@ -28,6 +28,12 @@ module.exports = {
`gatsby-plugin-typescript`,
`gatsby-plugin-layout`,
'gatsby-plugin-react-helmet',
{
resolve: `gatsby-plugin-polyfill-io`,
options: {
features: [`Promise`, `fetch`, `Object.assign`, `Symbol`, `Array.from`]
}
},
{
resolve: `sonarsource-source-filesystem`,
options: { name: 'src', path: `${__dirname}/src/pages/` }

+ 1
- 0
server/sonar-docs/package.json Visa fil

@@ -8,6 +8,7 @@
"classnames": "2.2.6",
"gatsby": "2.2.8",
"gatsby-plugin-layout": "1.0.13",
"gatsby-plugin-polyfill-io": "1.1.0",
"gatsby-plugin-react-helmet": "3.0.10",
"gatsby-plugin-typescript": "2.0.11",
"gatsby-plugin-typography": "2.2.10",

+ 16
- 3
server/sonar-docs/src/components/PluginMetaData.tsx Visa fil

@@ -82,9 +82,22 @@ export default class PluginMetaData extends React.Component<Props, State> {
const pageContainer = document.querySelector('.page-container');

if (pageContainer) {
const iterator = document.createNodeIterator(pageContainer, NodeFilter.SHOW_COMMENT, {
acceptNode: (_: Node) => NodeFilter.FILTER_ACCEPT
});
// The following uses an older syntax for createNodeIterator() in order
// to support IE11
// - IE doesn't support the new { acceptNode: (node: Node) => number }
// format for the 3rd parameter, and instead expects to get it passed
// the function directly. Modern browsers support both paradigms as a
// fallback, so we fallback to the old one.
// - IE11 requires the 4th argument.
// @ts-ignore: tsc requires an additional comment at the function call.
const iterator = document.createNodeIterator(
pageContainer,
NodeFilter.SHOW_COMMENT,
// @ts-ignore: IE11 doesn't support the { acceptNode: () => number } format.
(_: Node) => NodeFilter.FILTER_ACCEPT,
// @ts-ignore: IE11 requires the 4th argument.
false
);

let node;
const wrappers: Dict<HTMLDivElement> = {};

+ 7
- 0
server/sonar-docs/yarn.lock Visa fil

@@ -5051,6 +5051,13 @@ gatsby-plugin-page-creator@^2.0.11:
lodash "^4.17.10"
micromatch "^3.1.10"

gatsby-plugin-polyfill-io@^1.1.0:
version "1.1.0"
resolved "https://repox.jfrog.io/repox/api/npm/npm/gatsby-plugin-polyfill-io/-/gatsby-plugin-polyfill-io-1.1.0.tgz#61424c773ae123680e50b9a6692a4b939a1e6e13"
integrity sha1-YUJMdzrhI2gOULmmaSpLk5oebhM=
dependencies:
babel-runtime "^6.26.0"

gatsby-plugin-react-helmet@3.0.10:
version "3.0.10"
resolved "https://repox.jfrog.io/repox/api/npm/npm/gatsby-plugin-react-helmet/-/gatsby-plugin-react-helmet-3.0.10.tgz#08a4f3f7d6ffd020d78817679535fb6548602302"

Laddar…
Avbryt
Spara