@dotcms/uve 1.5.5-next.2180 → 1.5.5-next.2245
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 +21 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The `@dotcms/uve` SDK adds live editing to your JavaScript app using the dotCMS Universal Visual Editor (UVE). It provides low-level tools that power our framework-specific SDKs, such as [@dotcms/react](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/react/README.md) and [@dotcms/angular](https://github.com/dotCMS/core/blob/main/core-web/libs/sdk/angular/README.md).
|
|
4
4
|
|
|
5
|
-
> ⚠️ We **do not recommend using this SDK directly** for most use cases
|
|
5
|
+
> ⚠️ We **do not recommend using this SDK directly** for most use cases; you should use a [framework SDK that handles setup](#getting-started-recommended-examples), rendering, and event wiring for you.
|
|
6
6
|
|
|
7
7
|
With `@dotcms/uve`, framework SDKs are able to:
|
|
8
8
|
- Make pages and contentlets editable
|
|
@@ -17,11 +17,11 @@ With `@dotcms/uve`, framework SDKs are able to:
|
|
|
17
17
|
- [🚩 Custom Setup: Manual Rendering (Not Recommended)](#-custom-setup-manual-rendering-not-recommended)
|
|
18
18
|
- [Prerequisites & Setup](#prerequisites--setup)
|
|
19
19
|
- [Get a dotCMS Environment](#get-a-dotcms-environment)
|
|
20
|
-
- [
|
|
20
|
+
- [Configure The Universal Visual Editor App](#configure-the-universal-visual-editor-app)
|
|
21
21
|
- [Installation](#installation)
|
|
22
22
|
- [Using the SDK with TypeScript](#using-the-sdk-with-typescript)
|
|
23
23
|
- [SDK Reference](#sdk-reference)
|
|
24
|
-
- [`initUVE()`](#inituveconfig-
|
|
24
|
+
- [`initUVE()`](#inituveconfig-dotcmspageresponse)
|
|
25
25
|
- [`getUVEState()`](#getuvestate)
|
|
26
26
|
- [`createUVESubscription()`](#createuvesubscriptioneventtype-callback)
|
|
27
27
|
- [`editContentlet()`](#editcontentletcontentlet)
|
|
@@ -49,7 +49,7 @@ With `@dotcms/uve`, framework SDKs are able to:
|
|
|
49
49
|
We strongly recommend using one of our official framework SDKs, which are designed to handle UVE integration, routing, rendering, and more—out of the box. These examples are the best way to get started:
|
|
50
50
|
|
|
51
51
|
- [dotCMS Angular SDK: Angular Example](https://github.com/dotCMS/core/tree/main/examples/angular) – Ideal for Angular apps 🅰️
|
|
52
|
-
- [dotCMS React SDK: NextJS Example](https://github.com/dotCMS/core/tree/main/examples/
|
|
52
|
+
- [dotCMS React SDK: NextJS Example](https://github.com/dotCMS/core/tree/main/examples/nextjs) – Ideal for NextJS projects ⚛️
|
|
53
53
|
- [dotCMS React SDK: Astro Example](https://github.com/dotCMS/core/tree/main/examples/astro) – Ideal for Astro projects 🌌
|
|
54
54
|
|
|
55
55
|
These examples handle UVE integration, routing, rendering, and more—out of the box. **If you're building a headless dotCMS front-end, start there.**
|
|
@@ -66,7 +66,7 @@ You can use `@dotcms/uve` directly, but **it’s not recommended or supported**
|
|
|
66
66
|
|
|
67
67
|
Here's a minimal setup using `@dotcms/client` and `@dotcms/uve`:
|
|
68
68
|
|
|
69
|
-
1.
|
|
69
|
+
1. Initialize the Client and get the page response:
|
|
70
70
|
|
|
71
71
|
```ts
|
|
72
72
|
// getPage.ts
|
|
@@ -94,12 +94,13 @@ const getPage = async () => {
|
|
|
94
94
|
|
|
95
95
|
```ts
|
|
96
96
|
import { initUVE, createUVESubscription } from '@dotcms/uve';
|
|
97
|
+
import { UVEEventType } from '@dotcms/types';
|
|
97
98
|
import { getPage } from './getPage';
|
|
98
99
|
|
|
99
100
|
const pageResponse = await getPage();
|
|
100
101
|
|
|
101
102
|
initUVE(pageResponse);
|
|
102
|
-
createUVESubscription(
|
|
103
|
+
createUVESubscription(UVEEventType.CONTENT_CHANGES, (newPageResponse) => {
|
|
103
104
|
// Handle page updates (e.g. re-render)
|
|
104
105
|
});
|
|
105
106
|
```
|
|
@@ -118,7 +119,7 @@ createUVESubscription('changes', (newPageResponse) => {
|
|
|
118
119
|
#### 🔄 How to Render a dotCMS Page
|
|
119
120
|
|
|
120
121
|
> 📚 For a complete guide, here is a full tutorial:
|
|
121
|
-
> 👉 [dotCMS Page Rendering Architecture](
|
|
122
|
+
> 👉 [dotCMS Page Rendering Architecture](https://dev.dotcms.com/docs/dotcms-page-rendering-architecture)
|
|
122
123
|
|
|
123
124
|
dotCMS pages are structured as nested layout objects:
|
|
124
125
|
|
|
@@ -218,7 +219,6 @@ The SDK uses several key types from `@dotcms/types`:
|
|
|
218
219
|
import {
|
|
219
220
|
DotCMSBasicContentlet,
|
|
220
221
|
DotCMSPageResponse,
|
|
221
|
-
DotCMSUVEConfig,
|
|
222
222
|
DotCMSInlineEditingType,
|
|
223
223
|
UVEEventType,
|
|
224
224
|
UVEState
|
|
@@ -229,7 +229,7 @@ For a complete reference of all available types and interfaces, please refer to
|
|
|
229
229
|
|
|
230
230
|
## SDK Reference
|
|
231
231
|
|
|
232
|
-
### `initUVE(config?:
|
|
232
|
+
### `initUVE(config?: DotCMSPageResponse)`
|
|
233
233
|
|
|
234
234
|
`initUVE` is a function that initializes the Universal Visual Editor (UVE). It sets up the necessary communication between your app and the editor, enabling seamless integration and interaction.
|
|
235
235
|
|
|
@@ -243,7 +243,7 @@ For a complete reference of all available types and interfaces, please refer to
|
|
|
243
243
|
const { destroyUVESubscriptions } = initUVE(pageResponse);
|
|
244
244
|
```
|
|
245
245
|
|
|
246
|
-
> ⚠️ If you don't provide a `pageResponse`, we
|
|
246
|
+
> ⚠️ If you don't provide a `pageResponse`, we cannot guarantee that the UVE will be initialized correctly.
|
|
247
247
|
|
|
248
248
|
### `getUVEState()`
|
|
249
249
|
|
|
@@ -303,14 +303,16 @@ sub.unsubscribe();
|
|
|
303
303
|
|
|
304
304
|
- `UVEEventType.CONTENT_CHANGES`: Triggered when the content of the page changes.
|
|
305
305
|
- `UVEEventType.PAGE_RELOAD`: Triggered when the page is reloaded.
|
|
306
|
-
- `UVEEventType.
|
|
307
|
-
- `UVEEventType.IFRAME_SCROLL`: Triggered when the iframe is scrolled.
|
|
308
|
-
- `UVEEventType.IFRAME_SCROLL_END`: Triggered when the iframe has stopped scrolling.
|
|
306
|
+
- `UVEEventType.IFRAME_SCROLL`: Triggered when scroll action is needed inside the iframe (`'up'` or `'down'`).
|
|
309
307
|
- `UVEEventType.CONTENTLET_HOVERED`: Triggered when a contentlet is hovered.
|
|
308
|
+
- `UVEEventType.CONTENTLET_CLICKED`: Triggered when a contentlet is clicked.
|
|
309
|
+
- `UVEEventType.AUTO_BOUNDS`: Triggered when the SDK syncs page bounds after layout changes (internal SDK use).
|
|
310
|
+
- `UVEEventType.SCROLL_TO_SECTION`: Triggered when the editor requests a scroll to a specific page section (internal).
|
|
311
|
+
- `UVEEventType.SELECTION_CLEARED`: Triggered when the editor clears its selection (internal).
|
|
310
312
|
|
|
311
313
|
### `editContentlet(contentlet)`
|
|
312
314
|
|
|
313
|
-
`editContentlet` is a function that opens the dotCMS modal editor for any contentlet in or out of page area.
|
|
315
|
+
`editContentlet` is a function that opens the dotCMS modal editor for any contentlet in or out of the page area.
|
|
314
316
|
|
|
315
317
|
| Input | Type | Required | Description |
|
|
316
318
|
| ------------ | ------------------ | -------- | -------------------------------- |
|
|
@@ -340,7 +342,7 @@ const myEditButton = ({ contentlet }) => {
|
|
|
340
342
|
| Input | Type | Required | Description |
|
|
341
343
|
| ----------- | ---------------------------- | -------- | ------------------------------------------------------------------------------ |
|
|
342
344
|
| `type` | `DotCMSInlineEditingType` | ✅ | `'BLOCK_EDITOR'` or `'WYSIWYG'` |
|
|
343
|
-
| `
|
|
345
|
+
| `data` | `DotCMSInlineEditingPayload` | ✅ | [Field content required to enable inline editing](#dotcmsinlineeditingpayload) |
|
|
344
346
|
|
|
345
347
|
#### Usage
|
|
346
348
|
|
|
@@ -449,7 +451,7 @@ reorderMenu({ startLevel: 2, depth: 3 });
|
|
|
449
451
|
|
|
450
452
|
| Input | Type | Required | Description |
|
|
451
453
|
| --------- | ------------------------------------------ | -------- | ---------------------------- |
|
|
452
|
-
| `message` | [`DotCMSUVEMessage<T>`](#
|
|
454
|
+
| `message` | [`DotCMSUVEMessage<T>`](#dotcmsuvemessaget) | ✅ | Object with action + payload |
|
|
453
455
|
|
|
454
456
|
#### Usage
|
|
455
457
|
|
|
@@ -488,7 +490,7 @@ Style editor schemas are configured in the DotCMS admin UI under **Content Types
|
|
|
488
490
|
**Key Benefits:**
|
|
489
491
|
|
|
490
492
|
- **Real-Time Visual Editing**: Modify component styles and see changes instantly in the editor
|
|
491
|
-
- **Content-Specific Customization**: Different content types can have unique style schemas, and the same contentlet could have different styles depending on
|
|
493
|
+
- **Content-Specific Customization**: Different content types can have unique style schemas, and the same contentlet could have different styles depending on whether it is located in a different container or page
|
|
492
494
|
- **Admin-Managed**: Style schemas are defined in the DotCMS admin UI under Content Types and fetched automatically by the SDK
|
|
493
495
|
|
|
494
496
|
**Use Cases:**
|
|
@@ -627,7 +629,7 @@ When **defining styles** for a contentlet within a page using **Style Editor**,
|
|
|
627
629
|
|
|
628
630
|
> **NOTE:** (🎨 Styles are different) means the capability to define distinct styles, even when utilizing the identical Contentlet.
|
|
629
631
|
|
|
630
|
-
The only known limitation is that moving a contentlet with defined styles between different container types (5th scenario)
|
|
632
|
+
The only known limitation is that moving a contentlet with defined styles between different container types (5th scenario) results in the loss of those styles. A fix for this scenario is on our roadmap.
|
|
631
633
|
|
|
632
634
|
## Troubleshooting
|
|
633
635
|
|
|
@@ -713,7 +715,7 @@ We offer multiple channels to get help with the dotCMS UVE SDK:
|
|
|
713
715
|
- **GitHub Issues**: For bug reports and feature requests, please [open an issue](https://github.com/dotCMS/core/issues/new/choose) in the GitHub repository
|
|
714
716
|
- **Community Forum**: Join our [community discussions](https://community.dotcms.com/) to ask questions and share solutions
|
|
715
717
|
- **Stack Overflow**: Use the tag `dotcms-uve` when posting questions
|
|
716
|
-
- **Enterprise Support**: Enterprise customers can access premium support through the [dotCMS Support Portal](https://
|
|
718
|
+
- **Enterprise Support**: Enterprise customers can access premium support through the [dotCMS Support Portal](https://www.dotcms.com/support)
|
|
717
719
|
|
|
718
720
|
When reporting issues, please include:
|
|
719
721
|
|