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 tags are converting/deleting in codeView #1108

Closed
developergaurav opened this issue Oct 18, 2022 · 10 comments
Closed

HTML tags are converting/deleting in codeView #1108

developergaurav opened this issue Oct 18, 2022 · 10 comments

Comments

@developergaurav
Copy link

developergaurav commented Oct 18, 2022

Describe the bug
I am using sun-editor v3.4.1 in react. but it is not working right with image tags. I have whitelisted multiple tags and even tried to use se-component and __se__tag as suggested in the document. It is replacing the tags and removes the parent tag automatically.

To Reproduce
Steps to reproduce the behavior:

  1. Go to CodeView
  2. Paste the HTML mentioned below
  3. Click on CodeView again
  4. It's completely changing the HTML and putting the image tag outside of its parent.

Expected behavior
It should remain to its own parent somehow and shouldn't remove parent tags.

Screenshots
Screenshot 2022-10-18 at 4 32 15 PM

Additional context
<section class="content-pages page-brands se-component"> <div class="container __se__tag"> <div class="row"> <div class="col-lg-12"> <div class="brand-outer"> <div class="brand-items"> <a href="javascript:void()" target="_blank"> <img src="https://example.com/uploads/images/logo1.png" alt="" /> </a> </div> <div class="brand-items"> <a href="javascript:void()" target="_blank"> <img src="https://example.com/uploads/images/logo2.png" alt="" /> </a> </div> </div> </div> </div> </div> </section>

@JiHong88
Copy link
Owner

Add the "__se__tag" class to the top-level element.
<section class="__se__tag">

@developergaurav
Copy link
Author

@JiHong88 If you notice, We already have this class on the top of the element as per the documentation. The funny thing is if we have one image in HTML it works fine but if we have multiple images, it behaves oddly. It removes parent HTML tags (in this case tag has been removed and image wrapper put outside of parent

brand-items). There are some other things we noticed when using this version. It works well in 2.15.0 (with these classes __se__tag or se-component and so on) which we have downgraded for now. But this version has other compatibility problems.

Screenshot 2022-10-19 at 2 17 51 PM

@developergaurav
Copy link
Author

Dude! you are doing things wrong. See Here

@PRO-BROS What's wrong?

@developergaurav
Copy link
Author

@JiHong88 If you notice, We already have this class on the top of the element as per the documentation. The funny thing is if we have one image in HTML it works fine but if we have multiple images, it behaves oddly. It removes parent HTML tags (in this case tag has been removed and the image wrapper put outside of the parent

brand-items). There are some other things we noticed when using this version. It works well in 2.15.0 (with these classes __se__tag or se-component and so on) which we have downgraded for now. But this version has other compatibility problems.
Screenshot 2022-10-19 at 2 17 51 PM

@JiHong88 Is there something you find at your end?

@JiHong88
Copy link
Owner

@developergaurav Can you show me the "HTML" string you are testing right now?

@developergaurav
Copy link
Author

@developergaurav Can you show me the "HTML" string you are testing right now?

@JiHong88 Here is the "HTML" code:

`






















































































































































































































`

@JiHong88
Copy link
Owner

@developergaurav "HTML" code is missing.

@developergaurav
Copy link
Author

developergaurav commented Nov 22, 2022

@developergaurav "HTML" code is missing.

@JiHong88 Actually, it is there but somehow GitHub makes it invisible. Attached again:

<section class="content-pages page-brands">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <div class="brand-outer">
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo1.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo2.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo3.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo4.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo5.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo6.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo7.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo8.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo9.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo10.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo11.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo12.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo13.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo14.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo1.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo15.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo16.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo17.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo18.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo19.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo20.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo21.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo22.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo23.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo24.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo25.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo26.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo27.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo28.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo29.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo30.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo31.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo32.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo33.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo34.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo35.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo36.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo37.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo38.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo39.png" alt="" />
                        </a>
                    </div>
                    <div class="brand-items">
                        <a href="javascript:void()" target="_blank">
                            <img src="https://example.com/uploads/images/logo40.png" alt="" />
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

@JiHong88 JiHong88 added this to the 2.44.4 milestone Jan 25, 2023
@JiHong88
Copy link
Owner

The 2.44.4 version has been updated.
Thank you.

@developergaurav
Copy link
Author

The 2.44.4 version has been updated. Thank you.

@JiHong88 Thanks to you! I will update it.

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

3 participants
@JiHong88 @developergaurav and others