Greetings. I created a teaser break plugin from the page break plugin. It worked in earlier versions of 3.0, but it stopped working when I upgraded to 3.5. Below is my plugin and this is the error I get in Firebug console: m.getAttribute is not a function - m.getAttribute is not a function
... /ckeditor/ckeditor.js?t=ABLC4TW
Line 124
Any help will be greatly appreciated.
... /ckeditor/ckeditor.js?t=ABLC4TW
Line 124
Any help will be greatly appreciated.
CKEDITOR.plugins.add( 'teaserbreak', { init : function( editor ) { // Register the command. editor.addCommand( 'teaserbreak', CKEDITOR.plugins.teaserbreakCmd ); // Register the toolbar button. editor.ui.addButton( 'TeaserBreak', { label : 'Teaser Break', icon : this.path + 'images/teasertoolbar.gif', command : 'teaserbreak' }); // Add the styles that renders our fake objects. editor.addCss( 'img.cke_teaser_pagebreak,img.cke_teaser_break' + '{' + 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/teaserbreak.gif' ) + ');' + 'background-position: center center;' + 'background-repeat: no-repeat;' + 'clear: both;' + 'display: block;' + 'float: none;' + 'width: 100%;' + 'border-top: #999999 1px dotted;' + 'border-bottom: #999999 1px dotted;' + 'height: 5px;' + '}' + 'img.cke_teaser_break' + '{' + 'border-top: #FF0000 1px dotted;' + 'border-bottom: #FF0000 1px dotted;' + '}' ); }, afterInit : function( editor ) { // Adds the comment processing rules to the data filter, so comments // are replaced by fake elements. editor.dataProcessor.dataFilter.addRules( { comment : function( value ) { if ( value == 'break' ) return editor.createFakeParserElement( new CKEDITOR.htmlParser.comment( value ), 'cke_teaser_' + value, 'hr' ); return value; } }); requires : [ 'fakeobjects', 'htmldataprocessor' ] } }); // Register the commands. CKEDITOR.plugins.teaserbreakCmd = { exec : function(editor) { // Create the element that represents a teaser break. var label = 'Teaser Break'; // Creates the fake image used for this element. var text = 'break'; var breakObject = editor.createFakeElement( new CKEDITOR.dom.comment( text ), 'cke_teaser_' + text, 'hr' ); breakObject.setAttributes( { alt : label, 'aria-label' : label, title : label } ); var ranges = editor.getSelection().getRanges( true ); editor.fire( 'saveSnapshot' ); for ( var range, i = ranges.length - 1 ; i >= 0; i-- ) { range = ranges[ i ]; if ( i < ranges.length -1 ) breakObject = breakObject.clone( true ); range.splitBlock( 'p' ); range.insertNode( breakObject ); if ( i == ranges.length - 1 ) { range.moveToPosition( breakObject, CKEDITOR.POSITION_AFTER_END ); range.select(); } var previous = breakObject.getPrevious(); if ( previous && CKEDITOR.dtd[ previous.getName() ].div ) breakObject.move( previous ); } editor.fire( 'saveSnapshot' ); } };
Re: Help fixing plugin for 3.5