summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-core/src')
-rw-r--r--packages/gitbook-core/src/lib/bootstrap.js7
-rw-r--r--packages/gitbook-core/src/lib/renderWithContext.js12
2 files changed, 11 insertions, 8 deletions
diff --git a/packages/gitbook-core/src/lib/bootstrap.js b/packages/gitbook-core/src/lib/bootstrap.js
index f5183d1..f3c99b7 100644
--- a/packages/gitbook-core/src/lib/bootstrap.js
+++ b/packages/gitbook-core/src/lib/bootstrap.js
@@ -5,9 +5,10 @@ const createContext = require('./createContext');
const renderWithContext = require('./renderWithContext');
/**
- * Bootstrap GitBook on the browser (this function should not be called on the server side)
+ * Bootstrap GitBook on the browser (this function should not be called on the server side).
+ * @param {Object} matching
*/
-function bootstrap() {
+function bootstrap(matching) {
const initialState = getPayload(window.document);
const plugins = window.gitbookPlugins;
@@ -19,7 +20,7 @@ function bootstrap() {
window.gitbookContext = context;
// Render with the store
- const el = renderWithContext(context);
+ const el = renderWithContext(context, matching);
ReactDOM.render(el, mountNode);
}
diff --git a/packages/gitbook-core/src/lib/renderWithContext.js b/packages/gitbook-core/src/lib/renderWithContext.js
index 44f8ba4..f9a093c 100644
--- a/packages/gitbook-core/src/lib/renderWithContext.js
+++ b/packages/gitbook-core/src/lib/renderWithContext.js
@@ -9,7 +9,8 @@ const contextShape = require('../shapes/context');
const GitBookApplication = React.createClass({
propTypes: {
- context: contextShape
+ context: contextShape,
+ matching: React.PropTypes.object
},
componentDidMount() {
@@ -23,13 +24,13 @@ const GitBookApplication = React.createClass({
},
render() {
- const { context } = this.props;
+ const { context, matching } = this.props;
return (
<ContextProvider context={context}>
<PJAXWrapper>
<I18nProvider>
- <InjectedComponent matching={{ role: 'Body' }} />
+ <InjectedComponent matching={matching} />
</I18nProvider>
</PJAXWrapper>
</ContextProvider>
@@ -42,11 +43,12 @@ const GitBookApplication = React.createClass({
* Render the application for a GitBook context.
*
* @param {GitBookContext} context
+ * @param {Object} matching
* @return {React.Element} element
*/
-function renderWithContext(context) {
+function renderWithContext(context, matching) {
return (
- <GitBookApplication context={context} />
+ <GitBookApplication context={context} matching={matching} />
);
}