diff --git a/source/nodejs/adaptivecards-designer/src/card-designer.ts b/source/nodejs/adaptivecards-designer/src/card-designer.ts index f55fc29100..17cd44d056 100644 --- a/source/nodejs/adaptivecards-designer/src/card-designer.ts +++ b/source/nodejs/adaptivecards-designer/src/card-designer.ts @@ -1729,6 +1729,43 @@ export class CardDesigner extends Designer.DesignContext { this.setCardPayload(card, true); } + public configHostContainer(hostApp: number, theme: string, size: string, deviceEmulation: number){ + if (hostApp && 0 <= hostApp && hostApp < this._hostContainers.length + && this._hostContainerChoicePicker.selectedIndex !== hostApp) { + this._hostContainerChoicePicker.selectedIndex = hostApp; + } + + if (!!this.hostContainer.supportsMultipleThemes) { + if (!this.sampleHostData) { + this.sampleHostData = {}; + } + if (theme && HostContainer.supportedContainerThemes.includes(theme)) { + this._containerThemeChoicePicker.selectedIndex = HostContainer.supportedContainerThemes.indexOf(theme); + } + this.updateHostDataThemeProperty(); + } + + if (!!this.hostContainer.supportsMultipleSizes) { + if (!this.sampleHostData) { + this.sampleHostData = {}; + } + if (size && WidgetContainer.supportedContainerSizes.includes(size)) { + this._containerSizeChoicePicker.selectedIndex = WidgetContainer.supportedContainerSizes.indexOf(size); + } + this.updateHostDataSizeProperty(); + } + + if (deviceEmulation && !!this._hostContainer.enableDeviceEmulation && 0 <= deviceEmulation && deviceEmulation < this._deviceEmulations.length && + this._deviceEmulationChoicePicker.selectedIndex !== deviceEmulation) { + this._deviceEmulationChoicePicker.selectedIndex = deviceEmulation; + } + } + + public togglePreviewButton() { + this._togglePreviewButton.isToggled = true; + this.togglePreview(); + } + onCardPayloadChanged: (designer: CardDesigner) => void; onCardValidated: (designer: CardDesigner, validationLogEntries: Adaptive.IValidationEvent[]) => void; onActiveHostContainerChanged: (designer: CardDesigner) => void; diff --git a/source/nodejs/adaptivecards-site/themes/adaptivecards/layout/designer.ejs b/source/nodejs/adaptivecards-site/themes/adaptivecards/layout/designer.ejs index 7aa684a421..40d94d72a5 100644 --- a/source/nodejs/adaptivecards-site/themes/adaptivecards/layout/designer.ejs +++ b/source/nodejs/adaptivecards-site/themes/adaptivecards/layout/designer.ejs @@ -308,6 +308,12 @@ }); } designer.sampleHostData = {}; + + designer.configHostContainer(parseInt(getParameterByName("hostApp")), getParameterByName("theme"), getParameterByName("size"), parseInt(getParameterByName("deviceEmulation"))); + + if (getParameterByName("preview") === "1") { + designer.togglePreviewButton(); + } } if (!ACDesigner.SettingsManager.isLocalStorageAvailable) {