Skip to content

Commit 2c51de3

Browse files
authored
Merge pull request #56 from modulor-js/fixes
Fixes
2 parents c806add + c91b53b commit 2c51de3

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

components/sandbox-manager/sandbox-manager.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const { Router } = require('modulor/router');
55
const { getStories } = require('../../js/story');
66
const Channel = require('../../js/channel');
77
const AddonsApi = require('../../addons');
8+
const { getDefaultParams } = require('../../js/config');
89

910
const template = require('./sandbox-manager.html');
1011

@@ -42,14 +43,13 @@ class ManagerApp extends HTMLElement {
4243

4344
const firstStory = stories[Object.keys(stories)[0]];
4445
const addonPanels = AddonsApi.getPanels();
46+
const defaultParams = getDefaultParams();
4547

46-
const DEFAULT_PARAMS = {
47-
width: 80,
48-
height: 75,
48+
const DEFAULT_PARAMS = Object.assign({}, defaultParams, {
4949
story: firstStory.storyName,
5050
storyKind: Object.keys(firstStory.getStories())[0],
5151
addon: Object.keys(addonPanels)[0],
52-
};
52+
});
5353

5454
this.router = new Router({
5555
base: window.location.pathname,
@@ -120,7 +120,7 @@ class ManagerApp extends HTMLElement {
120120
* here all routes changes will be observed
121121
* only query parameters will be used
122122
* */
123-
this.router.add('*', (path, query) => {
123+
this.router.add('(.*)', (path, query) => {
124124
// set sizes
125125
const width = Number(query.width);
126126
const height = Number(query.height);

js/config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const config = {
2+
width: 80,
3+
height: 75,
4+
};
5+
6+
module.exports = {
7+
getDefaultParams(){
8+
return Object.assign({}, config);
9+
},
10+
11+
setDefaultParams(params){
12+
return Object.assign(config, params);
13+
}
14+
}
15+

0 commit comments

Comments
 (0)