File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1143,6 +1143,15 @@ <h3 data-i18n="modalTitle">连接 IMAP 邮箱</h3>
11431143 } ) ;
11441144}
11451145
1146+ window . addEventListener ( 'message' , function ( event ) {
1147+ if ( event . origin !== window . location . origin ) return ;
1148+ if ( event . data ?. type === 'manymail-lang-change' && event . data . lang ) {
1149+ currentLang = event . data . lang === 'en' ? 'en' : 'zh' ;
1150+ localStorage . setItem ( 'manymail-lang' , currentLang ) ;
1151+ applyLang ( ) ;
1152+ }
1153+ } ) ;
1154+
11461155async function api ( method , url , body ) {
11471156 const opts = { method, headers : { } } ;
11481157 if ( body ) {
Original file line number Diff line number Diff line change @@ -772,6 +772,13 @@ <h5 class="modal-title" id="composeModalLabel"><i class="bi bi-pencil-square me-
772772 currentLang = currentLang === 'zh' ? 'en' : 'zh' ;
773773 localStorage . setItem ( 'manymail-lang' , currentLang ) ;
774774 applyLang ( ) ;
775+ const imapFrame = document . getElementById ( 'imap-frame' ) ;
776+ try {
777+ imapFrame ?. contentWindow ?. postMessage ( {
778+ type : 'manymail-lang-change' ,
779+ lang : currentLang ,
780+ } , window . location . origin ) ;
781+ } catch ( e ) { }
775782 // re-render dynamic content
776783 if ( currentMessages . length > 0 && currentTab === 'inbox' ) renderMessages ( currentMessages ) ;
777784 if ( currentSentMessages . length > 0 && currentTab === 'sent' ) renderSentMessages ( currentSentMessages ) ;
You can’t perform that action at this time.
0 commit comments