<commit_before>import svg from '@proton/styles/assets/img/icons/email-sprite-icons.svg';
import { locateHead } from '../../../helpers/message/messageHead';
import { MessageState } from '../../../logic/messages/messagesTypes';
import { MESSAGE_IFRAME_ROOT_ID, MESSAGE_IFRAME_PRINT_HEADER_ID, MESSAGE_IFRAME_PRINT_FOOTER_ID } from '../constants';

import cssStyles from '../MessageIframe.raw.scss';

const getIframeHtml = (
    emailContent: string,
    message: MessageState,
    isPlainText: boolean,
    themeCSSVariables: string
) => {
    const messageHead = locateHead(message.messageDocument?.document) || '';

    const bodyStyles = message.messageDocument?.document?.querySelector('body')?.getAttribute('style');
    const bodyClasses = message.messageDocument?.document?.querySelector('body')?.getAttribute('class');

    // Plain text needs content needs to have no spaces in order to be correctly displayed
    if (isPlainText) {
        const emailHead = `<head><style>${themeCSSVariables}</style><style>${cssStyles}</style>${messageHead}</head>`;
        const emailBody = `<body><div id="${MESSAGE_IFRAME_ROOT_ID}" class="proton-plain-text"><div id="${MESSAGE_IFRAME_PRINT_HEADER_ID}"></div>${emailContent}</div></body>`;

        return `<html>${emailHead}${emailBody}</html>`;<commit_msg>Fix horizontal scrollbar override in plain text messages MAILWEB-3331<commit_after>import svg from '@proton/styles/assets/img/icons/email-sprite-icons.svg';
import { locateHead } from '../../../helpers/message/messageHead';
import { MessageState } from '../../../logic/messages/messagesTypes';
import { MESSAGE_IFRAME_ROOT_ID, MESSAGE_IFRAME_PRINT_HEADER_ID, MESSAGE_IFRAME_PRINT_FOOTER_ID } from '../constants';

import cssStyles from '../MessageIframe.raw.scss';

const getIframeHtml = (
    emailContent: string,
    message: MessageState,
    isPlainText: boolean,
    themeCSSVariables: string
) => {
    const messageHead = locateHead(message.messageDocument?.document) || '';

    const bodyStyles = message.messageDocument?.document?.querySelector('body')?.getAttribute('style');
    const bodyClasses = message.messageDocument?.document?.querySelector('body')?.getAttribute('class');

    /**
     * About this line:
     * <div style="width: 100% !important;padding-bottom:10px;!important">${emailContent}</div>
     * Padding bottom is needed for the scrollbar
     */
    // Plain text needs content needs to have no spaces in order to be correctly displayed
    if (isPlainText) {
        const emailHead = `<head><style>${themeCSSVariables}</style><style>${cssStyles}</style>${messageHead}</head>`;
        const emailBody = `<body><div id="${MESSAGE_IFRAME_ROOT_ID}" class="proton-plain-text"><div id="${MESSAGE_IFRAME_PRINT_HEADER_ID}"></div><div style="width: 100% !important;padding-bottom:10px;!important">${emailContent}</div></div></body>`;

        return `<html>${emailHead}${emailBody}</html>`;
{'fraction_non_alphanumeric': 0.15850736049298186, 'fraction_numerical': 0.004792879150975694, 'mean_word_length': 5.012345679012346, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5452546', 'n_tokens_mistral': 867, 'n_tokens_neox': 861, 'n_words': 162}