1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-18 20:59:43 +02:00

Merge pull request #377 from Ma27/preview-button-toggle

gui/editors: toggle Preview/Edit button
This commit is contained in:
Harvey Kandola 2020-11-12 18:57:42 +00:00 committed by GitHub
commit 972413110f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 3 deletions

View file

@ -14,7 +14,7 @@ version: "3"
services:
db:
image: postgres:latest
image: postgres:12
restart: always
ports:
- 5432:5432

View file

@ -27,6 +27,10 @@ export default Component.extend(Modals, Notifier, {
return `page-editor-${page.id}`;
}),
previewText: 'Preview',
previewIcon: computed('previewIcon', function () {
let constants = this.get('constants');
return constants.Icon.Preview;
}),
pageTitle: '',
didReceiveAttrs() {
@ -102,8 +106,10 @@ export default Component.extend(Modals, Notifier, {
},
onPreview() {
let constants = this.get('constants');
let pt = this.get('previewText');
this.set('previewText', pt === 'Preview' ? 'Edit Mode' : 'Preview');
this.set('previewIcon', pt === 'Preview' ? constants.Icon.Edit : constants.Icon.Preview);
return this.get('onPreview')();
},

View file

@ -39,6 +39,7 @@ export default Component.extend({
click(e) {
if (!_.isUndefined(this.onClick)) {
this.onClick(e);
this.notifyPropertyChange('calcClass');
return;
}

View file

@ -29,8 +29,8 @@
tooltip="Insert Link" onClick=(action "onShowLinkModal")}}
{{/if}}
{{#if previewButton}}
{{ui/ui-toolbar-icon icon=constants.Icon.Preview color=constants.Color.Gray
tooltip="Preview changes" onClick=(action "onPreview")}}
{{ui/ui-toolbar-icon icon=previewIcon color=constants.Color.Gray
tooltip=previewText onClick=(action "onPreview")}}
{{/if}}
{{ui/ui-toolbar-icon icon=constants.Icon.Tick color=constants.Color.Green tooltip="Save changes" onClick=(action "onAction")}}
{{ui/ui-toolbar-icon icon=constants.Icon.Cross color=constants.Color.Red tooltip="Cancel editing" onClick=(action "onCancel")}}