Skip to content

Commit d3f10b7

Browse files
committed
feat: Switch to Custom config when config is changed
1 parent a8c1b73 commit d3f10b7

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ module.exports = new class Application extends MatreshkaObject {
6565
evt.preventDefault();
6666
const results = lint(this.code, this.toJSON());
6767

68-
this.set({ results })
69-
70-
console.log(results);
68+
this.set({ results });
7169
},
7270
'change:parserName': () => setParser(this.parserName),
73-
'rules@modify': evt => console.log('tablo')
71+
'rules@rulechange': () => {
72+
this.set('configName', '', { silent: true });
73+
}
7474
});
7575
}
7676
}

src/rules/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ export default class Rules extends MatreshkaArray {
1212
.calc('useRecommended', {
1313
object: parent,
1414
key: 'useRecommended'
15-
}, null, { debounceCalc: false });
16-
17-
this.recreate(plugins);
15+
}, null, { debounceCalc: false })
16+
.on({
17+
'*.*@rulechange': () => {
18+
this.trigger('rulechange')
19+
}
20+
})
21+
.recreate(plugins);
1822
}
1923

2024
update(rules) {

src/rules/rule.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default class Rule extends MatreshkaObject {
4040
source: 'dynamicValue',
4141
handler: value => JSON.stringify(value, null, '\t')
4242
}
43-
});
43+
})
44+
.on('click::isOn', () => this.trigger('rulechange'));
4445
}
4546
}

0 commit comments

Comments
 (0)