You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The number of preferences that are integers representing enumerations keeps growing. Boolean preferences are automatically dealt with, but integers/enumerations are not.
Currently, to support a preference in the Chrome extension, the following needs to be done:
extensions/chromium/preferences_schema.json should get a new entry. Preferences are only shown if a "title" is provided. Boolean prefs are automatically rendered, e.g.:
The problem here is that the enumeration type is common, yet it requires much boilerplate code (in options.js, a single helper function can be used). If we choose a consistent format, templates in options.html can be auto-generated too (at the expense of readability, because then the dropdown labels have to be written in preferences_schema.json).
Secondly, to avoid breaking the settings page whenever a preference is changed/added, I should add linting to enforce that it is not possible to accidentally break the settings page (which has happened twice alredy, fixed in #8653 and #9490).
The text was updated successfully, but these errors were encountered:
The number of preferences that are integers representing enumerations keeps growing. Boolean preferences are automatically dealt with, but integers/enumerations are not.
Currently, to support a preference in the Chrome extension, the following needs to be done:
extensions/chromium/preferences_schema.json
should get a new entry. Preferences are only shown if a "title" is provided. Boolean prefs are automatically rendered, e.g.:pdf.js/extensions/chromium/preferences_schema.json
Lines 45 to 49 in a89071b
The following format (enumerations) are becoming more common,:but unlike the boolean type, they need extra attention, explained below.
pdf.js/extensions/chromium/preferences_schema.json
Lines 29 to 38 in a89071b
extensions/chromium/options/options.html
For enumerated preferences, add a new template, e.g.pdf.js/extensions/chromium/options/options.html
Lines 83 to 93 in a89071b
extensions/chromium/options/options.js
Add an if-check for the new preference name, and call a function that generates the event handler:pdf.js/extensions/chromium/options/options.js
Lines 82 to 83 in a89071b
pdf.js/extensions/chromium/options/options.js
Lines 203 to 218 in a89071b
The problem here is that the enumeration type is common, yet it requires much boilerplate code (in options.js, a single helper function can be used). If we choose a consistent format, templates in options.html can be auto-generated too (at the expense of readability, because then the dropdown labels have to be written in preferences_schema.json).
Secondly, to avoid breaking the settings page whenever a preference is changed/added, I should add linting to enforce that it is not possible to accidentally break the settings page (which has happened twice alredy, fixed in #8653 and #9490).
The text was updated successfully, but these errors were encountered: