I'm working on an email client within an HTML web application and am using TinyMCE as the text editor. One of my requirements is to allow the input of full HTML email creatives and am attempting to paste them into the source code input. When I do this however and save it, TinyMCE appears to be removing a lot of the code from the pasted creative, for example the doctype
tag, html
tags, entire head
section (including inline CSS), and various other tags for example tbody
etc.
I've also noticed that the text within the title
tag has been put inside p
tags at the start of the document.
Ideally I'd prefer to have the ability to paste the full document and not have any of the source altered, any suggestions would be appreciated.
Here is the code I'm using to initialise TinyMCE:
tinymce.init({
selector: '.js-email-editor',
plugins: [
'advlist autolink lists link image charmap print preview hr anchor pagebreak legacyoutput',
'searchreplace wordcount visualblocks visualchars code',
'insertdatetime media nonbreaking save table contextmenu directionality',
'emoticons template paste textcolor colorpicker textpattern imagetools codesample toc help'
],
toolbar1: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
toolbar2: 'print preview media | forecolor backcolor emoticons | codesample help',
image_advtab: true,
content_css: [
'//fonts.googleapis.com/css?family=Lato:300,300i,400,400i',
'//www.tinymce.com/css/codepen.min.css'
],
branding: false,
valid_elements: '*[*]'
});