diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 52a8c507b..622f15b51 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -1091,7 +1091,42 @@ static const NSString *kEncryptedUserNamePrefix = @"uenc"; } } - return mailAccounts; + // Patch for CKEditor 5 + // HTML Signatures with tables are broken with CKEditor 5 + // In this case, signatures may be encapsulated with a
+ // Details in https://bugs.sogo.nu/view.php?id=5920 + NSMutableArray *tmpMailAccounts, *tmpIdentities; + NSDictionary *account, *identities, *identity; + NSMutableDictionary *tmpAccount, *tmpIdentity; + NSString *signature; + + if (mailAccounts && [mailAccounts count] > 0) { + tmpMailAccounts = [NSMutableArray array]; + for (account in mailAccounts) { + tmpAccount = [NSMutableDictionary dictionaryWithDictionary: account]; + if ([account objectForKey: @"identities"]) { + identities = [account objectForKey: @"identities"]; + tmpIdentities = [NSMutableArray array]; + for (identity in identities) { + tmpIdentity = [NSMutableDictionary dictionaryWithDictionary: identity]; + if ([tmpIdentity objectForKey: @"signature"]) { + // Add raw html embed class + if ([[tmpIdentity objectForKey: @"signature"] rangeOfString:@"%@
", [tmpIdentity objectForKey: @"signature"]]; + [tmpIdentity setObject:signature forKey:@"signature"]; + } + } + [tmpIdentities addObject: tmpIdentity]; + } + [tmpAccount setObject:tmpIdentities forKey: @"identities"]; + } + [tmpMailAccounts addObject: tmpAccount]; + } + } + + return tmpMailAccounts; } - (NSDictionary *) accountWithName: (NSString *) accountName; diff --git a/UI/WebServerResources/js/Common/sgCkeditor.component.js b/UI/WebServerResources/js/Common/sgCkeditor.component.js index df84ae3b3..4a67d8472 100644 --- a/UI/WebServerResources/js/Common/sgCkeditor.component.js +++ b/UI/WebServerResources/js/Common/sgCkeditor.component.js @@ -254,6 +254,9 @@ } ] }; + config.htmlEmbed = { + showPreviews: true + }; config.image = { resizeUnit: "px", insert: { diff --git a/UI/WebServerResources/scss/views/AdministrationUI.scss b/UI/WebServerResources/scss/views/AdministrationUI.scss index a18a80933..ca5aaaf2b 100644 --- a/UI/WebServerResources/scss/views/AdministrationUI.scss +++ b/UI/WebServerResources/scss/views/AdministrationUI.scss @@ -10,4 +10,9 @@ .ck-editor__editable { min-height: 200px; } + + .ck-widget.raw-html-embed .raw-html-embed__preview-content>* { + margin-left: unset !important; + margin-right: unset !important; + } } \ No newline at end of file diff --git a/UI/WebServerResources/scss/views/MailerUI.scss b/UI/WebServerResources/scss/views/MailerUI.scss index 1d855b74e..7253d037f 100644 --- a/UI/WebServerResources/scss/views/MailerUI.scss +++ b/UI/WebServerResources/scss/views/MailerUI.scss @@ -423,4 +423,9 @@ md-dialog md-dialog-actions.sg-mail-editor-attachments { right: 0!important; left: auto!important; } + + .ck-widget.raw-html-embed .raw-html-embed__preview-content>* { + margin-left: unset!important; + margin-right: unset!important; + } } \ No newline at end of file diff --git a/UI/WebServerResources/scss/views/PreferencesUI.scss b/UI/WebServerResources/scss/views/PreferencesUI.scss index bebf96970..0930aa916 100644 --- a/UI/WebServerResources/scss/views/PreferencesUI.scss +++ b/UI/WebServerResources/scss/views/PreferencesUI.scss @@ -18,4 +18,9 @@ .ck-editor__editable { min-height: 70px; } + + .ck-widget.raw-html-embed .raw-html-embed__preview-content>* { + margin-left: unset!important; + margin-right: unset!important; + } } \ No newline at end of file