-
Notifications
You must be signed in to change notification settings - Fork 131
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
pasteAsText: true configuration option ignores headings #92
Comments
If I add a custom configuration for tag filtering, will it be more flexible? Will it meet this requirement? |
Other editors offer several paste function. E.g. TinyMCE or CKE offers:
I think we should use pasteAsText as what it is and what is common use: paste as plain text. That is also my requirement. If you want, you can additionally offer other functionality to discern from other editors, e.g. pasteAsSimpleHtml. But that is not my requirement. |
The only "formatting" pasteAsText commonly supports are line breaks that are interpreted as |
Thank you for the fix last week. Please not that pasteAsText still has not the common use. Line breaks are not preserved. |
hi @TobiasKrais , the Line breaks are be preserved if config the pastedAsText ? if yes, i will continue to optimize this issue. |
TinyMCE and other editors convert line breaks to |
This is my workaround in editor config: htmlPasteConfig: {
pasteProcessor: (html) => {
// Create a temporary DOM element
let tempDiv = document.createElement('div');
tempDiv.innerHTML = html;
// Extract text content and replace newlines with <br> tags
let formattedContent = tempDiv.innerText.replace('/\\n/g', '<br>');
return formattedContent;
}
}, |
When
pasteAsText: true
is activated in configuration, text is pasted without formatting. When copied text includes a heading like h1, the editor shows it as h1 heading. Other editors like TinyMCE paste headings also as plain text.The text was updated successfully, but these errors were encountered: