Skip to content

Commit

Permalink
Merge pull request #1425 from araver/master
Browse files Browse the repository at this point in the history
Add Sample Data to Adaptive Card Editor
  • Loading branch information
joelfmrodrigues committed Feb 13, 2023
2 parents 7112cbd + 7d033e5 commit 53aa3a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export const AdaptiveCardDesigner = (props: IAdaptiveCardDesignerHostProps): JSX
props.context);

convertNullToEmptyString(dataObject);
cardDesigner.sampleData = dataObject?.$root || {};
cardDesigner.dataStructure = FieldDefinition.deriveFrom(dataObject.$root);
}, [isMonacoLoaded,
props.addDefaultAdaptiveCardHostContainer,
Expand Down
11 changes: 5 additions & 6 deletions src/controls/adaptiveCardHost/AdaptiveCardHost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,11 @@ export const AdaptiveCardHost = (props: IAdaptiveCardHostProps): JSX.Element =>
currentAdaptiveCard.parse(cardPayload, serializationContextInstanceRef.current);

const renderedElement = currentAdaptiveCard.render();
currentRenderElement.innerHTML = "";
currentRenderElement.appendChild(renderedElement);

// just for debugging pourpouse
console.log(evaluationContext);
// *****
// If this isn't acceptable, we should compare the old template with the new template
if (renderedElement.outerHTML !== currentRenderElement.innerHTML) {
currentRenderElement.innerHTML = "";
currentRenderElement.appendChild(renderedElement);
}
} catch (cardRenderError) {
if (props.onError) {
props.onError(cardRenderError);
Expand Down

0 comments on commit 53aa3a4

Please sign in to comment.