mirror of
https://github.com/documize/community.git
synced 2025-07-21 14:19:43 +02:00
use previous level for newly inserted section
This commit is contained in:
parent
3f109a9d1d
commit
f24eb5ad42
1 changed files with 5 additions and 0 deletions
|
@ -111,9 +111,13 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||||
addSection(model) {
|
addSection(model) {
|
||||||
// calculate sequence of page (position in document)
|
// calculate sequence of page (position in document)
|
||||||
let sequence = 0;
|
let sequence = 0;
|
||||||
|
let level = 1;
|
||||||
let beforePage = this.get('beforePage');
|
let beforePage = this.get('beforePage');
|
||||||
|
|
||||||
|
|
||||||
if (is.not.null(beforePage)) {
|
if (is.not.null(beforePage)) {
|
||||||
|
level = beforePage.get('level');
|
||||||
|
|
||||||
// get any page before the beforePage so we can insert this new section between them
|
// get any page before the beforePage so we can insert this new section between them
|
||||||
let index = _.findIndex(this.get('pages'), function(p) { return p.get('id') === beforePage.get('id'); });
|
let index = _.findIndex(this.get('pages'), function(p) { return p.get('id') === beforePage.get('id'); });
|
||||||
|
|
||||||
|
@ -129,6 +133,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
||||||
}
|
}
|
||||||
|
|
||||||
model.page.sequence = sequence;
|
model.page.sequence = sequence;
|
||||||
|
model.page.level = level;
|
||||||
|
|
||||||
this.send('onHideSectionWizard');
|
this.send('onHideSectionWizard');
|
||||||
this.set('pageId', '');
|
this.set('pageId', '');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue