Skip to content

Commit e2fbc3d

Browse files
committed
Added comments to AdaptiveCardDesigner.Helpers.ts
1 parent f8e0c70 commit e2fbc3d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/controls/adaptiveCardDesignerHost/AdaptiveCardDesigner.Helpers.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
/* This file contains reusable functions useful for managing designer functionality */
2+
13
import { Guid } from '@microsoft/sp-core-library';
24
import { CardDesigner, IChoicePickerItem, SnippetPaletteItem, ToolbarButton, ToolbarChoicePicker } from "adaptivecards-designer";
35

6+
// Given the instance of a "CardDesigner", it allows you to hide an element of the toolbar given its id.
47
export const hideToolbarElement = (cardDesigner: CardDesigner, elementId: string) => {
58
cardDesigner.toolbar.getElementById(elementId).isVisible = false;
69
};
710

11+
// Given the instance of a "CardDesigner", it allows you to add an element in the toolbar.
812
export const addToolbarButton = (cardDesigner: CardDesigner, caption: string, iconClass: string, positionElementId: string, isAfter: true, hideElementId?: string, onClick?: (sender: ToolbarButton) => void): string => {
913
let id = `__${Guid.newGuid().toString()}_ToolbarButton`;
1014
let newToolbarButton = new ToolbarButton(
@@ -25,6 +29,7 @@ export const addToolbarButton = (cardDesigner: CardDesigner, caption: string, ic
2529
return id;
2630
};
2731

32+
// Given the instance of a "CarDesigner", it allows you to add a snippets to the toolbox.
2833
export const addToolboxSnippet = (cardDesigner: CardDesigner, category: string, name: string, payload: object) => {
2934
let newSnippet = new SnippetPaletteItem(category, name);
3035
newSnippet.snippet = payload;
@@ -35,6 +40,7 @@ export const addToolboxSnippet = (cardDesigner: CardDesigner, category: string,
3540
cardDesigner.customPaletteItems.push(newSnippet);
3641
};
3742

43+
// Given the instance of a "CarDesigner", it allows to add a "Choice Picker" to the toolbar
3844
export const addToolbarChoicePicker = (cardDesigner: CardDesigner,
3945
afterElementId: string,
4046
separator: boolean,
@@ -51,6 +57,7 @@ export const addToolbarChoicePicker = (cardDesigner: CardDesigner,
5157
return id;
5258
};
5359

60+
// Convert nulls to empty strings, used for binding with Adaptive Card Template
5461
export const convertNullToEmptyString = (object: any) => {
5562
for (var key in object) {
5663
if (null === object[key] || undefined === object[key]) object[key] = '';

0 commit comments

Comments
 (0)