Skip to content

Commit 8c1b369

Browse files
committed
#671 - Require login for PNG/Copy PNG actions
1 parent 773195c commit 8c1b369

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/components/ContentWrap.jsx

+8
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ export default class ContentWrap extends Component {
414414
trackEvent('ui', 'paneHeaderDblClick', codeWrapParent.dataset.type);
415415
}
416416
async exportPngClickHandler(e) {
417+
if(!window.user) {
418+
this.props.onLogin();
419+
return;
420+
}
417421
const png = await this.getPngBlob();
418422
saveAs(png, 'zenuml.png');
419423
trackEvent('ui', 'downloadPng');
@@ -429,6 +433,10 @@ export default class ContentWrap extends Component {
429433
}
430434

431435
async copyImageClickHandler(e) {
436+
if(!window.user) {
437+
this.props.onLogin();
438+
return;
439+
}
432440
if (!navigator.clipboard || !navigator.clipboard.write) {
433441
this.showCopyErrorNotice();
434442
trackEvent('ui', 'copyImageFailed1');

src/components/app.jsx

+4
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,10 @@ BookLibService.Borrow(id) {
10301030
}
10311031
}
10321032
async openBtnClickHandler() {
1033+
if(!window.user) {
1034+
this.loginBtnClickHandler();
1035+
return;
1036+
}
10331037
trackEvent('ui', 'openBtnClick');
10341038
await this.openSavedItemsPane();
10351039
}

0 commit comments

Comments
 (0)