a little help with this wrapper widget.

2 views
Skip to first unread message

Jorge Vargas

unread,
May 1, 2008, 12:51:29 PM5/1/08
to toscawidge...@googlegroups.com
I found a nice editor the other day which you probably have heard of.
it's call wymeditor (http://wymeditor.org/) and it's aim is to be a
100% content editor which is XHTML.

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.

percious

unread,
May 1, 2008, 5:36:25 PM5/1/08
to ToscaWidgets-discuss
Couple of things.

that version of the jquery widget is probably out of date. Last month
we changed the namespace over to tw instead of toscawidgets.widgets.

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.

-chris

On May 1, 10:51 am, "Jorge Vargas" <jorge.var...@gmail.com> wrote:
> I found a nice editor the other day which you probably have heard of.
> it's call wymeditor (http://wymeditor.org/) and it's aim is to be a
> 100% content editor which is XHTML.
>
> 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 herehttp://trac.wymeditor.org/trac/wiki/0.4/Integration
>
> here is the code so farhttp://paste.turbogears.org/paste/2634
>
> any pointers are welcome.

Alberto Valverde

unread,
May 1, 2008, 7:18:50 PM5/1/08
to toscawidge...@googlegroups.com
Jorge Vargas wrote:
> I found a nice editor the other day which you probably have heard of.
> it's call wymeditor (http://wymeditor.org/) and it's aim is to be a
> 100% content editor which is XHTML.
>
> 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.
>

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

Jorge Vargas

unread,
May 1, 2008, 10:32:57 PM5/1/08
to toscawidge...@googlegroups.com
On Thu, May 1, 2008 at 5:36 PM, percious <ch...@percious.com> wrote:
>
> Couple of things.
>
> that version of the jquery widget is probably out of date. Last month
> we changed the namespace over to tw instead of toscawidgets.widgets.
>
huh? I am importing tw.jquery

> 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/

Jorge Vargas

unread,
May 1, 2008, 10:41:57 PM5/1/08
to toscawidge...@googlegroups.com
On Thu, May 1, 2008 at 7:18 PM, Alberto Valverde <alb...@toscat.net> wrote:
>
> Jorge Vargas wrote:
> > I found a nice editor the other day which you probably have heard of.
> > it's call wymeditor (http://wymeditor.org/) and it's aim is to be a
> > 100% content editor which is XHTML.
> >
> > 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.
> >
>
> 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 got lost there, why I need jquery_ui?

> > 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
>
>
>
>
> >
>

Reply all
Reply to author
Forward
0 new messages