Thunderbird/Betterbird add-on (Manifest V3): typing inside a quote splits the quote and inserts your own text with a marker such as [OH]:. - English and German user interface - Licensed under the Mozilla Public License 2.0 - English documentation, JSDoc lint gate, 87 tests (node:test + jsdom)
62 lines
3.4 KiB
Markdown
62 lines
3.4 KiB
Markdown
# Component: Options Page and Settings
|
|
|
|
**Files:** `src/options/options.html`, `options.js`, `options.css`; logic in `src/lib/settings.js`,
|
|
preview via `src/lib/marker.js`, translations via `src/lib/i18n.js`
|
|
|
|
**Storage location:** `storage.local["settings"]`:
|
|
|
|
```json
|
|
{
|
|
"global": {
|
|
"template": "[{initials}]:",
|
|
"textColor": "#0056b3",
|
|
"...": "..."
|
|
},
|
|
"identities": { "id3": { "template": "[{initials} / ACME]:", "...": "..." } }
|
|
}
|
|
```
|
|
|
|
- Without its own profile, an identity uses `global`; the page then shows the global settings with
|
|
the fields disabled. An own profile is a complete copy that is created from `global` when the
|
|
checkbox "Own settings for this identity" is ticked; unticking it deletes the profile.
|
|
- Every value read passes through `sanitizeSettings()`: unknown keys are dropped, missing or invalid
|
|
values are replaced with the defaults.
|
|
|
|
**Settings:**
|
|
|
|
| Key | Default | Meaning |
|
|
| ------------------------------------------- | --------------- | -------------------------------------------- |
|
|
| `enabledByDefault` | `true` | new emails start with the add-on active |
|
|
| `template` | `[{initials}]:` | marker template, max. 200 characters |
|
|
| `markerColor`, `markerBold`, `markerItalic` | `#003d80`, bold | style of the marker |
|
|
| `textColor`, `textBold`, `textItalic` | `#0056b3` | style of the own text |
|
|
| `highlight`, `highlightColor` | off, `#fff8c5` | background of the comment |
|
|
| `blankLineBefore`, `blankLineAfter` | off | spacing (1em) before/after the comment¹ |
|
|
| `splitMode` | `native` | `native` = editor splits, `manual` = add-on |
|
|
| `debug` | off | `console.debug` output of the compose script |
|
|
|
|
¹ Plain-text messages only use `blankLineBefore`, as a line break before the marker. Colours, bold,
|
|
italic and highlight apply to HTML messages only.
|
|
|
|
Placeholders in the template: `{initials}`, `{name}`, `{email}`, `{date}`, `{time}`. The buttons
|
|
below the template field insert them at the cursor.
|
|
|
|
Changes are saved 300 ms after the last edit and reach open compose windows through
|
|
`storage.onChanged`.
|
|
"Reset to defaults" asks for confirmation: the first click changes the button text, a second click
|
|
within four seconds resets the settings shown.
|
|
|
|
**Identities:** read with `identities.list()`, or from `accounts.list()` if that is not available.
|
|
The profile list shows "All identities (default)" first, then each identity, marked when it has its
|
|
own settings.
|
|
|
|
**Preview:** built with DOM APIs only: two `<blockquote type="cite">` elements with sample text and
|
|
the comment node from `createCommentNode()` in between. Marker and texts are always plain text. It
|
|
uses the selected identity, otherwise the first identity, otherwise a sample identity from the
|
|
messages (`previewSampleName`, `previewSampleEmail`).
|
|
|
|
**Localization:** static texts carry `data-i18n` attributes and are replaced by `localizeDocument()`
|
|
when the page loads; `<html lang>` is set from `i18n.getUILanguage()`. Dynamic texts (profile list,
|
|
hints, status, reset confirmation, preview) come from `i18n.getMessage()`. Details:
|
|
[i18n.md](./i18n.md).
|