So I search around and found some references of people wanting to
create a widget for it and some suggestions on how to do it, based on
that and the tinymce widget I manage to put together a wrapper for wym
but I'm stuck here. I believe I got everything looking like it should
but there is something I'm missing.
I believe my error is when loading jquery. but I'm not sure how to
link one JSwidget to another.
I'm trying to reproduce the minimal example from here
http://trac.wymeditor.org/trac/wiki/0.4/Integration
here is the code so far
http://paste.turbogears.org/paste/2634
any pointers are welcome.
list is as the links javascript, ie:
jquery = JSLink(modname=..., filename='jquery.js')
jquery_ui = JSLink(modname=..., filename='jquery-ui.js',
javascript=[jquery])
Now, when jquery_ui is required by a widget, it will automatically pull
jquery too.
> I'm trying to reproduce the minimal example from here
> http://trac.wymeditor.org/trac/wiki/0.4/Integration
>
> here is the code so far
> http://paste.turbogears.org/paste/2634
>
The init_js thingie won't work since the $css variable won't be
substituted when the JSSource is injected since they're called without
arguments. Something like this will work:
jQuery = js_function('jQuery')
include_dynamic_js = True
def update_params(self, d):
super(....).update_params(d)
d.add_call(jQuery('#'+self.id).wymeditor({
'html': '',
'stylesheet': something
})
Alberto
> Also, im not sure what you mean by "link", but JSSource widgets take a
> "javascript" parameter, which allows you to include other JSSource
> widgets, which in turn will be added to the html in the proper order
> to allow all of the js libraries to load properly.
>
> last thing, please use tw.jquery for your jquery system, as this is
> the most up-to-date, and the others have been deprecated.
>
this is the package I currently have tw.jquery-0.1a0dev_r151-py2.5.egg/
> > I'm trying to reproduce the minimal example from here
> > http://trac.wymeditor.org/trac/wiki/0.4/Integration
> >
> > here is the code so far
> > http://paste.turbogears.org/paste/2634
> >
>
> The init_js thingie won't work since the $css variable won't be
> substituted when the JSSource is injected since they're called without
> arguments. Something like this will work:
>
> jQuery = js_function('jQuery')
>
> include_dynamic_js = True
> def update_params(self, d):
> super(....).update_params(d)
> d.add_call(jQuery('#'+self.id).wymeditor({
> 'html': '',
> 'stylesheet': something
> })
>
ok this makes more sense as it's actually executing the code, I'll try
to work it out based on this example and let you know thanks
> Alberto
>
>
>
>
> >
>