Skip to content

Commit

Permalink
#671 - Require login for PNG/Copy PNG actions
Browse files Browse the repository at this point in the history
  • Loading branch information
whimet committed Mar 2, 2024
1 parent 773195c commit 8c1b369
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/ContentWrap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ export default class ContentWrap extends Component {
trackEvent('ui', 'paneHeaderDblClick', codeWrapParent.dataset.type);
}
async exportPngClickHandler(e) {
if(!window.user) {
this.props.onLogin();
return;
}
const png = await this.getPngBlob();
saveAs(png, 'zenuml.png');
trackEvent('ui', 'downloadPng');
Expand All @@ -429,6 +433,10 @@ export default class ContentWrap extends Component {
}

async copyImageClickHandler(e) {
if(!window.user) {
this.props.onLogin();
return;
}
if (!navigator.clipboard || !navigator.clipboard.write) {
this.showCopyErrorNotice();
trackEvent('ui', 'copyImageFailed1');
Expand Down
4 changes: 4 additions & 0 deletions src/components/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,10 @@ BookLibService.Borrow(id) {
}
}
async openBtnClickHandler() {
if(!window.user) {
this.loginBtnClickHandler();
return;
}
trackEvent('ui', 'openBtnClick');
await this.openSavedItemsPane();
}
Expand Down

0 comments on commit 8c1b369

Please sign in to comment.