How to save keyboard shortcuts and advanced settings

WebViewer Version: 11.10

Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? No
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? No
Is your issue related to annotations? No

Please give a brief summary of your issue:

Hi,

I’m interested in persisting a user’s WebViewer settings across sessions—specifically changes made under Settings → Keyboard Shortcuts and Settings → Advanced Settings (for example, modifying a hotkey or toggling an advanced option).

My goal is to capture these changes, store them (likely as a JSON object), and then reapply them programmatically when the user loads WebViewer in a future session so their preferences persist.

Currently, I’m considering tracking non-default settings on the frontend and introducing a manual “Save Settings” action that would store them. Then on WebViewer load, we would retrieve those saved settings and apply them programmatically. I spot-checked a few advanced settings, it looks like those can be set programmatically. Hotkeys too, but…

Is there an event listener or built-in mechanism in WebViewer that fires when a setting (such as a keyboard shortcut or advanced setting) is changed, so I can capture these updates automatically? Or what approach do you recommend?

Thanks,
Koa

Hi Koa,

By default, Webviewer already saves all the changes made and stores them in local storage. Most of your customers should already have this enabled and should not need this.

For those who do, I’m afraid we don’t have an event that triggers at every change; we just update the store.

As you can see here, when you set a shortcut: GitHub UI

We use setShortCut from the manager, which uses the store dispatch to update the value: hotkeysManager.js

Values are retrieved from the local storage: userSettings.js

If you’d like to submit a feature request to create an event, we can. Otherwise, I would suggest you implement a save settings button that would get the values in the local storage and import them back on their next session.

Let me know if you have any questions.

Best Regards,
Mickaël.