Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in AceRange or user error? #20

Open
Ueland opened this issue May 8, 2015 · 2 comments
Open

Bug in AceRange or user error? #20

Ueland opened this issue May 8, 2015 · 2 comments

Comments

@Ueland
Copy link

Ueland commented May 8, 2015

Hello,

I have been experimenting a bit with the AceRange object, and tried to create a AceRange object via a JSNI function:

var range = $entry(@edu.ycp.cs.dh.acegwt.client.ace.AceRange::create(IIII)(0, 0, 10, 100));

This throw the exception: "TypeError: $wnd.require is not a function"

I noticed that AceRange.java:47 has the following line:

 var Range = $wnd.require('ace/range').Range;

Should not that rather be this: ?

 var Range = $wnd.ace.require('ace/range').Range;

Doing the following in my on JNDI function appears to work:

var Range = $wnd.ace.require('ace/range').Range;
          var editor = this.@edu.ycp.cs.dh.acegwt.client.ace.AceEditor::editor;
          var range = new Range(n, n, n, n);
          editor.getSession().addMarker(range,"foo", "foo", true);

Or is it just a matter of user error on my behalf? :)

@aranega
Copy link
Contributor

aranega commented May 8, 2015

Hi,

Indeed, you're right, I made a mistake :), it should be $wnd.ace.require.... I fixed this bug in local but totally forgot to send a pull request about it (I added other features that require polishing). This issue is also present in AceEditor::setModeByName.
Actually, if I'm not wrong, this error occurs only if you use other library that redefine require (I had the same issue with dojo).

@Ueland
Copy link
Author

Ueland commented May 9, 2015

That`s correct, but no worries, just had to confirm my theory that i was not doing it all wrong here :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants