1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-21 22:29:41 +02:00

gui/editors: toggle Preview/Edit button

When hitting "Preview" on a previewable section (e.g. one with
markdown), the tooltip and icon of the preview-button still show
"Preview". With this change, both the text and the button will be
switched accordingly.
This commit is contained in:
Maximilian Bosch 2020-10-31 21:18:20 +01:00
parent 73e8c7a278
commit 9ed8f79315
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E
3 changed files with 9 additions and 2 deletions

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')();
},