summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-10-13 21:52:54 +0200
committerSamy Pesse <samypesse@gmail.com>2016-10-13 21:53:15 +0200
commit2c3072fd8a4c3c31297d5f56799fa9200e225971 (patch)
treea56e0fe34bdcc2e8400a90c274e4ec018f000ef6 /packages/gitbook-core
parentbb14f48c3988597794c8304f9ef5da60db7f8446 (diff)
downloadgitbook-2c3072fd8a4c3c31297d5f56799fa9200e225971.zip
gitbook-2c3072fd8a4c3c31297d5f56799fa9200e225971.tar.gz
gitbook-2c3072fd8a4c3c31297d5f56799fa9200e225971.tar.bz2
Fix update of page attributes in hook "page"
Diffstat (limited to 'packages/gitbook-core')
-rw-r--r--packages/gitbook-core/src/models/Page.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/packages/gitbook-core/src/models/Page.js b/packages/gitbook-core/src/models/Page.js
index 838191e..e3c4a96 100644
--- a/packages/gitbook-core/src/models/Page.js
+++ b/packages/gitbook-core/src/models/Page.js
@@ -1,20 +1,22 @@
-const { Record } = require('immutable');
+const { Record, Map, fromJS } = require('immutable');
const DEFAULTS = {
- title: '',
- content: '',
- dir: 'ltr',
- depth: 1,
- level: '',
- previous: null,
- next: null
+ title: '',
+ content: '',
+ dir: 'ltr',
+ depth: 1,
+ level: '',
+ previous: null,
+ next: null,
+ attributes: Map()
};
class Page extends Record(DEFAULTS) {
static create(state) {
return state instanceof Page ?
state : new Page({
- ...state
+ ...state,
+ attributes: fromJS(state.attributes)
});
}
}