angular-froala-wysiwyg
angular-froala-wysiwyg copied to clipboard
Question: How to access `FroalaEditor.ENTER_BR` in my component options?
I've tried...
import { FroalaEditor } from 'froala-editor';
// ...
editorOptions: Object = {
enter: FroalaEditor.ENTER_BR,
// ...
}
And I get this error...
TypeError: undefined is not an object (evaluating 'froala_editor__WEBPACK_IMPORTED_MODULE_1__["FroalaEditor"].ENTER_BR')
I tried this as a shot in the dark unable to find what ENTER_BR maps to...
editorOptions: Object = {
enter: 'enter_br',
// ...
}
And it replaces the wrapping <p> with <br> sometimes but an <undefined></undefined> tag starts wrapping everything depending on how the text is edited. Most likely because the string key doesn't actually do anything.
I'd appreciate any assistance that can be provided so I can understand how to get ENTER_BR to work in my Angular 9 app. Thank you!
Try importing FroalaEditor like this :
import FroalaEditor from 'froala-editor';
as it is done here https://github.com/froala/angular-froala-wysiwyg/blob/master/demo/src/app/app.component.ts
then FroalaEditor should not be undefined (what your error is saying)
It's an enum, you can specify the values numerically. The following assignment works for me:
0 = ENTER_P
1 = ENTER_DIV
2 = ENTER_BR
Example for the selection of ENTER_DIV:
const editorOptions: Object = {
enter: 1
}