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"`
|
Permissions pm.Record `json:"permissions"`
|
||||||
Roles pm.DocumentRecord `json:"roles"`
|
Roles pm.DocumentRecord `json:"roles"`
|
||||||
Spaces []space.Space `json:"folders"`
|
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();
|
this.removeTooltips();
|
||||||
},
|
},
|
||||||
|
|
||||||
onDocumentPageAdded(pageId) {
|
onDocumentPageAdded(pageId) { // eslint-disable-line no-unused-vars
|
||||||
this.setSize();
|
this.setSize();
|
||||||
this.send('onGotoPage', pageId);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setSize() {
|
setSize() {
|
||||||
|
|
|
@ -53,6 +53,8 @@ export default Component.extend(TooltipMixin, {
|
||||||
this.setupAddWizard();
|
this.setupAddWizard();
|
||||||
this.renderTooltips();
|
this.renderTooltips();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.jumpToSection();
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement() {
|
willDestroyElement() {
|
||||||
|
@ -80,7 +82,9 @@ export default Component.extend(TooltipMixin, {
|
||||||
link.orphan = true;
|
link.orphan = true;
|
||||||
} else {
|
} else {
|
||||||
if (link.linkType === "section") {
|
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);
|
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: {
|
actions: {
|
||||||
onSavePageAsBlock(block) {
|
onSavePageAsBlock(block) {
|
||||||
let cb = this.get('onSavePageAsBlock');
|
let cb = this.get('onSavePageAsBlock');
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
// https://documize.com
|
// https://documize.com
|
||||||
|
|
||||||
import { Promise as EmberPromise } from 'rsvp';
|
import { Promise as EmberPromise } from 'rsvp';
|
||||||
import { schedule } from '@ember/runloop';
|
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
import Controller from '@ember/controller';
|
import Controller from '@ember/controller';
|
||||||
import TooltipMixin from '../../../mixins/tooltip';
|
import TooltipMixin from '../../../mixins/tooltip';
|
||||||
|
@ -20,8 +19,9 @@ export default Controller.extend(TooltipMixin, {
|
||||||
templateService: service('template'),
|
templateService: service('template'),
|
||||||
sectionService: service('section'),
|
sectionService: service('section'),
|
||||||
linkService: service('link'),
|
linkService: service('link'),
|
||||||
currentPageId: '',
|
// currentPageId: '',
|
||||||
tab: 'content',
|
tab: 'content',
|
||||||
|
queryParams: ['currentPageId'],
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onTabChange(tab) {
|
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 });
|
pendingChanges.push({ pageId: pages[i].get('page.id'), level: pages[i].get('page.level') - 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.set('currentPageId', null);
|
||||||
|
|
||||||
if (deleteChildren) {
|
if (deleteChildren) {
|
||||||
pendingChanges.push({ pageId: deleteId });
|
pendingChanges.push({ pageId: deleteId });
|
||||||
|
|
||||||
|
@ -117,7 +119,6 @@ export default Controller.extend(TooltipMixin, {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// page delete followed by re-leveling child pages
|
|
||||||
this.get('documentService').deletePage(documentId, deleteId).then(() => {
|
this.get('documentService').deletePage(documentId, deleteId).then(() => {
|
||||||
this.get('documentService').fetchPages(this.get('document.id'), this.get('session.user.id')).then((pages) => {
|
this.get('documentService').fetchPages(this.get('document.id'), this.get('session.user.id')).then((pages) => {
|
||||||
this.set('pages', pages);
|
this.set('pages', pages);
|
||||||
|
@ -144,10 +145,8 @@ export default Controller.extend(TooltipMixin, {
|
||||||
this.get('document.slug'),
|
this.get('document.slug'),
|
||||||
newPage.id);
|
newPage.id);
|
||||||
} else {
|
} else {
|
||||||
schedule('afterRender', () => {
|
this.set('currentPageId', newPage.id);
|
||||||
this.set('currentPageId', newPage.id);
|
resolve(newPage.id);
|
||||||
resolve(newPage.id);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,5 +57,10 @@ export default Route.extend(AuthenticatedRouteMixin, {
|
||||||
controller.set('permissions', model.permissions);
|
controller.set('permissions', model.permissions);
|
||||||
controller.set('roles', model.roles);
|
controller.set('roles', model.roles);
|
||||||
controller.set('blocks', model.blocks);
|
controller.set('blocks', model.blocks);
|
||||||
|
},
|
||||||
|
|
||||||
|
activate: function() {
|
||||||
|
this._super(...arguments);
|
||||||
|
window.scrollTo(0,0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,11 +38,12 @@
|
||||||
|
|
||||||
{{#if (eq tab 'content')}}
|
{{#if (eq tab 'content')}}
|
||||||
{{document/view-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
|
folder=folder folders=folders sections=sections permissions=permissions roles=roles
|
||||||
onSavePage=(action 'onSavePage') onInsertSection=(action 'onInsertSection')
|
onSavePage=(action 'onSavePage') onInsertSection=(action 'onInsertSection')
|
||||||
onSavePageAsBlock=(action 'onSavePageAsBlock') onDeleteBlock=(action 'onDeleteBlock')
|
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}}
|
||||||
|
|
||||||
{{#if (eq tab 'attachment')}}
|
{{#if (eq tab 'attachment')}}
|
||||||
|
|
|
@ -40,7 +40,7 @@ export default Controller.extend({
|
||||||
this.get('model.folder.slug'),
|
this.get('model.folder.slug'),
|
||||||
this.get('model.document.id'),
|
this.get('model.document.id'),
|
||||||
this.get('model.document.slug'),
|
this.get('model.document.slug'),
|
||||||
{ queryParams: { pageId: page.get('id')}});
|
{ queryParams: { currentPageId: page.get('id')}});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
table {
|
table {
|
||||||
border: 1px solid $color-border !important;
|
border: 1px solid $color-border !important;
|
||||||
|
|
||||||
|
th {
|
||||||
|
border: 1px solid $color-border !important;
|
||||||
|
}
|
||||||
|
|
||||||
td {
|
td {
|
||||||
padding: 5px 7px !important;
|
padding: 5px 7px !important;
|
||||||
border: 1px solid $color-border !important;
|
border: 1px solid $color-border !important;
|
||||||
|
|
|
@ -53,8 +53,8 @@
|
||||||
<div class="col content-linker-modal-container">
|
<div class="col content-linker-modal-container">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Search</label>
|
<label>Search</label>
|
||||||
<div class="tip">For content or attachments</div>
|
{{focus-input id="content-linker-search" type="input" class="form-control" value=keywords placeholder="keyword search" autocomplete="off"}}
|
||||||
{{focus-input id="content-linker-search" type="input" value=keywords placeholder="keyword search" autocomplete="off"}}
|
<small class="form-text text-muted">Document name, content, attachment name</small>
|
||||||
</div>
|
</div>
|
||||||
{{#unless hasMatches}}
|
{{#unless hasMatches}}
|
||||||
Nothing found.
|
Nothing found.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue