Custom drop list for elements

Post here questions and problems related to editing and publishing DITA content.
kmank
Posts: 118
Joined: Mon Apr 19, 2010 5:33 pm

Custom drop list for elements

Post by kmank »

I have a list of products that I wish to pick from for a particular list item - essentially include the list as a drop list (say within a nested ph tag?)
I envision some use of the library.less file, but not sure how to proceed. How could I achieve this?
Thank you!
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Custom drop list for elements

Post by Radu »

Hi,
Could you give more details? Do you want this when editing? Or when publishing?
If you want this when editing, are you using the Oxygen desktop or the Oxygen WebAuthor in-browser editor?
If you want this when publishing, are you publishing to Oxygen WebHelp or to another format?
Have you customized Oxygen until now?
Also providing an use case might help.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
kmank
Posts: 118
Joined: Mon Apr 19, 2010 5:33 pm

Re: Custom drop list for elements

Post by kmank »

This is for Oxygen desktop during authoring within the Author tab.
I have several list items in a UL that always have specific values entered. One such list of values includes Defect, Enhancement and Feature. I would like to be able to have those three items available in a drop list that is assigned to the list item for selection, rather than typing them out each time. Some of these lists are rather significant.
We had done this previously, which worked very well, but cannot remember the method to obtain it. I do, however, remember that it included the use of PH tags within the LI elements and using .less files behind the scenes.
alex_jitianu
Posts: 1009
Joined: Wed Nov 16, 2005 11:11 am

Re: Custom drop list for elements

Post by alex_jitianu »

Hello,

You can use a combo box form control to edit the value of these li elements. The CSS below does this for every li element so you need to refine the selector to match only those specific li elements (maybe with an attribute condition):

Code: Select all

li {
        content: oxy_combobox( 
            edit, '#text',
            editable, false,
            values, 'defect, enhancement, feature',
            labels, 'Defect, Enhancement, Feature'
}
If you're using DITA, you might have used the LESS mixin from {oxygenInstallDir}\frameworks\dita\lw\css\library.less . There's one for adding such a combo box (.combobox(@label, @attribute)), although this one doesn't specify the possible values and lets Oxygen retrieve it automatically from the associated schema or content completion configuration.

Best regards,
Alex
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Custom drop list for elements

Post by chrispitude »

Hi Alex,

This is the first I've heard of LESS support in Oxygen! Where can I learn more about this support?

- Chris
alex_jitianu
Posts: 1009
Joined: Wed Nov 16, 2005 11:11 am

Re: Custom drop list for elements

Post by alex_jitianu »

Hi,

You can read more about less here: https://lesscss.org/ . The Author mode can be customized though plain CSS, but LESS brings benefits like reusing through mixins.

Best regards,
Alex
kmank
Posts: 118
Joined: Mon Apr 19, 2010 5:33 pm

Re: Custom drop list for elements

Post by kmank »

I figured it out, and I'll post the solution here for the benefit of others.

I have a file we title CustomActions.less that contains a series of items like the following block:

Code: Select all

ph[audience="rn-Type"]:after{
    margin: 10px;
    .actionGroup("Type.Feature, Type.Enhancement, Type.Defect");
}
Using this example, within the Author mode of Oxygen, if I have a ph element with an audience attribute value of rn-Type, I can create a drop list of potential values by creating custom actions for each one (within Preferences > Document Type Association).

I then create a .LESS file that contains code like the example above. The .LESS file then also needs to be configured as an alternate CSS within Preferences > Document Type Association (and moved to the top of the list).

When editing the DITA content, a vertical three-dot button appears in the li element allowing you to select from any configured value, and the value is inserted into the element.
Post Reply