Summernote plugin - How to?

Hello everyone,

Trying to use this Summernote plugin, to clean word/html tags when paste content.

I already downloaded the js file, added into my page, but Chrome Dev Tools shows some errors:

Other question is where I add the plugin options? Inside of a script tag in my page?

Thanks!

Make sure summer-cleaner.js comes after the other Summernote .js files - I think this might be the cause of the error you mention.

Adding the options in script tags as you suggest should work. You’ll need to add the ‘cleaner’ to one of the toolbar groups, eg:
['font',['bold','underline','clear','cleaner']]

It almost works very well, but there seems to be a serious problem - the script disables the ability to paste into the Summernote textarea. If you drag/drop formatted text from Word and click the ‘cleaner’ button, it does a good job of cleaning the code, but the option to copy/paste needs to work too.

I found some references to the error when pasting:
summernote-bs4.min.js:2 Uncaught TypeError: Failed to execute 'setStart' on 'Range': parameter 1 is not of type 'Node'.
… and a suggestion that the problem had been fixed, but perhaps it hasn’t. It’s quite possibly that I haven’t added the plugin correctly. Let me know if you get it working.

Hey @TomD! Thanks!
The summernote is inside of a partial, the summer-cleaner.js file is below summernote in the main layout…
I tried to move both summernote js file and summer-cleaner.js to the partial as well, didn’t work :frowning:

I’ll try more tomorrow! Thanks for your time and I’ll let you know if I solve this problem!