Pasting html content (e-mail) partially remove css ( on images )
See original GitHub issueLastest version of quill, Im using quill to answers to mails Pasting my mail content [html] with editor.clipboard.dangerouslyPasteHTML();
My html content is fine, but when pasted, all inline css on images are removed
Do i miss any configuration ? This is my Quill config
var toolbarOptions = [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
[{ 'header': 1 }, { 'header': 2 }], // custom button values
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
[{ 'indent': '-1'}, { 'indent': '+1' }], // outdent/indent
[{ 'direction': 'rtl' }], // text direction
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
['link', 'image'],
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
[{ 'font': [] }],
[{ 'align': [] }],
['clean'] // remove formatting button
];
var options = {
debug: 'info',
modules: {
toolbar: toolbarOptions,
clipboard: {
matchVisual: false,
matchers: [
]
}
},
placeholder: 'Compose an epic...',
readOnly: false,
theme: 'snow'
};
var editor = new Quill('#message_tiny', options);`
html to had :
<img src="https://img.jpg" width="600" height="200" style="width:600px;height:200px;">
result:
<img src="https://img.jpg">
Platforms:
Mac Osx, Chrome 63.0.3239.84
Version: Quill version : “1.3.4”
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Embedding Images in HTML Email: Have the Rules Changed?
How to embed images in HTML emails properly? CID attachment, inline embedding, linked image, or any new technique? Read in our overview ...
Read more >How to Fix Image Padding and Spacing in HTML Emails
Have you ever noticed the small spacing below images in Outlook.com and Gmail? Learn how to get rid of extra space under images...
Read more >Remove problematic formatting from copied text
Use Ctrl+Shift+V (for PC) or Options+Shift+Command+V (for Mac) to paste the copied text without styles into your template. Paste into Notepad ...
Read more >How to Copy Text and Images from a Web Page
If you want to copy more than text and images (e.g., scripts, CSS, HTML), see: How to copy something from a web page...
Read more >HTML email background color: The best way to code them
1. Apply CSS linear gradient backgrounds to a table or table cell · 2. Create a fallback for Outlook with VML gradients ·...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
A keepHTML blot could solve the problem:
What this does is that if any html node has “keepHTML” class, the whole html node will be preserved.
OK… I’ve tried all sorts of solutions. I created and registered custom format blots and attributors. I was unsuccessful registering anything that would allow an img tag to have a very specific set of attributes.
I understand the philosophy behind deltas and totally agree. What an incredible solution! I was unable to find any examples for clipboard or documentation for deltas that demonstrate how one can extend what is recognized.
If I understand the principle of Deltas, it would be ideal to represent the alignment of an image using an ‘align’ attribute. Then, when formatting the dom, the formatter would emit the appropriate
style="float:left; margin:1em"
during conversion. I was unable to produce this using a custom formatter. You can see one attempt here: CodePen ReactQuill Custom Blot Eventually, I forked Quill and made the necessary changes in the default Image blot. This worked!Here is the diff:
I would like to accomplish this in the proper way. Is there any way to allow these attributes to be retained on an img element through Quill?
The specific use case is that I need to align and resize images in html. The ImageResize module and retain the html changes made by that utility. The issue is posted here.