@writeon/core 0.2.0 → 0.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/llms-full.txt CHANGED
@@ -175,6 +175,7 @@ Or use the [default kit](/guide/kit.md): a themeable toolbar and content styles
175
175
  ## Next
176
176
 
177
177
  - [Other frameworks](/guide/frameworks.md): Svelte, Angular, Solid, Lit and the rest.
178
+ - [Web component](/guide/element.md): `<writeon-editor>` for Blade, Twig and plain HTML forms, no build step.
178
179
  - [Core concepts](/guide/concepts.md): documents, extensions, commands and state.
179
180
  - [Saving and loading](/guide/saving.md): store JSON, convert to HTML or Markdown.
180
181
  - [Security](/guide/security.md): validate on the server before you store or render.
@@ -307,11 +308,11 @@ const editor = createEditor({ extensions, label: 'Notes' })
307
308
  // and the rest come in a separate chunk.
308
309
  // The document, undo history and selection are kept.
309
310
  export async function turnOnAdvanced(): Promise<void> {
310
- await editor.enable(() => import('@writeon/advanced'))
311
+ await editor.extend(() => import('@writeon/advanced'))
311
312
  }
312
313
  ```
313
314
 
314
- `editor.enable()` adds behaviour to the running editor and keeps the document, undo history and selection. Extensions already added are skipped, so calling it twice is harmless.
315
+ `editor.extend()` adds behaviour to the running editor and keeps the document, undo history and selection. Extensions already added are skipped, so calling it twice is harmless.
315
316
 
316
317
  If you do not need lazy loading, pass everything up front:
317
318
 
@@ -388,7 +389,7 @@ editor.run(setFontFamily(null))
388
389
  - **Pasted text keeps** a font when its `font-family` starts with one of yours, a colour when it is exactly one of yours, and alignment.
389
390
  - **Contrast:** `textColor()` warns while you develop when a colour is under 4.5:1 on the background (`background`, default white).
390
391
  - **Markdown** has no fonts or colours: `toMarkdown()` keeps the text without them.
391
- - For menus, `activeFontFamily(state)` and `activeTextColor(state)` give the current id, and `textAlignmentAt(state)` the alignment.
392
+ - For menus, `activeFontFamily(editor)` and `activeTextColor(editor)` give the current id, and `activeTextAlign(editor)` the alignment.
392
393
 
393
394
  ### Image addresses
394
395
 
@@ -781,6 +782,180 @@ The packages are ES modules only. Vitest runs them as they are. Jest needs its E
781
782
 
782
783
  ---
783
784
 
785
+ Source: /guide/element.md
786
+
787
+ # Web component
788
+
789
+ `@writeon/element` is the editor as an HTML element, `<writeon-editor>`. It needs no framework and no build step, so it fits server-rendered pages: Laravel Blade, Symfony Twig, Django, Rails, plain HTML. It works inside a `<form>` like a `<textarea>`.
790
+
791
+ ## Install
792
+
793
+ From a CDN, with no build step. Pin the version you tested with:
794
+
795
+ ```html
796
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@writeon/element@0.1/dist/style.css" />
797
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@writeon/element@0.1/dist/cdn/writeon-editor.js"></script>
798
+ ```
799
+
800
+ The CDN file has everything in it (about 115 KB gzipped). With a bundler (Vite, webpack), install the package instead; it shares ProseMirror and Writeon with the rest of your app:
801
+
802
+ ```sh
803
+ npm install @writeon/element
804
+ ```
805
+
806
+ ```ts
807
+ import '@writeon/element/style.css'
808
+ import '@writeon/element' // registers <writeon-editor>
809
+ ```
810
+
811
+ ## Use it in a form
812
+
813
+ Put a `<textarea>` inside, with the name and the current value:
814
+
815
+ ```blade [Blade]
816
+ <form method="post" action="/posts/{{ $post->id }}">
817
+ @csrf
818
+ <writeon-editor label="Article text" locale="uz">
819
+ <textarea name="body" required>{{ $post->body }}</textarea>
820
+ </writeon-editor>
821
+ <button>Save</button>
822
+ </form>
823
+ ```
824
+
825
+ ```twig [Twig]
826
+ <form method="post">
827
+ <writeon-editor label="Article text">
828
+ <textarea name="body" required>{{ post.body }}</textarea>
829
+ </writeon-editor>
830
+ <button>Save</button>
831
+ </form>
832
+ ```
833
+
834
+ ```html [HTML]
835
+ <form method="post">
836
+ <writeon-editor label="Article text">
837
+ <textarea name="body">&lt;p&gt;Hello&lt;/p&gt;</textarea>
838
+ </writeon-editor>
839
+ <button>Save</button>
840
+ </form>
841
+ ```
842
+
843
+ Print the value **escaped** (`{{ }}`, not `{!! !!}` or `|raw`). A textarea shows text, never runs it, so stored HTML cannot run while the page loads.
844
+
845
+ What the element does with the textarea:
846
+
847
+ - **Until the element starts, and if JavaScript does not load, the textarea is the field.** The form still sends the text. If the element cannot start (no accessible name, a value it cannot read), the textarea stays and a `writeon-error` event says why.
848
+ - Once it starts, it takes the textarea's `name`, `required`, `disabled` and `id` (for `<label for>`), and hides it.
849
+ - **Until the user changes the text, the form sends the original value unchanged**, even HTML the editor would not keep. Opening and saving a page never rewrites old content.
850
+ - After a change, the form sends the editor's HTML.
851
+
852
+ It also behaves like a form field in the other ways: `required` blocks the submit and focuses the editor (the message is in the editor's language), a form reset brings back the original value, and a disabled `<fieldset>` makes it read-only and leaves it out of the form.
853
+
854
+ ## Attributes
855
+
856
+ | Attribute | Meaning |
857
+ | --- | --- |
858
+ | `label` | The accessible name. Required, unless a `<label for="…">` points at the textarea's `id`. |
859
+ | `name` | The form field name. Usually taken from the textarea. |
860
+ | `locale` | `en`, `uz` or `ru`, for the toolbar and messages. Default: the nearest `lang` attribute, then English. |
861
+ | `placeholder` | Text shown while empty. |
862
+ | `required`, `readonly`, `disabled` | As on a textarea. |
863
+ | `format` | `html` (default) or `json`: what the form sends. |
864
+ | `toolbar` | `none` hides the toolbar. |
865
+ | `advanced` | Tables, images, task lists, code blocks, the `/` menu and the formatting bubble. Loaded when needed. |
866
+ | `upload-url` | With `advanced`: images are uploaded with a `POST` (field `file`) to this address, which answers `{ "url": "…" }`. |
867
+
868
+ Tables, images and task lists in stored HTML are kept even without `advanced`; the attribute only adds the tools to create and edit them.
869
+
870
+ ## JavaScript
871
+
872
+ ```ts
873
+ const field = document.querySelector('writeon-editor')
874
+
875
+ field.value // the current HTML (or JSON with format="json")
876
+ field.value = '<p>New text</p>'
877
+ field.editor // the full Editor: commands, state, getJSON()
878
+ field.upload = myUploadFunction // instead of upload-url, e.g. to add headers
879
+
880
+ field.addEventListener('input', () => {}) // every change
881
+ field.addEventListener('change', () => {}) // on leaving, after a change
882
+ ```
883
+
884
+ For an upload that needs a CSRF header (Laravel), set `upload` with `fetchUploader({ url, headers })` from `@writeon/advanced`; see [Image uploads](/recipes/upload-s3.md).
885
+
886
+ ## Security: sanitize on the server
887
+
888
+ The form sends HTML, and **anyone can send any HTML** to your server without the editor. Sanitize it before you store it, with an allowlist of exactly what the editor produces.
889
+
890
+ In PHP, with [symfony/html-sanitizer](https://symfony.com/doc/current/html_sanitizer.html) (works in Laravel too):
891
+
892
+ ```php
893
+ <?php
894
+ // composer require symfony/html-sanitizer:^7.4
895
+
896
+ use Symfony\Component\HtmlSanitizer\HtmlSanitizer;
897
+ use Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig;
898
+
899
+ // Exactly the tags and attributes <writeon-editor> produces. Anything
900
+ // else (scripts, event handlers, style, iframes, forms) is removed.
901
+ function writeon_sanitizer(): HtmlSanitizer
902
+ {
903
+ $config = (new HtmlSanitizerConfig())
904
+ ->allowElement('p')
905
+ ->allowElement('h1')
906
+ ->allowElement('h2')
907
+ ->allowElement('h3')
908
+ ->allowElement('strong')
909
+ ->allowElement('em')
910
+ ->allowElement('u')
911
+ ->allowElement('s')
912
+ ->allowElement('br')
913
+ ->allowElement('blockquote')
914
+ ->allowElement('div')
915
+ ->allowElement('code', ['class'])
916
+ ->allowElement('pre', ['data-language'])
917
+ ->allowElement('a', ['href', 'title'])
918
+ ->forceAttribute('a', 'rel', 'noopener noreferrer nofollow')
919
+ ->allowElement('ul', ['data-type'])
920
+ ->allowElement('ol', ['start'])
921
+ ->allowElement('li', ['data-type', 'data-checked'])
922
+ ->allowElement('span', ['data-type', 'data-id', 'data-label'])
923
+ ->allowElement('img', ['src', 'alt', 'title', 'width', 'height', 'data-alt-missing'])
924
+ ->allowElement('table')
925
+ ->allowElement('tbody')
926
+ ->allowElement('tr')
927
+ ->allowElement('th', ['colspan', 'rowspan', 'data-colwidth'])
928
+ ->allowElement('td', ['colspan', 'rowspan', 'data-colwidth'])
929
+ ->allowLinkSchemes(['http', 'https', 'mailto', 'tel'])
930
+ ->allowRelativeLinks()
931
+ ->allowMediaSchemes(['http', 'https'])
932
+ ->allowRelativeMedias()
933
+ ->withMaxInputLength(1_000_000);
934
+
935
+ return new HtmlSanitizer($config);
936
+ }
937
+ ```
938
+
939
+ Call `writeon_sanitizer()->sanitize($request->input('body'))` before you store the field.
940
+
941
+ This configuration is tested against the editor's output and against common attacks.
942
+
943
+ Then print the stored, sanitized value as HTML (`{!! $post->body !!}`) inside an element with your content styles. The checkbox of a task list item is not kept (an `<input>` in content is a risk); style `li[data-checked="true"]` in your CSS instead.
944
+
945
+ With a Node.js backend, send `format="json"` and use `validate()` and `toSafeHTML()` from `@writeon/server`, as described in [Security](/guide/security.md).
946
+
947
+ ## Livewire, Turbo and other DOM updaters
948
+
949
+ - **Livewire:** add `wire:ignore` to the element (or a wrapper), so Livewire does not replace the editor's DOM on every update. Read the value from the form, or with `field.value`.
950
+ - **Turbo / Hotwire:** works as is. A page restored from Turbo's cache starts with the last edited text.
951
+ - **htmx:** swapping the element out and in starts a new editor with the value of its textarea.
952
+
953
+ ## Limits
954
+
955
+ The element is the editor with the default kit. Mentions, custom blocks, fonts and colours have no attributes: use `field.editor`, or the npm packages directly with [your framework](/guide/frameworks.md).
956
+
957
+ ---
958
+
784
959
  Source: /guide/security.md
785
960
 
786
961
  # Security
@@ -835,7 +1010,7 @@ export async function savePost(
835
1010
  - checks the JSON shape and refuses `__proto__`, `constructor` and `prototype` keys;
836
1011
  - enforces limits: size (1 MB), depth (32) and node count (50 000) by default;
837
1012
  - removes unknown nodes, marks and attributes, invalid attribute values and content the schema does not allow;
838
- - removes links and images whose address is not allowed (`javascript:`, `data:` and so on);
1013
+ - removes links and images whose address is not allowed (`javascript:`, `data:` and so on). The allowed protocols are those of `link()` in the extensions you pass (`basic({ link: { protocols } })`), so the server accepts exactly what the editor does; `urls: { protocols }` overrides them;
839
1014
  - in `'strip'` mode (default) returns the cleaned document and what was removed; in `'strict'` mode refuses the whole document instead.
840
1015
 
841
1016
  `toSafeHTML()` renders only what the schema knows, escapes all text and checks every URL again.
@@ -1127,6 +1302,8 @@ export function MyToolbar({ editor }: { editor: Editor }) {
1127
1302
  }
1128
1303
  ```
1129
1304
 
1305
+ To add your own props to a prop getter's output, use `mergeProps()` from `@writeon/react`, or Vue's own `mergeProps()` from `vue`: both chain event handlers instead of replacing them.
1306
+
1130
1307
  ## Positioning
1131
1308
 
1132
1309
  Controllers never position anything. Popups that follow the text (bubble, suggestion lists) expose a `reference` compatible with [Floating UI](https://floating-ui.com)'s virtual elements:
@@ -1184,7 +1361,7 @@ Packages: `@writeon/core` (editor, `/presets`, `/commands`, `/extension`),
1184
1361
  `@writeon/react`, `@writeon/vue`, `@writeon/ui` (headless controllers),
1185
1362
  `@writeon/kit` (ready-made UI, `/react`, `/vue`, `/advanced`),
1186
1363
  `@writeon/advanced` (+ `/schema`), `@writeon/html`, `@writeon/markdown`,
1187
- `@writeon/server`.
1364
+ `@writeon/server`, `@writeon/element` (`<writeon-editor>` web component for HTML forms).
1188
1365
 
1189
1366
  Rules:
1190
1367
  - Store the document as JSON: `editor.getJSON()` (`DocJSON`). HTML and Markdown are
@@ -1198,7 +1375,7 @@ Rules:
1198
1375
  - Commands are factories: `editor.run(toggleBold())`, `editor.can(toggleBold())`;
1199
1376
  several in one undo step with `editor.transaction((tx) => { … })`.
1200
1377
  - Advanced features: include `advancedSchema()` in the extensions from the start;
1201
- load the behaviour later with `editor.enable(() => import('@writeon/advanced'))`,
1378
+ load the behaviour later with `editor.extend(() => import('@writeon/advanced'))`,
1202
1379
  or use the kit's `<Advanced>` / `mountAdvanced()`.
1203
1380
  - `editor.pm` (raw ProseMirror) is not a stable API; prefer commands, snapshots
1204
1381
  (`getSnapshot()`, `subscribe()`) and extensions (`defineExtension`).
@@ -1213,6 +1390,64 @@ Every public function, type and option has JSDoc, often with an example. Assista
1213
1390
 
1214
1391
  ---
1215
1392
 
1393
+ Source: /guide/stability.md
1394
+
1395
+ # Stability
1396
+
1397
+ From 1.0, Writeon follows [semantic versioning](https://semver.org): a patch fixes, a minor adds, and only a major breaks. This page says what counts as breaking.
1398
+
1399
+ **Before 1.0:**
1400
+ In 0.x a minor release may still break the API; its changelog says how to update. Stored documents are the exception: the promise below already holds since 0.1.0.
1401
+
1402
+ ## Stored documents
1403
+
1404
+ **Every 1.x release reads every document stored since 0.1.0.** You never have to rewrite your database for a Writeon update.
1405
+
1406
+ - A document carries its format version (`schemaVersion`). When the format changes, the release ships a migration, and `createEditor()` and `validate()` apply it on load. To store the upgraded form, run `migrateDoc()` yourself.
1407
+ - An older release refuses a document from a newer one with a clear error instead of loading it partly.
1408
+ - A test keeps the promise: documents with every node, mark and attribute, as the published releases since 0.1.0 stored them, must load, pass `validate()` in strict mode and render to the same HTML in every release.
1409
+
1410
+ ## What semver covers
1411
+
1412
+ - **The TypeScript API**: everything the package entry points export (`@writeon/core`, `@writeon/advanced/schema`, …). The repository keeps it as text in [`api/`](https://github.com/writeon-editor/writeon/tree/main/api), and a pull request that changes it shows the change there.
1413
+ - **The document format**: `DocJSON`, the node, mark and attribute names, and what each value means.
1414
+ - **The HTML of `toHTML()` and `toSafeHTML()`**: the elements, attributes and classes they write for a document. A minor release may add an attribute, never remove or rename one. `fromHTML()` reads what every earlier 1.x wrote.
1415
+ - **The kit's styling hooks**: the `--rte-*` CSS variables, `.rte-root`, `.rte-content` and `data-theme`.
1416
+ - **`<writeon-editor>`**: the tag name, its attributes, properties and events, and what it sends with the form.
1417
+ - **Error codes** of `validate()` (`unknown-node`, `unsafe-url`, …). Messages are for people and can change.
1418
+
1419
+ ## What it does not cover
1420
+
1421
+ - **`editor.pm`**, the ProseMirror view and state. It follows ProseMirror's own releases.
1422
+ - **Anything marked `@experimental`** in its docs, now `@writeon/advanced/embed`. It can change in a minor; the changelog says so. Stored documents are still covered.
1423
+ - **Anything marked `@internal`**, and imports of files inside a package (`@writeon/core/dist/…`) instead of its entry points.
1424
+ - **The markup of the editing UI**: toolbar, menus and popovers, except the styling hooks above. Style them through the CSS variables.
1425
+ - **Bug fixes.** When behaviour does not match the docs, a patch fixes the behaviour, even if some code relied on it.
1426
+
1427
+ ## Deprecations
1428
+
1429
+ A minor release can deprecate an API; the next major removes it at the earliest. A deprecated API:
1430
+
1431
+ - is marked `@deprecated` with what to use instead, so your editor shows it crossed out;
1432
+ - warns once in the console when it is first used;
1433
+ - is listed in the changelog of the release that deprecates it and in the upgrade guide of the major.
1434
+
1435
+ ## Browsers
1436
+
1437
+ Writeon supports browsers released in the last two years: Chrome, Edge, Firefox and Safari, on desktop, Android and iOS. Every change runs the end-to-end tests in current Chromium, Firefox and WebKit, and on emulated Android and iPhone screens.
1438
+
1439
+ `<writeon-editor>` needs form-associated custom elements: Chrome and Edge 77, Firefox 98, Safari 16.4 or later.
1440
+
1441
+ Dropping a browser that is still within the two years is a breaking change.
1442
+
1443
+ ## Node.js
1444
+
1445
+ `@writeon/html`, `@writeon/markdown` and `@writeon/server` run on the server without a DOM, on the maintained LTS versions of Node.js: 22, 24 and 26, all tested on every change. The packages are ES modules only: load them with `import`.
1446
+
1447
+ A major release of Writeon may drop a Node.js version that has reached its end of life.
1448
+
1449
+ ---
1450
+
1216
1451
  Source: /recipes/upload-s3.md
1217
1452
 
1218
1453
  # Image uploads to S3
@@ -1246,7 +1481,7 @@ async function signUpload(
1246
1481
  }
1247
1482
 
1248
1483
  export async function enableUploads(editor: Editor): Promise<void> {
1249
- await editor.enable([
1484
+ await editor.extend([
1250
1485
  imageUpload({
1251
1486
  upload: presignedUploader({ getTarget: signUpload }),
1252
1487
  // 5 MB
@@ -1342,6 +1577,9 @@ Source: /recipes/custom-blocks.md
1342
1577
 
1343
1578
  Some content is not text: a list of pickup branches, a product carousel, a map. Store it as a **custom block** (an embed) and let your front end render the component.
1344
1579
 
1580
+ **Experimental:**
1581
+ The `@writeon/advanced/embed` API can still change in a minor release (see [Stability](/guide/stability.md)). Stored blocks keep loading either way.
1582
+
1345
1583
  ```ts
1346
1584
  import {
1347
1585
  embed,
@@ -1394,7 +1632,7 @@ editor.run(updateEmbed({ category: 'saws', limit: 12 }))
1394
1632
  - **Settings** (`props`) are typed fields: `string`, `number` (with `min`, `max`, `integer`), `boolean` and `enum` (fixed `options`), each `required` or with a `default`. `embedPropsError(kind, props)` explains what is wrong, for your form.
1395
1633
  - **On the server**, `validate()` removes a block whose kind is not configured or whose props do not fit it (unknown fields, wrong types, a missing required field). Props are always a flat object of plain values.
1396
1634
  - **Markdown**: `[[product-list {"category":"drills","limit":8}]]` on its own line, read back by `fromMarkdown()`.
1397
- - **UI**: `embedKinds(state)` lists the kinds for your menu; `selectedEmbed(state)` gives the selected block for a settings form.
1635
+ - **UI**: `embedKinds(editor)` lists the kinds for your menu; `selectedEmbed(editor)` gives the selected block for a settings form.
1398
1636
 
1399
1637
  ---
1400
1638
 
@@ -1464,7 +1702,7 @@ Remember:
1464
1702
 
1465
1703
  - **Add it on the server too**, or `validate()` removes the new mark as unknown.
1466
1704
  - Commands are factories returning a command, like the built-in ones, so `editor.run(toggleHighlight())` and `editor.can(toggleHighlight())` read the same.
1467
- - An extension with nodes or marks must be passed to `createEditor()`. `editor.enable()` only adds behaviour; for that, split the extension into a schema part and a behaviour part, like `@writeon/advanced` does.
1705
+ - An extension with nodes or marks must be passed to `createEditor()`. `editor.extend()` only adds behaviour; for that, split the extension into a schema part and a behaviour part, like `@writeon/advanced` does.
1468
1706
 
1469
1707
  ---
1470
1708
 
@@ -1537,8 +1775,7 @@ Source: /api/advanced/reference.md
1537
1775
 
1538
1776
  Advanced editing behaviour: task lists, code blocks, image uploads, tables
1539
1777
  and mentions. Load it lazily and turn it on with
1540
- `editor.enable(advanced())`; the node types come from `@mfsv-
1541
- rte/advanced/schema`.
1778
+ `editor.extend(advanced())`; the node types come from `@writeon/advanced/schema`.
1542
1779
 
1543
1780
  ## Classes
1544
1781
 
@@ -2000,7 +2237,7 @@ Source: /api/advanced/variables/default.md
2000
2237
  const default: Extension[];
2001
2238
  ```
2002
2239
 
2003
- The default export, so `editor.enable(() => import('@writeon/advanced'))` works.
2240
+ The default export, so `editor.extend(() => import('@writeon/advanced'))` works.
2004
2241
 
2005
2242
  ---
2006
2243
 
@@ -2193,7 +2430,7 @@ All advanced behaviour. Pair it with `advancedSchema()` in `createEditor()`.
2193
2430
  createEditor({ extensions: [...basic(), advancedSchema(), ...advanced()], label })
2194
2431
  // or on demand, keeping the document, undo history and selection
2195
2432
  createEditor({ extensions: [...basic(), advancedSchema()], label })
2196
- await editor.enable(() => import('@writeon/advanced'))
2433
+ await editor.extend(() => import('@writeon/advanced'))
2197
2434
  ```
2198
2435
 
2199
2436
  ---
@@ -2477,6 +2714,9 @@ branches. Documents store `{ type: 'embed', attrs: { kind, props } }`; the
2477
2714
  kinds and their props are configured, so the server (`validate()`) drops
2478
2715
  anything else. Small and eager: add `embed()` to the editor from the start.
2479
2716
 
2717
+ Experimental: the API can change in a minor release (see the stability
2718
+ page). Stored embeds keep loading.
2719
+
2480
2720
  ## Interfaces
2481
2721
 
2482
2722
  - [EmbedBooleanProp](interfaces/EmbedBooleanProp.md)
@@ -2513,15 +2753,17 @@ Source: /api/advanced/embed/interfaces/EmbedBooleanProp.md
2513
2753
 
2514
2754
  # Interface: EmbedBooleanProp
2515
2755
 
2756
+ **`Experimental`**
2757
+
2516
2758
  A yes/no field of an embed.
2517
2759
 
2518
2760
  ## Properties
2519
2761
 
2520
2762
  | Property | Type | Description |
2521
2763
  | ------ | ------ | ------ |
2522
- | <a id="property-default"></a> `default?` | `boolean` | Value for a new embed. Default false. |
2523
- | <a id="property-label"></a> `label` | `string` | Shown in the form. |
2524
- | <a id="property-type"></a> `type` | `"boolean"` | A yes/no field. |
2764
+ | <a id="property-default"></a> `default?` | `boolean` | **`Experimental`** Value for a new embed. Default false. |
2765
+ | <a id="property-label"></a> `label` | `string` | **`Experimental`** Shown in the form. |
2766
+ | <a id="property-type"></a> `type` | `"boolean"` | **`Experimental`** A yes/no field. |
2525
2767
 
2526
2768
  ---
2527
2769
 
@@ -2529,17 +2771,19 @@ Source: /api/advanced/embed/interfaces/EmbedEnumProp.md
2529
2771
 
2530
2772
  # Interface: EmbedEnumProp
2531
2773
 
2774
+ **`Experimental`**
2775
+
2532
2776
  A choice from fixed options.
2533
2777
 
2534
2778
  ## Properties
2535
2779
 
2536
2780
  | Property | Type | Description |
2537
2781
  | ------ | ------ | ------ |
2538
- | <a id="property-default"></a> `default?` | `string` | Value for a new embed. |
2539
- | <a id="property-label"></a> `label` | `string` | Shown in the form. |
2540
- | <a id="property-options"></a> `options` | readonly [`EmbedOption`](EmbedOption.md)[] | The choices: the stored value and its label. |
2541
- | <a id="property-required"></a> `required?` | `boolean` | Must be chosen. |
2542
- | <a id="property-type"></a> `type` | `"enum"` | A choice from fixed options. |
2782
+ | <a id="property-default"></a> `default?` | `string` | **`Experimental`** Value for a new embed. |
2783
+ | <a id="property-label"></a> `label` | `string` | **`Experimental`** Shown in the form. |
2784
+ | <a id="property-options"></a> `options` | readonly [`EmbedOption`](EmbedOption.md)[] | **`Experimental`** The choices: the stored value and its label. |
2785
+ | <a id="property-required"></a> `required?` | `boolean` | **`Experimental`** Must be chosen. |
2786
+ | <a id="property-type"></a> `type` | `"enum"` | **`Experimental`** A choice from fixed options. |
2543
2787
 
2544
2788
  ---
2545
2789
 
@@ -2547,16 +2791,18 @@ Source: /api/advanced/embed/interfaces/EmbedKind.md
2547
2791
 
2548
2792
  # Interface: EmbedKind
2549
2793
 
2794
+ **`Experimental`**
2795
+
2550
2796
  A kind of block the user can insert.
2551
2797
 
2552
2798
  ## Properties
2553
2799
 
2554
2800
  | Property | Type | Description |
2555
2801
  | ------ | ------ | ------ |
2556
- | <a id="property-description"></a> `description?` | `string` | A second line in the menu. |
2557
- | <a id="property-id"></a> `id` | `string` | Stored in the document, e.g. `'pickup-branches'`. Letters, digits, `-` and `_`. |
2558
- | <a id="property-label"></a> `label` | `string` | Shown in the menu and in the editor, e.g. `'Olib ketish filiallari'`. |
2559
- | <a id="property-props"></a> `props?` | `Readonly`\<`Record`\<`string`, [`EmbedPropSpec`](../type-aliases/EmbedPropSpec.md)\>\> | Settings the user fills in, by field name (letters, digits, `_`). |
2802
+ | <a id="property-description"></a> `description?` | `string` | **`Experimental`** A second line in the menu. |
2803
+ | <a id="property-id"></a> `id` | `string` | **`Experimental`** Stored in the document, e.g. `'pickup-branches'`. Letters, digits, `-` and `_`. |
2804
+ | <a id="property-label"></a> `label` | `string` | **`Experimental`** Shown in the menu and in the editor, e.g. `'Olib ketish filiallari'`. |
2805
+ | <a id="property-props"></a> `props?` | `Readonly`\<`Record`\<`string`, [`EmbedPropSpec`](../type-aliases/EmbedPropSpec.md)\>\> | **`Experimental`** Settings the user fills in, by field name (letters, digits, `_`). |
2560
2806
 
2561
2807
  ---
2562
2808
 
@@ -2564,19 +2810,21 @@ Source: /api/advanced/embed/interfaces/EmbedNumberProp.md
2564
2810
 
2565
2811
  # Interface: EmbedNumberProp
2566
2812
 
2813
+ **`Experimental`**
2814
+
2567
2815
  A number field of an embed.
2568
2816
 
2569
2817
  ## Properties
2570
2818
 
2571
2819
  | Property | Type | Description |
2572
2820
  | ------ | ------ | ------ |
2573
- | <a id="property-default"></a> `default?` | `number` | Value for a new embed. |
2574
- | <a id="property-integer"></a> `integer?` | `boolean` | Whole numbers only. |
2575
- | <a id="property-label"></a> `label` | `string` | Shown in the form. |
2576
- | <a id="property-max"></a> `max?` | `number` | Largest value. |
2577
- | <a id="property-min"></a> `min?` | `number` | Smallest value. |
2578
- | <a id="property-required"></a> `required?` | `boolean` | Must be filled in. |
2579
- | <a id="property-type"></a> `type` | `"number"` | A number field. |
2821
+ | <a id="property-default"></a> `default?` | `number` | **`Experimental`** Value for a new embed. |
2822
+ | <a id="property-integer"></a> `integer?` | `boolean` | **`Experimental`** Whole numbers only. |
2823
+ | <a id="property-label"></a> `label` | `string` | **`Experimental`** Shown in the form. |
2824
+ | <a id="property-max"></a> `max?` | `number` | **`Experimental`** Largest value. |
2825
+ | <a id="property-min"></a> `min?` | `number` | **`Experimental`** Smallest value. |
2826
+ | <a id="property-required"></a> `required?` | `boolean` | **`Experimental`** Must be filled in. |
2827
+ | <a id="property-type"></a> `type` | `"number"` | **`Experimental`** A number field. |
2580
2828
 
2581
2829
  ---
2582
2830
 
@@ -2584,14 +2832,16 @@ Source: /api/advanced/embed/interfaces/EmbedOption.md
2584
2832
 
2585
2833
  # Interface: EmbedOption
2586
2834
 
2835
+ **`Experimental`**
2836
+
2587
2837
  One choice of an `enum` field.
2588
2838
 
2589
2839
  ## Properties
2590
2840
 
2591
2841
  | Property | Type | Description |
2592
2842
  | ------ | ------ | ------ |
2593
- | <a id="property-label"></a> `label` | `string` | Shown in the form. |
2594
- | <a id="property-value"></a> `value` | `string` | Stored in the document. |
2843
+ | <a id="property-label"></a> `label` | `string` | **`Experimental`** Shown in the form. |
2844
+ | <a id="property-value"></a> `value` | `string` | **`Experimental`** Stored in the document. |
2595
2845
 
2596
2846
  ---
2597
2847
 
@@ -2599,13 +2849,15 @@ Source: /api/advanced/embed/interfaces/EmbedOptions.md
2599
2849
 
2600
2850
  # Interface: EmbedOptions
2601
2851
 
2852
+ **`Experimental`**
2853
+
2602
2854
  Options for `embed()`.
2603
2855
 
2604
2856
  ## Properties
2605
2857
 
2606
2858
  | Property | Type | Description |
2607
2859
  | ------ | ------ | ------ |
2608
- | <a id="property-kinds"></a> `kinds` | readonly [`EmbedKind`](EmbedKind.md)[] | The blocks the user can insert. |
2860
+ | <a id="property-kinds"></a> `kinds` | readonly [`EmbedKind`](EmbedKind.md)[] | **`Experimental`** The blocks the user can insert. |
2609
2861
 
2610
2862
  ---
2611
2863
 
@@ -2613,17 +2865,19 @@ Source: /api/advanced/embed/interfaces/EmbedStringProp.md
2613
2865
 
2614
2866
  # Interface: EmbedStringProp
2615
2867
 
2868
+ **`Experimental`**
2869
+
2616
2870
  A text field of an embed.
2617
2871
 
2618
2872
  ## Properties
2619
2873
 
2620
2874
  | Property | Type | Description |
2621
2875
  | ------ | ------ | ------ |
2622
- | <a id="property-default"></a> `default?` | `string` | Value for a new embed. |
2623
- | <a id="property-label"></a> `label` | `string` | Shown in the form. |
2624
- | <a id="property-maxlength"></a> `maxLength?` | `number` | Longest value. Default 500. |
2625
- | <a id="property-required"></a> `required?` | `boolean` | Must be filled in. |
2626
- | <a id="property-type"></a> `type` | `"string"` | A text field. |
2876
+ | <a id="property-default"></a> `default?` | `string` | **`Experimental`** Value for a new embed. |
2877
+ | <a id="property-label"></a> `label` | `string` | **`Experimental`** Shown in the form. |
2878
+ | <a id="property-maxlength"></a> `maxLength?` | `number` | **`Experimental`** Longest value. Default 500. |
2879
+ | <a id="property-required"></a> `required?` | `boolean` | **`Experimental`** Must be filled in. |
2880
+ | <a id="property-type"></a> `type` | `"string"` | **`Experimental`** A text field. |
2627
2881
 
2628
2882
  ---
2629
2883
 
@@ -2631,15 +2885,17 @@ Source: /api/advanced/embed/interfaces/SelectedEmbed.md
2631
2885
 
2632
2886
  # Interface: SelectedEmbed
2633
2887
 
2888
+ **`Experimental`**
2889
+
2634
2890
  The selected embed, from `selectedEmbed()`.
2635
2891
 
2636
2892
  ## Properties
2637
2893
 
2638
2894
  | Property | Type | Description |
2639
2895
  | ------ | ------ | ------ |
2640
- | <a id="property-kind"></a> `kind` | [`EmbedKind`](EmbedKind.md) | Its kind, as configured. |
2641
- | <a id="property-pos"></a> `pos` | `number` | Its position in the document. |
2642
- | <a id="property-props"></a> `props` | [`EmbedProps`](../type-aliases/EmbedProps.md) | Its settings. |
2896
+ | <a id="property-kind"></a> `kind` | [`EmbedKind`](EmbedKind.md) | **`Experimental`** Its kind, as configured. |
2897
+ | <a id="property-pos"></a> `pos` | `number` | **`Experimental`** Its position in the document. |
2898
+ | <a id="property-props"></a> `props` | [`EmbedProps`](../type-aliases/EmbedProps.md) | **`Experimental`** Its settings. |
2643
2899
 
2644
2900
  ---
2645
2901
 
@@ -2651,6 +2907,8 @@ Source: /api/advanced/embed/type-aliases/EmbedProps.md
2651
2907
  type EmbedProps = Readonly<Record<string, EmbedPropValue>>;
2652
2908
  ```
2653
2909
 
2910
+ **`Experimental`**
2911
+
2654
2912
  An embed's settings, by field name.
2655
2913
 
2656
2914
  ---
@@ -2667,6 +2925,8 @@ type EmbedPropSpec =
2667
2925
  | EmbedEnumProp;
2668
2926
  ```
2669
2927
 
2928
+ **`Experimental`**
2929
+
2670
2930
  One field of an embed's settings.
2671
2931
 
2672
2932
  ---
@@ -2679,6 +2939,8 @@ Source: /api/advanced/embed/type-aliases/EmbedPropValue.md
2679
2939
  type EmbedPropValue = string | number | boolean;
2680
2940
  ```
2681
2941
 
2942
+ **`Experimental`**
2943
+
2682
2944
  A stored prop value.
2683
2945
 
2684
2946
  ---
@@ -2691,6 +2953,8 @@ Source: /api/advanced/embed/variables/embed.md
2691
2953
  const embed: (options) => Extension;
2692
2954
  ```
2693
2955
 
2956
+ **`Experimental`**
2957
+
2694
2958
  Custom blocks your front end renders. Each kind is a block the user
2695
2959
  inserts from a menu (and edits through a form when it has props); the
2696
2960
  editor shows it as `[[Label]]`. HTML: `<div data-embed="kind"
@@ -2734,6 +2998,8 @@ Source: /api/advanced/embed/functions/embedDefaults.md
2734
2998
  function embedDefaults(kind, props?): EmbedProps;
2735
2999
  ```
2736
3000
 
3001
+ **`Experimental`**
3002
+
2737
3003
  The props of a new embed: the defaults, overridden by `props`, empty values dropped.
2738
3004
 
2739
3005
  ## Parameters
@@ -2754,16 +3020,18 @@ Source: /api/advanced/embed/functions/embedKinds.md
2754
3020
  # Function: embedKinds()
2755
3021
 
2756
3022
  ```ts
2757
- function embedKinds(state): readonly EmbedKind[];
3023
+ function embedKinds(editor): readonly EmbedKind[];
2758
3024
  ```
2759
3025
 
3026
+ **`Experimental`**
3027
+
2760
3028
  The kinds configured with `embed()` in this editor's schema, or none.
2761
3029
 
2762
3030
  ## Parameters
2763
3031
 
2764
3032
  | Parameter | Type |
2765
3033
  | ------ | ------ |
2766
- | `state` | `EditorState` |
3034
+ | `editor` | [`Editor`](../../../core/interfaces/Editor.md) |
2767
3035
 
2768
3036
  ## Returns
2769
3037
 
@@ -2779,6 +3047,8 @@ Source: /api/advanced/embed/functions/embedPropsError.md
2779
3047
  function embedPropsError(kind, props): string | null;
2780
3048
  ```
2781
3049
 
3050
+ **`Experimental`**
3051
+
2782
3052
  Why `props` are not valid for `kind`, or null when they are. Missing
2783
3053
  optional fields are fine; unknown fields, wrong types and values out of
2784
3054
  range are not.
@@ -2804,6 +3074,8 @@ Source: /api/advanced/embed/functions/insertEmbed.md
2804
3074
  function insertEmbed(kind, props?): Command;
2805
3075
  ```
2806
3076
 
3077
+ **`Experimental`**
3078
+
2807
3079
  Insert an embed of `kind` with the defaults and `props`: in place of an
2808
3080
  empty paragraph, after the paragraph holding the cursor (text is never
2809
3081
  split) or after a selected node. The cursor ends in the paragraph below.
@@ -2828,16 +3100,18 @@ Source: /api/advanced/embed/functions/selectedEmbed.md
2828
3100
  # Function: selectedEmbed()
2829
3101
 
2830
3102
  ```ts
2831
- function selectedEmbed(state): SelectedEmbed | null;
3103
+ function selectedEmbed(editor): SelectedEmbed | null;
2832
3104
  ```
2833
3105
 
3106
+ **`Experimental`**
3107
+
2834
3108
  The selected embed (its kind, props and position), or null.
2835
3109
 
2836
3110
  ## Parameters
2837
3111
 
2838
3112
  | Parameter | Type |
2839
3113
  | ------ | ------ |
2840
- | `state` | `EditorState` |
3114
+ | `editor` | [`Editor`](../../../core/interfaces/Editor.md) |
2841
3115
 
2842
3116
  ## Returns
2843
3117
 
@@ -2853,6 +3127,8 @@ Source: /api/advanced/embed/functions/updateEmbed.md
2853
3127
  function updateEmbed(props): Command;
2854
3128
  ```
2855
3129
 
3130
+ **`Experimental`**
3131
+
2856
3132
  Replace the props of the selected embed. Fails when they are not valid.
2857
3133
 
2858
3134
  ## Parameters
@@ -2898,11 +3174,11 @@ Small and eager: add them to the editor from the start, like
2898
3174
  ## Functions
2899
3175
 
2900
3176
  - [activeFontFamily](functions/activeFontFamily.md)
3177
+ - [activeTextAlign](functions/activeTextAlign.md)
2901
3178
  - [activeTextColor](functions/activeTextColor.md)
2902
3179
  - [setFontFamily](functions/setFontFamily.md)
2903
3180
  - [setTextAlign](functions/setTextAlign.md)
2904
3181
  - [setTextColor](functions/setTextColor.md)
2905
- - [textAlignmentAt](functions/textAlignmentAt.md)
2906
3182
 
2907
3183
  ---
2908
3184
 
@@ -3097,7 +3373,7 @@ Source: /api/advanced/formatting/functions/activeFontFamily.md
3097
3373
  # Function: activeFontFamily()
3098
3374
 
3099
3375
  ```ts
3100
- function activeFontFamily(state): string | null;
3376
+ function activeFontFamily(editor): string | null;
3101
3377
  ```
3102
3378
 
3103
3379
  The font at the selection: its id, or null for none or a mix.
@@ -3106,7 +3382,7 @@ The font at the selection: its id, or null for none or a mix.
3106
3382
 
3107
3383
  | Parameter | Type |
3108
3384
  | ------ | ------ |
3109
- | `state` | `EditorState` |
3385
+ | `editor` | [`Editor`](../../../core/interfaces/Editor.md) |
3110
3386
 
3111
3387
  ## Returns
3112
3388
 
@@ -3114,12 +3390,35 @@ The font at the selection: its id, or null for none or a mix.
3114
3390
 
3115
3391
  ---
3116
3392
 
3393
+ Source: /api/advanced/formatting/functions/activeTextAlign.md
3394
+
3395
+ # Function: activeTextAlign()
3396
+
3397
+ ```ts
3398
+ function activeTextAlign(editor): TextAlignment | null;
3399
+ ```
3400
+
3401
+ The alignment of the block that holds the selection (`'left'` when unset),
3402
+ or null when that block cannot be aligned.
3403
+
3404
+ ## Parameters
3405
+
3406
+ | Parameter | Type |
3407
+ | ------ | ------ |
3408
+ | `editor` | [`Editor`](../../../core/interfaces/Editor.md) |
3409
+
3410
+ ## Returns
3411
+
3412
+ [`TextAlignment`](../type-aliases/TextAlignment.md) \| `null`
3413
+
3414
+ ---
3415
+
3117
3416
  Source: /api/advanced/formatting/functions/activeTextColor.md
3118
3417
 
3119
3418
  # Function: activeTextColor()
3120
3419
 
3121
3420
  ```ts
3122
- function activeTextColor(state): string | null;
3421
+ function activeTextColor(editor): string | null;
3123
3422
  ```
3124
3423
 
3125
3424
  The colour at the selection: its id, or null for none or a mix.
@@ -3128,7 +3427,7 @@ The colour at the selection: its id, or null for none or a mix.
3128
3427
 
3129
3428
  | Parameter | Type |
3130
3429
  | ------ | ------ |
3131
- | `state` | `EditorState` |
3430
+ | `editor` | [`Editor`](../../../core/interfaces/Editor.md) |
3132
3431
 
3133
3432
  ## Returns
3134
3433
 
@@ -3202,28 +3501,6 @@ Set the colour of the selection (or of what is typed next); `null` removes it.
3202
3501
 
3203
3502
  ---
3204
3503
 
3205
- Source: /api/advanced/formatting/functions/textAlignmentAt.md
3206
-
3207
- # Function: textAlignmentAt()
3208
-
3209
- ```ts
3210
- function textAlignmentAt(state): TextAlignment | null;
3211
- ```
3212
-
3213
- The alignment of the block that holds the selection (`'left'` when unset).
3214
-
3215
- ## Parameters
3216
-
3217
- | Parameter | Type |
3218
- | ------ | ------ |
3219
- | `state` | `EditorState` |
3220
-
3221
- ## Returns
3222
-
3223
- [`TextAlignment`](../type-aliases/TextAlignment.md) \| `null`
3224
-
3225
- ---
3226
-
3227
3504
  Source: /api/advanced/schema/reference.md
3228
3505
 
3229
3506
  # @writeon/advanced/schema
@@ -3288,7 +3565,7 @@ The node types of advanced mode, without their behaviour: task lists,
3288
3565
  code blocks, images, tables and mentions. Add it to `createEditor()` so documents that use these nodes
3289
3566
  load and display everywhere (in basic mode the content stays visible and
3290
3567
  its text editable), then turn on the behaviour with
3291
- `editor.enable(() => import('@writeon/advanced'))`. Small, always loaded.
3568
+ `editor.extend(() => import('@writeon/advanced'))`. Small, always loaded.
3292
3569
 
3293
3570
  Use the same list on the server: `validate(doc, { extensions: [...basic(), advancedSchema()] })`.
3294
3571
 
@@ -3351,8 +3628,9 @@ migrations, URL rules and helpers.
3351
3628
  ## Type Aliases
3352
3629
 
3353
3630
  - [Command](type-aliases/Command.md)
3354
- - [EditorEnableSource](type-aliases/EditorEnableSource.md)
3631
+ - [EditorExtendSource](type-aliases/EditorExtendSource.md)
3355
3632
  - [EditorLabel](type-aliases/EditorLabel.md)
3633
+ - [HeadingLevel](type-aliases/HeadingLevel.md)
3356
3634
 
3357
3635
  ## Variables
3358
3636
 
@@ -3515,12 +3793,34 @@ Release everything. The editor cannot be used afterwards.
3515
3793
 
3516
3794
  ***
3517
3795
 
3518
- ### enable()
3796
+ ### ~~enable()~~
3519
3797
 
3520
3798
  ```ts
3521
3799
  enable(source): Promise<void>;
3522
3800
  ```
3523
3801
 
3802
+ #### Parameters
3803
+
3804
+ | Parameter | Type |
3805
+ | ------ | ------ |
3806
+ | `source` | [`EditorExtendSource`](../type-aliases/EditorExtendSource.md) |
3807
+
3808
+ #### Returns
3809
+
3810
+ `Promise`\<`void`\>
3811
+
3812
+ #### Deprecated
3813
+
3814
+ Renamed to `extend()`, which this calls. Removed in 1.0.
3815
+
3816
+ ***
3817
+
3818
+ ### extend()
3819
+
3820
+ ```ts
3821
+ extend(source): Promise<void>;
3822
+ ```
3823
+
3524
3824
  Add behaviour (commands' keymaps, input rules, plugins) from more
3525
3825
  extensions to the running editor, typically loaded on demand. The
3526
3826
  document, undo history and selection are kept. Their nodes and marks
@@ -3531,7 +3831,7 @@ must already be in the schema: pass the schema extension (e.g.
3531
3831
 
3532
3832
  | Parameter | Type |
3533
3833
  | ------ | ------ |
3534
- | `source` | [`EditorEnableSource`](../type-aliases/EditorEnableSource.md) |
3834
+ | `source` | [`EditorExtendSource`](../type-aliases/EditorExtendSource.md) |
3535
3835
 
3536
3836
  #### Returns
3537
3837
 
@@ -3540,7 +3840,7 @@ must already be in the schema: pass the schema extension (e.g.
3540
3840
  #### Example
3541
3841
 
3542
3842
  ```ts
3543
- await editor.enable(() => import('@writeon/advanced'))
3843
+ await editor.extend(() => import('@writeon/advanced'))
3544
3844
  ```
3545
3845
 
3546
3846
  ***
@@ -3765,7 +4065,7 @@ Options for `createEditor()`.
3765
4065
  | <a id="property-content"></a> `content?` | [`DocJSON`](DocJSON.md) \| `null` | Initial document. Omit for an empty document. |
3766
4066
  | <a id="property-editable"></a> `editable?` | `boolean` | Whether the user can edit. Defaults to `true`. |
3767
4067
  | <a id="property-element"></a> `element?` | `HTMLElement` | Element to mount into. Omit to create the editor first and call `mount()` later. |
3768
- | <a id="property-extensions"></a> `extensions` | [`Extension`](Extension.md)[] | Extensions that make up the editor, usually a preset such as `basic()`. |
4068
+ | <a id="property-extensions"></a> `extensions` | readonly [`Extension`](Extension.md)[] | Extensions that make up the editor, usually a preset such as `basic()`. |
3769
4069
  | <a id="property-label"></a> `label` | [`EditorLabel`](../type-aliases/EditorLabel.md) | Accessible name: an `aria-label` string or the id of a labelling element. |
3770
4070
  | <a id="property-onblur"></a> `onBlur?` | (`editor`) => `void` | Called when the editable area loses focus, also when it is unmounted while focused. |
3771
4071
  | <a id="property-onchange"></a> `onChange?` | (`editor`) => `void` | Called after every change to the document. |
@@ -3901,12 +4201,12 @@ pass it to `editor.run()` or `editor.can()`.
3901
4201
 
3902
4202
  ---
3903
4203
 
3904
- Source: /api/core/type-aliases/EditorEnableSource.md
4204
+ Source: /api/core/type-aliases/EditorExtendSource.md
3905
4205
 
3906
- # Type Alias: EditorEnableSource
4206
+ # Type Alias: EditorExtendSource
3907
4207
 
3908
4208
  ```ts
3909
- type EditorEnableSource =
4209
+ type EditorExtendSource =
3910
4210
  | readonly Extension[]
3911
4211
  | (() => Promise<
3912
4212
  | readonly Extension[]
@@ -3915,7 +4215,7 @@ type EditorEnableSource =
3915
4215
  }>);
3916
4216
  ```
3917
4217
 
3918
- Extensions to enable, or a loader for them (a module whose default export is the list works too).
4218
+ Extensions to add, or a loader for them (a module whose default export is the list works too).
3919
4219
 
3920
4220
  ---
3921
4221
 
@@ -3957,6 +4257,18 @@ Id of the element that labels the editor (`aria-labelledby`).
3957
4257
 
3958
4258
  ---
3959
4259
 
4260
+ Source: /api/core/type-aliases/HeadingLevel.md
4261
+
4262
+ # Type Alias: HeadingLevel
4263
+
4264
+ ```ts
4265
+ type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
4266
+ ```
4267
+
4268
+ A heading level, `1` (`<h1>`) to `6` (`<h6>`).
4269
+
4270
+ ---
4271
+
3960
4272
  Source: /api/core/variables/DEFAULT_PROTOCOLS.md
3961
4273
 
3962
4274
  # Variable: DEFAULT\_PROTOCOLS
@@ -4145,6 +4457,12 @@ lists, links, history.
4145
4457
  - [undo](functions/undo.md)
4146
4458
  - [unsetLink](functions/unsetLink.md)
4147
4459
 
4460
+ ## References
4461
+
4462
+ ### HeadingLevel
4463
+
4464
+ Re-exports [HeadingLevel](../type-aliases/HeadingLevel.md)
4465
+
4148
4466
  ---
4149
4467
 
4150
4468
  Source: /api/core/commands/interfaces/LinkAttrs.md
@@ -4352,7 +4670,7 @@ Turn the selected blocks into headings of `level`. Requires the `heading` extens
4352
4670
 
4353
4671
  | Parameter | Type |
4354
4672
  | ------ | ------ |
4355
- | `level` | `number` |
4673
+ | `level` | [`HeadingLevel`](../../type-aliases/HeadingLevel.md) |
4356
4674
 
4357
4675
  ## Returns
4358
4676
 
@@ -4447,7 +4765,7 @@ Heading of `level` if the block is not one already, otherwise back to a paragrap
4447
4765
 
4448
4766
  | Parameter | Type |
4449
4767
  | ------ | ------ |
4450
- | `level` | `number` |
4768
+ | `level` | [`HeadingLevel`](../../type-aliases/HeadingLevel.md) |
4451
4769
 
4452
4770
  ## Returns
4453
4771
 
@@ -4744,305 +5062,756 @@ Options for the `heading` extension.
4744
5062
 
4745
5063
  | Property | Type | Description |
4746
5064
  | ------ | ------ | ------ |
4747
- | <a id="property-levels"></a> `levels?` | readonly `number`[] | Heading levels the user can create. Default `[1, 2, 3]`. |
5065
+ | <a id="property-levels"></a> `levels?` | readonly [`HeadingLevel`](../../type-aliases/HeadingLevel.md)[] | Heading levels the user can create. Default `[1, 2, 3]`. |
5066
+
5067
+ ---
5068
+
5069
+ Source: /api/core/extensions/interfaces/HistoryOptions.md
5070
+
5071
+ # Interface: HistoryOptions
5072
+
5073
+ Options for the `history` extension.
5074
+
5075
+ ## Properties
5076
+
5077
+ | Property | Type | Description |
5078
+ | ------ | ------ | ------ |
5079
+ | <a id="property-depth"></a> `depth?` | `number` | How many undo steps to keep. Default 100. |
5080
+ | <a id="property-newgroupdelay"></a> `newGroupDelay?` | `number` | Changes closer together than this (ms) merge into one undo step. Default 500. |
5081
+
5082
+ ---
5083
+
5084
+ Source: /api/core/extensions/interfaces/LinkOptions.md
5085
+
5086
+ # Interface: LinkOptions
5087
+
5088
+ Options for the `link` extension.
5089
+
5090
+ ## Properties
5091
+
5092
+ | Property | Type | Description |
5093
+ | ------ | ------ | ------ |
5094
+ | <a id="property-protocols"></a> `protocols?` | readonly `string`[] | Allowed URL protocols. Default: `http`, `https`, `mailto`, `tel`. |
5095
+
5096
+ ---
5097
+
5098
+ Source: /api/core/extensions/variables/blockquote.md
5099
+
5100
+ # Variable: blockquote
5101
+
5102
+ ```ts
5103
+ const blockquote: () => Extension;
5104
+ ```
5105
+
5106
+ Block quotes. `Mod-Shift-b` or `> `.
5107
+
5108
+ ## Returns
5109
+
5110
+ [`Extension`](../../interfaces/Extension.md)
5111
+
5112
+ ---
5113
+
5114
+ Source: /api/core/extensions/variables/bold.md
5115
+
5116
+ # Variable: bold
5117
+
5118
+ ```ts
5119
+ const bold: () => Extension;
5120
+ ```
5121
+
5122
+ Bold text. `Mod-b`, `**text**` or `__text__`.
5123
+
5124
+ ## Returns
5125
+
5126
+ [`Extension`](../../interfaces/Extension.md)
5127
+
5128
+ ---
5129
+
5130
+ Source: /api/core/extensions/variables/code.md
5131
+
5132
+ # Variable: code
5133
+
5134
+ ```ts
5135
+ const code: () => Extension;
5136
+ ```
5137
+
5138
+ Inline code. `Mod-e` or `` `text` ``. No other marks inside code.
5139
+
5140
+ ## Returns
5141
+
5142
+ [`Extension`](../../interfaces/Extension.md)
5143
+
5144
+ ---
5145
+
5146
+ Source: /api/core/extensions/variables/hardBreak.md
5147
+
5148
+ # Variable: hardBreak
5149
+
5150
+ ```ts
5151
+ const hardBreak: () => Extension;
5152
+ ```
5153
+
5154
+ Line break inside a block. `Shift-Enter` or `Mod-Enter`.
5155
+
5156
+ ## Returns
5157
+
5158
+ [`Extension`](../../interfaces/Extension.md)
5159
+
5160
+ ---
5161
+
5162
+ Source: /api/core/extensions/variables/heading.md
5163
+
5164
+ # Variable: heading
5165
+
5166
+ ```ts
5167
+ const heading: (options?) => Extension;
5168
+ ```
5169
+
5170
+ Headings. `Mod-Alt-1…6`, `# ` … `###### `; `Mod-Alt-0` back to paragraph.
5171
+
5172
+ ## Parameters
5173
+
5174
+ | Parameter | Type |
5175
+ | ------ | ------ |
5176
+ | `options?` | [`HeadingOptions`](../interfaces/HeadingOptions.md) |
5177
+
5178
+ ## Returns
5179
+
5180
+ [`Extension`](../../interfaces/Extension.md)
5181
+
5182
+ ---
5183
+
5184
+ Source: /api/core/extensions/variables/history.md
5185
+
5186
+ # Variable: history
5187
+
5188
+ ```ts
5189
+ const history: (options?) => Extension;
5190
+ ```
5191
+
5192
+ Undo and redo. `Mod-z`, `Mod-Shift-z` / `Mod-y`; `Backspace` right after a shortcut undoes it.
5193
+
5194
+ ## Parameters
5195
+
5196
+ | Parameter | Type |
5197
+ | ------ | ------ |
5198
+ | `options?` | [`HistoryOptions`](../interfaces/HistoryOptions.md) |
5199
+
5200
+ ## Returns
5201
+
5202
+ [`Extension`](../../interfaces/Extension.md)
5203
+
5204
+ ---
5205
+
5206
+ Source: /api/core/extensions/variables/italic.md
5207
+
5208
+ # Variable: italic
5209
+
5210
+ ```ts
5211
+ const italic: () => Extension;
5212
+ ```
5213
+
5214
+ Italic text. `Mod-i`, `*text*` or `_text_`.
5215
+
5216
+ ## Returns
5217
+
5218
+ [`Extension`](../../interfaces/Extension.md)
5219
+
5220
+ ---
5221
+
5222
+ Source: /api/core/extensions/variables/link.md
5223
+
5224
+ # Variable: link
5225
+
5226
+ ```ts
5227
+ const link: (options?) => Extension;
5228
+ ```
5229
+
5230
+ Links. Unsafe URLs (such as `javascript:`) are dropped on paste and refused
5231
+ by `setLink()`. Links never get `target="_blank"`: opening new windows
5232
+ without warning is an accessibility problem.
5233
+
5234
+ ## Parameters
5235
+
5236
+ | Parameter | Type |
5237
+ | ------ | ------ |
5238
+ | `options?` | [`LinkOptions`](../interfaces/LinkOptions.md) |
5239
+
5240
+ ## Returns
5241
+
5242
+ [`Extension`](../../interfaces/Extension.md)
5243
+
5244
+ ---
5245
+
5246
+ Source: /api/core/extensions/variables/list.md
5247
+
5248
+ # Variable: list
5249
+
5250
+ ```ts
5251
+ const list: () => Extension;
5252
+ ```
5253
+
5254
+ Bullet and ordered lists. `Mod-Shift-8` / `Mod-Shift-7`, `- ` / `1. `, `Tab` / `Shift-Tab` to nest.
5255
+
5256
+ ## Returns
5257
+
5258
+ [`Extension`](../../interfaces/Extension.md)
5259
+
5260
+ ---
5261
+
5262
+ Source: /api/core/extensions/variables/strike.md
5263
+
5264
+ # Variable: strike
5265
+
5266
+ ```ts
5267
+ const strike: () => Extension;
5268
+ ```
5269
+
5270
+ Strikethrough. `Mod-Shift-s` or `~~text~~`.
5271
+
5272
+ ## Returns
5273
+
5274
+ [`Extension`](../../interfaces/Extension.md)
5275
+
5276
+ ---
5277
+
5278
+ Source: /api/core/extensions/variables/underline.md
5279
+
5280
+ # Variable: underline
5281
+
5282
+ ```ts
5283
+ const underline: () => Extension;
5284
+ ```
5285
+
5286
+ Underlined text. `Mod-u`.
5287
+
5288
+ ## Returns
5289
+
5290
+ [`Extension`](../../interfaces/Extension.md)
5291
+
5292
+ ---
5293
+
5294
+ Source: /api/core/presets/reference.md
5295
+
5296
+ # @writeon/core/presets
5297
+
5298
+ The `basic()` preset: everything a typical text field needs, each part
5299
+ configurable or switchable off.
5300
+
5301
+ ## Interfaces
5302
+
5303
+ - [BasicOptions](interfaces/BasicOptions.md)
5304
+
5305
+ ## Functions
5306
+
5307
+ - [basic](functions/basic.md)
5308
+
5309
+ ---
5310
+
5311
+ Source: /api/core/presets/interfaces/BasicOptions.md
5312
+
5313
+ # Interface: BasicOptions
5314
+
5315
+ Per-extension settings for `basic()`. `false` leaves an extension out.
5316
+
5317
+ ## Properties
5318
+
5319
+ | Property | Type | Description |
5320
+ | ------ | ------ | ------ |
5321
+ | <a id="property-blockquote"></a> `blockquote?` | `false` | Blockquotes. |
5322
+ | <a id="property-bold"></a> `bold?` | `false` | Bold. |
5323
+ | <a id="property-code"></a> `code?` | `false` | Inline code. |
5324
+ | <a id="property-hardbreak"></a> `hardBreak?` | `false` | Line breaks (`Shift-Enter`). |
5325
+ | <a id="property-heading"></a> `heading?` | \| `false` \| [`HeadingOptions`](../../extensions/interfaces/HeadingOptions.md) | Headings, or their options. |
5326
+ | <a id="property-history"></a> `history?` | \| `false` \| [`HistoryOptions`](../../extensions/interfaces/HistoryOptions.md) | Undo and redo, or their options. |
5327
+ | <a id="property-italic"></a> `italic?` | `false` | Italic. |
5328
+ | <a id="property-link"></a> `link?` | `false` \| [`LinkOptions`](../../extensions/interfaces/LinkOptions.md) | Links, or their options. |
5329
+ | <a id="property-list"></a> `list?` | `false` | Bullet and ordered lists. |
5330
+ | <a id="property-strike"></a> `strike?` | `false` | Strikethrough. |
5331
+ | <a id="property-underline"></a> `underline?` | `false` | Underline. |
5332
+
5333
+ ---
5334
+
5335
+ Source: /api/core/presets/functions/basic.md
5336
+
5337
+ # Function: basic()
5338
+
5339
+ ```ts
5340
+ function basic(options?): Extension[];
5341
+ ```
5342
+
5343
+ The basic editor: paragraphs, headings, bold, italic, underline, strike,
5344
+ inline code, links, lists, blockquotes, line breaks and undo/redo.
5345
+
5346
+ ## Parameters
5347
+
5348
+ | Parameter | Type |
5349
+ | ------ | ------ |
5350
+ | `options?` | [`BasicOptions`](../interfaces/BasicOptions.md) |
5351
+
5352
+ ## Returns
5353
+
5354
+ [`Extension`](../../interfaces/Extension.md)[]
5355
+
5356
+ ## Example
5357
+
5358
+ ```ts
5359
+ basic() // everything, defaults
5360
+ basic({ strike: false }) // without strikethrough
5361
+ basic({ heading: { levels: [2, 3] } }) // only H2 and H3
5362
+ basic({ link: { protocols: ['https'] } }) // https links only
5363
+ ```
5364
+
5365
+ ---
5366
+
5367
+ Source: /api/element/reference.md
5368
+
5369
+ # @writeon/element
5370
+
5371
+ `<writeon-editor>`: Writeon as a web component and form field, for plain
5372
+ HTML, server-rendered pages (Laravel Blade, Symfony Twig, Django…) and any
5373
+ framework. Importing this module registers the element.
5374
+
5375
+ ## Example
5376
+
5377
+ ```html
5378
+ <link rel="stylesheet" href="…/@writeon/element/dist/style.css" />
5379
+ <script type="module">import '@writeon/element'</script>
5380
+
5381
+ <writeon-editor label="Article text">
5382
+ <textarea name="body">{{ $post->body }}</textarea>
5383
+ </writeon-editor>
5384
+ ```
5385
+
5386
+ ## Classes
5387
+
5388
+ - [WriteonEditor](classes/WriteonEditor.md)
5389
+
5390
+ ## Type Aliases
5391
+
5392
+ - [WriteonFormat](type-aliases/WriteonFormat.md)
5393
+
5394
+ ## Functions
5395
+
5396
+ - [defineWriteonEditor](functions/defineWriteonEditor.md)
5397
+
5398
+ ---
5399
+
5400
+ Source: /api/element/classes/WriteonEditor.md
5401
+
5402
+ # Class: WriteonEditor
5403
+
5404
+ `<writeon-editor>`: the editor with the default kit, as a form field.
5405
+
5406
+ Put a `<textarea>` inside: it is the field until the element starts (and
5407
+ for good if JavaScript does not load), and it gives the name, the initial
5408
+ value and `required`. Its text is never run as HTML while the page loads.
5409
+
5410
+ ```html
5411
+ <writeon-editor label="Article text">
5412
+ <textarea name="body">&lt;p&gt;Hello&lt;/p&gt;</textarea>
5413
+ </writeon-editor>
5414
+ ```
5415
+
5416
+ The submitted value is HTML (or JSON with `format="json"`). Until the
5417
+ user changes the text, the form submits the original value unchanged.
5418
+ Always validate or sanitize it on the server.
5419
+
5420
+ ## Extends
5421
+
5422
+ - `Base`
5423
+
5424
+ ## Constructors
5425
+
5426
+ ### Constructor
5427
+
5428
+ ```ts
5429
+ new WriteonEditor(): WriteonEditor;
5430
+ ```
5431
+
5432
+ #### Returns
5433
+
5434
+ `WriteonEditor`
5435
+
5436
+ #### Inherited from
5437
+
5438
+ `Base.constructor`
5439
+
5440
+ ## Properties
5441
+
5442
+ ### formAssociated
5443
+
5444
+ ```ts
5445
+ static formAssociated: boolean = true;
5446
+ ```
5447
+
5448
+ Takes part in forms like a built-in field (ElementInternals).
5449
+
5450
+ ***
5451
+
5452
+ ### observedAttributes
5453
+
5454
+ ```ts
5455
+ static observedAttributes: string[];
5456
+ ```
5457
+
5458
+ Attributes that update a running editor.
5459
+
5460
+ ***
5461
+
5462
+ ### upload
5463
+
5464
+ ```ts
5465
+ upload: UploadFn | undefined;
5466
+ ```
5467
+
5468
+ Upload function for images when `advanced` is on. `upload-url` sets a simple one.
5469
+
5470
+ ## Accessors
5471
+
5472
+ ### disabled
5473
+
5474
+ #### Get Signature
5475
+
5476
+ ```ts
5477
+ get disabled(): boolean;
5478
+ ```
5479
+
5480
+ Read-only and left out of the form, like `disabled` on a textarea. Reflects the attribute.
5481
+
5482
+ ##### Returns
5483
+
5484
+ `boolean`
5485
+
5486
+ #### Set Signature
5487
+
5488
+ ```ts
5489
+ set disabled(value): void;
5490
+ ```
5491
+
5492
+ Sets or removes the `disabled` attribute.
5493
+
5494
+ ##### Parameters
5495
+
5496
+ | Parameter | Type |
5497
+ | ------ | ------ |
5498
+ | `value` | `boolean` |
5499
+
5500
+ ##### Returns
5501
+
5502
+ `void`
5503
+
5504
+ ***
5505
+
5506
+ ### editor
4748
5507
 
4749
- ---
5508
+ #### Get Signature
4750
5509
 
4751
- Source: /api/core/extensions/interfaces/HistoryOptions.md
5510
+ ```ts
5511
+ get editor(): Editor | null;
5512
+ ```
4752
5513
 
4753
- # Interface: HistoryOptions
5514
+ The editor, once the element is connected. Use it for commands and state.
4754
5515
 
4755
- Options for the `history` extension.
5516
+ ##### Returns
4756
5517
 
4757
- ## Properties
5518
+ [`Editor`](../../core/interfaces/Editor.md) \| `null`
4758
5519
 
4759
- | Property | Type | Description |
4760
- | ------ | ------ | ------ |
4761
- | <a id="property-depth"></a> `depth?` | `number` | How many undo steps to keep. Default 100. |
4762
- | <a id="property-newgroupdelay"></a> `newGroupDelay?` | `number` | Changes closer together than this (ms) merge into one undo step. Default 500. |
5520
+ ***
4763
5521
 
4764
- ---
5522
+ ### form
4765
5523
 
4766
- Source: /api/core/extensions/interfaces/LinkOptions.md
5524
+ #### Get Signature
4767
5525
 
4768
- # Interface: LinkOptions
5526
+ ```ts
5527
+ get form(): HTMLFormElement | null;
5528
+ ```
4769
5529
 
4770
- Options for the `link` extension.
5530
+ The form the element belongs to.
4771
5531
 
4772
- ## Properties
5532
+ ##### Returns
4773
5533
 
4774
- | Property | Type | Description |
4775
- | ------ | ------ | ------ |
4776
- | <a id="property-protocols"></a> `protocols?` | readonly `string`[] | Allowed URL protocols. Default: `http`, `https`, `mailto`, `tel`. |
5534
+ `HTMLFormElement` \| `null`
4777
5535
 
4778
- ---
5536
+ ***
4779
5537
 
4780
- Source: /api/core/extensions/variables/blockquote.md
5538
+ ### format
4781
5539
 
4782
- # Variable: blockquote
5540
+ #### Get Signature
4783
5541
 
4784
5542
  ```ts
4785
- const blockquote: () => Extension;
5543
+ get format(): WriteonFormat;
4786
5544
  ```
4787
5545
 
4788
- Block quotes. `Mod-Shift-b` or `> `.
5546
+ `html` (default) or `json`: what `value` and the form use.
4789
5547
 
4790
- ## Returns
5548
+ ##### Returns
4791
5549
 
4792
- [`Extension`](../../interfaces/Extension.md)
5550
+ [`WriteonFormat`](../type-aliases/WriteonFormat.md)
4793
5551
 
4794
- ---
5552
+ ***
4795
5553
 
4796
- Source: /api/core/extensions/variables/bold.md
5554
+ ### labels
4797
5555
 
4798
- # Variable: bold
5556
+ #### Get Signature
4799
5557
 
4800
5558
  ```ts
4801
- const bold: () => Extension;
5559
+ get labels(): NodeList;
4802
5560
  ```
4803
5561
 
4804
- Bold text. `Mod-b`, `**text**` or `__text__`.
5562
+ The `<label>` elements of the field, as on a built-in field.
4805
5563
 
4806
- ## Returns
5564
+ ##### Returns
4807
5565
 
4808
- [`Extension`](../../interfaces/Extension.md)
5566
+ `NodeList`
4809
5567
 
4810
- ---
5568
+ ***
4811
5569
 
4812
- Source: /api/core/extensions/variables/code.md
5570
+ ### name
4813
5571
 
4814
- # Variable: code
5572
+ #### Get Signature
4815
5573
 
4816
5574
  ```ts
4817
- const code: () => Extension;
5575
+ get name(): string | null;
4818
5576
  ```
4819
5577
 
4820
- Inline code. `Mod-e` or `` `text` ``. No other marks inside code.
5578
+ The form field name, from `name` or the textarea's.
4821
5579
 
4822
- ## Returns
5580
+ ##### Returns
4823
5581
 
4824
- [`Extension`](../../interfaces/Extension.md)
5582
+ `string` \| `null`
4825
5583
 
4826
- ---
5584
+ ***
4827
5585
 
4828
- Source: /api/core/extensions/variables/hardBreak.md
5586
+ ### readOnly
4829
5587
 
4830
- # Variable: hardBreak
5588
+ #### Get Signature
4831
5589
 
4832
5590
  ```ts
4833
- const hardBreak: () => Extension;
5591
+ get readOnly(): boolean;
4834
5592
  ```
4835
5593
 
4836
- Line break inside a block. `Shift-Enter` or `Mod-Enter`.
4837
-
4838
- ## Returns
4839
-
4840
- [`Extension`](../../interfaces/Extension.md)
5594
+ Not editable, but still sent with the form. Reflects the `readonly` attribute.
4841
5595
 
4842
- ---
5596
+ ##### Returns
4843
5597
 
4844
- Source: /api/core/extensions/variables/heading.md
5598
+ `boolean`
4845
5599
 
4846
- # Variable: heading
5600
+ #### Set Signature
4847
5601
 
4848
5602
  ```ts
4849
- const heading: (options?) => Extension;
5603
+ set readOnly(value): void;
4850
5604
  ```
4851
5605
 
4852
- Headings. `Mod-Alt-1…6`, `# ` … `###### `; `Mod-Alt-0` back to paragraph.
5606
+ Sets or removes the `readonly` attribute.
4853
5607
 
4854
- ## Parameters
5608
+ ##### Parameters
4855
5609
 
4856
5610
  | Parameter | Type |
4857
5611
  | ------ | ------ |
4858
- | `options?` | [`HeadingOptions`](../interfaces/HeadingOptions.md) |
5612
+ | `value` | `boolean` |
4859
5613
 
4860
- ## Returns
5614
+ ##### Returns
4861
5615
 
4862
- [`Extension`](../../interfaces/Extension.md)
5616
+ `void`
4863
5617
 
4864
- ---
5618
+ ***
4865
5619
 
4866
- Source: /api/core/extensions/variables/history.md
5620
+ ### required
4867
5621
 
4868
- # Variable: history
5622
+ #### Get Signature
4869
5623
 
4870
5624
  ```ts
4871
- const history: (options?) => Extension;
5625
+ get required(): boolean;
4872
5626
  ```
4873
5627
 
4874
- Undo and redo. `Mod-z`, `Mod-Shift-z` / `Mod-y`; `Backspace` right after a shortcut undoes it.
5628
+ An empty editor blocks the submit. Reflects the attribute.
4875
5629
 
4876
- ## Parameters
5630
+ ##### Returns
5631
+
5632
+ `boolean`
5633
+
5634
+ #### Set Signature
5635
+
5636
+ ```ts
5637
+ set required(value): void;
5638
+ ```
5639
+
5640
+ Sets or removes the `required` attribute.
5641
+
5642
+ ##### Parameters
4877
5643
 
4878
5644
  | Parameter | Type |
4879
5645
  | ------ | ------ |
4880
- | `options?` | [`HistoryOptions`](../interfaces/HistoryOptions.md) |
5646
+ | `value` | `boolean` |
4881
5647
 
4882
- ## Returns
5648
+ ##### Returns
4883
5649
 
4884
- [`Extension`](../../interfaces/Extension.md)
5650
+ `void`
4885
5651
 
4886
- ---
5652
+ ***
4887
5653
 
4888
- Source: /api/core/extensions/variables/italic.md
5654
+ ### validationMessage
4889
5655
 
4890
- # Variable: italic
5656
+ #### Get Signature
4891
5657
 
4892
5658
  ```ts
4893
- const italic: () => Extension;
5659
+ get validationMessage(): string;
4894
5660
  ```
4895
5661
 
4896
- Italic text. `Mod-i`, `*text*` or `_text_`.
5662
+ The message shown when the field is invalid.
4897
5663
 
4898
- ## Returns
5664
+ ##### Returns
4899
5665
 
4900
- [`Extension`](../../interfaces/Extension.md)
5666
+ `string`
4901
5667
 
4902
- ---
5668
+ ***
4903
5669
 
4904
- Source: /api/core/extensions/variables/link.md
5670
+ ### validity
4905
5671
 
4906
- # Variable: link
5672
+ #### Get Signature
4907
5673
 
4908
5674
  ```ts
4909
- const link: (options?) => Extension;
5675
+ get validity(): ValidityState | undefined;
4910
5676
  ```
4911
5677
 
4912
- Links. Unsafe URLs (such as `javascript:`) are dropped on paste and refused
4913
- by `setLink()`. Links never get `target="_blank"`: opening new windows
4914
- without warning is an accessibility problem.
5678
+ Validity, as on a built-in field (`valueMissing` for an empty `required` editor).
4915
5679
 
4916
- ## Parameters
5680
+ ##### Returns
4917
5681
 
4918
- | Parameter | Type |
4919
- | ------ | ------ |
4920
- | `options?` | [`LinkOptions`](../interfaces/LinkOptions.md) |
5682
+ `ValidityState` \| `undefined`
4921
5683
 
4922
- ## Returns
5684
+ ***
4923
5685
 
4924
- [`Extension`](../../interfaces/Extension.md)
5686
+ ### value
4925
5687
 
4926
- ---
5688
+ #### Get Signature
4927
5689
 
4928
- Source: /api/core/extensions/variables/list.md
5690
+ ```ts
5691
+ get value(): string;
5692
+ ```
4929
5693
 
4930
- # Variable: list
5694
+ The current value: HTML, or JSON text with `format="json"`.
5695
+
5696
+ ##### Returns
5697
+
5698
+ `string`
5699
+
5700
+ #### Set Signature
4931
5701
 
4932
5702
  ```ts
4933
- const list: () => Extension;
5703
+ set value(value): void;
4934
5704
  ```
4935
5705
 
4936
- Bullet and ordered lists. `Mod-Shift-8` / `Mod-Shift-7`, `- ` / `1. `, `Tab` / `Shift-Tab` to nest.
5706
+ Replace the content; a `json` element takes JSON text.
4937
5707
 
4938
- ## Returns
5708
+ ##### Parameters
4939
5709
 
4940
- [`Extension`](../../interfaces/Extension.md)
5710
+ | Parameter | Type |
5711
+ | ------ | ------ |
5712
+ | `value` | `string` |
4941
5713
 
4942
- ---
5714
+ ##### Returns
4943
5715
 
4944
- Source: /api/core/extensions/variables/strike.md
5716
+ `void`
4945
5717
 
4946
- # Variable: strike
5718
+ ***
5719
+
5720
+ ### willValidate
5721
+
5722
+ #### Get Signature
4947
5723
 
4948
5724
  ```ts
4949
- const strike: () => Extension;
5725
+ get willValidate(): boolean;
4950
5726
  ```
4951
5727
 
4952
- Strikethrough. `Mod-Shift-s` or `~~text~~`.
5728
+ Whether the field takes part in form validation.
4953
5729
 
4954
- ## Returns
5730
+ ##### Returns
4955
5731
 
4956
- [`Extension`](../../interfaces/Extension.md)
5732
+ `boolean`
4957
5733
 
4958
- ---
5734
+ ## Methods
4959
5735
 
4960
- Source: /api/core/extensions/variables/underline.md
5736
+ ### checkValidity()
4961
5737
 
4962
- # Variable: underline
5738
+ ```ts
5739
+ checkValidity(): boolean;
5740
+ ```
5741
+
5742
+ Whether the field is valid; fires `invalid` when not.
5743
+
5744
+ #### Returns
5745
+
5746
+ `boolean`
5747
+
5748
+ ***
5749
+
5750
+ ### focus()
4963
5751
 
4964
5752
  ```ts
4965
- const underline: () => Extension;
5753
+ focus(): void;
4966
5754
  ```
4967
5755
 
4968
- Underlined text. `Mod-u`.
5756
+ Focus the editable area.
4969
5757
 
4970
- ## Returns
5758
+ #### Returns
4971
5759
 
4972
- [`Extension`](../../interfaces/Extension.md)
5760
+ `void`
4973
5761
 
4974
- ---
5762
+ #### Overrides
4975
5763
 
4976
- Source: /api/core/presets/reference.md
5764
+ `Base.focus`
4977
5765
 
4978
- # @writeon/core/presets
5766
+ ***
4979
5767
 
4980
- The `basic()` preset: everything a typical text field needs, each part
4981
- configurable or switchable off.
5768
+ ### reportValidity()
4982
5769
 
4983
- ## Interfaces
5770
+ ```ts
5771
+ reportValidity(): boolean;
5772
+ ```
4984
5773
 
4985
- - [BasicOptions](interfaces/BasicOptions.md)
5774
+ Like `checkValidity()`, and shows the message to the user.
4986
5775
 
4987
- ## Functions
5776
+ #### Returns
4988
5777
 
4989
- - [basic](functions/basic.md)
5778
+ `boolean`
4990
5779
 
4991
5780
  ---
4992
5781
 
4993
- Source: /api/core/presets/interfaces/BasicOptions.md
4994
-
4995
- # Interface: BasicOptions
5782
+ Source: /api/element/type-aliases/WriteonFormat.md
4996
5783
 
4997
- Per-extension settings for `basic()`. `false` leaves an extension out.
5784
+ # Type Alias: WriteonFormat
4998
5785
 
4999
- ## Properties
5786
+ ```ts
5787
+ type WriteonFormat = "html" | "json";
5788
+ ```
5000
5789
 
5001
- | Property | Type | Description |
5002
- | ------ | ------ | ------ |
5003
- | <a id="property-blockquote"></a> `blockquote?` | `false` | Blockquotes. |
5004
- | <a id="property-bold"></a> `bold?` | `false` | Bold. |
5005
- | <a id="property-code"></a> `code?` | `false` | Inline code. |
5006
- | <a id="property-hardbreak"></a> `hardBreak?` | `false` | Line breaks (`Shift-Enter`). |
5007
- | <a id="property-heading"></a> `heading?` | \| `false` \| [`HeadingOptions`](../../extensions/interfaces/HeadingOptions.md) | Headings, or their options. |
5008
- | <a id="property-history"></a> `history?` | \| `false` \| [`HistoryOptions`](../../extensions/interfaces/HistoryOptions.md) | Undo and redo, or their options. |
5009
- | <a id="property-italic"></a> `italic?` | `false` | Italic. |
5010
- | <a id="property-link"></a> `link?` | `false` \| [`LinkOptions`](../../extensions/interfaces/LinkOptions.md) | Links, or their options. |
5011
- | <a id="property-list"></a> `list?` | `false` | Bullet and ordered lists. |
5012
- | <a id="property-strike"></a> `strike?` | `false` | Strikethrough. |
5013
- | <a id="property-underline"></a> `underline?` | `false` | Underline. |
5790
+ What the form submits: `html` (default) or the document as `json`.
5014
5791
 
5015
5792
  ---
5016
5793
 
5017
- Source: /api/core/presets/functions/basic.md
5794
+ Source: /api/element/functions/defineWriteonEditor.md
5018
5795
 
5019
- # Function: basic()
5796
+ # Function: defineWriteonEditor()
5020
5797
 
5021
5798
  ```ts
5022
- function basic(options?): Extension[];
5799
+ function defineWriteonEditor(name?): void;
5023
5800
  ```
5024
5801
 
5025
- The basic editor: paragraphs, headings, bold, italic, underline, strike,
5026
- inline code, links, lists, blockquotes, line breaks and undo/redo.
5802
+ Register the element under `name` (default `writeon-editor`). Called on
5803
+ import; call it again for another tag name. Does nothing without a DOM or
5804
+ when the name is taken.
5027
5805
 
5028
5806
  ## Parameters
5029
5807
 
5030
- | Parameter | Type |
5031
- | ------ | ------ |
5032
- | `options?` | [`BasicOptions`](../interfaces/BasicOptions.md) |
5808
+ | Parameter | Type | Default value |
5809
+ | ------ | ------ | ------ |
5810
+ | `name?` | `string` | `'writeon-editor'` |
5033
5811
 
5034
5812
  ## Returns
5035
5813
 
5036
- [`Extension`](../../interfaces/Extension.md)[]
5037
-
5038
- ## Example
5039
-
5040
- ```ts
5041
- basic() // everything, defaults
5042
- basic({ strike: false }) // without strikethrough
5043
- basic({ heading: { levels: [2, 3] } }) // only H2 and H3
5044
- basic({ link: { protocols: ['https'] } }) // https links only
5045
- ```
5814
+ `void`
5046
5815
 
5047
5816
  ---
5048
5817
 
@@ -5096,7 +5865,7 @@ Options for `toHTML()`.
5096
5865
  | Property | Type | Description |
5097
5866
  | ------ | ------ | ------ |
5098
5867
  | <a id="property-extensions"></a> `extensions` | readonly [`Extension`](../../core/interfaces/Extension.md)[] | The same extensions the editor uses. |
5099
- | <a id="property-urls"></a> `urls?` | \{ `protocols?`: readonly `string`[]; \} | Allowed protocols for `href`/`src`. Default: http, https, mailto, tel. |
5868
+ | <a id="property-urls"></a> `urls?` | \{ `protocols?`: readonly `string`[]; \} | Allowed protocols for `href`/`src`. Default: those of the `link()` extension in `extensions` (`link({ protocols })`), or http, https, mailto and tel. |
5100
5869
  | `urls.protocols?` | readonly `string`[] | Allowed URL protocols, without the colon. |
5101
5870
 
5102
5871
  ---
@@ -5303,8 +6072,8 @@ Options for `mountToolbar()`.
5303
6072
  | Property | Type | Description |
5304
6073
  | ------ | ------ | ------ |
5305
6074
  | <a id="property-blocktypes"></a> `blockTypes?` | `boolean` | Show the "Text style" menu (paragraph, headings). Default true. |
5306
- | <a id="property-exclude"></a> `exclude?` | readonly `string`[] | Buttons to leave out, by id (e.g. `['underline', 'code']`). |
5307
- | <a id="property-headinglevels"></a> `headingLevels?` | readonly `number`[] | Heading levels in that menu. Match `basic({ heading: { levels } })`. Default [1, 2, 3]. |
6075
+ | <a id="property-exclude"></a> `exclude?` | readonly [`BasicToolbarItemId`](../../ui/type-aliases/BasicToolbarItemId.md)[] | Buttons to leave out, by id (e.g. `['underline', 'code']`). |
6076
+ | <a id="property-headinglevels"></a> `headingLevels?` | readonly [`HeadingLevel`](../../core/type-aliases/HeadingLevel.md)[] | Heading levels in that menu. Match `basic({ heading: { levels } })`. Default [1, 2, 3]. |
5308
6077
  | <a id="property-idprefix"></a> `idPrefix?` | `string` | Prefix for element ids, needed when several editors share a page. Default: generated. |
5309
6078
  | <a id="property-link"></a> `link?` | `boolean` | Show the link button and form. Default true. Set `false` for the `Mod-k` shortcut too. |
5310
6079
  | <a id="property-messages"></a> `messages?` | `Partial`\<[`Messages`](../../ui/interfaces/Messages.md)\> | UI texts, e.g. `uz` from `@writeon/ui/locales/uz`. Default English. |
@@ -5505,7 +6274,7 @@ function mountAdvanced(
5505
6274
  Mount the default kit's advanced UI: image dialog and uploads, table
5506
6275
  actions, task list and code block buttons in the kit toolbar, the `/`
5507
6276
  command menu, `@` mentions and the selection bubble. Also turns on the
5508
- advanced behaviour (`editor.enable()`), keeping the document and undo
6277
+ advanced behaviour (`editor.extend()`), keeping the document and undo
5509
6278
  history. The editor must have `advancedSchema()`. Load this module on
5510
6279
  demand, so none of it is in your main bundle.
5511
6280
 
@@ -5596,8 +6365,8 @@ Props of `<Toolbar>`: the editor plus `KitToolbarOptions`.
5596
6365
  | ------ | ------ | ------ | ------ |
5597
6366
  | <a id="property-blocktypes"></a> `blockTypes?` | `boolean` | Show the "Text style" menu (paragraph, headings). Default true. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`blockTypes`](../../interfaces/KitToolbarOptions.md#property-blocktypes) |
5598
6367
  | <a id="property-editor"></a> `editor` | [`Editor`](../../../core/interfaces/Editor.md) | The editor to control. A different editor remounts the toolbar. | - |
5599
- | <a id="property-exclude"></a> `exclude?` | readonly `string`[] | Buttons to leave out, by id (e.g. `['underline', 'code']`). | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`exclude`](../../interfaces/KitToolbarOptions.md#property-exclude) |
5600
- | <a id="property-headinglevels"></a> `headingLevels?` | readonly `number`[] | Heading levels in that menu. Match `basic({ heading: { levels } })`. Default [1, 2, 3]. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`headingLevels`](../../interfaces/KitToolbarOptions.md#property-headinglevels) |
6368
+ | <a id="property-exclude"></a> `exclude?` | readonly [`BasicToolbarItemId`](../../../ui/type-aliases/BasicToolbarItemId.md)[] | Buttons to leave out, by id (e.g. `['underline', 'code']`). | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`exclude`](../../interfaces/KitToolbarOptions.md#property-exclude) |
6369
+ | <a id="property-headinglevels"></a> `headingLevels?` | readonly [`HeadingLevel`](../../../core/type-aliases/HeadingLevel.md)[] | Heading levels in that menu. Match `basic({ heading: { levels } })`. Default [1, 2, 3]. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`headingLevels`](../../interfaces/KitToolbarOptions.md#property-headinglevels) |
5601
6370
  | <a id="property-idprefix"></a> `idPrefix?` | `string` | Prefix for element ids, needed when several editors share a page. Default: generated. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`idPrefix`](../../interfaces/KitToolbarOptions.md#property-idprefix) |
5602
6371
  | <a id="property-link"></a> `link?` | `boolean` | Show the link button and form. Default true. Set `false` for the `Mod-k` shortcut too. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`link`](../../interfaces/KitToolbarOptions.md#property-link) |
5603
6372
  | <a id="property-messages"></a> `messages?` | `Partial`\<[`Messages`](../../../ui/interfaces/Messages.md)\> | UI texts, e.g. `uz` from `@writeon/ui/locales/uz`. Default English. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`messages`](../../interfaces/KitToolbarOptions.md#property-messages) |
@@ -5736,8 +6505,8 @@ Props of `<Toolbar>`: the editor plus `KitToolbarOptions`.
5736
6505
  | ------ | ------ | ------ | ------ |
5737
6506
  | <a id="property-blocktypes"></a> `blockTypes?` | `boolean` | Show the "Text style" menu (paragraph, headings). Default true. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`blockTypes`](../../interfaces/KitToolbarOptions.md#property-blocktypes) |
5738
6507
  | <a id="property-editor"></a> `editor` | [`Editor`](../../../core/interfaces/Editor.md) | The editor to control. Read once, on mount. | - |
5739
- | <a id="property-exclude"></a> `exclude?` | readonly `string`[] | Buttons to leave out, by id (e.g. `['underline', 'code']`). | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`exclude`](../../interfaces/KitToolbarOptions.md#property-exclude) |
5740
- | <a id="property-headinglevels"></a> `headingLevels?` | readonly `number`[] | Heading levels in that menu. Match `basic({ heading: { levels } })`. Default [1, 2, 3]. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`headingLevels`](../../interfaces/KitToolbarOptions.md#property-headinglevels) |
6508
+ | <a id="property-exclude"></a> `exclude?` | readonly [`BasicToolbarItemId`](../../../ui/type-aliases/BasicToolbarItemId.md)[] | Buttons to leave out, by id (e.g. `['underline', 'code']`). | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`exclude`](../../interfaces/KitToolbarOptions.md#property-exclude) |
6509
+ | <a id="property-headinglevels"></a> `headingLevels?` | readonly [`HeadingLevel`](../../../core/type-aliases/HeadingLevel.md)[] | Heading levels in that menu. Match `basic({ heading: { levels } })`. Default [1, 2, 3]. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`headingLevels`](../../interfaces/KitToolbarOptions.md#property-headinglevels) |
5741
6510
  | <a id="property-idprefix"></a> `idPrefix?` | `string` | Prefix for element ids, needed when several editors share a page. Default: generated. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`idPrefix`](../../interfaces/KitToolbarOptions.md#property-idprefix) |
5742
6511
  | <a id="property-link"></a> `link?` | `boolean` | Show the link button and form. Default true. Set `false` for the `Mod-k` shortcut too. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`link`](../../interfaces/KitToolbarOptions.md#property-link) |
5743
6512
  | <a id="property-messages"></a> `messages?` | `Partial`\<[`Messages`](../../../ui/interfaces/Messages.md)\> | UI texts, e.g. `uz` from `@writeon/ui/locales/uz`. Default English. | [`KitToolbarOptions`](../../interfaces/KitToolbarOptions.md).[`messages`](../../interfaces/KitToolbarOptions.md#property-messages) |
@@ -6834,14 +7603,20 @@ Source: /api/react/interfaces/UseToolbarResult.md
6834
7603
 
6835
7604
  # Interface: UseToolbarResult
6836
7605
 
6837
- Returned by `useToolbar()`.
7606
+ Returned by `useToolbar()`: the controller state as fields, plus the items and prop getters.
7607
+
7608
+ ## Extends
7609
+
7610
+ - [`ToolbarState`](../../ui/interfaces/ToolbarState.md)
6838
7611
 
6839
7612
  ## Properties
6840
7613
 
6841
- | Property | Modifier | Type | Description |
6842
- | ------ | ------ | ------ | ------ |
6843
- | <a id="property-items"></a> `items` | `readonly` | readonly [`ToolbarItem`](../../ui/interfaces/ToolbarItem.md)[] | The items passed in `options`. |
6844
- | <a id="property-state"></a> `state` | `readonly` | [`ToolbarState`](../../ui/interfaces/ToolbarState.md) | The toolbar state; the component re-renders when it changes. |
7614
+ | Property | Modifier | Type | Description | Inherited from |
7615
+ | ------ | ------ | ------ | ------ | ------ |
7616
+ | <a id="property-active"></a> `active` | `readonly` | `Readonly`\<`Record`\<`string`, `boolean`\>\> | Whether each toggle item (by id) is on. Only items with `isActive` have an entry. | [`ToolbarState`](../../ui/interfaces/ToolbarState.md).[`active`](../../ui/interfaces/ToolbarState.md#property-active) |
7617
+ | <a id="property-enabled"></a> `enabled` | `readonly` | `Readonly`\<`Record`\<`string`, `boolean`\>\> | Whether each item's command (by id) can run now (`editor.can()`). | [`ToolbarState`](../../ui/interfaces/ToolbarState.md).[`enabled`](../../ui/interfaces/ToolbarState.md#property-enabled) |
7618
+ | <a id="property-focusid"></a> `focusId` | `readonly` | `string` \| `null` | The item that holds the toolbar's single Tab stop. | [`ToolbarState`](../../ui/interfaces/ToolbarState.md).[`focusId`](../../ui/interfaces/ToolbarState.md#property-focusid) |
7619
+ | <a id="property-items"></a> `items` | `readonly` | readonly [`ToolbarItem`](../../ui/interfaces/ToolbarItem.md)[] | The items passed in `options`. | - |
6845
7620
 
6846
7621
  ## Methods
6847
7622
 
@@ -7424,7 +8199,7 @@ Options for `validate()`.
7424
8199
  | <a id="property-extensions"></a> `extensions` | readonly [`Extension`](../../core/interfaces/Extension.md)[] | The same extensions the editor uses. Pass one shared array; its schema is cached. |
7425
8200
  | <a id="property-limits"></a> `limits?` | [`ValidateLimits`](ValidateLimits.md) | Size limits. Defaults are listed on `ValidateLimits`. |
7426
8201
  | <a id="property-mode"></a> `mode?` | `"strip"` \| `"strict"` | `'strip'` (default) removes what is invalid and reports it in `removed`. `'strict'` rejects the whole document if anything would be removed. Limit violations are always rejected. |
7427
- | <a id="property-urls"></a> `urls?` | \{ `protocols?`: readonly `string`[]; \} | Allowed protocols for every `href`/`src` attribute. Default: http, https, mailto, tel. |
8202
+ | <a id="property-urls"></a> `urls?` | \{ `protocols?`: readonly `string`[]; \} | Allowed protocols for every `href`/`src` attribute. Default: those of the `link()` extension in `extensions` (`link({ protocols })`), or http, https, mailto and tel. |
7428
8203
  | `urls.protocols?` | readonly `string`[] | Allowed URL protocols, without the colon. |
7429
8204
 
7430
8205
  ---
@@ -7682,7 +8457,8 @@ menu and suggestions. Renders nothing.
7682
8457
  - [createTooltip](functions/createTooltip.md)
7683
8458
  - [displayShortcut](functions/displayShortcut.md)
7684
8459
  - [filterSuggestions](functions/filterSuggestions.md)
7685
- - [format](functions/format.md)
8460
+ - [~~format~~](functions/format.md)
8461
+ - [formatMessage](functions/formatMessage.md)
7686
8462
  - [isApplePlatform](functions/isApplePlatform.md)
7687
8463
  - [matchesShortcut](functions/matchesShortcut.md)
7688
8464
  - [mergeElementProps](functions/mergeElementProps.md)
@@ -7700,7 +8476,7 @@ Options for `basicBlockTypeItems()`.
7700
8476
 
7701
8477
  | Property | Type | Description |
7702
8478
  | ------ | ------ | ------ |
7703
- | <a id="property-levels"></a> `levels?` | readonly `number`[] | Heading levels to offer. Default `[1, 2, 3]`; match `basic({ heading: { levels } })`. |
8479
+ | <a id="property-levels"></a> `levels?` | readonly [`HeadingLevel`](../../core/type-aliases/HeadingLevel.md)[] | Heading levels to offer. Default `[1, 2, 3]`; match `basic({ heading: { levels } })`. |
7704
8480
  | <a id="property-messages"></a> `messages?` | `Partial`\<[`Messages`](Messages.md)\> | Labels to override; English by default. |
7705
8481
 
7706
8482
  ---
@@ -9067,6 +9843,10 @@ Source: /api/ui/interfaces/ToolbarState.md
9067
9843
 
9068
9844
  Snapshot of a toolbar.
9069
9845
 
9846
+ ## Extended by
9847
+
9848
+ - [`UseToolbarResult`](../../react/interfaces/UseToolbarResult.md)
9849
+
9070
9850
  ## Properties
9071
9851
 
9072
9852
  | Property | Modifier | Type | Description |
@@ -9722,13 +10502,38 @@ containing) it, case-insensitive. Use it in `items` for static lists.
9722
10502
 
9723
10503
  Source: /api/ui/functions/format.md
9724
10504
 
9725
- # Function: format()
10505
+ # ~~Function: format()~~
9726
10506
 
9727
10507
  ```ts
9728
10508
  function format(message, values): string;
9729
10509
  ```
9730
10510
 
9731
- Fill `{name}` placeholders in a message.
10511
+ ## Parameters
10512
+
10513
+ | Parameter | Type |
10514
+ | ------ | ------ |
10515
+ | `message` | `string` |
10516
+ | `values` | `Record`\<`string`, `string` \| `number`\> |
10517
+
10518
+ ## Returns
10519
+
10520
+ `string`
10521
+
10522
+ ## Deprecated
10523
+
10524
+ Renamed to `formatMessage()`, which this calls. Removed in 1.0.
10525
+
10526
+ ---
10527
+
10528
+ Source: /api/ui/functions/formatMessage.md
10529
+
10530
+ # Function: formatMessage()
10531
+
10532
+ ```ts
10533
+ function formatMessage(message, values): string;
10534
+ ```
10535
+
10536
+ Fill `{name}` placeholders in a message, e.g. `formatMessage(m.heading, { level: 2 })`.
9732
10537
 
9733
10538
  ## Parameters
9734
10539
 
@@ -9838,6 +10643,22 @@ English with any given overrides.
9838
10643
 
9839
10644
  ---
9840
10645
 
10646
+ Source: /api/ui/locales/en/reference.md
10647
+
10648
+ # @writeon/ui/locales/en
10649
+
10650
+ English messages for the UI controllers and the kit: the default. The same
10651
+ object as `en` from `@writeon/ui`; this entry exists so locales can be
10652
+ loaded by code, e.g. `import(\`@writeon/ui/locales/${lang}\`)`.
10653
+
10654
+ ## References
10655
+
10656
+ ### default
10657
+
10658
+ Renames and re-exports [en](../../variables/en.md)
10659
+
10660
+ ---
10661
+
9841
10662
  Source: /api/ui/locales/ru/reference.md
9842
10663
 
9843
10664
  # @writeon/ui/locales/ru
@@ -10017,7 +10838,7 @@ Options for `useEditor()`. `element` is handled by `<EditorContent>`; `editable`
10017
10838
  | ------ | ------ | ------ | ------ |
10018
10839
  | <a id="property-content"></a> `content?` | [`DocJSON`](../../core/interfaces/DocJSON.md) \| `null` | Initial document. Omit for an empty document. | [`EditorOptions`](../../core/interfaces/EditorOptions.md).[`content`](../../core/interfaces/EditorOptions.md#property-content) |
10019
10840
  | <a id="property-editable"></a> `editable?` | `MaybeRefOrGetter`\<`boolean`\> | Whether the user can edit. A ref or getter is watched and applied on change. Default true. | - |
10020
- | <a id="property-extensions"></a> `extensions` | [`Extension`](../../core/interfaces/Extension.md)[] | Extensions that make up the editor, usually a preset such as `basic()`. | [`EditorOptions`](../../core/interfaces/EditorOptions.md).[`extensions`](../../core/interfaces/EditorOptions.md#property-extensions) |
10841
+ | <a id="property-extensions"></a> `extensions` | readonly [`Extension`](../../core/interfaces/Extension.md)[] | Extensions that make up the editor, usually a preset such as `basic()`. | [`EditorOptions`](../../core/interfaces/EditorOptions.md).[`extensions`](../../core/interfaces/EditorOptions.md#property-extensions) |
10021
10842
  | <a id="property-label"></a> `label` | [`EditorLabel`](../../core/type-aliases/EditorLabel.md) | Accessible name: an `aria-label` string or the id of a labelling element. | [`EditorOptions`](../../core/interfaces/EditorOptions.md).[`label`](../../core/interfaces/EditorOptions.md#property-label) |
10022
10843
  | <a id="property-onblur"></a> `onBlur?` | (`editor`) => `void` | Called when the editable area loses focus, also when it is unmounted while focused. | [`EditorOptions`](../../core/interfaces/EditorOptions.md).[`onBlur`](../../core/interfaces/EditorOptions.md#property-onblur) |
10023
10844
  | <a id="property-onchange"></a> `onChange?` | (`editor`) => `void` | Called after every change to the document. | [`EditorOptions`](../../core/interfaces/EditorOptions.md).[`onChange`](../../core/interfaces/EditorOptions.md#property-onchange) |
@@ -11031,6 +11852,7 @@ Source: /api/reference.md
11031
11852
  - [@writeon/core/extension](core/extension/reference.md)
11032
11853
  - [@writeon/core/extensions](core/extensions/reference.md)
11033
11854
  - [@writeon/core/presets](core/presets/reference.md)
11855
+ - [@writeon/element](element/reference.md)
11034
11856
  - [@writeon/html](html/reference.md)
11035
11857
  - [@writeon/kit](kit/reference.md)
11036
11858
  - [@writeon/kit/advanced](kit/advanced/reference.md)
@@ -11041,6 +11863,7 @@ Source: /api/reference.md
11041
11863
  - [@writeon/react](react/reference.md)
11042
11864
  - [@writeon/server](server/reference.md)
11043
11865
  - [@writeon/ui](ui/reference.md)
11866
+ - [@writeon/ui/locales/en](ui/locales/en/reference.md)
11044
11867
  - [@writeon/ui/locales/ru](ui/locales/ru/reference.md)
11045
11868
  - [@writeon/ui/locales/uz](ui/locales/uz/reference.md)
11046
11869
  - [@writeon/vue](vue/reference.md)