-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update: Open Preview Thumbnails by default #971
Conversation
Verified that @ConradJChan has signed the CLA. Thanks for the pull request! |
this.rootEl.insertBefore(this.thumbnailsSidebarEl, this.containerEl); | ||
|
||
if (this.getCachedThumbnailsToggledState()) { | ||
this.rootEl.classList.add(CLASS_BOX_PREVIEW_THUMBNAILS_OPEN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strongly recommend moving this to its own method. The sidebar open class logic is going to be in multiple places and will require a OPEN_ACTIVE
class now, as well.
* localStorage if not cached. Defaults to true if not found. | ||
* @return {boolean} Whether thumbnails is toggled open or not | ||
*/ | ||
getCachedThumbnailsToggledState() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this live in the Thumbnails Sidebar class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do a follow on PR to see how I can clean this up
ece1f9c
to
2986c88
Compare
const thumbnailsToggledMap = this.cache.get(THUMBNAILS_SIDEBAR_TOGGLED_MAP_KEY) || {}; | ||
const newThumbnailsToggledMap = { ...thumbnailsToggledMap, [this.options.file.id]: !!isOpen }; | ||
|
||
this.cache.set(THUMBNAILS_SIDEBAR_TOGGLED_MAP_KEY, newThumbnailsToggledMap, true /* useLocalStorage */); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the /* useLocalStorage */
comment needed? I thought it was a webpack annotation for a second.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah not needed, was a copy pasta
Will open the Preview Thumbnails by default for document viewers. Will also remember on a per file basis (via
localStorage
) the toggle state of the thumbnails sidebar.Todo: