Skip to content
This repository has been archived by the owner on Aug 14, 2021. It is now read-only.

Possibility to customize the default values of the filters checkboxes #96

Open
paztis opened this issue Feb 10, 2020 · 6 comments
Open

Comments

@paztis
Copy link

paztis commented Feb 10, 2020

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 ?

@Gerrit0
Copy link
Contributor

Gerrit0 commented Feb 14, 2020

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.

@paztis
Copy link
Author

paztis commented Feb 14, 2020

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

@Gerrit0
Copy link
Contributor

Gerrit0 commented Feb 15, 2020

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

this.optionVisibility = new FilterItemSelect('visibility', 'private');

@paztis
Copy link
Author

paztis commented Feb 15, 2020

Thanks

@SimonCockx
Copy link

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?

@jnordberg
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants