open external note action links in a new tab
This commit is contained in:
parent
4d419f6b1d
commit
46ef804ae4
|
@ -33,6 +33,18 @@ class InboxPanel extends Component {
|
||||||
this.props.updateCurrentUserData( userDataFields );
|
this.props.updateCurrentUserData( userDataFields );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleActionClick( event, note_id, action_id ) {
|
||||||
|
const { triggerNoteAction } = this.props;
|
||||||
|
const href = event.target.href || '';
|
||||||
|
|
||||||
|
if ( 'http' === href.substr( 0, 4 ).toLowerCase() ) {
|
||||||
|
event.preventDefault();
|
||||||
|
window.open( href, '_blank' );
|
||||||
|
}
|
||||||
|
|
||||||
|
triggerNoteAction( note_id, action_id );
|
||||||
|
}
|
||||||
|
|
||||||
renderEmptyCard() {
|
renderEmptyCard() {
|
||||||
return (
|
return (
|
||||||
<ActivityCard
|
<ActivityCard
|
||||||
|
@ -50,7 +62,7 @@ class InboxPanel extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderNotes() {
|
renderNotes() {
|
||||||
const { lastRead, notes, triggerNoteAction } = this.props;
|
const { lastRead, notes } = this.props;
|
||||||
|
|
||||||
if ( 0 === Object.keys( notes ).length ) {
|
if ( 0 === Object.keys( notes ).length ) {
|
||||||
return this.renderEmptyCard();
|
return this.renderEmptyCard();
|
||||||
|
@ -65,7 +77,7 @@ class InboxPanel extends Component {
|
||||||
isDefault
|
isDefault
|
||||||
isPrimary={ action.primary }
|
isPrimary={ action.primary }
|
||||||
href={ action.url || undefined }
|
href={ action.url || undefined }
|
||||||
onClick={ () => triggerNoteAction( note.id, action.id ) }
|
onClick={ e => this.handleActionClick( e, note.id, action.id ) }
|
||||||
>
|
>
|
||||||
{ action.label }
|
{ action.label }
|
||||||
</Button>
|
</Button>
|
||||||
|
|
Loading…
Reference in New Issue