Home > OS >  In Angular, how to insert <div> instead of <p> when enter is pressed in CKeditor?
In Angular, how to insert <div> instead of <p> when enter is pressed in CKeditor?

Time:10-08

I have tried using

config = {
    height: 250,
    enterMode: 'CKEDITOR.ENTER_DIV',
  };
}

But this doesn't work. It still puts a paragraph tag instead of the div tag in the source.

What am I missing here -

https://stackblitz.com/edit/ckeditor-3efz3n?file=app/app.component.ts

CodePudding user response:

You sholw not use it as a string there is no meaning to CKEDITOR.ENTER_DIV. You should import the value from the source code or use the number 3

If you would like to import:

config = {
    height: 250,
    enterMode: CKEDITOR.ENTER_DIV, // It's a variable not a string like in the question
  };
}

Or without import you can do it will fix your issue:

config = {
    height: 250,
    enterMode: 3
  };
}

I have found the number 3 in The ckEditor source code.

  • Related