froala/aurelia-froala-editor

enter config on attribute level ignored

tobiaszuercher opened this issue · 5 comments

hi
the enter get's somehow ignored when defining on attribute level:
<froala-editor config.bind="{ enter: $.FroalaEditor.ENTER_BR }"></froala-editor>

however it works with

.aurelia.use.plugin(PLATFORM.moduleName('aurelia-froala-editor'), config => {
      config.options({
        enter: $.FroalaEditor.ENTER_BR
      })

configs written in aurelia.use.plugin callback are overwritten as soon as config.bind is used on <froala-editor> element. i'd prefer to have those settings merged and id would also solve the issue since we can define the enter behavior globally.

just found a workaround:
<froala-editor config.bind="{ enter: 2}"></froala-editor>

0 -> P
1 -> DIV
2 -> BR

still i'd like to see global config merged with the ones from the attribute

@tobiaszuercher we'll check it. It appears that somehow the jQuery variable is not visible when you define it on attribute level.

sboyd commented

Thanks @tobiaszuercher your work around did the trick for me.
--Steve

happy to see somebody could use my comment after more than a year :)

given i'm paying for this library i may ask @stefanneculai: any update for a real fix?

@stefanneculai in the issue above, the value of config.bind is not transpiled because we are passing "{ enter: $.FroalaEditor.ENTER_BR }" as a string. What can be done instead is we can first transpile it's value using a variable and then use that variable.

Below is the example of the same.
In app.js:

this.enter_br = { enter: $.FroalaEditor.ENTER_BR };
this.enter_div = { enter: $.FroalaEditor.ENTER_DIV };

and then can use the variable as:

config.bind="enter_br"