question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Designer] How can I change the default card payload?

See original GitHub issue

I’m trying to use the Card Designer JS SDK in a product I’m working on, and I would like to change the default card payload that the designer is initialized with so that it is a blank card, instead of the “Publish Adaptive Card Schema” card.

I can’t set my own stored card payload with designer.setCard() until the Monaco Editor component gets initialized - require(['vs/editor/editor.main'], function () { designer.monacoModuleLoaded(); designer.setCard(card)}): - , so for half a second after the designer is attached it will show the default card from constants.ts.

This might be a little unusual because I am using OrchardCore, and so I’m pulling in their packaged version of Monaco, but going through the OrchardCore source it should be the same version.

I suppose I can wrap everything in a div and hide it until everything is initialized, but I would rather not do that.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
paulcam206commented, Apr 7, 2022

Sounds like this has been resolved. Please let us know if this doesn’t work for you. Thanks!

1reaction
licanhuacommented, Mar 31, 2022

@ericrrichards we don’t have API for you to change the default payload from code. I moved designer.attachTo(document.getElementById("designerRootHost")); into the require function, likely it avoids the problem in my testing.

			require(['vs/editor/editor.main'], function () {
				designer.attachTo(document.getElementById("designerRootHost"));
				designer.monacoModuleLoaded();
				designer.setCard(
				{
					type: "AdaptiveCard",
					version: "1.0",
					body: [
						{
							type: "TextBlock",
							text: "Hello world"
						}
					]
				}
			);
			});

Otherwise please try what @fabiofranzini mentioned, and it should work too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

edit default approval Adaptive Card - Office 365 Basics -
Go to https://adaptivecards.io/designer/ and paste the previously copied code into the Card Payload Editor. As soon as you change any ...
Read more >
Getting Started with Creating Adaptive Cards for ... - YouTube
This video will explain how to get started with making Adaptive Cards for Microsoft Teams. We will look at the overview of the...
Read more >
How To Create An Adaptive Card And Post An ... - YouTube
Specifically, this video is an adaptive card designer tutorial for ... Adaptive cards can be designed for and used in Microsoft Teams to...
Read more >
Having trouble with AdaptiveCard Designer accepting card ...
I've created a card in Designer, added it to my flow, and made changes as needed. I now need to troubleshoot some issues...
Read more >
Designing Adaptive Cards for your Microsoft Teams app
In this module, learn how to design Adaptive Cards for your Teams app and get the Microsoft Teams UI Kit.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found