mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-03-21 14:22:44 +00:00
feat(core): Update to ckeditor 5. Fixes #5920. Encapsulate signature in raw-html-embed div when there are tables inside. Changed settings for raw html to enable preview.
This commit is contained in:
@@ -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 <div class="raw-html-embed">
|
||||
// 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:@"<table"].location != NSNotFound
|
||||
&& [[tmpIdentity objectForKey: @"signature"] rangeOfString:@"<figure class=\"table\""].location == NSNotFound
|
||||
&& [[tmpIdentity objectForKey: @"signature"] rangeOfString:@"raw-html-embed"].location == NSNotFound) {
|
||||
signature = [NSString stringWithFormat:@"<div class=\"raw-html-embed\">%@</div>", [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;
|
||||
|
||||
@@ -254,6 +254,9 @@
|
||||
}
|
||||
]
|
||||
};
|
||||
config.htmlEmbed = {
|
||||
showPreviews: true
|
||||
};
|
||||
config.image = {
|
||||
resizeUnit: "px",
|
||||
insert: {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user