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

html comment whiteliting still not fixed #286

Closed
anuradhaindika83 opened this issue Mar 23, 2020 · 1 comment
Closed

html comment whiteliting still not fixed #286

anuradhaindika83 opened this issue Mar 23, 2020 · 1 comment
Labels
Milestone

Comments

@anuradhaindika83
Copy link

anuradhaindika83 commented Mar 23, 2020

Hi,

When I call the below code

suneditor.setContents('<!DOCTYPE html>'+
                                '<html lang="en">'+
                                '<head>'+
                                    '<meta charset="UTF-8">'+
                                    '<meta name="viewport" content="width=device-width, initial-scale=1">'+
                                    '<meta name="author" content="https://github.com/JiHong88" />'+
                                    '<meta name="description" content="Pure javascript wysiwyg web editor" /> <!-- meta comment -->'+
                                '<style>'+
                                '/* css comment goes here */'+
                                '</style>'+
                                '</head>'+
                                '<body>'+
                                '<!-- html comment goes here -->'+

                                '</body>'+
                                '</html>');

I get the following output on the code viewer

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
</title>
<link href="https://cdn.jsdelivr.net/npm/suneditor@latest/dist/css/suneditor.min.css" rel="stylesheet">
<style>
/** Iframe height auto */
body{height: min-content; overflow: hidden;}
</style>
</head>
<body class="sun-editor-editable" contenteditable="true" spellcheck="false" >
<!-- meta comment --><style>/* css comment goes here */</style>&lt;__comment__&gt;html comment goes here
<!-- __comment__ -->
</body>
</html>

Thanks
Anuradha

@JiHong88
Copy link
Owner

Hi
The global option was missing from the replace statement.
I will notify you know after fixed.

And even if you are using the fullPage option
The getContents method puts the content inside the body tag.
Please put the style and meta tags in different ways.

const editor = suneditor.create(..)
editor.core.context.element.wysiwygFrame.head.innerHTML = ''

Thank you

@JiHong88 JiHong88 added the bug label Mar 23, 2020
@JiHong88 JiHong88 added this to the 2.28.1 milestone Mar 23, 2020
@JiHong88 JiHong88 added this to In progress in suneditor Mar 27, 2020
@JiHong88 JiHong88 moved this from In progress to Review in progress in suneditor Mar 27, 2020
@JiHong88 JiHong88 moved this from Review in progress to Done in suneditor Mar 27, 2020
@JiHong88 JiHong88 moved this from Done to Review in progress in suneditor Mar 27, 2020
suneditor automation moved this from Review in progress to Done Mar 27, 2020
@JiHong88 JiHong88 removed this from Done in suneditor Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants