Comments (4)
I got it working with some effort. I think you need to use require
to load ace
ace_test = jp_proxy_widget.JSProxyWidget()
def load_test():
ace_test.js_init("""
element.requirejs.config({
paths: {
d3: '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min',
ace: '//cdnjs.cloudflare.com/ajax/libs/ace/1.4.7/ace'
}
});
element.requirejs(["ace"], function() { // no argument to load function!
element.html("ace is loaded: " + ace)
var e = $('<div id="editor"></div>').appendTo(element);
e.width("500px");
e.height("300px");
var editor = ace.edit(e[0]);
});
""")
# You need to wrap the function in "uses_require" to make sure
# require is loaded properly
ace_test.uses_require(load_test)
ace_test
from jp_proxy_widget.
from jp_proxy_widget.
Actually, I got sporadic failures with the method given above.
This seems to work consistently in my tests:
ace_test = jp_proxy_widget.JSProxyWidget()
def load_test():
ace_test.js_init("""
// load ace from a CDN using require.js
element.requirejs.config({
paths: {
//d3: '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min',
ace: '//pagecdn.io/lib/ace/1.4.8'
}
});
// Use require.js to attach ace to the window object.
element.requirejs(["ace/ace"], function(ace) { // no argument to load function!
element.html("ace is loaded: " + ace)
var e = $('<div id="editor"></div>').appendTo(element);
e.width("500px");
e.height("300px");
var editor = ace.edit(e[0]);
});
""")
# wrap the load operation in 'uses_require' to initialize require.js.
ace_test.uses_require(load_test)
ace_test
from jp_proxy_widget.
Thanks... one thing I notice if I run this is that I get the Uninitialized Proxy Widget
warning as if things were loaded twice?
from jp_proxy_widget.
Related Issues (20)
- typo in the docs HOT 1
- Opening a jp_proxy_widget in a separate JupyterLab window HOT 8
- Running on Raspberry Pi - 'numpy' has no attribute 'float128' HOT 4
- Nested object properties bind to 'None' HOT 1
- loading jQuery UI CSS results in error HOT 4
- feature request: W.renderNow() or similar HOT 6
- Open Widget in a Separate Browser Tab Connected by Broadcast Channel API HOT 12
- Is it possible for users to highlight list items? HOT 3
- Error displaying widget: model not found HOT 2
- load_css HOT 2
- make enable step automagic
- Installing in JupyterLite HOT 5
- Can jp_proxy_widget be installed without install HOT 25
- 'jp_proxy_widget' is loaded but can not be instantiated exception HOT 7
- using `pip3 install jp_proxy_widget` fails during enable step
- add babel/react support
- Binderised demo of jp_proxy_widget working in JupyterLab HOT 10
- Detachable / floating jp_proxy_widget example? HOT 14
- Canvas download as png utility function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jp_proxy_widget.