TF-753 Migrate enough_html_editor library to Linagora

This commit is contained in:
dab246
2022-08-08 13:17:22 +07:00
committed by Dat H. Pham
parent e6ad9e97ed
commit fd975fea91
4 changed files with 33 additions and 9 deletions
@@ -141,9 +141,6 @@ class ComposerController extends BaseController {
return newContentHtml; return newContentHtml;
} else { } else {
String contentHtml = await htmlEditorApi?.getText() ?? ''; String contentHtml = await htmlEditorApi?.getText() ?? '';
if(Platform.isAndroid) {
contentHtml = contentHtml.replaceAll('"', '"');
}
log('ComposerController::_getEmailBodyText():MOBILE: $contentHtml'); log('ComposerController::_getEmailBodyText():MOBILE: $contentHtml');
final newContentHtml = contentHtml.removeEditorStartTag(); final newContentHtml = contentHtml.removeEditorStartTag();
if (changedEmail) { if (changedEmail) {
@@ -670,6 +670,7 @@ class ComposerView extends GetWidget<ComposerController>
child: HtmlEditor( child: HtmlEditor(
key: const Key('composer_editor'), key: const Key('composer_editor'),
minHeight: 550, minHeight: 550,
addDefaultSelectionMenuItems: false,
initialContent: initialContent, initialContent: initialContent,
onCreated: (editorApi) { onCreated: (editorApi) {
richTextMobileTabletController.htmlEditorApi = editorApi; richTextMobileTabletController.htmlEditorApi = editorApi;
@@ -148,15 +148,41 @@ class RichTextMobileTabletController extends BaseRichTextController {
htmlEditorApi?.formatHeader(styleSelected.styleValue); htmlEditorApi?.formatHeader(styleSelected.styleValue);
} }
void applyParagraphType(ParagraphType newParagraph) { void applyParagraphType(ParagraphType newParagraph) async {
selectedParagraph.value = newParagraph; selectedParagraph.value = newParagraph;
htmlEditorApi?.execCommand(newParagraph.commandAction); switch(newParagraph) {
case ParagraphType.alignLeft:
await htmlEditorApi?.formatAlignLeft();
break;
case ParagraphType.alignRight:
await htmlEditorApi?.formatAlignRight();
break;
case ParagraphType.alignCenter:
await htmlEditorApi?.formatAlignCenter();
break;
case ParagraphType.justify:
await htmlEditorApi?.formatAlignJustify();
break;
case ParagraphType.indent:
await htmlEditorApi?.formatIndent();
break;
case ParagraphType.outdent:
await htmlEditorApi?.formatOutent();
break;
}
menuParagraphController.hideMenu(); menuParagraphController.hideMenu();
} }
void applyOrderListType(OrderListType newOrderList) { void applyOrderListType(OrderListType newOrderList) async {
selectedOrderList.value = newOrderList; selectedOrderList.value = newOrderList;
htmlEditorApi?.execCommand(newOrderList.commandAction); switch(newOrderList) {
case OrderListType.bulletedList:
await htmlEditorApi?.insertUnorderedList();
break;
case OrderListType.numberedList:
await htmlEditorApi?.insertOrderedList();
break;
}
menuOrderListController.hideMenu(); menuOrderListController.hideMenu();
} }
+2 -2
View File
@@ -124,8 +124,8 @@ dependencies:
# enough_html_editor: Compose email for Mobile & Tablet # enough_html_editor: Compose email for Mobile & Tablet
enough_html_editor: enough_html_editor:
git: git:
url: https://github.com/ManhNTX/enough_html_editor.git url: https://github.com/linagora/enough_html_editor.git
ref: improvements_for_use_tmail ref: email_supported
# html_editor_enhanced: Compose email for Web Browser # html_editor_enhanced: Compose email for Web Browser
html_editor_enhanced: html_editor_enhanced: