abalmus / aurelia-ace-editor

Aurelia ace editor plugin
Creative Commons Zero v1.0 Universal
4 stars 4 forks source link

Binding content from template is one-way #4

Closed jdposthuma closed 8 years ago

jdposthuma commented 8 years ago

I might be missing something, but the following code only binds one-way:

<ace content.bind="editSetting.dataString" config-theme="ace/theme/chrome" config-mode="ace/mode/json"></ace>

Great library, BTW!

abalmus commented 8 years ago

try content.two-way="editSetting.dataString"

abalmus commented 8 years ago

Ignore my last comment. I think I understand what you mean, this requires to subscribe on change event and update the content. But this is a good idea to make it two way binding by default, I'll have a look.

As a solution for now get the instance of the ace editor and subscribe on change event.

something like:

editor.on("change", function() { // update content });

more infor: https://ace.c9.io/#nav=api&api=editor

jdposthuma commented 8 years ago

Thanks! At this point, my integration doesn't need real-time binding, so I'm just grabbing the content when the user clicks ok:

this.editor.getSession().getValue()

abalmus commented 8 years ago

Yea, thats good enough.

Related to two-way binding, I'm also thinking about performance, if it ok to update the model every time you change the content. :(

jdposthuma commented 8 years ago

true

Jason Posthuma Developer 303-210-4525

On Thu, Jul 14, 2016 at 8:45 AM, abalmus notifications@github.com wrote:

Yea, thats good enough.

Related to two-way binding, I'm also thinking about performance, if it ok to update the model every time you change the content. :(

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/abalmus/aurelia-ace-editor/issues/4#issuecomment-232686829, or mute the thread https://github.com/notifications/unsubscribe/AOfspAuXeIvOj9-I5yYGs9y1yYLgjO5Tks5qVkuXgaJpZM4JL6Pu .