TF-1877 Use execSummernoteAPI to format text style
(cherry picked from commit 6c81bef9a0cbe391ebf42096dc33ae0d99cf79c8)
This commit is contained in:
+82
-2
@@ -321,10 +321,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_keyboard_visibility
|
||||
sha256: "86b71bbaffa38e885f5c21b1182408b9be6951fd125432cf6652c636254cef2d"
|
||||
sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.4.0"
|
||||
version: "5.4.1"
|
||||
flutter_keyboard_visibility_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -386,6 +386,14 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_typeahead:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_typeahead
|
||||
sha256: f31211a8536f87908c3dcbdb88666e2f4d77f5f06c2b3a48eaad5599969ff32d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.6.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -599,6 +607,54 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
path_provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider
|
||||
sha256: "04890b994ee89bfa80bf3080bfec40d5a92c5c7a785ebb02c13084a099d2b6f9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.13"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: "2cec049d282c7f13c594b4a73976b0b4f2d7a1838a6dd5aaf7bd9719196bee86"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.27"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_foundation
|
||||
sha256: "1995d88ec2948dac43edf8fe58eb434d35d22a2940ecee1a9fefcd62beee6eb3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.3"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
sha256: ffbb8cc9ed2c9ec0e4b7a541e56fd79b138e8f47d2fb86815f15358a349b3b57
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.11"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
sha256: c2af5a8a6369992d915f8933dfc23172071001359d17896e83db8be57db8a397
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
sha256: "1cb68ba4cd3a795033de62ba1b7b4564dace301f952de6bfb3cd91b202b6ee96"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.7"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -607,6 +663,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -631,6 +695,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.5.1"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: process
|
||||
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.4"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -908,6 +980,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.1"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -134,9 +134,8 @@ class RichTextWebController extends BaseRichTextController {
|
||||
);
|
||||
break;
|
||||
default:
|
||||
editorController.execCommand(textStyleType.commandAction);
|
||||
editorController.execSummernoteAPI(textStyleType.summernoteNameAPI);
|
||||
_selectTextStyleType(textStyleType);
|
||||
editorController.setFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -146,8 +145,9 @@ class RichTextWebController extends BaseRichTextController {
|
||||
final colorAsString = newColor.toHexTriplet();
|
||||
log('RichTextWebController::_applyForegroundColor():colorAsString: $colorAsString');
|
||||
selectedTextColor.value = newColor;
|
||||
editorController.execCommand(RichTextStyleType.textColor.commandAction, argument: colorAsString);
|
||||
editorController.setFocus();
|
||||
editorController.execSummernoteAPI(
|
||||
RichTextStyleType.textColor.summernoteNameAPI,
|
||||
value: colorAsString);
|
||||
}
|
||||
|
||||
void applyBackgroundColor(Color? selectedColor) {
|
||||
@@ -155,8 +155,9 @@ class RichTextWebController extends BaseRichTextController {
|
||||
final colorAsString = newColor.toHexTriplet();
|
||||
log('RichTextWebController::_applyBackgroundColor():colorAsString: $colorAsString');
|
||||
selectedTextBackgroundColor.value = newColor;
|
||||
editorController.execCommand(RichTextStyleType.textBackgroundColor.commandAction, argument: colorAsString);
|
||||
editorController.setFocus();
|
||||
editorController.execSummernoteAPI(
|
||||
RichTextStyleType.textBackgroundColor.summernoteNameAPI,
|
||||
value: colorAsString);
|
||||
}
|
||||
|
||||
void _selectTextStyleType(RichTextStyleType textStyleType) {
|
||||
@@ -182,10 +183,9 @@ class RichTextWebController extends BaseRichTextController {
|
||||
void applyNewFontStyle(FontNameType? newFont) {
|
||||
final fontSelected = newFont ?? FontNameType.sansSerif;
|
||||
selectedFontName.value = fontSelected;
|
||||
editorController.execCommand(
|
||||
RichTextStyleType.fontName.commandAction,
|
||||
argument: fontSelected.value);
|
||||
editorController.setFocus();
|
||||
editorController.execSummernoteAPI(
|
||||
RichTextStyleType.fontName.summernoteNameAPI,
|
||||
value: fontSelected.value);
|
||||
}
|
||||
|
||||
bool get isMenuFontOpen => menuFontStatus.value == DropdownMenuFontStatus.open;
|
||||
@@ -220,17 +220,20 @@ class RichTextWebController extends BaseRichTextController {
|
||||
|
||||
void applyHeaderStyle(HeaderStyleType? newStyle) {
|
||||
final styleSelected = newStyle ?? HeaderStyleType.normal;
|
||||
editorController.execCommand(
|
||||
if (styleSelected == HeaderStyleType.blockquote || styleSelected == HeaderStyleType.code) {
|
||||
editorController.execCommand(
|
||||
RichTextStyleType.headerStyle.commandAction,
|
||||
argument: styleSelected.styleValue);
|
||||
editorController.setFocus();
|
||||
editorController.setFocus();
|
||||
} else {
|
||||
editorController.execSummernoteAPI(styleSelected.summernoteNameAPI);
|
||||
}
|
||||
}
|
||||
|
||||
void applyParagraphType(ParagraphType newParagraph) {
|
||||
selectedParagraph.value = newParagraph;
|
||||
editorController.execCommand(newParagraph.commandAction);
|
||||
editorController.execSummernoteAPI(newParagraph.summernoteNameAPI);
|
||||
menuParagraphController.hideMenu();
|
||||
editorController.setFocus();
|
||||
}
|
||||
|
||||
void closeAllMenuPopup() {
|
||||
@@ -250,9 +253,8 @@ class RichTextWebController extends BaseRichTextController {
|
||||
|
||||
void applyOrderListType(OrderListType newOrderList) {
|
||||
selectedOrderList.value = newOrderList;
|
||||
editorController.execCommand(newOrderList.commandAction);
|
||||
editorController.execSummernoteAPI(newOrderList.summernoteNameAPI);
|
||||
menuOrderListController.hideMenu();
|
||||
editorController.setFocus();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -58,6 +58,27 @@ enum HeaderStyleType {
|
||||
}
|
||||
}
|
||||
|
||||
String get summernoteNameAPI {
|
||||
switch (this) {
|
||||
case HeaderStyleType.normal:
|
||||
return 'formatPara';
|
||||
case HeaderStyleType.h1:
|
||||
return 'formatH1';
|
||||
case HeaderStyleType.h2:
|
||||
return 'formatH2';
|
||||
case HeaderStyleType.h3:
|
||||
return 'formatH3';
|
||||
case HeaderStyleType.h4:
|
||||
return 'formatH4';
|
||||
case HeaderStyleType.h5:
|
||||
return 'formatH5';
|
||||
case HeaderStyleType.h6:
|
||||
return 'formatH6';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
double get textSize {
|
||||
switch(this) {
|
||||
case HeaderStyleType.normal:
|
||||
|
||||
@@ -17,6 +17,15 @@ enum OrderListType {
|
||||
}
|
||||
}
|
||||
|
||||
String get summernoteNameAPI {
|
||||
switch(this) {
|
||||
case OrderListType.bulletedList:
|
||||
return 'insertUnorderedList';
|
||||
case OrderListType.numberedList:
|
||||
return 'insertOrderedList';
|
||||
}
|
||||
}
|
||||
|
||||
String getIcon(ImagePaths imagePaths) {
|
||||
switch (this) {
|
||||
case OrderListType.bulletedList:
|
||||
|
||||
@@ -29,6 +29,23 @@ enum ParagraphType {
|
||||
}
|
||||
}
|
||||
|
||||
String get summernoteNameAPI {
|
||||
switch(this) {
|
||||
case ParagraphType.alignLeft:
|
||||
return 'justifyLeft';
|
||||
case ParagraphType.alignRight:
|
||||
return 'justifyRight';
|
||||
case ParagraphType.alignCenter:
|
||||
return 'justifyCenter';
|
||||
case ParagraphType.justify:
|
||||
return 'justifyFull';
|
||||
case ParagraphType.indent:
|
||||
return 'indent';
|
||||
case ParagraphType.outdent:
|
||||
return 'outdent';
|
||||
}
|
||||
}
|
||||
|
||||
String getIcon(ImagePaths imagePaths) {
|
||||
switch (this) {
|
||||
case ParagraphType.alignLeft:
|
||||
|
||||
@@ -38,6 +38,27 @@ enum RichTextStyleType {
|
||||
}
|
||||
}
|
||||
|
||||
String get summernoteNameAPI {
|
||||
switch (this) {
|
||||
case RichTextStyleType.textColor:
|
||||
return 'foreColor';
|
||||
case RichTextStyleType.textBackgroundColor:
|
||||
return 'backColor';
|
||||
case RichTextStyleType.fontName:
|
||||
return 'fontName';
|
||||
case bold:
|
||||
return 'bold';
|
||||
case italic:
|
||||
return 'italic';
|
||||
case underline:
|
||||
return 'underline';
|
||||
case strikeThrough:
|
||||
return 'strikethrough';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
String getIcon(ImagePaths imagePaths) {
|
||||
switch (this) {
|
||||
case bold:
|
||||
|
||||
@@ -114,9 +114,9 @@ class ComposerStyle {
|
||||
static EdgeInsetsGeometry getEditorPadding(BuildContext context, ResponsiveUtils responsiveUtils) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
if (responsiveUtils.isMobile(context)) {
|
||||
return const EdgeInsetsDirectional.symmetric(horizontal: 16);
|
||||
return const EdgeInsetsDirectional.symmetric(horizontal: 6);
|
||||
} else {
|
||||
return const EdgeInsetsDirectional.only(start: 88, end: 48);
|
||||
return const EdgeInsetsDirectional.only(start: 78, end: 38);
|
||||
}
|
||||
} else {
|
||||
if (responsiveUtils.isPortraitMobile(context) || responsiveUtils.isLandscapeMobile(context)) {
|
||||
|
||||
+82
-2
@@ -321,10 +321,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_keyboard_visibility
|
||||
sha256: "86b71bbaffa38e885f5c21b1182408b9be6951fd125432cf6652c636254cef2d"
|
||||
sha256: "4983655c26ab5b959252ee204c2fffa4afeb4413cd030455194ec0caa3b8e7cb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.4.0"
|
||||
version: "5.4.1"
|
||||
flutter_keyboard_visibility_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -386,6 +386,14 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_typeahead:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_typeahead
|
||||
sha256: f31211a8536f87908c3dcbdb88666e2f4d77f5f06c2b3a48eaad5599969ff32d
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.6.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -576,6 +584,54 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
path_provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider
|
||||
sha256: "04890b994ee89bfa80bf3080bfec40d5a92c5c7a785ebb02c13084a099d2b6f9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.13"
|
||||
path_provider_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: "2cec049d282c7f13c594b4a73976b0b4f2d7a1838a6dd5aaf7bd9719196bee86"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.27"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_foundation
|
||||
sha256: "1995d88ec2948dac43edf8fe58eb434d35d22a2940ecee1a9fefcd62beee6eb3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.3"
|
||||
path_provider_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_linux
|
||||
sha256: ffbb8cc9ed2c9ec0e4b7a541e56fd79b138e8f47d2fb86815f15358a349b3b57
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.11"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_platform_interface
|
||||
sha256: c2af5a8a6369992d915f8933dfc23172071001359d17896e83db8be57db8a397
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
path_provider_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_windows
|
||||
sha256: "1cb68ba4cd3a795033de62ba1b7b4564dace301f952de6bfb3cd91b202b6ee96"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.7"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -584,6 +640,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -608,6 +672,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.5.1"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: process
|
||||
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.4"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -885,6 +957,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.1"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: xdg_directories
|
||||
sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
+1
-1
@@ -866,7 +866,7 @@ packages:
|
||||
description:
|
||||
path: "."
|
||||
ref: email_supported
|
||||
resolved-ref: "13e235943349c89ab0cf0c3e28233f02eba01ea6"
|
||||
resolved-ref: "6ff18272f3ffee6893c8cf59d1a014369789f3d1"
|
||||
url: "https://github.com/linagora/html-editor-enhanced.git"
|
||||
source: git
|
||||
version: "2.5.1"
|
||||
|
||||
Reference in New Issue
Block a user