1515
1616import React , { useRef , useState } from "react"
1717
18- import { Button , Checkbox , Field , Input , Select , SelectTabData , SelectTabEvent , Tab , TabValue , makeStyles } from "@fluentui/react-components"
18+ import {
19+ Button ,
20+ Checkbox ,
21+ Field ,
22+ Select ,
23+ SelectTabData ,
24+ SelectTabEvent ,
25+ Tab ,
26+ TabValue ,
27+ makeStyles ,
28+ Textarea ,
29+ } from "@fluentui/react-components" ;
1930
2031import { AttrEditInput , CalloutEditProps , CalloutEditResult , CalloutProps , PandocAttr , UIToolsAttr } from "editor-types" ;
2132
@@ -32,10 +43,10 @@ import { useEffect } from "react";
3243
3344export function editCallout ( attrUITools : UIToolsAttr ) {
3445 return async ( props : CalloutEditProps , removeEnabled : boolean ) : Promise < CalloutEditResult | null > => {
35-
36- const values : EditCalloutDialogValues = {
37- values : { ...attrUITools . propsToInput ( props . attr ) , ...props . callout } ,
38- action : "edit"
46+
47+ const values : EditCalloutDialogValues = {
48+ values : { ...attrUITools . propsToInput ( props . attr ) , ...props . callout } ,
49+ action : "edit"
3950 } ;
4051
4152 const result = await showValueEditorDialog ( EditCalloutDialog , values , {
@@ -65,7 +76,7 @@ interface EditCalloutDialogOptions {
6576 removeEnabled : boolean ;
6677}
6778
68- const EditCalloutDialog : React . FC < {
79+ const EditCalloutDialog : React . FC < {
6980 values : EditCalloutDialogValues ,
7081 options : EditCalloutDialogOptions ,
7182 onClosed : ( values ?: EditCalloutDialogValues ) => void }
@@ -93,7 +104,7 @@ const EditCalloutDialog: React.FC<{
93104 }
94105 }
95106
96- const removeButton =
107+ const removeButton =
97108 < Button onClick = { ( ) => close ( { ...props . values , action : 'remove' } ) } >
98109 { t ( "Unwrap Div" ) }
99110 </ Button > ;
@@ -128,32 +139,36 @@ const EditCalloutDialog: React.FC<{
128139 </ Field >
129140 </ div >
130141 < Field label = { t ( "Caption" ) } placeholder = { t ( "(Optional)" ) } >
131- < Input value = { caption } onChange = { ( _ev , data ) => setCaption ( data . value ) } />
142+ < Textarea
143+ value = { caption }
144+ onChange = { ( _ev , data ) => setCaption ( data . value ) }
145+ resize = "vertical"
146+ />
132147 </ Field >
133- < Checkbox label = { t ( "Display icon alongside callout" ) } checked = { icon } onChange = { ( _ev , data ) => setIcon ( ! ! data . checked ) } />
148+ < Checkbox label = { t ( "Display icon alongside callout" ) } checked = { icon } onChange = { ( _ev , data ) => setIcon ( ! ! data . checked ) } />
134149 </ EditAttrPanel > ;
135150
136- const attributesPanel =
151+ const attributesPanel =
137152 < EditAttrPanel >
138153 < EditAttr value = { attr } onChange = { setAttr } />
139154 </ EditAttrPanel > ;
140155
141156 return (
142157 < ModalDialog
143- title = { t ( "Callout" ) }
158+ title = { t ( "Callout" ) }
144159 theme = { fluentTheme ( ) }
145- isOpen = { isOpen }
160+ isOpen = { isOpen }
146161 leftButtons = { props . options . removeEnabled ? removeButton : undefined }
147162 onOK = { ( ) => close ( { values : { ...attr , type, appearance, caption, icon} , action : 'edit' } ) }
148163 onCancel = { ( ) => close ( ) }
149164 >
150165 < ModalDialogTabList
151- id = "edit-callout"
152- selectedValue = { selectedTab }
166+ id = "edit-callout"
167+ selectedValue = { selectedTab }
153168 onTabSelect = { onTabSelect }
154169 >
155170 < Tab id = "callout" value = "callout" > { t ( "Callout" ) } </ Tab >
156- < Tab id = "attributes" value = "attributes" > { t ( "Attributes" ) } </ Tab >
171+ < Tab id = "attributes" value = "attributes" > { t ( "Attributes" ) } </ Tab >
157172 </ ModalDialogTabList >
158173 < div >
159174 { selectedTab === "callout" && calloutPanel }
@@ -173,4 +188,4 @@ const useStyles = makeStyles({
173188 width : '50%'
174189 }
175190 } ,
176- } )
191+ } )
0 commit comments