Support for more settings

Created on 1 July 2020, over 4 years ago
Updated 3 November 2023, about 1 year ago

Firstly, thanks for picking up this module and giving it some love, it really needed it.

We've maintained a set of patches for some time to implement various settings:

window.rsConf = {
  ui: {
    disableDetachment: true,
    tools: { translation: false },
  },
};

The post mode setting, the only one available through the UI, is only one of a number of other settings that users may want to adjust. One of the issues we've had with with post_mode.js is that it overwrites the settings object completely making it hard to add extra settings:

window.rsConf = {general: {usePost: true}};

What are you thoughts on how to allow users to customise other settings? I see two obvious options:

1: Add UI options to implement more of the setttings - that said, there are some that are seemingly not documented anywhere: https://wrdev.readspeaker.com/adaptation/configurations

2: Allow the user to enter a JS object (like the one above) into a textarea so it's open season - that will make it harder for the average user to add custom settings however, unless you took the common ones (like post mode) and made them checkboxes and then you could use a custom JS object to extend that.

I'd also like to see the introduction of a region selector, the default region for URLs seems to be Europe (eu) but we use Oceancia (oc) - would be great it this was an additional option - it could be added into the URL for the remote script as another token (as per the recent addition of the account ID), and also into the template file.

I'm happy to provide patches for the above if you have a preferred approcah.

Cheers

Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇦🇺Australia Feng-Shui

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany sunlix Wesel

    Okay I will commit here my first approach to solve the possible ReadSpeaker configuration at all.
    If anyone has some motivation to support this it would be kick ass. Any help is really appreciated.

  • Status changed to Active about 1 year ago
  • 🇩🇪Germany sunlix Wesel

    Opinion to the cb (javascript callbacks) config:

    I think there is no usefull case to support that from config perspective.
    This are raw javascript callbacks that should be handled in the javascript world itself. (library)

    You can define a new library like this to attach your custom javascript to the open_readspeaker/conf library.

    # my-custom-module-or-theme.libraries.yml
    open_readspeaker_callbacks:
      version: VERSION
      js:
        js/cb.js: { }
      dependencies:
        - open_readspeaker/conf
    
    // cb.js
    (function (rsConf) {
      'use strict';
      const callbacks = { cb: { ui: { open: function() { console.log('Open Callback!') }}}}
      window.rsConf = { ...rsConf, ...callbacks};
    })(rsConf);
    

    I think a paragraph in the README.md should be enough to inform the Drupal-Developers / Site-Builders.

  • @sunlix opened merge request.
  • 🇩🇪Germany sunlix Wesel

    I think this is ready for now.

    I left a TODO for the phrases config-map.
    Currently I have no use case for this so I tend to spin off a follow-up to track the use case from the community.

  • Status changed to Needs review about 1 year ago
    • sunlix committed 098ed433 on 2.x
      Issue #3156251 by sunlix, Feng-Shui: Support for more settings
      
  • Status changed to Fixed about 1 year ago
  • 🇩🇪Germany sunlix Wesel

    Merged.
    I will update the update-hook later on, if all config changes are in place, so we get one update-hook for the full config migration.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024