Git Product home page Git Product logo

Comments (15)

Prinmode avatar Prinmode commented on August 22, 2024 3

Same here, using the 0.8.9 version

from summernote-cleaner.

garthgoodson avatar garthgoodson commented on August 22, 2024 2

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.

rfrisch43 avatar rfrisch43 commented on August 22, 2024

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.

chandawarlokesh avatar chandawarlokesh commented on August 22, 2024

Same Issue for me

from summernote-cleaner.

t3custom avatar t3custom commented on August 22, 2024

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.

daneastwell avatar daneastwell commented on August 22, 2024

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.

1-bit-wonder avatar 1-bit-wonder commented on August 22, 2024

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.

daneastwell avatar daneastwell commented on August 22, 2024

@nigel-stewart The bug you're seeing is also reproducible in other situations within Summernote - e.g. summernote/summernote#1759

from summernote-cleaner.

samantha-ko avatar samantha-ko commented on August 22, 2024

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.

bk73 avatar bk73 commented on August 22, 2024

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.

samantha-ko avatar samantha-ko commented on August 22, 2024

A workaround:

  1. In line 162 of summernote-cleaner.js, ensure that if keepHtml is true, use 'text/html' AND
  2. When calling summernote(), ensure that cleaner settings for keepOnlyTags includes <html> and <body>
  3. When calling summernote(), ensure that cleaner settings for badTags excludes <html> and <body>

This seems to work in

  • Chrome 68.0.3440.106
  • Firefox 62.0

from summernote-cleaner.

mypetertw avatar mypetertw commented on August 22, 2024

Same Issue for me :(

from summernote-cleaner.

mypetertw avatar mypetertw commented on August 22, 2024

A workaround:

  1. In line 162 of summernote-cleaner.js, ensure that if keepHtml is true, use 'text/html' AND
  2. When calling summernote(), ensure that cleaner settings for keepOnlyTags includes <html> and <body>
  3. When calling summernote(), ensure that cleaner settings for badTags 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.

arsusbravo avatar arsusbravo commented on August 22, 2024

A workaround:

  1. In line 162 of summernote-cleaner.js, ensure that if keepHtml is true, use 'text/html' AND
  2. When calling summernote(), ensure that cleaner settings for keepOnlyTags includes <html> and <body>
  3. When calling summernote(), ensure that cleaner settings for badTags excludes <html> and <body>

This seems to work in

  • Chrome 68.0.3440.106
  • Firefox 62.0

This works! Thanks!

from summernote-cleaner.

dzpt avatar dzpt commented on August 22, 2024

keepHtml = false and it still remove all tags, someone should fork and fix this

from summernote-cleaner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.