thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.77k stars 2.67k forks source link

WYSYWG Editor removes code #5289

Open wyklif opened 3 years ago

wyklif commented 3 years ago

Version information

Description

When adding HTML code to the WYSIWG the code gets automatically stripped off and some tags are removed

Steps To Reproduce

Steps to reproduce the behavior:

  1. Create bread with a rich text editor field
  2. Click on the source code icon on WYSIWYG Editor
  3. Paste Following HTML and click ok
    <ul class="fa-ul">
    <li><span class="fa-li"><i class="fas fa-check"></i></span>One Shop</li>
    <li><span class="fa-li"><i class="fas fa-check"></i></span>One Month Subscription</li>
    <li><span class="fa-li"><i class="fas fa-check"></i></span>Unlimited Things</li>
     <li><span class="fa-li"><i class="fas fa-check"></i></span>Unlimited Things 2</li>
    </ul>
  4. Click on save to save the entry
  5. After redirection click on edit to edit entry
  6. click on source code of WYSIWYG editor
  7. Code has been stripped to
    <ul class="fa-ul">
    <li>One Shop</li>
    <li>One Month Subscription</li>
    <li>Unlimited Things</li>
    <li>Unlimited Things 2</li>
    </ul>

Expected behavior

Pasted HTML should be saved as is

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

howdu commented 3 years ago

Tinymce has a rather strict code cleanup encase somebody copies text from MS Word/etc with unintended hidden html. https://www.tiny.cloud/docs-4x/configure/content-filtering/#custom_elements

You can overwrite this using field details e.g:

{
    "tinymceOptions": {
        "min_height": "300",
        "extended_valid_elements": "i[class],span[class]"
    }
}
wyklif commented 3 years ago

Tinymce has a rather strict code cleanup encase somebody copies text from MS Word/etc with unintended hidden html. https://www.tiny.cloud/docs-4x/configure/content-filtering/#custom_elements

You can overwrite this using field details e.g:

{
    "tinymceOptions": {
        "min_height": "300",
        "extended_valid_elements": "i[class],span[class]"
    }
}

Hi @howdu thanks for the reply, i will try this