在 Angular 中,如何在 CKeditor 中按下回车键时插入 <div> 而不是 <p>?

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

我试过使用

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

但这行不通。它仍然在源代码中放置段落标签而不是 div 标签。

我在这里错过了什么 -

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

你不应该把它当作一个字符串来使用CKEDITOR.ENTER_DIV。 您应该从源代码中导入值或使用数字 3

如果您想导入:

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

或者没有导入你可以这样做将解决你的问题:

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

我在 The ckEditor source code 中找到了数字 3