Improve HTML detection from templates

This commit is contained in:
Hillel Coren 2022-04-15 13:42:48 +03:00
parent 899238ce7c
commit e0135da65a
2 changed files with 3 additions and 3 deletions

View File

@ -155,7 +155,7 @@ class _InvoiceEmailViewState extends State<InvoiceEmailView>
final company = widget.viewModel.state.company; final company = widget.viewModel.state.company;
if (company.markdownEmailEnabled && if (company.markdownEmailEnabled &&
widget.viewModel.state.prefState.isDesktop && widget.viewModel.state.prefState.isDesktop &&
_rawBodyPreview.startsWith('<p>')) { _rawBodyPreview.trim().startsWith('<')) {
_rawBodyPreview = html2md.convert(_rawBodyPreview); _rawBodyPreview = html2md.convert(_rawBodyPreview);
} }
} }

View File

@ -147,7 +147,7 @@ class _TemplatesAndRemindersState extends State<TemplatesAndReminders>
if (viewModel.state.company.markdownEmailEnabled && if (viewModel.state.company.markdownEmailEnabled &&
widget.viewModel.state.prefState.isDesktop && widget.viewModel.state.prefState.isDesktop &&
_bodyController.text.startsWith('<p>')) { _bodyController.text.trim().startsWith('<')) {
_bodyController.text = html2md.convert(_bodyController.text); _bodyController.text = html2md.convert(_bodyController.text);
} }
@ -164,7 +164,7 @@ class _TemplatesAndRemindersState extends State<TemplatesAndReminders>
if (state.company.markdownEmailEnabled && if (state.company.markdownEmailEnabled &&
widget.viewModel.state.prefState.isDesktop && widget.viewModel.state.prefState.isDesktop &&
_defaultBody.startsWith('<p>')) { _defaultBody.trim().startsWith('<')) {
_defaultBody = html2md.convert(_defaultBody); _defaultBody = html2md.convert(_defaultBody);
} }
}); });