mirror of
https://github.com/documize/community.git
synced 2025-08-05 13:35:25 +02:00
implemented scroll-to-page functionality
This commit is contained in:
parent
9f7585e2a5
commit
079e53ff0d
12 changed files with 45 additions and 26 deletions
|
@ -72,6 +72,8 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
return;
|
||||
}
|
||||
|
||||
this.get('toEdit', '');
|
||||
// this.set('pageId', this.get('page.id'));
|
||||
this.set('editMode', true);
|
||||
},
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
actions: {
|
||||
onExpand() {
|
||||
this.set('pageId', this.get('page.id'));
|
||||
this.set('expanded', !this.get('expanded'));
|
||||
},
|
||||
|
||||
|
|
|
@ -33,16 +33,18 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
this._super(...arguments);
|
||||
|
||||
this.loadBlocks();
|
||||
|
||||
Ember.run.schedule('afterRender', () => {
|
||||
let jumpTo = "#page-" + this.get('pageId');
|
||||
if (!$(jumpTo).inView()) {
|
||||
$(jumpTo).velocity("scroll", { duration: 250, offset: -100 });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
didRender() {
|
||||
this._super(...arguments);
|
||||
|
||||
let jumpTo = this.get('pageId');
|
||||
if (is.not.empty(jumpTo) && is.not.undefined(jumpTo) && !$("#page-" + jumpTo).inView()) {
|
||||
$("#page-" + jumpTo).velocity("scroll", { duration: 250, offset: -100 });
|
||||
}
|
||||
|
||||
this.contentLinkHandler();
|
||||
},
|
||||
|
||||
|
@ -130,7 +132,6 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
model.page.level = level;
|
||||
|
||||
this.send('onHideSectionWizard');
|
||||
this.set('pageId', '');
|
||||
|
||||
return this.get('onInsertSection')(model);
|
||||
},
|
||||
|
@ -180,6 +181,8 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
page = { id: '0' };
|
||||
}
|
||||
|
||||
this.set('pageId', '');
|
||||
|
||||
let beforePage = this.get('beforePage');
|
||||
if (is.not.null(beforePage) && $("#new-section-wizard").is(':visible') && beforePage.get('id') === page.id) {
|
||||
this.send('onHideSectionWizard');
|
||||
|
@ -241,8 +244,12 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
const promise = this.addSection(model);
|
||||
promise.then((id) => {
|
||||
this.set('pageId', id);
|
||||
|
||||
if (model.page.pageType === 'section') {
|
||||
this.set('toEdit', id);
|
||||
} else {
|
||||
this.set('toEdit', '');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -279,8 +286,16 @@ export default Ember.Component.extend(NotifierMixin, TooltipMixin, {
|
|||
|
||||
this.audit.record("added-content-block-" + block.get('contentType'));
|
||||
|
||||
const promise = this.addSection(model);
|
||||
promise.then((id) => {
|
||||
this.set('pageId', id);
|
||||
|
||||
this.addSection(model);
|
||||
// if (model.page.pageType === 'section') {
|
||||
// this.set('toEdit', id);
|
||||
// } else {
|
||||
// this.set('toEdit', '');
|
||||
// }
|
||||
});
|
||||
},
|
||||
|
||||
onDeleteBlock(id) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue