首页 > 解决方案 > 在 Angular 中,如何插入

代替

在CKeditor中按下回车时?

问题描述

我试过使用

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

但这不起作用。它仍然在源代码中放置一个段落标签而不是 div 标签。

我在这里想念什么 -

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

标签: angularckeditor

解决方案


你不要把它当作一个没有意义的字符串来使用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
  };
}

3ckEditor 源代码中找到了这个数字。


推荐阅读