Skip to content

Commit

Permalink
Merge branch 'master' into devtools-renable-copy-attr-context-menu-fo…
Browse files Browse the repository at this point in the history
…r-firefox
  • Loading branch information
Brian Vaughn committed Dec 29, 2019
2 parents bf4f00e + 2b903da commit 5a42b97
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/react-devtools-extensions/src/injectGlobalHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,17 @@ if (sessionStorageGetItem(SESSION_STORAGE_RELOAD_AND_PROFILE_KEY) === 'true') {
injectCode(rendererCode);
}

// Inject a `__REACT_DEVTOOLS_GLOBAL_HOOK__` global so that React can detect that the
// devtools are installed (and skip its suggestion to install the devtools).
injectCode(
';(' + installHook.toString() + '(window))' + saveNativeValues + detectReact,
);
// Inject a __REACT_DEVTOOLS_GLOBAL_HOOK__ global for React to interact with.
// Only do this for HTML documents though, to avoid e.g. breaking syntax highlighting for XML docs.
if (document.contentType === 'text/html') {
injectCode(
';(' +
installHook.toString() +
'(window))' +
saveNativeValues +
detectReact,
);
}

if (typeof exportFunction === 'function') {
// eslint-disable-next-line no-undef
Expand All @@ -106,4 +112,4 @@ if (typeof exportFunction === 'function') {
window.wrappedJSObject.__REACT_DEVTOOLS_GLOBAL_HOOK__,
{defineAs: 'clipboardCopyText'},
);
}
}

0 comments on commit 5a42b97

Please sign in to comment.