AP.flag.create({}) receives the actions prop with events. On layout it is {actionName}. How can I change href to make ability to open link in new tab or change tag to button to remove the open in new tab
action from context menu?
Hello!
I don’t know if it fully answers your question but this snippet should allow opening new tab to external page:
var flag = AP.flag.create({
title: 'Successfully created a flag.',
body: 'This is a flag.',
type: 'success',
actions: {
'actionkey': 'Click me'
}
});
AP.events.on('flag.action', function(event){
if (event.actionIdentifier === ("actionkey")) {
window.open('https://www.atlassian.com', '_blank');
}
});
if you need to open the page relative to your Jira url then you could use this API: Navigator
Also there is some discussion about similar topic here: Show AP.flag with dynamic URL in action
Feel free to contact me if you have more questions.
Cheers!
Now I use this way. But I don’t like that the action context menu has the open in new tab
item. If user click it, he/she will not see an effect of the action. I think it must be a button, but not anchor