mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
parent
b8fee6b962
commit
9b82f42cc1
9 changed files with 1057 additions and 37 deletions
|
@ -13,11 +13,12 @@ import $ from 'jquery';
|
|||
import { computed, observer } from '@ember/object';
|
||||
import { debounce } from '@ember/runloop';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import ModalMixin from '../../mixins/modal';
|
||||
import tocUtil from '../../utils/toc';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend(ModalMixin, {
|
||||
export default Component.extend(Notifier, ModalMixin, {
|
||||
documentService: service('document'),
|
||||
searchService: service('search'),
|
||||
router: service(),
|
||||
|
@ -80,6 +81,29 @@ export default Component.extend(ModalMixin, {
|
|||
this.setState(this.get('page.id'));
|
||||
},
|
||||
|
||||
didInsertElement(){
|
||||
this._super(...arguments);
|
||||
|
||||
let pageId = this.get('page.id');
|
||||
let url = this.get('appMeta.appHost') +
|
||||
this.get('router').generate('document.index', {queryParams: {currentPageId: pageId}});
|
||||
let self = this;
|
||||
|
||||
let clip = new ClipboardJS('#page-copy-link-' + pageId, {
|
||||
text: function() {
|
||||
self.notifySuccess('Link copied to clipboard');
|
||||
return url;
|
||||
}
|
||||
});
|
||||
|
||||
this.set('clip', clip);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
let clip = this.get('clip');
|
||||
if (!_.isUndefined(clip)) clip.destroy();
|
||||
},
|
||||
|
||||
searchDocs() {
|
||||
let payload = { keywords: this.get('docSearchFilter').trim(), doc: true };
|
||||
if (payload.keywords.length == 0) return;
|
||||
|
@ -277,6 +301,15 @@ export default Component.extend(ModalMixin, {
|
|||
let cb = this.get('onPageLevelChange');
|
||||
cb(state.pageId, pendingChanges);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onExpand() {
|
||||
this.set('expanded', !this.get('expanded'));
|
||||
this.get('onExpand')(this.get('page.id'), this.get('expanded'));
|
||||
},
|
||||
|
||||
onCopyLink() {
|
||||
this.set('currentPageId', this.get('page.id'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -337,6 +337,7 @@ let constants = EmberObject.extend({
|
|||
Close: 'Close',
|
||||
Copy: 'Copy',
|
||||
Delete: 'Delete',
|
||||
Duplicate: 'Duplicate',
|
||||
Edit: 'Edit',
|
||||
Export: 'Export',
|
||||
File: 'File',
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<div class="sidebar-content">
|
||||
<Layout::Grid::SidebarGoTop />
|
||||
<Layout::Grid::SidebarCustomAction>
|
||||
<i class="dicon {{constants.Icon.Expand}} {{if (gt expandState.length 0) 'color-green-500'}}" {{action "onExpandAll"}}>
|
||||
<i class="dicon {{constants.Icon.Expand}} {{if (gt expandState.length 0) "color-green-500"}}" {{action "onExpandAll"}}>
|
||||
{{#attach-tooltip showDelay=750}}Expand/collapse{{/attach-tooltip}}
|
||||
</i>
|
||||
</Layout::Grid::SidebarCustomAction>
|
||||
|
|
|
@ -12,34 +12,35 @@
|
|||
</div>
|
||||
{{else}}
|
||||
<div class={{page.tocIndentCss}}>
|
||||
{{document/page-heading
|
||||
expanded=expanded
|
||||
page=page
|
||||
meta=meta
|
||||
pages=pages
|
||||
roles=roles
|
||||
folder=folder
|
||||
blocks=blocks
|
||||
tabMode=tabMode
|
||||
pending=pending
|
||||
document=document
|
||||
permissions=permissions
|
||||
onEdit=(action "onEdit")
|
||||
refresh=(action refresh)
|
||||
onExpand=(action onExpand)
|
||||
onCopyPage=(action "onCopyPage")
|
||||
onMovePage=(action "onMovePage")
|
||||
onDeletePage=(action "onDeletePage")
|
||||
onSavePageAsBlock=(action "onSavePageAsBlock")
|
||||
onPageLevelChange=(action onPageLevelChange)
|
||||
onPageSequenceChange=(action onPageSequenceChange)
|
||||
onShowSectionWizard=(action onShowSectionWizard)}}
|
||||
{{document/page-heading
|
||||
expanded=expanded
|
||||
page=page
|
||||
meta=meta
|
||||
pages=pages
|
||||
roles=roles
|
||||
folder=folder
|
||||
blocks=blocks
|
||||
tabMode=tabMode
|
||||
pending=pending
|
||||
document=document
|
||||
permissions=permissions
|
||||
currentPageId=currentPageId
|
||||
onEdit=(action "onEdit")
|
||||
refresh=(action refresh)
|
||||
onExpand=(action onExpand)
|
||||
onCopyPage=(action "onCopyPage")
|
||||
onMovePage=(action "onMovePage")
|
||||
onDeletePage=(action "onDeletePage")
|
||||
onSavePageAsBlock=(action "onSavePageAsBlock")
|
||||
onPageLevelChange=(action onPageLevelChange)
|
||||
onPageSequenceChange=(action onPageSequenceChange)
|
||||
onShowSectionWizard=(action onShowSectionWizard)}}
|
||||
|
||||
{{#if expanded}}
|
||||
<div class="wysiwyg">
|
||||
{{section/base-renderer page=page}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if expanded}}
|
||||
<div class="wysiwyg">
|
||||
{{section/base-renderer page=page}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
|
|
|
@ -8,14 +8,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="grid-cell-2 grid-cell-right grid-cell-middle">
|
||||
<div class="section-heading no-print" id="page-toolbar-{{ page.id }}">
|
||||
<div class="section-toolbar">
|
||||
<i class="dicon {{constants.Icon.Expand}} {{unless expanded "expand"}}" {{action "onExpand"}}>
|
||||
{{#attach-tooltip showDelay=1000}}Show/hide{{/attach-tooltip}}
|
||||
</i>
|
||||
<div class="section-heading no-print" id="page-toolbar-{{ page.id }}">
|
||||
<div class="section-toolbar">
|
||||
{{#unless (eq document.protection constants.ProtectionType.Lock)}}
|
||||
{{#if canEdit}}
|
||||
<div class="gap"/>
|
||||
<i class="add-section dicon {{constants.Icon.Plus}}" {{action "onShowSectionWizard" page}}>
|
||||
{{#attach-tooltip showDelay=1000}}Insert section above{{/attach-tooltip}}
|
||||
</i>
|
||||
|
@ -62,8 +58,16 @@
|
|||
</i>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
</div>
|
||||
<div class="gap"/>
|
||||
<i id="page-copy-link-{{page.id}}" class="dicon {{constants.Icon.Link}}" {{action "onCopyLink"}}>
|
||||
{{#attach-tooltip showDelay=1000}}Copy link{{/attach-tooltip}}
|
||||
</i>
|
||||
<div class="gap"/>
|
||||
<i class="dicon {{constants.Icon.Expand}} {{unless expanded "expand"}}" {{action "onExpand"}}>
|
||||
{{#attach-tooltip showDelay=1000}}Show/hide{{/attach-tooltip}}
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
pending=item.pending
|
||||
permissions=permissions
|
||||
attachments=attachments
|
||||
currentPageId=currentPageId
|
||||
refresh=(action refresh)
|
||||
onExpand=(action onExpand)
|
||||
onAttachmentUpload=(action onAttachmentUpload)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue