New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
on anchor clicked contract change #1924
on anchor clicked contract change #1924
Conversation
Currently, adaptiveCard instance is passed to handle anchor click. Change here is to pass text block element from which adaptiveCard instance can be derived
Please also update the visualizer application which uses this feature. |
function raiseAnchorClickedEvent(element: CardElement, anchor: HTMLAnchorElement): boolean { | ||
let card = element.getRootElement() as AdaptiveCard; | ||
function raiseAnchorClickedEvent(textBlock: TextBlock, anchor: HTMLAnchorElement): boolean { | ||
let card = textBlock.getRootElement() as AdaptiveCard; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to change this. Please keep it as CardElement. We may support inline actions in elements that are not TextBlock in the future.
@@ -5417,7 +5417,7 @@ export class AdaptiveCard extends ContainerWithActions { | |||
return true; | |||
} | |||
|
|||
onAnchorClicked: (rootCard: AdaptiveCard, anchor: HTMLAnchorElement) => boolean = null; | |||
onAnchorClicked: (textBlock: TextBlock, anchor: HTMLAnchorElement) => boolean = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be element: CardElement
@@ -5325,7 +5325,7 @@ export class AdaptiveCard extends ContainerWithActions { | |||
static readonly elementTypeRegistry = new ElementTypeRegistry(); | |||
static readonly actionTypeRegistry = new ActionTypeRegistry(); | |||
|
|||
static onAnchorClicked: (rootCard: AdaptiveCard, anchor: HTMLAnchorElement) => boolean = null; | |||
static onAnchorClicked: (textBlock: TextBlock, anchor: HTMLAnchorElement) => boolean = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be element: CardElement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix typo, otherwise looks good.
@@ -5325,7 +5325,7 @@ export class AdaptiveCard extends ContainerWithActions { | |||
static readonly elementTypeRegistry = new ElementTypeRegistry(); | |||
static readonly actionTypeRegistry = new ActionTypeRegistry(); | |||
|
|||
static onAnchorClicked: (textBlock: TextBlock, anchor: HTMLAnchorElement) => boolean = null; | |||
static onAnchorClicked: (elementd: CardElement, anchor: HTMLAnchorElement) => boolean = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elementd
--> element
Realized that changes are required in designer as well. Made the appropriate changes |
var regEx = /^action:([a-z0-9]+)$/ig; | ||
|
||
var rootCard = element.getRootElement(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check that this is an AdaptiveCard. getRootElement returns a CardElement.
var regEx = /^action:([a-z0-9]+)$/ig; | ||
var rootCard = element.getRootElement(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check that this is actually an AdaptiveCard instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making var rootCard = element.getRootElement() as AdaptiveCard works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that should be enough given there is a if (rootCard)
statement after.
Currently, adaptiveCard instance is passed to handle anchor click. Change here is to pass text block element from which adaptiveCard instance can be derived if required.