mirror of
https://github.com/documize/community.git
synced 2025-07-21 22:29:41 +02:00
Scroll to correct point in document for edit mode
This commit is contained in:
parent
c0d70e38de
commit
412127811e
9 changed files with 35 additions and 16 deletions
|
@ -491,5 +491,5 @@ type BulkDocumentData struct {
|
|||
Permissions pm.Record `json:"permissions"`
|
||||
Roles pm.DocumentRecord `json:"roles"`
|
||||
Spaces []space.Space `json:"folders"`
|
||||
Links []link.Link `json:"link"`
|
||||
Links []link.Link `json:"links"`
|
||||
}
|
||||
|
|
|
@ -72,9 +72,8 @@ export default Component.extend(TooltipMixin, {
|
|||
this.removeTooltips();
|
||||
},
|
||||
|
||||
onDocumentPageAdded(pageId) {
|
||||
onDocumentPageAdded(pageId) { // eslint-disable-line no-unused-vars
|
||||
this.setSize();
|
||||
this.send('onGotoPage', pageId);
|
||||
},
|
||||
|
||||
setSize() {
|
||||
|
|
|
@ -53,6 +53,8 @@ export default Component.extend(TooltipMixin, {
|
|||
this.setupAddWizard();
|
||||
this.renderTooltips();
|
||||
}
|
||||
|
||||
this.jumpToSection();
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
|
@ -80,7 +82,9 @@ export default Component.extend(TooltipMixin, {
|
|||
link.orphan = true;
|
||||
} else {
|
||||
if (link.linkType === "section") {
|
||||
this.get('browser').scrollTo(`#page-${link.targetId}`);
|
||||
self.get('currentPageId', link.targetId)
|
||||
self.jumpToSection();
|
||||
// self.get('browser').scrollTo(`#page-${link.targetId}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,6 +151,13 @@ export default Component.extend(TooltipMixin, {
|
|||
return this.get('onInsertSection')(model);
|
||||
},
|
||||
|
||||
jumpToSection() {
|
||||
let cp = this.get('currentPageId');
|
||||
if (is.not.empty(cp) && is.not.undefined(cp) && is.not.null(cp)) {
|
||||
this.get('browser').scrollTo(`#page-${cp}`)
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
onSavePageAsBlock(block) {
|
||||
let cb = this.get('onSavePageAsBlock');
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
// https://documize.com
|
||||
|
||||
import { Promise as EmberPromise } from 'rsvp';
|
||||
import { schedule } from '@ember/runloop';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Controller from '@ember/controller';
|
||||
import TooltipMixin from '../../../mixins/tooltip';
|
||||
|
@ -20,8 +19,9 @@ export default Controller.extend(TooltipMixin, {
|
|||
templateService: service('template'),
|
||||
sectionService: service('section'),
|
||||
linkService: service('link'),
|
||||
currentPageId: '',
|
||||
// currentPageId: '',
|
||||
tab: 'content',
|
||||
queryParams: ['currentPageId'],
|
||||
|
||||
actions: {
|
||||
onTabChange(tab) {
|
||||
|
@ -108,6 +108,8 @@ export default Controller.extend(TooltipMixin, {
|
|||
pendingChanges.push({ pageId: pages[i].get('page.id'), level: pages[i].get('page.level') - 1 });
|
||||
}
|
||||
|
||||
this.set('currentPageId', null);
|
||||
|
||||
if (deleteChildren) {
|
||||
pendingChanges.push({ pageId: deleteId });
|
||||
|
||||
|
@ -117,7 +119,6 @@ export default Controller.extend(TooltipMixin, {
|
|||
});
|
||||
});
|
||||
} else {
|
||||
// page delete followed by re-leveling child pages
|
||||
this.get('documentService').deletePage(documentId, deleteId).then(() => {
|
||||
this.get('documentService').fetchPages(this.get('document.id'), this.get('session.user.id')).then((pages) => {
|
||||
this.set('pages', pages);
|
||||
|
@ -144,10 +145,8 @@ export default Controller.extend(TooltipMixin, {
|
|||
this.get('document.slug'),
|
||||
newPage.id);
|
||||
} else {
|
||||
schedule('afterRender', () => {
|
||||
this.set('currentPageId', newPage.id);
|
||||
resolve(newPage.id);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -57,5 +57,10 @@ export default Route.extend(AuthenticatedRouteMixin, {
|
|||
controller.set('permissions', model.permissions);
|
||||
controller.set('roles', model.roles);
|
||||
controller.set('blocks', model.blocks);
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
this._super(...arguments);
|
||||
window.scrollTo(0,0);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -38,11 +38,12 @@
|
|||
|
||||
{{#if (eq tab 'content')}}
|
||||
{{document/view-content
|
||||
document=document links=links pages=pages blocks=blocks
|
||||
document=document links=links pages=pages blocks=blocks currentPageId=currentPageId
|
||||
folder=folder folders=folders sections=sections permissions=permissions roles=roles
|
||||
onSavePage=(action 'onSavePage') onInsertSection=(action 'onInsertSection')
|
||||
onSavePageAsBlock=(action 'onSavePageAsBlock') onDeleteBlock=(action 'onDeleteBlock')
|
||||
onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onPageDeleted') refresh=(action 'refresh')}}
|
||||
onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onPageDeleted')
|
||||
refresh=(action 'refresh')}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq tab 'attachment')}}
|
||||
|
|
|
@ -40,7 +40,7 @@ export default Controller.extend({
|
|||
this.get('model.folder.slug'),
|
||||
this.get('model.document.id'),
|
||||
this.get('model.document.slug'),
|
||||
{ queryParams: { pageId: page.get('id')}});
|
||||
{ queryParams: { currentPageId: page.get('id')}});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
table {
|
||||
border: 1px solid $color-border !important;
|
||||
|
||||
th {
|
||||
border: 1px solid $color-border !important;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 5px 7px !important;
|
||||
border: 1px solid $color-border !important;
|
||||
|
|
|
@ -53,8 +53,8 @@
|
|||
<div class="col content-linker-modal-container">
|
||||
<div class="form-group">
|
||||
<label>Search</label>
|
||||
<div class="tip">For content or attachments</div>
|
||||
{{focus-input id="content-linker-search" type="input" value=keywords placeholder="keyword search" autocomplete="off"}}
|
||||
{{focus-input id="content-linker-search" type="input" class="form-control" value=keywords placeholder="keyword search" autocomplete="off"}}
|
||||
<small class="form-text text-muted">Document name, content, attachment name</small>
|
||||
</div>
|
||||
{{#unless hasMatches}}
|
||||
Nothing found.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue