summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core/src
diff options
context:
space:
mode:
authorJohan Preynat <johan.preynat@gmail.com>2016-10-09 00:58:30 +0200
committerJohan Preynat <johan.preynat@gmail.com>2016-10-09 00:58:30 +0200
commit5a57a2c62ad67210143bfe5dd96dd1605b3724f6 (patch)
tree94cef22779ea438a44eaf3fa3b201456652d7005 /packages/gitbook-core/src
parent4cfffb26f265ce1af71e1f34dc0a9468ad0caaf1 (diff)
parent2d429b731b7ebbf6480f62efa379dad48ee7bdee (diff)
downloadgitbook-5a57a2c62ad67210143bfe5dd96dd1605b3724f6.zip
gitbook-5a57a2c62ad67210143bfe5dd96dd1605b3724f6.tar.gz
gitbook-5a57a2c62ad67210143bfe5dd96dd1605b3724f6.tar.bz2
Merge remote-tracking branch 'origin/dream' into dream
# Conflicts: # packages/gitbook-plugin-headings/package.json
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} />
);
}