mirror of
https://github.com/mautic/mautic.git
synced 2025-11-21 19:03:25 +08:00
Compare commits
3 commits
895e73f3b3
...
44260f75b5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44260f75b5 | ||
|
|
8faefd6393 | ||
|
|
01f7a564b0 |
3 changed files with 17 additions and 4 deletions
|
|
@ -261,10 +261,10 @@ Mautic.ConvertFieldToCkeditor = function(textarea, ckEditorToolbarOptions) {
|
||||||
ckEditors.delete( textarea[0] )
|
ckEditors.delete( textarea[0] )
|
||||||
}
|
}
|
||||||
const tokenCallback = textarea.attr('data-token-callback');
|
const tokenCallback = textarea.attr('data-token-callback');
|
||||||
Mautic.InitCkEditor(textarea, Mautic.GetCkEditorConfigOptions(ckEditorToolbarOptions, tokenCallback));
|
Mautic.InitCkEditor(textarea, Mautic.GetCkEditorConfigOptions(ckEditorToolbarOptions, tokenCallback, textarea));
|
||||||
}
|
}
|
||||||
|
|
||||||
Mautic.GetCkEditorConfigOptions = function(ckEditorToolbarOptions, tokenCallback) {
|
Mautic.GetCkEditorConfigOptions = function(ckEditorToolbarOptions, tokenCallback, textarea = null) {
|
||||||
const defaultOptions = ['undo', 'redo', '|', 'bold', 'italic', 'underline', 'heading', 'fontfamily', 'fontsize', 'fontColor', 'fontBackgroundColor', 'alignment', 'numberedList', 'bulletedList', 'blockQuote', 'removeFormat', 'link', 'ckfinder', 'mediaEmbed', 'insertTable', 'sourceEditing'];
|
const defaultOptions = ['undo', 'redo', '|', 'bold', 'italic', 'underline', 'heading', 'fontfamily', 'fontsize', 'fontColor', 'fontBackgroundColor', 'alignment', 'numberedList', 'bulletedList', 'blockQuote', 'removeFormat', 'link', 'ckfinder', 'mediaEmbed', 'insertTable', 'sourceEditing'];
|
||||||
const ckEditorToolbar = typeof ckEditorToolbarOptions != "undefined" && ckEditorToolbarOptions.length > 0 ? ckEditorToolbarOptions : defaultOptions;
|
const ckEditorToolbar = typeof ckEditorToolbarOptions != "undefined" && ckEditorToolbarOptions.length > 0 ? ckEditorToolbarOptions : defaultOptions;
|
||||||
const ckEditorColors = [
|
const ckEditorColors = [
|
||||||
|
|
@ -284,6 +284,7 @@ Mautic.GetCkEditorConfigOptions = function(ckEditorToolbarOptions, tokenCallbac
|
||||||
{ color: '#4c4ce6', label: 'Blue' },
|
{ color: '#4c4ce6', label: 'Blue' },
|
||||||
{ color: '#994ce6', label: 'Purple' }
|
{ color: '#994ce6', label: 'Purple' }
|
||||||
];
|
];
|
||||||
|
const allowFullHtml = textarea && typeof textarea.attr('allow-full-html') !== 'undefined';
|
||||||
const ckEditorOption = {
|
const ckEditorOption = {
|
||||||
toolbar: {
|
toolbar: {
|
||||||
items: ckEditorToolbar,
|
items: ckEditorToolbar,
|
||||||
|
|
@ -328,7 +329,18 @@ Mautic.GetCkEditorConfigOptions = function(ckEditorToolbarOptions, tokenCallbac
|
||||||
allowedProtocols: [ 'https?', 'tel', 'sms', 'sftp', 'smb', 'slack' ]
|
allowedProtocols: [ 'https?', 'tel', 'sms', 'sftp', 'smb', 'slack' ]
|
||||||
},
|
},
|
||||||
htmlSupport: {
|
htmlSupport: {
|
||||||
allow: [
|
fullPage: {
|
||||||
|
allowRenderStylesFromHead: allowFullHtml
|
||||||
|
},
|
||||||
|
allow: allowFullHtml ? [
|
||||||
|
{
|
||||||
|
// Allow all HTML elements
|
||||||
|
name: /.*/,
|
||||||
|
attributes: true,
|
||||||
|
classes: true,
|
||||||
|
styles: true
|
||||||
|
}
|
||||||
|
] : [
|
||||||
{
|
{
|
||||||
name: /^(a|span)$/,
|
name: /^(a|span)$/,
|
||||||
attributes: true,
|
attributes: true,
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class SubmitActionEmailType extends AbstractType
|
||||||
[
|
[
|
||||||
'label' => 'mautic.form.action.sendemail.message',
|
'label' => 'mautic.form.action.sendemail.message',
|
||||||
'label_attr' => ['class' => 'control-label'],
|
'label_attr' => ['class' => 'control-label'],
|
||||||
'attr' => ['class' => 'form-control editor editor-basic'],
|
'attr' => ['class' => 'form-control editor editor-basic', 'allow-full-html' => true],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'data' => $message,
|
'data' => $message,
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ class EmailType extends AbstractType
|
||||||
'class' => 'form-control editor editor-basic-fullpage editor-builder-tokens editor-email',
|
'class' => 'form-control editor editor-basic-fullpage editor-builder-tokens editor-email',
|
||||||
'data-token-callback' => 'email:getBuilderTokens',
|
'data-token-callback' => 'email:getBuilderTokens',
|
||||||
'data-token-activator' => '{',
|
'data-token-activator' => '{',
|
||||||
|
'allow-full-html' => true,
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue