1
- import {
2
- HtmlMailField ,
3
- htmlMailField ,
4
- } from "@mail/views/web/fields/html_mail_field/html_mail_field" ;
5
1
import { registry } from "@web/core/registry" ;
6
2
import { LocalOverlayContainer } from "@html_editor/local_overlay_container" ;
7
3
import { MassMailingIframe } from "@mass_mailing/iframe/mass_mailing_iframe" ;
@@ -15,11 +11,12 @@ import { normalizeHTML, parseHTML } from "@html_editor/utils/html";
15
11
import { Deferred , Race } from "@web/core/utils/concurrency" ;
16
12
import { MAIN_PLUGINS as MAIN_EDITOR_PLUGINS } from "@html_editor/plugin_sets" ;
17
13
import { DynamicPlaceholderPlugin } from "@html_editor/others/dynamic_placeholder_plugin" ;
14
+ import { getCSSRules , toInline } from "@mail/views/web/fields/html_mail_field/convert_inline" ;
18
15
19
- export class MassMailingHtmlField extends HtmlMailField {
16
+ export class MassMailingHtmlField extends HtmlField {
20
17
static template = "mass_mailing.HtmlField" ;
21
18
static components = {
22
- ...HtmlMailField . components ,
19
+ ...HtmlField . components ,
23
20
LocalOverlayContainer,
24
21
MassMailingIframe,
25
22
ThemeSelector,
@@ -265,9 +262,9 @@ export class MassMailingHtmlField extends HtmlMailField {
265
262
const processingEl = this . iframeRef . el . contentDocument . createElement ( "DIV" ) ;
266
263
processingEl . append ( parseHTML ( this . iframeRef . el . contentDocument , value ) ) ;
267
264
this . insertForInlineProcessing ( processingEl ) ;
268
- const inlineValue = (
269
- await HtmlMailField . getInlineHTML ( processingEl , this . iframeRef . el . contentDocument )
270
- ) . innerHTML ;
265
+ const cssRules = getCSSRules ( this . iframeRef . el . contentDocument ) ;
266
+ await toInline ( processingEl , cssRules ) ;
267
+ const inlineValue = processingEl . innerHTML ;
271
268
processingEl . remove ( ) ;
272
269
if ( shouldRestoreDisplayNone ) {
273
270
this . iframeRef . el . classList . add ( "d-none" ) ;
@@ -283,7 +280,7 @@ export class MassMailingHtmlField extends HtmlMailField {
283
280
}
284
281
285
282
export const massMailingHtmlField = {
286
- ...htmlMailField ,
283
+ ...htmlField ,
287
284
component : MassMailingHtmlField ,
288
285
// TODO EGGMAIL decide which options we want in extractProps?
289
286
extractProps ( { attrs, options } ) {
0 commit comments