logo       

Re: Customising elements that are created from the toolbar: msg#00045

web.kupu.devel

Subject: Re: Customising elements that are created from the toolbar

Nicholas Hemley wrote:

> basically, I would like to customise, for example, the lists so that
> when a list is created it is created with class info such as <ul><li
> class='content'></ul> etc.
>
> Obviously, i cannot just override the style for <li> in a skin since i
> need the editor to add the class info (this is picked up later on in a
> live site exported from Plone)

Unfortunately the tool used to create lists currently just sets the style
attribute rather than setting a classname.

> Any info would be appreciated. I guess the question is how I customise
> elements that are created from the toolbar...

The available liststyles are defined in toolbar.kupu. What I would do if I
were going to make these customisable would be first to add appropriate
configuration sections to the kupu tool, and then override the kupu:part
for liststyles in plone's toolbar.kupu so that it generates the list from
the configured options.

Then I would extend ListTool in kupubasetools.js. Currently setListStyle
sets the style.listStyleType attribute to the value from the pulldown; I
would change this to split the pulldown value in two parts on '|' where the
first part is what is currently used, and the second part is a className.
Then all you have to do is set the className attribute if one is specified,
or delete the className attribute if there isn't one.

This is what we do for the paragraph styles. The configuration there uses
three parts: title|tag|class, so for pulldown lists I would make the
configuration: title|listStyleType|class. kupuploneui.js contains the code
which sets paragraph styles with classes.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise