File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change 2525 knowl . knowlModal . setAttribute ( 'aria-hidden' , 'true' ) ;
2626
2727 const knowlDialog = document . createElement ( 'div' ) ;
28- knowlDialog . classList . add ( 'modal-dialog' , 'modal-dialog-centered' , 'modal-dialog-scrollable' ) ;
28+ knowlDialog . classList . add (
29+ 'knowl-dialog' ,
30+ 'modal-dialog' ,
31+ 'modal-dialog-centered' ,
32+ 'modal-dialog-scrollable'
33+ ) ;
34+ knowlDialog . dataset . iframeHeight = '1' ;
2935 knowl . knowlModal . append ( knowlDialog ) ;
3036
3137 const knowlContent = document . createElement ( 'div' ) ;
6066 knowlContent . append ( knowlFooter ) ;
6167 }
6268
63- // Insert the knowl modal into the end of the closest div ancestor.
64- // If no such element is found, there is not much else that can be done, so just bail.
65- const insertElt = knowl . closest ( 'div' ) ;
66- if ( insertElt ) insertElt . append ( knowl . knowlModal ) ;
67- else return ;
69+ knowl . knowlModal . addEventListener ( 'shown.bs.modal' , ( ) => {
70+ const heightAdjust = Math . min (
71+ 600 ,
72+ knowlBody . scrollHeight +
73+ knowlHeader . offsetHeight +
74+ ( knowlContent . querySelector ( '.modal-footer' ) ?. offsetHeight || 0 )
75+ ) ;
76+ if ( knowlDialog . offsetHeight < heightAdjust ) knowlDialog . style . height = `${ heightAdjust } px` ;
77+ } ) ;
78+
79+ document . body . append ( knowl . knowlModal ) ;
6880
6981 knowl . dataset . bsTarget = `#${ knowl . knowlModal . id } ` ;
7082
You can’t perform that action at this time.
0 commit comments