@witty-works/editor 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -7
- package/dist/witty-editor.js +11 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ One self-contained script: no framework, no stylesheet to include.
|
|
|
8
8
|
|
|
9
9
|
```html
|
|
10
10
|
<div id="editor"></div>
|
|
11
|
-
<script src="https://cdn.jsdelivr.net/npm/@witty-works/editor@2.
|
|
11
|
+
<script src="https://cdn.jsdelivr.net/npm/@witty-works/editor@2.3.0/dist/witty-editor.js"></script>
|
|
12
12
|
<script>
|
|
13
13
|
const editor = WittyEditor.mount(document.getElementById('editor'), {
|
|
14
14
|
endpoint: 'https://your-nlp-api.example/',
|
|
@@ -47,7 +47,7 @@ It returns a handle:
|
|
|
47
47
|
- `setConfig(config)`: replace the whole check config (no merging) and check again; `{}` sends none.
|
|
48
48
|
- `getSettings()`: the current settings, `{config, llmAlternatives, orthography}`, as a copy; the same object `onSettingsChange` receives.
|
|
49
49
|
- `getText()`: the document as plain text.
|
|
50
|
-
- `switchGenderFormat(target)`: rewrite the text into a German gender format, as the menu does (see below). Resolves with `{outcome, target, count, limitReached}`; `outcome` is `switched`, `nothing`, `disabled` (the account keeps these alerts off), `unsupported` (the API has no bulk alerts) or `unavailable` (the Inklusivum).
|
|
50
|
+
- `switchGenderFormat(target)`: rewrite the text into a German gender format, as the menu does (see below). Resolves with `{outcome, target, count, limitReached}`; `outcome` is `switched`, `nothing`, `disabled` (the account keeps these alerts off), `forced` (the account forces another format, given as `applied`; nothing is changed), `unsupported` (the API has no bulk alerts) or `unavailable` (the Inklusivum).
|
|
51
51
|
- `editor`: the underlying [TipTap](https://tiptap.dev) editor.
|
|
52
52
|
- `destroy()`: remove the editor and everything it added to the page.
|
|
53
53
|
|
|
@@ -56,22 +56,29 @@ It returns a handle:
|
|
|
56
56
|
The W icon at the end of the toolbar shows whether Witty is checking, and opens a menu (a keyboard-operable ARIA menu: arrow keys, Home and End move, Escape closes and returns focus to the icon):
|
|
57
57
|
|
|
58
58
|
- **Settings…**: Witty's categories and preferences, as in the browser extension.
|
|
59
|
-
- **Switch gender format…**: rewrites every gendered form in the text into one of the eight German separator formats (`/in`, `/-in`, `_in`, `*in`, `:in`, `(-)`, `()`, `In`), labelled as in the settings. The Inklusivum (`de-e`) is listed but not available yet.
|
|
59
|
+
- **Switch gender format…**: rewrites every gendered form in the text into one of the eight German separator formats (`/in`, `/-in`, `_in`, `*in`, `:in`, `(-)`, `()`, `In`), labelled as in the settings. It also genders roles in the generic masculine (`Der Lehrer` → `Die:der Lehrer:in`) and pair formulas (`Schüler und Schülerinnen` → `Schüler:innen`), as far as the API marks them. The Inklusivum (`de-e`) is listed but not available yet.
|
|
60
60
|
- **Help** and **About**: the Witty Works help on the editor and the website, in a new tab.
|
|
61
61
|
|
|
62
|
-
A switch makes the chosen format the configured one, waits until the whole text has been checked (every batch of a long text), and then applies all alerts the API marked with `bulk: "gender_format"` in one transaction, so a single undo restores the text. The result is announced in the live region and passed to `onStatus` as `genderFormatSwitch
|
|
62
|
+
A switch makes the chosen format the configured one, waits until the whole text has been checked (every batch of a long text), and then applies all alerts the API marked with `bulk: "gender_format"` in one transaction, so a single undo restores the text. The result is announced once, in the editor's live region, and passed to `onStatus` as `genderFormatSwitch`; `count` includes the gendered masculines. If only part of the text was checked (`limitReached`), what was checked is switched and the message says so.
|
|
63
63
|
|
|
64
64
|
The switch's checks ask for the gender-format alerts even where the account turned them off: `gendered_denominations_ending_advanced` is taken out of `disabled_categories` and `gendered_roles_format` is `inclusive_gender`, for those requests only; the user's settings stay as they are. If the API still sends none, because the account's stored configuration forces them off, the editor says "Switching the gender format is turned off for this account".
|
|
65
65
|
|
|
66
|
+
An organisation or user config can also force the gender format. The API then converts towards the forced format, whatever the request asks for, so the editor compares the check response's `gender_separator` with the chosen format first. If they differ, it changes nothing, keeps the previous setting, and says which format the organisation sets (outcome `forced`).
|
|
67
|
+
|
|
66
68
|
### The `bulk` contract
|
|
67
69
|
|
|
68
70
|
The editor decides what to apply by `bulk` alone, never by subcategory:
|
|
69
71
|
|
|
70
|
-
- A check result with `bulk: "gender_format"` belongs to the switch to the configured `german_gender_ending
|
|
72
|
+
- A check result with `bulk: "gender_format"` belongs to the switch to the configured `german_gender_ending`: a form in another separator format, a role in the generic masculine, or a pair formula the API recognises.
|
|
73
|
+
- `bulk_alternative` is the index into its `alternatives` of the one the switch applies. The editor applies `alternatives[bulk_alternative]` when the index is an integer within range and that alternative has a `text`, and skips the result otherwise.
|
|
74
|
+
- Without `bulk_alternative` (API versions before it), a result is applied only if it has exactly one alternative, which is then the form in the target format.
|
|
75
|
+
- Such results never overlap, and applying all of them in any order gives the same text.
|
|
76
|
+
- Feminine forms, address forms, pronouns and pair formulas the API didn't recognise are left out by the API on purpose; the editor applies nothing it isn't marked for.
|
|
71
77
|
- `bulk` is absent (or `null`) on every other result. Unknown `bulk` values are ignored.
|
|
72
|
-
-
|
|
78
|
+
- Every check response lists the groups the request can return in `bulk_actions`, whether or not a result does: `["gender_format"]` for German with a separator format, inclusive roles and the gender-format alerts on, `[]` otherwise. After the switch's check, a list without `"gender_format"` means the account keeps the switch off.
|
|
79
|
+
- `gender_separator` in the check response is the format the API applied; for German it is a `german_gender_ending` value.
|
|
73
80
|
|
|
74
|
-
Switching needs an NLP API that
|
|
81
|
+
Switching needs an NLP API that sends `bulk_actions`; releases up to 2.4.8 do not. With those, the editor falls back to guessing from the results: gender-format results without `bulk` mean the server doesn't support switching yet, and the menu entry says so.
|
|
75
82
|
|
|
76
83
|
## Long texts
|
|
77
84
|
|