@@ -72,23 +72,32 @@ this.calendarItemDetails = class extends ExtensionAPI {
7272 const separatorCell = separator . appendChild ( document . createElementNS ( "http://www.w3.org/1999/xhtml" , "td" ) ) ;
7373 separatorCell . setAttribute ( "colspan" , "2" ) ;
7474
75+ // Fix an annoying bug, this should be part of a different patch
76+ document . getElementById ( "url-link" ) . style . maxWidth = "42em" ;
77+
7578 const browser = document . createXULElement ( "browser" ) ;
7679 browser . setAttribute ( "flex" , "1" ) ;
7780
78- // TODO The real version will need a max-height and auto-resizing
79- browser . style . height = "200px" ;
8081 browser . style . width = "100%" ;
8182 browser . style . display = "block" ;
8283
83- // Fix an annoying bug, this should be part of a different patch
84- document . getElementById ( "url-link" ) . style . maxWidth = "42em" ;
85-
86- const options = { maxWidth : null , fixedWidth : true } ;
87- setupE10sBrowser ( this . extension , browser , browserCell , options ) . then ( ( ) => {
88- const target = new URL ( this . extension . manifest . calendar_item_details . default_content ) ;
89- target . searchParams . set ( "area" , "inline" ) ;
90- browser . fixupAndLoadURIString ( target . href , { triggeringPrincipal : this . extension . principal } ) ;
91- } ) ;
84+ // Do this on the next tick so the column width is correctly calculated
85+ window . setTimeout ( ( ) => {
86+ const columnWidth = document . querySelector ( "#event-grid th" ) ?. offsetWidth || 0 ;
87+
88+ const options = { maxWidth : null , fixedWidth : true , maxHeight : 200 } ;
89+ setupE10sBrowser ( this . extension , browser , browserCell , options ) . then ( ( ) => {
90+ browser . messageManager . addMessageListener ( "Extension:BrowserResized" , function ( message ) {
91+ if ( message . data . detail == "delayed" ) {
92+ browser . style . height = `${ message . data . height } px` ;
93+ }
94+ } ) ;
95+ const target = new URL ( this . extension . manifest . calendar_item_details . default_content ) ;
96+ target . searchParams . set ( "area" , "inline" ) ;
97+ target . searchParams . set ( "columnWidth" , columnWidth ) ;
98+ browser . fixupAndLoadURIString ( target . href , { triggeringPrincipal : this . extension . principal } ) ;
99+ } ) ;
100+ } , 0 ) ;
92101 }
93102 } ) ;
94103
0 commit comments