Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace email notification textarea with WYSIWYG editor #159

Open
4 tasks
emteknetnz opened this issue Mar 7, 2022 · 2 comments
Open
4 tasks

Replace email notification textarea with WYSIWYG editor #159

emteknetnz opened this issue Mar 7, 2022 · 2 comments

Comments

@emteknetnz
Copy link
Member

emteknetnz commented Mar 7, 2022

ACs

  • For the email notification editor, swap out the textarea with a wysiwyg (tinymce) editor HTMLEditorField
  • Shortcodes need to render as absolute HTML links when an email is end e.g. shortcode link to a page on the site converts to an absolute (not relative) link
  • Update the tinymce config to remove the following buttons that are unlikely to work in most email clients:
  • alignment (left/centre/right/justify)
  • insert table
  • insert media/image buttons (relative links won't work for emails, and images are also disabled by default in most email clients)
  • Anchor (insert an anchor)
  • In gmail and outlook, test that the following formatting works. If they don't, then remove the button/format:
  • bold
  • italic
  • underline
  • bullet-list
  • numbered-list
  • decrease/increase indent
  • headings 1-6
  • preformatted text
@emteknetnz
Copy link
Member Author

emteknetnz commented Mar 7, 2022

You can easily swap out the editor by updating ContentReviewDefaultSettings::updateCMSFields() - change ReviewBody from a TextAreaField to an HTMLEditorField

You can updated the config for the HTMLEditorField via setEditorConfig()

See TinyMCEConfig for the default settings. To create your own config:

$config = clone HTMLEditorConfig::get('cms');
$config->setOption('formats', $formats);
HTMLEditorConfig::set_config('contentreviewemail', $config);
// ...
HTMLEditorField::create('Field','Title')->setEditorConfig('contentreviewemail');

You'll need to remove the buttons via an updated js file (editor.js? tinymce.js?) rather than in PHP. I'm not sure of the best way to do this.

@mariabelobrol
Copy link

  • frfgggg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants