Skip to content
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

Merged
merged 15 commits into from Sep 19, 2018

Conversation

dptejas
Copy link
Contributor

@dptejas dptejas commented Sep 19, 2018

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.

@dclaux
Copy link
Member

dclaux commented Sep 19, 2018

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;
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be element: CardElement

Copy link
Member

@dclaux dclaux left a 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elementd --> element

@dptejas
Copy link
Contributor Author

dptejas commented Sep 19, 2018

Please also update the visualizer application which uses this feature.

Realized that changes are required in designer as well. Made the appropriate changes

var regEx = /^action:([a-z0-9]+)$/ig;

var rootCard = element.getRootElement();
Copy link
Member

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();
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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.

@dclaux dclaux merged commit bf3f838 into microsoft:master Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants