Skip to content

Instantly share code, notes, and snippets.

@fhdalikhan
Created March 17, 2020 21:25
Show Gist options
  • Save fhdalikhan/859a207c94736d973057d91a4a31d194 to your computer and use it in GitHub Desktop.
Save fhdalikhan/859a207c94736d973057d91a4a31d194 to your computer and use it in GitHub Desktop.
ckeditor allow all tags and their css classes etc and stop editor creating an empty paragraph along with option to insert paragraph when it is disabled
CKEDITOR.replace( 'ck-editor', {
allowedContent: true
};
CKEDITOR.editorConfig = function( config ) {
config.enterMode = 2;
};
And this will give you both the <p> and <br> tag when needed but does not prevent
the start and stop <p> tag
CKEDITOR.editorConfig = function( config ) {
config.enterMode = CKEDITOR.ENTER_BR // pressing the ENTER Key puts the <br/> tag
config.shiftEnterMode = CKEDITOR.ENTER_P; //pressing the SHIFT + ENTER Keys puts the <p> tag
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment