Page 1 of 1

Custom drop list for elements

Posted: Fri Feb 10, 2023 1:40 am
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!

Re: Custom drop list for elements

Posted: Fri Feb 10, 2023 7:48 am
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

Re: Custom drop list for elements

Posted: Fri Feb 10, 2023 4:58 pm
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.

Re: Custom drop list for elements

Posted: Mon Feb 13, 2023 3:21 pm
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

Re: Custom drop list for elements

Posted: Mon Feb 13, 2023 5:00 pm
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

Re: Custom drop list for elements

Posted: Tue Feb 14, 2023 10:44 am
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

Re: Custom drop list for elements

Posted: Wed Feb 15, 2023 6:26 pm
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.