Allow setting defaults for preview display settings

Created on 2 February 2024, 11 months ago
Updated 29 March 2024, 9 months ago

Problem/Motivation

The default preview settings are currently hardcoded in JS. It would be useful to be able to change these default settings.

Proposed resolution

Add checkboxes for these settings to the settings form at /admin/config/content/same-page-preview and read those values instead of hardcoding them in JS.

✨ Feature request
Status

Active

Version

2.1

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @dieterholvoet
  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    I think I understand what you're asking for. You want the administrator to be able to modify the default values for each of these settings. Is tha right?

    In that context, I imagine this scenario:

    1. A content administrator logs into the site and uses same page preview. At this point localSettings stores a value for each setting (whether it is activated)
    2. A site administrator modifies what the default values for these settings
    3. The content administrator doesn't receive this change because the local values will override the default value.

    Or rather, the default values only impact users that have never used+devices same Page Preview or have flushed out the localSettings.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    A content administrator logs into the site and uses same page preview. At this point localSettings stores a value for each setting (whether it is activated)

    I would only store settings in local storage if the user actually changed them manually. No need to store defaults in two places, right?

  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    The way localSettings work is to provide settings locally to the device. A natural consequence to having localSettings is that the device will use the localSettings before the remote settings (in this case the server provided defaults).

    If we can accept this architectural limitation then we can continue to have per-device settings. If this is a deal breaker then I'll have to make this consequence clear in the documentation.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I think the per-device settings can still be useful, but I also think that we should only store settings on the device if the user actually changes them manually, which probably isn't going to happen that often if you're dealing with editors that aren't very tech savvy. In that case, it would be useful to be able to set good site-wide defaults.

  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    It makes sense to provide the ability to control these settings from an administrative perspective. I think what will need to be proved in user testing is where users expect to find these settings and how the interact with the controls.

    I think having a settings button in the preview pane is a good place to discover these settings.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I'm not saying these settings shouldn't live in the preview pane. To clarify my proposition:

    • We add a section to the settings form where the site administrator can set site-wide defaults for these settings. These are stored in config.
    • We keep the settings in the preview pane, but we only store them in local settings when the editor actually changes one of these values in the preview pane. If not, we use the site-wide settings stored in config.

    Another option would be to stop storing settings in local storage and to store them in the database, for all devices of the user. The fact that user-defined settings reset when switching devices could be considered unexpected. But that should probably be a separate discussion.

  • πŸ‡ΊπŸ‡ΈUnited States cosmicdreams Minneapolis/St. Paul

    For better or worse, at least for version 2.x, we've made the architectural decision to store the settings in localStorage.

    We can revisit that decision later.

    For the rest of your points, we can see what refinements we can make.

    Please update the description on what you think the next steps are.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    Okay, I created a separate issue for the local storage discussion ( πŸ“Œ Stop storing default settings in local storage Active ) and I reworded the issue description.

Production build 0.71.5 2024