javascript - BR is not working in Ckeditor -
does know why br not working in ckeditor? i'm wondering why br
tag not working in dataprocessor
. i've been searching , posted in ckeditor forum no 1 responded.
actually, br inserted if use enter
or shift + enter
.
here's plugin.js:
// run these after attaching ang detaching ckeditor. afterinit: function (editor) { var dataprocessor = editor.dataprocessor, // ckeditor in state enabled. datafilter = dataprocessor && dataprocessor.datafilter, // ckeditor in state disabled. htmlfilter = dataprocessor && dataprocessor.htmlfilter; if ( htmlfilter ) { htmlfilter.addrules({ // loop through elements elements: { // perform when found image tag. img : function( element) { if (element.attributes.class == 'wysiwyg-addbr') { return new ckeditor.htmlparser.element( 'br', {'class': 'clear-both'}); } } } }); } }
seems ckeditor.htmlparser.element() don't accept br
element unknown reason.
return new ckeditor.htmlparser.element( 'br', {'class': 'clear-both'});
the above code generates error(see below).
uncaught typeerror: cannot read property 'type' of undefined
but if tried code below works, element in uppercase.
return new ckeditor.htmlparser.element( 'br', {'class': 'clear-both'});
i found code in ckeditor.js , seems code reason why br
being supressed.
o.elements.br = function ( ) { return function ( b ) { if (b.parent.type != uncaught typeerror: cannot read property 'type' of undefined ckeditor.node_document_fragment) { var c = b.attributes; if ("data-cke-bogus" in c || "data-cke-eol" in c) delete c["data-cke-bogus"]; else { ( c = b.next; c && e( c ); ) c = c.next; var h = f( b ); !c && d( b.parent ) ? l(b.parent, g( )) : d( c ) && (h && !d( h )) && j(c, g( )) } } } }(p);
if removed code br
works, dont think thats best approach problem. there must way this.
Comments
Post a Comment