Comments (15)
Same here, using the 0.8.9 version
from summernote-cleaner.
Try replacing 'Text' with 'text/html' around line 162 where the data is copied from the clipboard. It seems that using Text strips html prior to the cleaner cleaning the text.
from summernote-cleaner.
I'm also experiencing this issue.
Here are my settings:
cleaner: {
action: 'both',
newline: '<br>'
notStyle: 'position:absolute;top:0;left:0;right:0',
icon: '<i class="note-icon">WC</i>',
keepHtml: true,
keepOnlyTags: ['<p>', '<br>', '<ul>', '<li>', '<b>', '<strong>', '<i>', '<u>', '<a>'],
keepClasses: false,
badTags: ['style', 'script', 'applet', 'embed', 'noframes', 'noscript', 'html'],
badAttributes: ['style', 'start', 'class'],
limitChars: 0,
limitDisplay: 'both',
limitStop: false
}
Using summernote-rails (~> 0.8.10.0).
Requiring these files in asset pipeline:
//= require summernote/summernote.min
//= require summernote-cleaner (your master branch)
//= require summernote-init (init script partially referenced above)
I will note that it is getting initialized and it does clean on paste. It simply doesn't respect the KeepOnlyTags options that are set. Instead it removes all tags no matter what.
Thanks in advance.
from summernote-cleaner.
Same Issue for me
from summernote-cleaner.
This is happening to me as well... v0.8.9. Has anyone found a solution?
If I set action to 'button', and click the button only, it works well. However, if I select-all after pasting from Word and click the button, I get the same issue - completely stripped of all HTML tags.
from summernote-cleaner.
This commit appears to have fixed in Chrome at time of writing, but maybe has regressed since?
Note also that getData
when used with the 'Text' parameter may well be non-functional in Chrome, requiring 'text/html' instead? This StackOverflow answer goes into more detail.
from summernote-cleaner.
Use of 'text/html'
produces a type error in both Chrome and Firefox.
Chrome says: Failed to execute 'setStart' on 'Range': parameter 1 is not of type 'Node'.
While Firefox tells me: Argument 1 of Range.setStart is not an object.
from summernote-cleaner.
@nigel-stewart The bug you're seeing is also reproducible in other situations within Summernote - e.g. summernote/summernote#1759
from summernote-cleaner.
Hi there,
I believe the cleanText function is stripping <html> and <body> tags by default, which at least Chrome and Firefox need to parse the clipboard text/html. I worked around the problem by explicitly keeping <html> and <body> tags in the cleaner options.
from summernote-cleaner.
I am having same issue, it does a wonderful job of stripping everything out, but ignores keepOnlyTags. I have tried above solutions with no luck. Anyone fixed this yet?
from summernote-cleaner.
A workaround:
- In line 162 of summernote-cleaner.js, ensure that if
keepHtml
is true, use'text/html'
AND - When calling
summernote()
, ensure that cleaner settings forkeepOnlyTags
includes<html>
and<body>
- When calling
summernote()
, ensure that cleaner settings forbadTags
excludes<html>
and<body>
This seems to work in
- Chrome 68.0.3440.106
- Firefox 62.0
from summernote-cleaner.
Same Issue for me :(
from summernote-cleaner.
A workaround:
- In line 162 of summernote-cleaner.js, ensure that if
keepHtml
is true, use'text/html'
AND- When calling
summernote()
, ensure that cleaner settings forkeepOnlyTags
includes<html>
and<body>
- When calling
summernote()
, ensure that cleaner settings forbadTags
excludes<html>
and<body>
This seems to work in
- Chrome 68.0.3440.106
- Firefox 62.0
its not work for me. Why ... :(
from summernote-cleaner.
A workaround:
- In line 162 of summernote-cleaner.js, ensure that if
keepHtml
is true, use'text/html'
AND- When calling
summernote()
, ensure that cleaner settings forkeepOnlyTags
includes<html>
and<body>
- When calling
summernote()
, ensure that cleaner settings forbadTags
excludes<html>
and<body>
This seems to work in
- Chrome 68.0.3440.106
- Firefox 62.0
This works! Thanks!
from summernote-cleaner.
keepHtml = false
and it still remove all tags, someone should fork and fix this
from summernote-cleaner.
Related Issues (20)
- Style attributes not stripped when (in html) there are new line characters in the css code HOT 1
- Why 'style' and 'class' attributes still appear when paste from ms word ? HOT 4
- Error with paste with latest master HOT 20
- Pasting HTML from a plaintext context HOT 4
- badTags tagStripper can suffer catastrophic backtracking HOT 10
- Missing returns in cleanHtmlPaste Function
- Publish tags/releases HOT 3
- Limit functions using text rather than HTML length HOT 7
- keepTagContents not working correctly HOT 2
- Using the button in the toolbar seems to paste it before the actual code, therefore duplicating content HOT 4
- JS error when pasting HOT 5
- JS error occur since yesterday HOT 2
- Running into Uncaught TypeError: this.get is not a function when pasting text HOT 8
- keepOnlyTags config is being ignored HOT 1
- [paste] tags aren't removed properly when there are linebreaks between attributes HOT 2
- problem in copy and paste the space HOT 2
- Unable to paste plain text HOT 2
- Feature request: remove tag but keep contents HOT 5
- Cleaner success status text never disappears HOT 1
- chrome words together HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from summernote-cleaner.