@editora/core 1.0.31 → 1.0.33
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 +11 -3
- package/dist/{CollaborationPlugin.native-B9aiC2s7.mjs → CollaborationPlugin.native-8gcyVRnR.mjs} +869 -857
- package/dist/{VersionDiffPlugin.native-DJZIzFSK.mjs → VersionDiffPlugin.native-2v8ZaZWN.mjs} +248 -247
- package/dist/editora.min.js +15 -15
- package/dist/editora.umd.js +15 -15
- package/dist/index-BahpGXyw.js +12 -0
- package/dist/{index-8WhEVFK8.mjs → index-BlsTuyTe.mjs} +676 -582
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/plugin-loader.js +4 -4
- package/dist/webcomponent-core.js +480 -386
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +29 -29
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +481 -387
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +267 -267
- package/package.json +1 -1
- package/dist/index-DMk3V5_f.js +0 -12
package/README.md
CHANGED
|
@@ -52,6 +52,10 @@ Or from npm, for a bundler such as Vite, webpack or esbuild:
|
|
|
52
52
|
npm install @editora/core
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
A bundler (Vite, webpack, esbuild, Next.js) handles the packages on any Node version. Importing them in plain
|
|
56
|
+
Node, with no bundler in between (a script, a test runner, a server render that keeps dependencies external), needs
|
|
57
|
+
Node 20.19 or later, or 22.12 or later: older releases, Node 18 included, cannot load them.
|
|
58
|
+
|
|
55
59
|
## Quick start
|
|
56
60
|
|
|
57
61
|
```html
|
|
@@ -164,8 +168,12 @@ The editor in the picture at the top of this page is configured like this:
|
|
|
164
168
|
```
|
|
165
169
|
|
|
166
170
|
You can also configure an editor from JavaScript with `editor.setConfig({ toolbar: 'bold italic', height: 300 })`.
|
|
171
|
+
`setConfig` rebuilds the editor and keeps what the user has typed; pass `content` to replace it instead.
|
|
167
172
|
To switch the theme at run time, set the attribute: `editor.setAttribute('theme', 'dark')`.
|
|
168
173
|
|
|
174
|
+
`readonly` shows content that cannot be edited. `disabled` goes further, like a disabled form field: it also
|
|
175
|
+
disables the toolbar buttons and takes the editor out of the tab order. Both work as attributes and in `setConfig`.
|
|
176
|
+
|
|
169
177
|
### Toolbar items
|
|
170
178
|
|
|
171
179
|
`toolbar` takes names separated by spaces, with `|` between groups. The names are camelCase and case-sensitive
|
|
@@ -229,13 +237,13 @@ loaded by, is in [`@editora/plugins`](https://www.npmjs.com/package/@editora/plu
|
|
|
229
237
|
| `setContent(html)` | Replaces the content. The HTML is sanitised first. |
|
|
230
238
|
| `execCommand(name)` | Runs a command, as the toolbar does: `toggleBold`, `toggleItalic`, `toggleBulletList`, `insertTable`, `undo`, and so on. Returns `true` if the command ran. |
|
|
231
239
|
| `focus()` / `blur()` | Moves the focus into or out of the editor. |
|
|
232
|
-
| `setConfig(options)` |
|
|
240
|
+
| `setConfig(options)` | Rebuilds the editor with new options, such as `toolbar`, `height`, `theme` or `disabled`. What the user typed is kept; `content` replaces it. |
|
|
233
241
|
| `getAPI()` | The same methods as an object, plus `on(event, handler)`, `getConfig()` and `setReadonly(boolean)`. |
|
|
234
242
|
|
|
235
243
|
| Event | `event.detail` | |
|
|
236
244
|
| --- | --- | --- |
|
|
237
|
-
| `editor-ready` | | The editor has been built. It fires again if the editor is rebuilt, for example after you change `plugins` or `toolbar
|
|
238
|
-
| `content-change` | `{ html }` | The content changed. It
|
|
245
|
+
| `editor-ready` | | The editor has been built. It fires again if the editor is rebuilt, for example after you change `plugins` or `toolbar` (once, however many attributes you change together). |
|
|
246
|
+
| `content-change` | `{ html }` | The content changed. It fires once after the user pauses typing, and when the editor loses the focus with a change that has not been reported yet, so it does not repeat the same HTML. |
|
|
239
247
|
| `editor-focus` / `editor-blur` | | The editor gained or lost the focus. |
|
|
240
248
|
| `editor-destroy` | | The editor was torn down. |
|
|
241
249
|
|