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

Merge main to 22.09 branch and remove searchAndRemoveForbiddenElements #7873

Merged
merged 4 commits into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions source/nodejs/adaptivecards-designer/src/card-designer-surface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -965,25 +965,6 @@ export class CardDesignerSurface {
}
}

private searchAndRemoveForbiddenElements(peerToSearch: DesignerPeers.DesignerPeer, forbiddenElements: any) {
if (peerToSearch.children) {
// Remove forbidden elements
peerToSearch.children.filter((child) =>
(forbiddenElements.includes(child.getCardObject().getJsonTypeName())))
.forEach((e) => {
e.remove(false, true);
});
// If a peer is a container, we should see if it contains forbidden elements as well
peerToSearch.children.filter((child) =>
(child instanceof DesignerPeers.CardElementPeer
&& (child.cardElement instanceof Adaptive.Container || child.cardElement instanceof Adaptive.StylableCardElementContainer)))
.forEach((e) => {
this.searchAndRemoveForbiddenElements(e, forbiddenElements);
});
}

}

get rootPeer(): DesignerPeers.DesignerPeer {
return this._rootPeer;
}
Expand Down
4 changes: 2 additions & 2 deletions source/nodejs/adaptivecards/src/card-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ export class TextBlock extends BaseTextBlock {
// Markdown processing is handled outside of Adaptive Cards. It's up to the host to ensure that markdown is safely
// processed.
private static readonly _ttMarkdownPolicy = window.trustedTypes?.createPolicy(
"markdownPassthroughPolicy",
"adaptivecards#markdownPassthroughPolicy",
{ createHTML: (value) => value }
);

Expand All @@ -1117,7 +1117,7 @@ export class TextBlock extends BaseTextBlock {
// _originalInnerHtml so that we can restore/recalculate truncation later if space availability has changed (see
// TextBlock.restoreOriginalContent())
private static readonly _ttRoundtripPolicy = window.trustedTypes?.createPolicy(
"restoreContentsPolicy",
"adaptivecards#restoreContentsPolicy",
{ createHTML: (value) => value }
);

Expand Down
2 changes: 1 addition & 1 deletion source/nodejs/adaptivecards/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export function truncateText(element: HTMLElement, maxHeight: number, lineHeight
* TextBlock.truncateIfSupported}), but had a bug where it might actually pass through an element
* for which innerHTML yielded actual HTML (since fixed).
*/
const ttDeprecatedPolicy = window.trustedTypes?.createPolicy("deprecatedExportedFunctionPolicy", {
const ttDeprecatedPolicy = window.trustedTypes?.createPolicy("adaptivecards#deprecatedExportedFunctionPolicy", {
createHTML: (value) => value
});

Expand Down