Similar issue was described in http://drupal.org/node/814970 but those solutions didn't fix the problem for me.
The problem was that Insert Teaser Break button generates JS error: "getAttribute is not a function". After some debugging I found out that when creating a teaser break (which in fact is a html comment) this plugin uses a function called createFakeElement that is not supposed to operate on html comments because it tries to access getAttribute('align') method which on comments doesn't make sense. The solution was to add this method to comment object before it is passed to createFakeElementFunction. The second place where the problem occures is when switching from source to Rich text editor, when createFakeParserElement() tries to set align attribute for a comment. So the fix was done in file ckeditor/plugins/drupalbreaks/plugin.js in two places:
in function insertComment( text ) :
I changed this:
function insertComment( text )
{
// Create the fake element that will be inserted into the document.
// The trick is declaring it as an <hr>, so it will behave like a
// block element (and in effect it behaves much like an <hr>).
var fakeElement = editor.createFakeElement( new CKEDITOR.dom.comment( text ), 'cke_drupal_' + text, 'hr' );
...
to this:
function insertComment( text )
{
// Create the fake element that will be inserted into the document.
// The trick is declaring it as an <hr>, so it will behave like a
// block element (and in effect it behaves much like an <hr>).
var realElement = new CKEDITOR.dom.comment( text );
realElement.getAttribute = function() {
return null;
};
var fakeElement = editor.createFakeElement( realElement, 'cke_drupal_' + text, 'hr');
...
and in function afterInit:
this
comment : function( value )
{
if ( value == 'break' || value == 'pagebreak' )
return editor.createFakeParserElement( new CKEDITOR.htmlParser.comment( value ), 'cke_drupal_' + value, 'hr' );
return value;
}
to this:
if ( value == 'break' || value == 'pagebreak' ) {
var realElement = new CKEDITOR.htmlParser.comment( value );
realElement.attributes = {
'align':null
};
return editor.createFakeParserElement( realElement, 'cke_drupal_' + value, 'hr' );
}
return value;
Maybe it helps somebody
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | ckeditor_drupalbreak_fix.patch | 1.45 KB | medieval111 |
Comments
Comment #1
dczepierga commentedCould you check that the last version from CVS works for you??
This bug should be fixed earlier.
Comment #2
medieval111 commentedI did not check the latest CVS, but I can confirm that these changes do the trick! I also included a patch.
Comment #3
jcisio commentedIt looks like your patch is for 1.1 (I don't see this change). Did you upgrade from CKEditor 3.2 and bypass 3.3? This error was noticed and fixed in CVS #814970: Teaser break not working with CKEditor 3.3
Comment #4
smarsh commentedI'm a nube and have the same issue. It's my first Drupal install and I have only installed 3.4 yet the teaser break does nothing. It worked fine before CKE. It could be me but I don't know what I'm doing right or wrong.
Any help?
Comment #5
jcisio commentedThe latest dev version of the module fixes it.
Comment #6
cjwest commentedI'm also looking for the teaser break. Tried both 3.4.1 and the nightly build. I don't see the plugin. What do you suggest?
Comment #7
Jeraarts commentedI am having the same problem with CKEditor 3.4.1. When inserting a teaser break in the plain text editor, switching to the CKeditor just shows a grey box. I have tried this on several browsers on different computers. Any suggestions?
Comment #8
Jochus commentedI'm having the same problem. Any fixes?
Drupal ckeditor: 1.2
Implementation of ckeditor: 3.4.2
Comment #9
Jochus commentedNevermind, has been fixed by clearing ALL browser cache! Thanks!