froala / angular-froala-wysiwyg

Angular 4, 5, 6, 7, 8 and 9 plugin for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
732 stars 200 forks source link

Question: How to access `FroalaEditor.ENTER_BR` in my component options? #403

Open RyanHedges opened 4 years ago

RyanHedges commented 4 years ago

Following this documentation

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!

qdelettre commented 4 years ago

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)

epicsoft-llc commented 3 years ago

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
}
NaJinju commented 2 months ago

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
}

Thanks a lot. You save my time and life.