n2cms / n2cms

N2 CMS, an open source CMS for ASP.NET
http://n2cms.com
Other
363 stars 195 forks source link

Trouble with ckeditor stripping attribute values #374

Closed brianmatic closed 10 years ago

brianmatic commented 10 years ago

I overrode the ck config file and set ck not to change my source using:

config.allowedContent = true;

It doesn't seem to work. It is stripping some attributes from the source. This may be an issue with N2 though. It appears to work correctly as I switch back and forth between source and WYSWIG. When I save and preview then return to source it has stripped the data attrib. Any ideas? Here is a quick demo: http://screencast.com/t/WG4NATAFq

It also is stripping script tags.

I found this on stackoverflow:

//var yourAnchor = 'Some Link';

editor.insertHtml(yourAnchor, 'unfiltered_html');

http://stackoverflow.com/questions/15795142/is-there-anyway-to-stop-ckeditor-4-from-filtering-my-anchor-tag-attributes/15805636#15805636

Just wondering if it is being stripped when loaded from the db to ckeditor.

bherila commented 10 years ago

solutionsauzlx says:

Hi Mate, For the ckEditor issue add the following code into the config.js file under where these 2 lines are.

config.contentsLangDirection = 'ltr'; config.extraPlugins = ''; 
config.extraAllowedContent = "table tr td p span img map area a input button div[*]; table tr td p span img map area a input button div(*); table tr td p span img map area a input button div{*}"; 
config.ignoreEmptyParagraph = true; 
config.image_removeLinkByEmptyURL = false; 

I can't remember off the top of my head, but there is 3 sections one for [], (), {}, one is for being able to actually use these html types(elements) one is for the attributes of the elements but i can't remember what the third is :(. Hope that is some help.

brianmatic commented 10 years ago

Thanks @bherila. I tried those options but it seemed like N2 may have been striping them on page load the next time I viewed that page.

libardo commented 10 years ago

This sounds like a config option:

n2/edit/ckeditor allowedContent="true"

Is it what you were looking for?

brianmatic commented 10 years ago

I will give it a try.

libardo commented 10 years ago

I'm assuming the config option did the trick and we can close the issue