@witty-works/editor 2.2.0 → 2.2.1
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 +7 -4
- package/dist/witty-editor.js +10 -10
- 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.2.
|
|
11
|
+
<script src="https://cdn.jsdelivr.net/npm/@witty-works/editor@2.2.1/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
|
|
|
@@ -63,15 +63,18 @@ A switch makes the chosen format the configured one, waits until the whole text
|
|
|
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
72
|
- A check result with `bulk: "gender_format"` belongs to the switch to the configured `german_gender_ending`. It has exactly one alternative, the form in that format, and such results never overlap.
|
|
71
73
|
- `bulk` is absent (or `null`) on every other result. Unknown `bulk` values are ignored.
|
|
72
|
-
-
|
|
74
|
+
- 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.
|
|
75
|
+
- `gender_separator` in the check response is the format the API applied; for German it is a `german_gender_ending` value.
|
|
73
76
|
|
|
74
|
-
Switching needs an NLP API that
|
|
77
|
+
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
78
|
|
|
76
79
|
## Long texts
|
|
77
80
|
|