bolt / core

🧿 Bolt 5 core
https://boltcms.io
MIT License
542 stars 159 forks source link

Unable to save pasted content #2996

Open ghost opened 2 years ago

ghost commented 2 years ago

I am unable to save pasted content. When I paste the content and then save the entry, the content field is empty again.

Details

Question Answer
Relevant Bolt Version Bolt 5.0.7
Install type Composer install
PHP version 7.3.29
Web server Linux
For UX/UI issues Firefox

Reproduction

After these steps, the content field is empty again. The content IS saved when I:

nestordedios commented 2 years ago

Hi @gwbonline ,

What type of content are you copying from the external source and what is the external source (If we can know about that)?

How does the copied text looks like in the editor when you view the HTML markup?

Maybe unintentionally you are copying HTML tags which are not defined in the htmlcleaner option of your config.yaml, like for instance "video", "audio", "scripts", etc...

This is the default htmlcleaner configuration which you will need to adapt to your needs:

# Define the HTML tags and attributes that are allowed in cleaned HTML. This
# is used for sanitizing HTML, to make sure there are no undesirable elements
# left in the content that is shown to users. For example, tags like `<script>`
# or `onclick`-attributes.
# Note: enabling options in the `wysiwyg` settings will implicitly add items to
# the allowed tags. For example, if you set `images: true`, the `<img>` tag
# will be allowed, regardless of it being in the `allowed_tags` setting.
htmlcleaner:
    allowed_tags: [ div, span, p, br, hr, s, u, strong, em, i, b, li, ul, ol, mark, blockquote, cite, pre, code, tt, h1, h2, h3, h4, h5, h6, dd, dl, dt, table, tbody, thead, tfoot, th, td, tr, a, img, address, abbr, iframe, caption, sub, sup, figure, figcaption, article, section, small ]
    allowed_attributes: [ id, class, style, name, value, href, src, alt, title, width, height, frameborder, allowfullscreen, scrolling, target, colspan, rowspan, rel, download, hreflang ]
    allowed_frame_targets: [ _blank, _self, _parent, _top ]