ryancramerdesign / InputfieldCKEditor

CKEditor Inputfield module for ProcessWire
8 stars 4 forks source link

CKeditor throws an error here and does not load. #14

Closed tbba closed 10 years ago

tbba commented 10 years ago

The CKeditor throws an error, unfortunatly, and does not show on the PW edit pages here. (seen in SAFARI Mac and Firefox):

Error] TypeError: 'undefined' is not an object (evaluating 'a.attributes') style (ckeditor.js, line 423) init (ckeditor.js, line 753) (anonyme Funktion) (ckeditor.js, line 235) n (ckeditor.js, line 215) load (ckeditor.js, line 215) (anonyme Funktion) (ckeditor.js, line 234) (anonyme Funktion) (ckeditor.js, line 222) (anonyme Funktion) (ckeditor.js, line 220) n (ckeditor.js, line 215) r (ckeditor.js, line 215) o (ckeditor.js, line 215) (anonyme Funktion) (ckeditor.js, line 216)

Note: The fields in question are converted, not new. Maybe that is important: The field had been TinyMCE fields before, which worked. Today I switched to CKE (latest module, latest purifier module, latest PW dev).

Am I the only one with this?

ryancramerdesign commented 10 years ago

I haven't been able to immediately duplicate this here, at least not by replacing a TinyMCE field with a CKEditor one. However, I have seen this error before when the field had some invalid markup in it (or some weird markup, not exactly sure). CKEditor seems to choke on some markup combinations, producing exactly the error you mentioned, and I've not been able to nail down exactly what combination produces it. But in your CKEditor settings, make sure you've got HTML Purifier enabled, as that will clean the markup both before display, and before save. If you are using a CKE inline field, try converting it to a regular field (at least temporarily). If all else fails, convert it to a regular "textarea" for inputfield, copy the offending markup out and paste it into http://w3.validator.org, fix it, paste it back in, then re-enable CKEditor. I've only had to do this once, but it did resolve the issue.

Also, if you can copy/paste some of the markup that isn't working into a text file, perhaps I can analyze it further to figure out what might be upsetting CKE. Apparently there is something that TinyMCE would insert on occasion that CKE does not like. If we can figure out what it is, I can filter it out automatically.

tbba commented 10 years ago

Thanks Ryan. I am not sure it is malformed content. I did not see any at first glance when checking the output code in the page source and the whole page validates. Also: I just made a new test page, where obviously there was no content yet and there are still no cke boxes showing. Another site with almost the same setup of modules works, I just tested that. So I need to dig further.

tbba commented 10 years ago

An example text (shortened, every other word removed) copied from the database directly:

<p>ist ein <strong>weltweit</strong>, das besonders und die <strong>schnelle</strong> ihrer.</p><p>Unsere <strong><a href="{~page_1182_url}">Advanced</a></strong> prüft dabei die eingegebenen auf und bereitet das vor. Notwendige sicher (aber auch) werden.</p><p>Bei <strong>erfolgreicher</strong> des zahlt die eine von <strong>bis zu</strong>.behält des <em>(txt)</em> als ein.</p><p>verfügt über ein, das sich auf die der nach <a href="http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2004:046:0007:DE:PDF">vo2004</a> spezialisiert hat.</p>

bfncs commented 10 years ago

Hi @tbaberlin & @ryancramerdesign,

I'm also having problems like type errors with the current version of this module after updating. The fields' contents were created before also using CKEditor (where it worked without problems).

I wasn't able to debug it completely, but I recognized the following so far:

I'll try to find out some more, at least some steps to replicate it from a fresh install.

tbba commented 10 years ago

For me, deactivating Advanced Content Filtering did not help, unfortunately. I needed to switch to TinyMCE for the time being. (I am glad PS is offering this alternative, so I am relaxed.)

ryancramerdesign commented 10 years ago

Marc, Carl,

So far it's a mystery and I've not been able to reproduce the error, but I will keep trying here. Also if anyone else experiences similar issues please chime in too, as I think the more examples we have the closer we'll be to tracking it down. Until we can determine exactly what the issue is, I'm going to continue just keeping this module up to date with the latest CKE, just in case it's connected to the CKE version at all.

On Friday, January 31, 2014, Carl notifications@github.com wrote:

For me, deactivating Advanced Content Filtering did not help, unfortunately. I needed to switch to TinyMCE for the time being. (I am glad PS is offering this alternative, so I am relaxed.)

Reply to this email directly or view it on GitHubhttps://github.com/ryancramerdesign/InputfieldCKEditor/issues/14#issuecomment-33838815 .

tbba commented 10 years ago

Found my problem finally:

Default format tags, and it works (ACF enabled): p;h1;h2;h3;h4;h5;h6;pre;address

Setting this, breaks it: p;h2;h3;h4;

What that means: if the last char is a semicolon (by mistake): BANG

This can be filtered easily? Or a short note about this at the field's desciption?

ryancramerdesign commented 10 years ago

Good to hear! Thanks for letting me know. Seems like this is one they should fix in CKEditor itself, but I'll adjust our module to trim off the trailing semicolon automatically so that we don't have to worry about it.

On Thu, Feb 27, 2014 at 4:46 AM, Carl notifications@github.com wrote:

Found my problem finally:

Default format tags, and it works (ACF enabled): p;h1;h2;h3;h4;h5;h6;pre;address

Setting this, breaks it: p;h2;h3;h4;

What that means: if the last char is a semicolon (by mistake): BANG

This can be filtered easily? Or a short note about this at the field's desciption?

Reply to this email directly or view it on GitHubhttps://github.com/ryancramerdesign/InputfieldCKEditor/issues/14#issuecomment-36225781 .