typedoc-default-themes icon indicating copy to clipboard operation
typedoc-default-themes copied to clipboard

Possibility to customize the default values of the filters checkboxes

Open paztis opened this issue 5 years ago • 6 comments

In my current documentation, I'd like the filters to be displayed with these default values: visibility: public inherited: false externals: true only-exported: true

but for now, your hardcoded values are visibility: private inherited: true externals: true only-exported: false

Is there's a way to customize these values through a custom theme ? Or through properties of typedoc build ?

paztis avatar Feb 10 '20 21:02 paztis

You can do this with a custom theme:

  1. Create <theme>/partials/header.hbs
  2. Copy the content of https://github.com/TypeStrong/typedoc-default-themes/blob/master/src/default/partials/header.hbs to that file.
  3. Change the defaults for the checkbox.

Gerrit0 avatar Feb 14 '20 04:02 Gerrit0

For visibility, it is not a checkbox. So it has not impact until you click on it. I will try to add a script in header to force the localStorage values instead

paztis avatar Feb 14 '20 09:02 paztis

Ah, good point there, I forgot that that was controlled via JS. I'd be open to a PR that makes the JS pick up the default from the HTML instead of hardcoding it

https://github.com/TypeStrong/typedoc-default-themes/blob/042f26df8b6c8445d944e697ad5124c8151cfb15/src/default/assets/js/src/typedoc/components/Filter.ts#L142

Gerrit0 avatar Feb 15 '20 23:02 Gerrit0

Thanks

paztis avatar Feb 15 '20 23:02 paztis

I have been trying to set the default of inherited to false, but with no luck. When I edit the html and the js like this:

this.optionInherited = new FilterItemCheckbox("inherited", false)

(set the default to false)

<input type="checkbox" id="tsd-filter-inherited" />

(removed the checked property)

then the functionality reverses: the checkbox is turned off by default, but the filter is still on. What did I do wrong?

SimonCockx avatar Jul 29 '20 14:07 SimonCockx

If you add the toggle-externals class to the root html element it will start off with externals disabled. Checkbox does not work correctly though, you have to toggle it twice for it to start working. Would love to see this as a configuration option for this theme.

Another issue is when you disable externals and navigate to an external type (e.g. as a return type from a non-external) you land on a blank page and have to toggle externals for the information to be visible

jnordberg avatar Jan 31 '21 01:01 jnordberg