1
1
import * as monacoLoader from '@monaco-editor/loader' ;
2
2
import { Versions } from 'adaptivecards' ;
3
3
import { BindingPreviewMode , CardDesigner , FieldDefinition , GlobalSettings , HostContainer , ToolbarChoicePicker } from 'adaptivecards-designer' ;
4
- import * as markdownit from " markdown-it" ;
4
+ import * as markdownit from ' markdown-it' ;
5
5
import { Spinner , SpinnerSize } from 'office-ui-fabric-react/lib/Spinner' ;
6
6
import * as React from 'react' ;
7
7
import { useEffect , useRef , useState } from 'react' ;
@@ -14,15 +14,15 @@ import { initializeDesignerPeers } from './fluentUI/peers/DesignerPeers';
14
14
import { IAdaptiveCardDesignerHostProps } from './IAdaptiveCardDesignerProps' ;
15
15
16
16
export const EmptyCard = {
17
- " $schema" : " http://adaptivecards.io/schemas/adaptive-card.json" ,
18
- " type" : " AdaptiveCard" ,
19
- " version" : " 1.5"
17
+ ' $schema' : ' http://adaptivecards.io/schemas/adaptive-card.json' ,
18
+ ' type' : ' AdaptiveCard' ,
19
+ ' version' : ' 1.5'
20
20
} ;
21
21
22
22
export const AdaptiveCardDesigner = ( props : IAdaptiveCardDesignerHostProps ) => {
23
23
const adaptiveCardDesignerInstanceRef = useRef < CardDesigner > ( null ) ;
24
24
const renderElementRef = useRef < HTMLDivElement > ( ) ;
25
- const currentBreakpointValueRef = useRef < string > ( " 100%" ) ;
25
+ const currentBreakpointValueRef = useRef < string > ( ' 100%' ) ;
26
26
const [ isMonacoLoaded , setIsMonacoLoaded ] = useState ( false ) ;
27
27
const monacoRef = useRef < HTMLDivElement > ( null ) ;
28
28
@@ -92,10 +92,10 @@ export const AdaptiveCardDesigner = (props: IAdaptiveCardDesignerHostProps) => {
92
92
93
93
if ( props . addDefaultAdaptiveCardHostContainer ) {
94
94
hosts . push ( ...[
95
- new AdaptiveCardHostContainer ( " ACH - Default" , AdaptiveCardHostContainerType . Default ) ,
96
- new AdaptiveCardHostContainer ( " ACH - Teams" , AdaptiveCardHostContainerType . TeamsDefault ) ,
97
- new AdaptiveCardHostContainer ( " ACH - Teams Dark" , AdaptiveCardHostContainerType . TeamsDark ) ,
98
- new AdaptiveCardHostContainer ( " ACH - Teams High Contrast" , AdaptiveCardHostContainerType . TeamsHighContrast )
95
+ new AdaptiveCardHostContainer ( ' ACH - Default' , AdaptiveCardHostContainerType . Default ) ,
96
+ new AdaptiveCardHostContainer ( ' ACH - Teams' , AdaptiveCardHostContainerType . TeamsDefault ) ,
97
+ new AdaptiveCardHostContainer ( ' ACH - Teams Dark' , AdaptiveCardHostContainerType . TeamsDark ) ,
98
+ new AdaptiveCardHostContainer ( ' ACH - Teams High Contrast' , AdaptiveCardHostContainerType . TeamsHighContrast )
99
99
] ) ;
100
100
}
101
101
@@ -105,12 +105,12 @@ export const AdaptiveCardDesigner = (props: IAdaptiveCardDesignerHostProps) => {
105
105
? props . bindingPreviewMode
106
106
: BindingPreviewMode . GeneratedData ;
107
107
108
- addToolbarButton ( cardDesigner , " New Card" , " acd-icon-newCard" ,
108
+ addToolbarButton ( cardDesigner , ' New Card' , ' acd-icon-newCard' ,
109
109
CardDesigner . ToolbarCommands . NewCard ,
110
110
true ,
111
111
CardDesigner . ToolbarCommands . NewCard ,
112
112
( sender ) => {
113
- let text = " Do you want to create a new Card?" ;
113
+ let text = ' Do you want to create a new Card?' ;
114
114
if ( confirm ( text ) == true ) {
115
115
cardDesigner . setCard ( ( props . newCardPayload ) ? props . newCardPayload : EmptyCard ) ;
116
116
cardDesigner . clearUndoStack ( ) ;
@@ -119,7 +119,7 @@ export const AdaptiveCardDesigner = (props: IAdaptiveCardDesignerHostProps) => {
119
119
} ) ;
120
120
121
121
if ( props . onSave ) {
122
- addToolbarButton ( cardDesigner , " Save" , " acd-icon-save" ,
122
+ addToolbarButton ( cardDesigner , ' Save' , ' acd-icon-save' ,
123
123
CardDesigner . ToolbarCommands . NewCard ,
124
124
true ,
125
125
null ,
@@ -130,15 +130,15 @@ export const AdaptiveCardDesigner = (props: IAdaptiveCardDesignerHostProps) => {
130
130
}
131
131
132
132
if ( props . showFluentBreakpointsPicker ) {
133
- addToolbarChoicePicker ( cardDesigner , CardDesigner . ToolbarCommands . HostAppPicker , true , " Breakpoints:" ,
133
+ addToolbarChoicePicker ( cardDesigner , CardDesigner . ToolbarCommands . HostAppPicker , true , ' Breakpoints:' ,
134
134
[
135
- { name : " Fluid (fit content)" , value : " 100%" } ,
136
- { name : " Small (>= 320px)" , value : " 320px" } ,
137
- { name : " Medium (>= 480px)" , value : " 480px" } ,
138
- { name : " Large (>= 640px)" , value : " 640px" } ,
139
- { name : " Extra large (>= 1024px)" , value : " 1024px" } ,
140
- { name : " Extra extra large (>= 1366px)" , value : " 1366px" } ,
141
- { name : " Extra extra extra large (>= 1920px)" , value : " 1920px" }
135
+ { name : ' Fluid (fit content)' , value : ' 100%' } ,
136
+ { name : ' Small (>= 320px)' , value : ' 320px' } ,
137
+ { name : ' Medium (>= 480px)' , value : ' 480px' } ,
138
+ { name : ' Large (>= 640px)' , value : ' 640px' } ,
139
+ { name : ' Extra large (>= 1024px)' , value : ' 1024px' } ,
140
+ { name : ' Extra extra large (>= 1366px)' , value : ' 1366px' } ,
141
+ { name : ' Extra extra extra large (>= 1920px)' , value : ' 1920px' }
142
142
] ,
143
143
( sender : ToolbarChoicePicker ) => {
144
144
currentBreakpointValueRef . current = sender . value ;
@@ -175,7 +175,7 @@ export const AdaptiveCardDesigner = (props: IAdaptiveCardDesignerHostProps) => {
175
175
console . log ( hostConfig ) ;
176
176
} ;
177
177
178
- cardDesigner . designerSurface . context . hostContainer . cardHost . style . width = " 100%" ;
178
+ cardDesigner . designerSurface . context . hostContainer . cardHost . style . width = ' 100%' ;
179
179
cardDesigner . dataToolbox . collapse ( ) ;
180
180
181
181
let data = ( props . data ) ? props . data : { $root : { } } ;
@@ -197,15 +197,15 @@ export const AdaptiveCardDesigner = (props: IAdaptiveCardDesignerHostProps) => {
197
197
{ ! isMonacoLoaded &&
198
198
< Spinner
199
199
style = { {
200
- display : " flex" ,
201
- justifyContent : " center" ,
202
- alignItems : " center" ,
203
- height : " 100%"
200
+ display : ' flex' ,
201
+ justifyContent : ' center' ,
202
+ alignItems : ' center' ,
203
+ height : ' 100%'
204
204
} }
205
205
size = { SpinnerSize . medium }
206
- label = " loading..."
207
- ariaLive = " assertive"
208
- labelPosition = " bottom" />
206
+ label = ' loading...'
207
+ ariaLive = ' assertive'
208
+ labelPosition = ' bottom' />
209
209
}
210
210
</ > ) ;
211
211
} ;
0 commit comments