Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

ui-ace editor options set after, rather than before, onLoad callback function is called #93

Closed
@ispringer

Description

@ispringer

In our app, we have a page with 3 ui-ace editors on the same page - one in html mode, one in css mode, and one in javascript mode. We use the same onLoad callback function for all three, since we want to set most of the same ACE options. But we also want to do a couple things specific to which editor is being configured. In order to determine, in the onLoad function, which of the three editors was being configured, we checked if the editor's mode was html, css, or javascript.

We recently upgraded Angular from 1.2 to 1.3, and ui-ace from 1.1.2 to 1.2.1. After these upgrades, the code described above stopped working, because the onLoad function was being called before, rather than after, the ui-ace options specified in the html had been applied.

Run the below plunk with the browser console open and watch the logging. Notice, that in onchange, the mode specified via ui-ace options in the html has not yet been set on the ACE editor (it's still set to the default mode, "text"), but after a $timeout, the mode has been set to "css".

http://plnkr.co/edit/QGr1j8jjRCVsaTVDveEA?p=preview

The question is, does it make more sense to call the onLoad callback before or after setting the ui-ace options on the ACE editor. I'm thinking setting them before might be more intuitive. What do you think?

Whatever is decided, I think it would be good to document the order in the README.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions