@@ -364,6 +364,7 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
364364 const [ scheduleMenuAnchor , setScheduleMenuAnchor ] = useState < RectCords > ( ) ;
365365 const [ showSchedulePicker , setShowSchedulePicker ] = useState ( false ) ;
366366 const [ pollCreatorOpen , setPollCreatorOpen ] = useState ( false ) ;
367+ const [ attachMenuAnchor , setAttachMenuAnchor ] = useState < RectCords > ( ) ;
367368 const [ silentReply , setSilentReply ] = useState ( ! mentionInReplies ) ;
368369 const [ hour24Clock ] = useSetting ( settingsAtom , 'hour24Clock' ) ;
369370 const isEncrypted = room . hasEncryptionStateEvent ( ) ;
@@ -777,6 +778,12 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
777778 } else if ( commandName === Command . UnFlip ) {
778779 plainText = `${ UNFLIP } ${ plainText } ` ;
779780 customHtml = `${ UNFLIP } ${ customHtml } ` ;
781+ } else if ( commandName === Command . CreatePoll ) {
782+ setPollCreatorOpen ( true ) ;
783+ resetEditor ( editor ) ;
784+ resetEditorHistory ( editor ) ;
785+ sendTypingStatus ( false ) ;
786+ return ;
780787 } else if ( commandName ) {
781788 const commandContent = commands [ commandName as Command ] ;
782789 if ( commandContent ) {
@@ -1398,16 +1405,63 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
13981405 </ >
13991406 }
14001407 before = {
1401- < IconButton
1402- onClick = { ( ) => pickFile ( '*' ) }
1403- variant = "SurfaceVariant"
1404- size = "300"
1405- radii = "300"
1406- title = "Upload File"
1407- aria-label = "Upload and attach a File"
1408+ < PopOut
1409+ anchor = { attachMenuAnchor }
1410+ position = "Top"
1411+ align = "Start"
1412+ content = {
1413+ < FocusTrap
1414+ focusTrapOptions = { {
1415+ initialFocus : false ,
1416+ onDeactivate : ( ) => setAttachMenuAnchor ( undefined ) ,
1417+ clickOutsideDeactivates : true ,
1418+ escapeDeactivates : stopPropagation ,
1419+ } }
1420+ >
1421+ < Menu variant = "Surface" >
1422+ < div style = { { padding : config . space . S100 } } >
1423+ < MenuItem
1424+ size = "300"
1425+ radii = "300"
1426+ variant = "Surface"
1427+ before = { < Icon size = "100" src = { Icons . Attachment } /> }
1428+ onClick = { ( ) => {
1429+ setAttachMenuAnchor ( undefined ) ;
1430+ pickFile ( '*' ) ;
1431+ } }
1432+ >
1433+ < Text size = "T300" > Upload File</ Text >
1434+ </ MenuItem >
1435+ < MenuItem
1436+ size = "300"
1437+ radii = "300"
1438+ variant = "Surface"
1439+ before = { < Icon size = "100" src = { Icons . OrderList } /> }
1440+ onClick = { ( ) => {
1441+ setAttachMenuAnchor ( undefined ) ;
1442+ setPollCreatorOpen ( true ) ;
1443+ } }
1444+ >
1445+ < Text size = "T300" > Create Poll</ Text >
1446+ </ MenuItem >
1447+ </ div >
1448+ </ Menu >
1449+ </ FocusTrap >
1450+ }
14081451 >
1409- < Icon src = { Icons . PlusCircle } />
1410- </ IconButton >
1452+ < IconButton
1453+ onClick = { ( evt ) =>
1454+ setAttachMenuAnchor ( evt . currentTarget . getBoundingClientRect ( ) )
1455+ }
1456+ variant = "SurfaceVariant"
1457+ size = "300"
1458+ radii = "300"
1459+ title = "Attach"
1460+ aria-label = "Attach or create poll"
1461+ >
1462+ < Icon src = { Icons . PlusCircle } />
1463+ </ IconButton >
1464+ </ PopOut >
14111465 }
14121466 after = {
14131467 < >
@@ -1506,16 +1560,6 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
15061560 />
15071561 }
15081562 >
1509- < IconButton
1510- onClick = { ( ) => setPollCreatorOpen ( true ) }
1511- variant = "SurfaceVariant"
1512- size = "300"
1513- radii = "300"
1514- title = "Create poll"
1515- aria-label = "Create poll"
1516- >
1517- < Icon src = { Icons . OrderList } />
1518- </ IconButton >
15191563 { ! hideStickerBtn && (
15201564 < IconButton
15211565 aria-pressed = { emojiBoardTab === EmojiBoardTab . Sticker }
0 commit comments