File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 "attachment_preview/static/src/js/utils.esm.js" ,
2020 "attachment_preview/static/src/js/mail_core/attachment_list.esm.js" ,
2121 "attachment_preview/static/src/js/web_views/fields/binary_field.esm.js" ,
22- "attachment_preview/static/src/js/web_views/form/form_renderer.esm.js" ,
2322 "attachment_preview/static/src/js/web_views/form/form_compiler.esm.js" ,
23+ "attachment_preview/static/src/js/web_views/form/form_controller.esm.js" ,
24+ "attachment_preview/static/src/js/web_views/form/form_renderer.esm.js" ,
2425 "attachment_preview/static/src/scss/attachment_preview.scss" ,
2526 "attachment_preview/static/src/xml/attachment_preview.xml" ,
2627 ],
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ export class AttachmentPreviewWidget extends Component {
1212 ( { detail : { attachment_id, attachment_info_list} } ) =>
1313 this . _onAttachmentPreview ( attachment_id , attachment_info_list )
1414 ) ;
15+ Component . env . bus . addEventListener ( "hide_attachment_preview" , this . hide ) ;
1516 this . state = useState ( { activeIndex : 0 } ) ;
16- this . rootRef = useRef ( "root" ) ;
1717 this . currentRef = useRef ( "current" ) ;
1818 this . iframeRef = useRef ( "iframe" ) ;
1919 onWillStart ( async ( ) => {
@@ -60,13 +60,11 @@ export class AttachmentPreviewWidget extends Component {
6060 }
6161
6262 show ( ) {
63- $ ( this . rootRef . el ) . removeClass ( "d-none" ) ;
64- Component . env . bus . trigger ( "shown" ) ;
63+ $ ( ".attachment_preview_widget" ) . removeClass ( "d-none" ) ;
6564 }
6665
6766 hide ( ) {
68- $ ( this . rootRef . el ) . addClass ( "d-none" ) ;
69- Component . env . bus . trigger ( "hidden" ) ;
67+ $ ( ".attachment_preview_widget" ) . addClass ( "d-none" ) ;
7068 }
7169
7270 updatePaginator ( ) {
Original file line number Diff line number Diff line change 1+ import { FormController } from "@web/views/form/form_controller" ;
2+ import { patch } from "@web/core/utils/patch" ;
3+
4+ patch ( FormController . prototype , {
5+ onWillLoadRoot ( nextConfiguration ) {
6+ super . onWillLoadRoot ( ...arguments ) ;
7+ const isSameThread =
8+ this . model . root ?. resId === nextConfiguration . resId &&
9+ this . model . root ?. resModel === nextConfiguration . resModel ;
10+ if ( ! isSameThread ) {
11+ this . env . bus . trigger ( "hide_attachment_preview" ) ;
12+ }
13+ } ,
14+ } ) ;
Original file line number Diff line number Diff line change 1111 left : 65.3% ;
1212 width : 100% ;
1313 height : 100% ;
14- z-index : 10 ;
14+ z-index : 20 ;
1515 }
1616 .attachment_preview_iframe {
1717 width : 36% ;
Original file line number Diff line number Diff line change 3939 </t >
4040
4141 <t t-name =" attachment_preview.AttachmentPreviewWidget" >
42- <div class =" attachment_preview_widget d-none" t-ref = " root " >
42+ <div class =" attachment_preview_widget d-none" >
4343 <div class =" attachment_preview_buttons" >
4444 <div class =" button-group pull-left" >
4545 <button
You can’t perform that action at this time.
0 commit comments