Skip to content

Loading ace editor into a widget #6

@psychemedia

Description

@psychemedia

I'm seem to be going round in circles on this one.

What's the trick for loading something like the ace editor?

If I try the following I get a new error message: TypeError: define is not a function error, which suggests I should be loading things in using require?

html="""<h1>sshgdhsgd</h1>
<div id="editor"></div>
"""

test0 = jp_proxy_widget.JSProxyWidget()

e = test0.element

# Call some standard jQuery method on the widget element:
e.empty()
e.width("1000px")
e.height("1000px")


test0.load_js_files(["ace-src-min/ace.js"])
#test0.require_js("ace/ace", "ace-src-min/ace.js")

e.html(html)

sc="""
     var editor = ace.edit("editor");
"""
test0.js_init(sc)

display(test0)

If instead replace the script load with a require load, eg test0.require_js("ace/ace", "ace-src-min/ace.js"), then I get a new error message: ReferenceError: ace is not defined error?

It's probably something obvious but I don't see it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions