Open ngm opened 7 years ago
Works but doesn't seem to strip out font size...
Take what's in this gist: https://gist.github.com/ngm/af8b0bf025e3c74faefcb167edf8bd67#file-messy-html
Copy it into Code View for an event, view it in HTML, save it
Should then look like this:
Cut the contents of the description box and paste it back in (so now we're recreating a user pasting from web or Word)
Looks like this:
Font size is too large - it still has font-size: 18px in the HTML
Can strip it out by selecting all the text and clicking the Remove Font Style button
Is there a summernote setting to also remove font-size when pasting in?
myself to pull updates to summernote & cleaner
I tried copy/pasting from a word document. It works perfectly. My assumption is that it preserves well formed HTML, for some reason, but it also kind of makes sense.
Not necessarily related to this, but appears there's a bug in summernote-cleaner such that it doesn't correctly strip the style tag if there is an apostrophe in the styling.
e.g.
becomes
(screenshotted the HTML as otherwise github strips it out of my comment...)
Anyway let's roll with this for now, I changed the options such that it should be keeping a few basic tags, but still stripping out all styling. I'll report that bug to summernote-cleaner and we'll keep our eye on this over time, just in case we need to tweak settings any further.
This is still not working as it should. Two problems: 1) Spacing no longer works - I'm quite sure it used to. Even when there's a break in the code, it's ignored in the way the page is displayed. See this as an example, although it applies to all current events: https://therestartproject.org/parties/leicester-restart-party/ 2) Incorrect font/size are not stripped when doing copy & paste, as this screenshot shows [the font in this event has now been fixed, the spacing can't be fixed]
Sometimes users copy paste existing info into the Description field from an existing website.
This can results in bad formatting on the front-end.
e.g. https://therestartproject.org/parties/aylesbury-hp21-7rt/
Ideas