@dotcms/angular 0.0.1-beta.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +646 -167
- package/dotcms-angular.d.ts.map +1 -1
- package/esm2022/dotcms-angular.mjs +2 -2
- package/esm2022/lib/components/dotcms-block-editor-renderer/blocks/code.component.mjs +49 -0
- package/esm2022/lib/components/dotcms-block-editor-renderer/blocks/dot-contentlet.component.mjs +125 -0
- package/esm2022/lib/components/dotcms-block-editor-renderer/blocks/image.component.mjs +25 -0
- package/esm2022/lib/components/dotcms-block-editor-renderer/blocks/list.component.mjs +66 -0
- package/esm2022/lib/components/dotcms-block-editor-renderer/blocks/table.component.mjs +97 -0
- package/esm2022/lib/components/dotcms-block-editor-renderer/blocks/text.component.mjs +231 -0
- package/esm2022/lib/components/dotcms-block-editor-renderer/blocks/unknown.component.mjs +65 -0
- package/esm2022/lib/components/dotcms-block-editor-renderer/blocks/video.component.mjs +48 -0
- package/esm2022/lib/components/dotcms-block-editor-renderer/dotcms-block-editor-renderer.component.mjs +50 -0
- package/esm2022/lib/components/dotcms-block-editor-renderer/item/dotcms-block-editor-item.component.mjs +45 -0
- package/esm2022/lib/components/dotcms-editable-text/dotcms-editable-text.component.mjs +240 -0
- package/esm2022/lib/components/dotcms-editable-text/utils.mjs +20 -0
- package/esm2022/lib/components/dotcms-layout-body/components/column/column.component.mjs +45 -0
- package/esm2022/lib/components/dotcms-layout-body/components/container/components/container-not-found/container-not-found.component.mjs +52 -0
- package/esm2022/lib/components/dotcms-layout-body/components/container/components/empty-container/empty-container.component.mjs +47 -0
- package/esm2022/lib/components/dotcms-layout-body/components/container/container.component.mjs +99 -0
- package/esm2022/lib/components/dotcms-layout-body/components/contentlet/contentlet.component.mjs +145 -0
- package/esm2022/lib/components/dotcms-layout-body/components/fallback-component/fallback-component.component.mjs +47 -0
- package/esm2022/lib/components/dotcms-layout-body/components/page-error-message/page-error-message.component.mjs +55 -0
- package/esm2022/lib/components/dotcms-layout-body/components/row/row.component.mjs +46 -0
- package/esm2022/lib/components/dotcms-layout-body/dotcms-layout-body.component.mjs +69 -0
- package/esm2022/lib/directives/dotcms-show-when/dotcms-show-when.directive.mjs +49 -0
- package/esm2022/lib/models/index.mjs +2 -2
- package/esm2022/lib/providers/dotcms-client/dotcms-client.provider.mjs +52 -0
- package/esm2022/lib/providers/dotcms-image-loader/dotcms-image_loader.mjs +74 -0
- package/esm2022/lib/services/dotcms-editable-page.service.mjs +93 -0
- package/esm2022/lib/store/dotcms.store.mjs +61 -0
- package/esm2022/public_api.mjs +8 -0
- package/fesm2022/dotcms-angular.mjs +1578 -612
- package/fesm2022/dotcms-angular.mjs.map +1 -1
- package/index.d.ts +6 -6
- package/lib/components/dotcms-block-editor-renderer/blocks/code.component.d.ts +10 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/code.component.d.ts.map +1 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/dot-contentlet.component.d.ts +34 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/dot-contentlet.component.d.ts.map +1 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/image.component.d.ts +9 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/image.component.d.ts.map +1 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/list.component.d.ts +14 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/list.component.d.ts.map +1 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/table.component.d.ts +10 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/table.component.d.ts.map +1 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/text.component.d.ts +27 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/text.component.d.ts.map +1 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/unknown.component.d.ts +18 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/unknown.component.d.ts.map +1 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/video.component.d.ts +10 -0
- package/lib/components/dotcms-block-editor-renderer/blocks/video.component.d.ts.map +1 -0
- package/lib/components/dotcms-block-editor-renderer/dotcms-block-editor-renderer.component.d.ts +39 -0
- package/lib/components/dotcms-block-editor-renderer/dotcms-block-editor-renderer.component.d.ts.map +1 -0
- package/lib/components/dotcms-block-editor-renderer/item/dotcms-block-editor-item.component.d.ts +12 -0
- package/lib/components/dotcms-block-editor-renderer/item/dotcms-block-editor-item.component.d.ts.map +1 -0
- package/lib/components/{dot-editable-text/dot-editable-text.component.d.ts → dotcms-editable-text/dotcms-editable-text.component.d.ts} +30 -30
- package/lib/components/dotcms-editable-text/dotcms-editable-text.component.d.ts.map +1 -0
- package/lib/components/dotcms-editable-text/utils.d.ts.map +1 -0
- package/lib/components/dotcms-layout-body/components/column/column.component.d.ts +21 -0
- package/lib/components/dotcms-layout-body/components/column/column.component.d.ts.map +1 -0
- package/lib/components/dotcms-layout-body/components/container/components/container-not-found/container-not-found.component.d.ts +27 -0
- package/lib/components/dotcms-layout-body/components/container/components/container-not-found/container-not-found.component.d.ts.map +1 -0
- package/lib/components/dotcms-layout-body/components/container/components/empty-container/empty-container.component.d.ts +23 -0
- package/lib/components/dotcms-layout-body/components/container/components/empty-container/empty-container.component.d.ts.map +1 -0
- package/lib/components/dotcms-layout-body/components/container/container.component.d.ts +32 -0
- package/lib/components/dotcms-layout-body/components/container/container.component.d.ts.map +1 -0
- package/lib/components/dotcms-layout-body/components/contentlet/contentlet.component.d.ts +48 -0
- package/lib/components/dotcms-layout-body/components/contentlet/contentlet.component.d.ts.map +1 -0
- package/lib/components/dotcms-layout-body/components/fallback-component/fallback-component.component.d.ts +16 -0
- package/lib/components/dotcms-layout-body/components/fallback-component/fallback-component.component.d.ts.map +1 -0
- package/lib/components/dotcms-layout-body/components/page-error-message/page-error-message.component.d.ts +13 -0
- package/lib/components/dotcms-layout-body/components/page-error-message/page-error-message.component.d.ts.map +1 -0
- package/lib/components/dotcms-layout-body/components/row/row.component.d.ts +22 -0
- package/lib/components/dotcms-layout-body/components/row/row.component.d.ts.map +1 -0
- package/lib/components/dotcms-layout-body/dotcms-layout-body.component.d.ts +30 -0
- package/lib/components/dotcms-layout-body/dotcms-layout-body.component.d.ts.map +1 -0
- package/lib/directives/dotcms-show-when/dotcms-show-when.directive.d.ts +21 -0
- package/lib/directives/dotcms-show-when/dotcms-show-when.directive.d.ts.map +1 -0
- package/lib/models/index.d.ts +9 -10
- package/lib/models/index.d.ts.map +1 -1
- package/lib/providers/dotcms-client/dotcms-client.provider.d.ts +60 -0
- package/lib/providers/dotcms-client/dotcms-client.provider.d.ts.map +1 -0
- package/lib/{utils/image_loader.d.ts → providers/dotcms-image-loader/dotcms-image_loader.d.ts} +1 -1
- package/lib/providers/dotcms-image-loader/dotcms-image_loader.d.ts.map +1 -0
- package/lib/services/dotcms-editable-page.service.d.ts +40 -0
- package/lib/services/dotcms-editable-page.service.d.ts.map +1 -0
- package/lib/store/dotcms.store.d.ts +36 -0
- package/lib/store/dotcms.store.d.ts.map +1 -0
- package/package.json +9 -9
- package/public_api.d.ts +9 -0
- package/public_api.d.ts.map +1 -0
- package/esm2022/index.mjs +0 -6
- package/esm2022/lib/components/dot-editable-text/dot-editable-text.component.mjs +0 -225
- package/esm2022/lib/components/dot-editable-text/utils.mjs +0 -43
- package/esm2022/lib/components/no-component/no-component.component.mjs +0 -32
- package/esm2022/lib/layout/column/column.component.mjs +0 -45
- package/esm2022/lib/layout/container/container.component.mjs +0 -126
- package/esm2022/lib/layout/contentlet/contentlet.component.mjs +0 -120
- package/esm2022/lib/layout/dotcms-layout/dotcms-layout.component.mjs +0 -101
- package/esm2022/lib/layout/row/row.component.mjs +0 -29
- package/esm2022/lib/models/dotcms.model.mjs +0 -3
- package/esm2022/lib/services/dotcms-context/page-context.service.mjs +0 -75
- package/esm2022/lib/utils/image_loader.mjs +0 -75
- package/esm2022/lib/utils/index.mjs +0 -84
- package/index.d.ts.map +0 -1
- package/lib/components/dot-editable-text/dot-editable-text.component.d.ts.map +0 -1
- package/lib/components/dot-editable-text/utils.d.ts.map +0 -1
- package/lib/components/no-component/no-component.component.d.ts +0 -22
- package/lib/components/no-component/no-component.component.d.ts.map +0 -1
- package/lib/layout/column/column.component.d.ts +0 -29
- package/lib/layout/column/column.component.d.ts.map +0 -1
- package/lib/layout/container/container.component.d.ts +0 -88
- package/lib/layout/container/container.component.d.ts.map +0 -1
- package/lib/layout/contentlet/contentlet.component.d.ts +0 -86
- package/lib/layout/contentlet/contentlet.component.d.ts.map +0 -1
- package/lib/layout/dotcms-layout/dotcms-layout.component.d.ts +0 -68
- package/lib/layout/dotcms-layout/dotcms-layout.component.d.ts.map +0 -1
- package/lib/layout/row/row.component.d.ts +0 -20
- package/lib/layout/row/row.component.d.ts.map +0 -1
- package/lib/models/dotcms.model.d.ts +0 -416
- package/lib/models/dotcms.model.d.ts.map +0 -1
- package/lib/services/dotcms-context/page-context.service.d.ts +0 -49
- package/lib/services/dotcms-context/page-context.service.d.ts.map +0 -1
- package/lib/utils/image_loader.d.ts.map +0 -1
- package/lib/utils/index.d.ts +0 -63
- package/lib/utils/index.d.ts.map +0 -1
- /package/lib/components/{dot-editable-text → dotcms-editable-text}/utils.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,229 +1,708 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dotCMS Angular SDK
|
|
2
2
|
|
|
3
|
-
`@dotcms/angular` is the official Angular library
|
|
3
|
+
The `@dotcms/angular` SDK is the DotCMS official Angular library. It empowers Angular developers to build powerful, editable websites and applications in no time.
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
7
|
+
- [Prerequisites & Setup](#prerequisites--setup)
|
|
8
|
+
- [dotCMS Instance](#dotcms-instance)
|
|
9
|
+
- [Create a dotCMS API Key](#create-a-dotcms-api-key)
|
|
10
|
+
- [Configure The Universal Visual Editor App](#configure-the-universal-visual-editor-app)
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [dotCMS Client Configuration](#dotcms-client-configuration)
|
|
13
|
+
- [Proxy Configuration for Static Assets](#proxy-configuration-for-static-assets)
|
|
14
|
+
- [Using dotCMS Images with Angular's `NgOptimizedImage` Directive (Recommended)](#using-dotcms-images-with-angulars-ngoptimizedimage-directive-recommended)
|
|
15
|
+
- [Quickstart: Render a Page with dotCMS](#quickstart-render-a-page-with-dotcms)
|
|
16
|
+
- [Example Project](#example-project-)
|
|
17
|
+
- [SDK Reference](#sdk-reference)
|
|
18
|
+
- [DotCMSLayoutBody](#dotcmslayoutbody)
|
|
19
|
+
- [DotCMSEditableText](#dotcmseditabletext)
|
|
20
|
+
- [DotCMSBlockEditorRenderer](#dotcmsblockeditorrenderer)
|
|
21
|
+
- [DotCMSShowWhen](#dotcmsshowwhen)
|
|
22
|
+
- [DotCMSEditablePageService](#dotcmseditablepageservice)
|
|
23
|
+
- [Troubleshooting](#troubleshooting)
|
|
24
|
+
- [Common Issues & Solutions](#common-issues--solutions)
|
|
25
|
+
- [Debugging Tips](#debugging-tips)
|
|
26
|
+
- [Still Having Issues?](#still-having-issues)
|
|
27
|
+
- [dotCMS Support](#dotcms-support)
|
|
28
|
+
- [How To Contribute](#how-to-contribute)
|
|
29
|
+
- [Licensing Information](#licensing-information)
|
|
18
30
|
|
|
19
|
-
##
|
|
31
|
+
## Prerequisites & Setup
|
|
20
32
|
|
|
21
|
-
|
|
22
|
-
- Enhanced development workflow with full TypeScript support.
|
|
23
|
-
- Optimized performance for efficient rendering of dotCMS pages in Angular applications.
|
|
24
|
-
- Flexible customization options to adapt to various project requirements.
|
|
33
|
+
### Get a dotCMS Environment
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
#### Version Compatibility
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
- **Recommended**: dotCMS Evergreen
|
|
38
|
+
- **Minimum**: dotCMS v25.05
|
|
39
|
+
- **Best Experience**: Latest Evergreen release
|
|
29
40
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
#### Environment Setup
|
|
42
|
+
|
|
43
|
+
**For Production Use:**
|
|
44
|
+
|
|
45
|
+
- ☁️ [Cloud hosting options](https://www.dotcms.com/pricing) - managed solutions with SLA
|
|
46
|
+
- 🛠️ [Self-hosted options](https://dev.dotcms.com/docs/current-releases) - deploy on your infrastructure
|
|
47
|
+
|
|
48
|
+
**For Testing & Development:**
|
|
49
|
+
|
|
50
|
+
- 🧑🏻💻 [dotCMS demo site](https://demo.dotcms.com/dotAdmin/#/public/login) - perfect for trying out the SDK
|
|
51
|
+
- 📘 [Learn how to use the demo site](https://dev.dotcms.com/docs/demo-site)
|
|
52
|
+
- 📝 Read-only access, ideal for building proof-of-concepts
|
|
53
|
+
|
|
54
|
+
**For Local Development:**
|
|
55
|
+
|
|
56
|
+
- 🐳 [Docker setup guide](https://github.com/dotCMS/core/tree/main/docker/docker-compose-examples/single-node-demo-site)
|
|
57
|
+
- 💻 [Local installation guide](https://dev.dotcms.com/docs/quick-start-guide)
|
|
58
|
+
|
|
59
|
+
### Configure The Universal Visual Editor App
|
|
60
|
+
|
|
61
|
+
For a step-by-step guide on setting up the Universal Visual Editor, check out our [easy-to-follow instructions](https://dev.dotcms.com/docs/uve-headless-config) and get started in no time!
|
|
62
|
+
|
|
63
|
+
### Create a dotCMS API Key
|
|
33
64
|
|
|
34
|
-
|
|
65
|
+
> [!TIP]
|
|
66
|
+
> Make sure your API Token has read-only permissions for Pages, Folders, Assets, and Content. Using a key with minimal permissions follows security best practices.
|
|
67
|
+
|
|
68
|
+
This integration requires an API Key with read-only permissions for security best practices:
|
|
69
|
+
|
|
70
|
+
1. Go to the **dotCMS admin panel**.
|
|
71
|
+
2. Click on **System** > **Users**.
|
|
72
|
+
3. Select the user you want to create the API Key for.
|
|
73
|
+
4. Go to **API Access Key** and generate a new key.
|
|
74
|
+
|
|
75
|
+
For detailed instructions, please refer to the [dotCMS API Documentation - Read-only token](https://dev.dotcms.com/docs/rest-api-authentication#ReadOnlyToken).
|
|
76
|
+
|
|
77
|
+
### Installation
|
|
35
78
|
|
|
36
79
|
```bash
|
|
37
|
-
|
|
80
|
+
npm install @dotcms/angular@latest
|
|
38
81
|
```
|
|
39
82
|
|
|
83
|
+
This will automatically install the required dependencies:
|
|
84
|
+
- `@dotcms/uve`: Enables interaction with the [Universal Visual Editor](https://dev.dotcms.com/docs/uve-headless-config) for real-time content editing
|
|
85
|
+
- `@dotcms/client`: Provides the core client functionality for fetching and managing dotCMS data
|
|
86
|
+
|
|
40
87
|
## Configuration
|
|
41
|
-
### Provider Setup
|
|
42
|
-
We need to provide the information of our dotCMS instance
|
|
43
88
|
|
|
44
|
-
|
|
89
|
+
The recommended way to configure the DotCMS client in your Angular application is to use the `provideDotCMSClient` function in your `app.config.ts`:
|
|
45
90
|
|
|
46
|
-
|
|
91
|
+
```ts
|
|
92
|
+
import { ApplicationConfig } from '@angular/core';
|
|
93
|
+
import { provideDotCMSClient } from '@dotcms/angular';
|
|
94
|
+
import { environment } from './environments/environment'; // Assuming your environment variables are here
|
|
47
95
|
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
96
|
+
export const appConfig: ApplicationConfig = {
|
|
97
|
+
providers: [
|
|
98
|
+
provideDotCMSClient({
|
|
99
|
+
dotcmsUrl: environment.dotcmsUrl,
|
|
100
|
+
authToken: environment.authToken,
|
|
101
|
+
siteId: environment.siteId
|
|
102
|
+
})
|
|
103
|
+
]
|
|
52
104
|
};
|
|
53
105
|
```
|
|
54
106
|
|
|
55
|
-
|
|
107
|
+
Then, you can inject the `DotCMSClient` into your components or services:
|
|
56
108
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
import {
|
|
60
|
-
|
|
109
|
+
```ts
|
|
110
|
+
import { Component, inject } from '@angular/core';
|
|
111
|
+
import { DotCMSClient } from '@dotcms/angular';
|
|
112
|
+
|
|
113
|
+
@Component({
|
|
114
|
+
selector: 'app-my-component',
|
|
115
|
+
template: `<!-- Your component template -->`
|
|
116
|
+
})
|
|
117
|
+
export class MyComponent {
|
|
118
|
+
dotcmsClient = inject(DotCMSClient);
|
|
119
|
+
|
|
120
|
+
ngOnInit() {
|
|
121
|
+
this.dotcmsClient.page
|
|
122
|
+
.get({ url: '/about-us' })
|
|
123
|
+
.then(({ pageAsset }) => {
|
|
124
|
+
console.log(pageAsset);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
61
129
|
|
|
62
|
-
|
|
130
|
+
### Proxy Configuration for Static Assets
|
|
63
131
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
132
|
+
Configure a proxy to leverage the powerful dotCMS image API, allowing you to resize and serve optimized images efficiently. This enhances application performance and improves user experience, making it a strategic enhancement for your project.
|
|
133
|
+
|
|
134
|
+
#### 1. Create a Proxy Configuration
|
|
135
|
+
|
|
136
|
+
Create a `proxy.conf.json` file in your project:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
// proxy.conf.json
|
|
140
|
+
{
|
|
141
|
+
"/dA": {
|
|
142
|
+
"target": "http://localhost:8080", // Your dotCMS instance URL
|
|
143
|
+
"secure": false, // Set to true if using HTTPS
|
|
144
|
+
"changeOrigin": true // Required for hosting scenarios
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### 2. Update Angular Configuration
|
|
150
|
+
|
|
151
|
+
Add the proxy configuration to your `angular.json`:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
// angular.json
|
|
155
|
+
{
|
|
156
|
+
"projects": {
|
|
157
|
+
"my-app": {
|
|
158
|
+
"architect": {
|
|
159
|
+
"serve": {
|
|
160
|
+
"builder": "@angular-devkit/build-angular:dev-server",
|
|
161
|
+
"options": {
|
|
162
|
+
"proxyConfig": "src/proxy.conf.json"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
70
166
|
}
|
|
71
|
-
|
|
72
|
-
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
73
169
|
```
|
|
74
170
|
|
|
75
|
-
|
|
171
|
+
#### 3. Usage in Components
|
|
76
172
|
|
|
77
|
-
|
|
78
|
-
|
|
173
|
+
Once configured, image URLs in your components will automatically be proxied to your dotCMS instance:
|
|
174
|
+
|
|
175
|
+
>📚 Learn more about [Image Resizing and Processing in dotCMS with Angular](https://www.dotcms.com/blog/image-resizing-and-processing-in-dotcms-with-angular-and-nextjs).
|
|
79
176
|
|
|
80
177
|
```typescript
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.catch((e) => {
|
|
90
|
-
const error: PageError = {
|
|
91
|
-
message: e.message,
|
|
92
|
-
status: e.status,
|
|
93
|
-
};
|
|
94
|
-
// Use the error response
|
|
95
|
-
})
|
|
178
|
+
// /components/my-dotcms-image.component.ts
|
|
179
|
+
@Component({
|
|
180
|
+
template: `
|
|
181
|
+
<img [src]="'/dA/' + contentlet.inode" alt="Asset from dotCMS" />
|
|
182
|
+
`
|
|
183
|
+
})
|
|
184
|
+
class MyDotCMSImageComponent {
|
|
185
|
+
@Input() contentlet: DotCMSBasicContentlet;
|
|
96
186
|
}
|
|
97
187
|
```
|
|
98
188
|
|
|
99
|
-
|
|
189
|
+
### Using dotCMS Images with Angular's `NgOptimizedImage` Directive (Recommended)
|
|
100
190
|
|
|
101
|
-
|
|
191
|
+
To optimize images served from dotCMS in your Angular app, we recommend using the built-in `NgOptimizedImage` directive. This integration supports automatic image preloading, lazy loading, and improved performance.
|
|
102
192
|
|
|
103
|
-
|
|
193
|
+
We provide a helper function `provideDotCMSImageLoader()` to configure image loading with your dotCMS instance.
|
|
104
194
|
|
|
105
|
-
|
|
106
|
-
- [`@dotcms/client` documentation](https://www.npmjs.com/package/@dotcms/client)
|
|
107
|
-
- [Page API documentation](https://www.dotcms.com/docs/latest/page-api)
|
|
195
|
+
#### Setup
|
|
108
196
|
|
|
109
|
-
|
|
197
|
+
Add the image loader to your `app.config.ts`:
|
|
110
198
|
|
|
111
|
-
|
|
199
|
+
```ts
|
|
200
|
+
// src/app/app.config.ts
|
|
201
|
+
import { provideDotCMSImageLoader } from '@dotcms/angular';
|
|
202
|
+
import { ApplicationConfig } from '@angular/core';
|
|
112
203
|
|
|
113
|
-
|
|
204
|
+
export const appConfig: ApplicationConfig = {
|
|
205
|
+
providers: [
|
|
206
|
+
provideDotCMSImageLoader(environment.dotcmsUrl)
|
|
207
|
+
]
|
|
208
|
+
};
|
|
209
|
+
```
|
|
114
210
|
|
|
115
|
-
####
|
|
211
|
+
#### Usage
|
|
116
212
|
|
|
117
|
-
|
|
118
|
-
|--------------|----------------------|-----------------------------------------------------------------------|
|
|
119
|
-
| `pageAsset` | `DotCMSPageAsset` | The object representing a dotCMS page from PageAPI response. |
|
|
120
|
-
| `components` | `DotCMSPageComponent`| An object mapping contentlets to their respective render components. |
|
|
121
|
-
| `editor` | `EditorConfig` | Configuration for data fetching in Edit Mode. |
|
|
213
|
+
Once configured, you can use the `NgOptimizedImage` directive to render dotCMS images:
|
|
122
214
|
|
|
123
|
-
|
|
215
|
+
```ts
|
|
216
|
+
// src/components/my-dotcms-image.component.ts
|
|
217
|
+
@Component({
|
|
218
|
+
selector: 'my-dotcms-image',
|
|
219
|
+
template: `
|
|
220
|
+
<img [ngSrc]="imagePath" alt="Asset from dotCMS" />
|
|
221
|
+
`,
|
|
222
|
+
standalone: true
|
|
223
|
+
})
|
|
224
|
+
export class MyDotCMSImageComponent {
|
|
225
|
+
@Input() contentlet!: DotCMSBasicContentlet;
|
|
124
226
|
|
|
125
|
-
|
|
227
|
+
get imagePath() {
|
|
228
|
+
return this.contentlet.image.versionPath;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
> 📚 Learn more about [`NgOptimizedImage`](https://angular.dev/guide/image-optimization)
|
|
234
|
+
|
|
235
|
+
## Quickstart: Render a Page with dotCMS
|
|
236
|
+
|
|
237
|
+
The following example demonstrates how to quickly set up a basic dotCMS page renderer in your Angular application. This example shows how to:
|
|
238
|
+
|
|
239
|
+
- Create a standalone component that renders a dotCMS page
|
|
240
|
+
- Set up dynamic component loading for different content types
|
|
241
|
+
- Handle both regular page viewing and editor mode
|
|
242
|
+
- Subscribe to real-time page updates when in the Universal Visual Editor
|
|
126
243
|
|
|
127
244
|
```typescript
|
|
245
|
+
// /src/app/pages/dotcms-page.component.ts
|
|
128
246
|
import { Component, signal } from '@angular/core';
|
|
129
|
-
|
|
247
|
+
|
|
248
|
+
import { DotCMSLayoutBody, DotCMSEditablePageService} from '@dotcms/angular';
|
|
249
|
+
import { getUVEState } from '@dotcms/uve';
|
|
250
|
+
import { DotCMSPageAsset } from '@dotcms/types';
|
|
251
|
+
|
|
252
|
+
import { DOTCMS_CLIENT_TOKEN } from './app.config';
|
|
253
|
+
|
|
254
|
+
const DYNAMIC_COMPONENTS = {
|
|
255
|
+
Blog: import('./blog.component').then(c => c.BlogComponent),
|
|
256
|
+
Product: import('./product.component').then(c => c.ProductComponent)
|
|
257
|
+
};
|
|
130
258
|
|
|
131
259
|
@Component({
|
|
132
260
|
selector: 'app-pages',
|
|
133
|
-
|
|
261
|
+
standalone: true,
|
|
262
|
+
imports: [DotCMSLayoutBody],
|
|
263
|
+
providers: [DotCMSEditablePageService, DOTCMS_CLIENT_TOKEN],
|
|
264
|
+
template: `
|
|
265
|
+
@if (pageAsset()) {
|
|
266
|
+
<dotcms-layout-body
|
|
267
|
+
[pageAsset]="pageAsset"
|
|
268
|
+
[components]="components()"
|
|
269
|
+
/>
|
|
270
|
+
} @else {
|
|
271
|
+
<div>Loading...</div>
|
|
272
|
+
}
|
|
273
|
+
`
|
|
134
274
|
})
|
|
135
275
|
export class PagesComponent {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
276
|
+
private readonly dotCMSClient: DotCMSClient = inject(DOTCMS_CLIENT_TOKEN);
|
|
277
|
+
private readonly editablePageService = inject(DotCMSEditablePageService);
|
|
278
|
+
readonly components = signal(DYNAMIC_COMPONENTS);
|
|
279
|
+
readonly pageAsset = signal<DotCMSPageAsset | null>(null);
|
|
280
|
+
|
|
281
|
+
ngOnInit() {
|
|
282
|
+
this.dotCMSClient.page
|
|
283
|
+
.get({ url: '/my-page' })
|
|
284
|
+
.then(({ pageAsset }) => {
|
|
285
|
+
if(getUVEState()) {
|
|
286
|
+
this.#subscribeToPageUpdates(response);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
this.pageAsset.set(pageAsset);
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
#subscribeToPageUpdates(response: DotCMSPageResponse) {
|
|
295
|
+
this.editablePageService
|
|
296
|
+
.listen(response)
|
|
297
|
+
.subscribe({ pageAsset } => this.pageAsset.set(pageAsset));
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Example Project 🚀
|
|
303
|
+
|
|
304
|
+
Looking to get started quickly? We've got you covered! Our [Angular starter project](https://github.com/dotCMS/core/tree/main/examples/angular) is the perfect launchpad for your dotCMS + Angular journey. This production-ready template demonstrates everything you need:
|
|
305
|
+
|
|
306
|
+
📦 Fetch and render dotCMS pages with best practices
|
|
307
|
+
🧩 Register and manage components for different content types
|
|
308
|
+
🔍 Listing pages with search functionality
|
|
309
|
+
📝 Detail pages for blogs
|
|
310
|
+
📈 Image and assets optimization for better performance
|
|
311
|
+
✨ Enable seamless editing via the Universal Visual Editor (UVE)
|
|
312
|
+
⚡️ Leverage Angular's dependency injection and signals for optimal performance
|
|
313
|
+
|
|
314
|
+
> [!TIP]
|
|
315
|
+
> This starter project is more than just an example, it follows all our best practices. We highly recommend using it as the base for your next dotCMS + Angular project!
|
|
316
|
+
|
|
317
|
+
## SDK Reference
|
|
318
|
+
|
|
319
|
+
All components, directives, and services should be imported from `@dotcms/angular`.
|
|
320
|
+
|
|
321
|
+
### DotCMSLayoutBody
|
|
322
|
+
|
|
323
|
+
`DotCMSLayoutBody` is a component used to render the layout for a DotCMS page, supporting both production and development modes.
|
|
324
|
+
|
|
325
|
+
| Input | Type | Required | Default | Description |
|
|
326
|
+
|--------------|--------------------------|----------|----------------|------------------------------------------------|
|
|
327
|
+
| `page` | `DotCMSPageAsset` | ✅ | - | The page asset containing the layout to render |
|
|
328
|
+
| `components` | `DotCMSPageComponent` | ✅ | `{}` | [Map of content type → Angular component](#component-mapping) |
|
|
329
|
+
| `mode` | `DotCMSPageRendererMode` | ❌ | `'production'` | [Rendering mode ('production' or 'development')](#layout-body-modes) |
|
|
330
|
+
|
|
331
|
+
#### Usage
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import { Component, signal } from '@angular/core';
|
|
335
|
+
import { DotCMSPageAsset } from '@dotcms/types';
|
|
336
|
+
import { DotCMSLayoutBody } from '@dotcms/angular';
|
|
337
|
+
|
|
338
|
+
import { DOTCMS_CLIENT_TOKEN } from './app.config';
|
|
339
|
+
|
|
340
|
+
@Component({
|
|
341
|
+
template: `
|
|
342
|
+
<dotcms-layout-body [page]="pageAsset()" [components]="components()" mode="development" />
|
|
343
|
+
`
|
|
344
|
+
})
|
|
345
|
+
export class MyPageComponent {
|
|
346
|
+
protected readonly components = signal({
|
|
347
|
+
Blog: import('./blog.component').then((c) => c.BlogComponent)
|
|
348
|
+
});
|
|
349
|
+
protected readonly pageAsset = signal<DotCMSPageAsset | null>(null);
|
|
350
|
+
private readonly dotCMSClient = inject(DOTCMS_CLIENT_TOKEN);
|
|
351
|
+
|
|
352
|
+
ngOnInit() {
|
|
353
|
+
this.dotCMSClient.page.get({ url: '/my-page' }).then(({ pageAsset }) => {
|
|
354
|
+
this.pageAsset.set(pageAsset);
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
#### Layout Body Modes
|
|
361
|
+
|
|
362
|
+
- `production`: Performance-optimized mode that only renders content with explicitly mapped components, leaving unmapped content empty.
|
|
363
|
+
- `development`: Debug-friendly mode that renders default components for unmapped content types and provides visual indicators and console logs for empty containers and missing mappings.
|
|
364
|
+
|
|
365
|
+
#### Component Mapping
|
|
366
|
+
|
|
367
|
+
The `DotCMSLayoutBody` component uses a `components` input to map content type variable names to Angular components. This allows you to render different components for different content types. Example:
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
const DYNAMIC_COMPONENTS = {
|
|
371
|
+
Blog: import('./blog.component').then((c) => c.BlogComponent),
|
|
372
|
+
Product: import('./product.component').then((c) => c.ProductComponent)
|
|
373
|
+
};
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
- Keys (e.g., `Blog`, `Product`): Match your [content type variable names](https://dev.dotcms.com/docs/content-types#VariableNames) in dotCMS
|
|
377
|
+
- Values: Dynamic imports of your Angular components that render each content type
|
|
378
|
+
- Supports lazy loading through dynamic imports
|
|
379
|
+
- Components must be standalone or declared in a module
|
|
380
|
+
|
|
381
|
+
> [!TIP]
|
|
382
|
+
> Always use the exact content type variable name from dotCMS as the key. You can find this in the Content Types section of your dotCMS admin panel.
|
|
383
|
+
|
|
384
|
+
### DotCMSEditableText
|
|
385
|
+
|
|
386
|
+
`DotCMSEditableText` is a component for inline editing of text fields in dotCMS, supporting plain text, text area, and WYSIWYG fields.
|
|
387
|
+
|
|
388
|
+
| Input | Type | Required | Description |
|
|
389
|
+
|--------------|---------------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
390
|
+
| `contentlet` | `T extends DotCMSBasicContentlet` | ✅ | The contentlet containing the editable field |
|
|
391
|
+
| `fieldName` | `keyof T` | ✅ | Name of the field to edit, which must be a valid key of the contentlet type `T` |
|
|
392
|
+
| `mode` | `'plain' \| 'full'` | ❌ | `plain` (default): Support text editing. Does not show style controls. <br/> `full`: Enables a bubble menu with style options. This mode only works with [`WYSIWYG` fields](https://dev.dotcms.com/docs/the-wysiwyg-field). |
|
|
393
|
+
| `format` | `'text' \| 'html'` | ❌ | `text` (default): Renders HTML tags as plain text <br/> `html`: Interprets and renders HTML markup |
|
|
394
|
+
|
|
395
|
+
#### Usage
|
|
396
|
+
|
|
397
|
+
```typescript
|
|
398
|
+
import { Component, Input } from '@angular/core';
|
|
399
|
+
import { RouterLink } from '@angular/router';
|
|
400
|
+
|
|
401
|
+
import { DotCMSBasicContentlet } from '@dotcms/types';
|
|
402
|
+
import { DotCMSEditableTextComponent } from '@dotcms/angular';
|
|
403
|
+
|
|
404
|
+
@Component({
|
|
405
|
+
selector: 'app-your-component',
|
|
406
|
+
imports: [RouterLink, NgOptimizedImage, DotCMSEditableTextComponent],
|
|
407
|
+
template: `
|
|
408
|
+
<div
|
|
409
|
+
class="flex overflow-hidden relative justify-center items-center w-full h-96 bg-gray-200">
|
|
410
|
+
<img
|
|
411
|
+
class="object-cover w-full"
|
|
412
|
+
[src]="'/dA/' + contentlet().inode"
|
|
413
|
+
[alt]="contentlet().title" />
|
|
414
|
+
<div
|
|
415
|
+
class="flex absolute inset-0 flex-col justify-center items-center p-4 text-center text-white">
|
|
416
|
+
<h2 class="mb-2 text-6xl font-bold text-shadow">
|
|
417
|
+
<dotcms-editable-text fieldName="title" [contentlet]="contentlet()" />
|
|
418
|
+
</h2>
|
|
419
|
+
<a
|
|
420
|
+
class="p-4 text-xl bg-red-400 rounded-sm transition duration-300 hover:bg-red-500"
|
|
421
|
+
[routerLink]="contentlet().link">
|
|
422
|
+
See more
|
|
423
|
+
</a>
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
`
|
|
427
|
+
})
|
|
428
|
+
export class MyBannerComponent {
|
|
429
|
+
@Input() contentlet: DotCMSBasicContentlet;
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
#### Editor Integration
|
|
434
|
+
|
|
435
|
+
- Detects UVE edit mode and enables inline TinyMCE editing
|
|
436
|
+
- Triggers a `Save` [workflow action](https://dev.dotcms.com/docs/workflows) on blur without needing full content dialog.
|
|
437
|
+
|
|
438
|
+
### DotCMSBlockEditorRenderer
|
|
439
|
+
|
|
440
|
+
`DotCMSBlockEditorRenderer` is a component for rendering [Block Editor](https://dev.dotcms.com/docs/block-editor) content from dotCMS with support for custom block renderers.
|
|
441
|
+
|
|
442
|
+
| Input | Type | Required | Description |
|
|
443
|
+
|-------------------|----------------------|----------|------------------------------------------------------------------------------------------------------------|
|
|
444
|
+
| `blocks` | `BlockEditorContent` | ✅ | The [Block Editor](https://dev.dotcms.com/docs/block-editor) content to render |
|
|
445
|
+
| `customRenderers` | `CustomRenderer` | ❌ | Custom rendering functions for specific [block types](https://dev.dotcms.com/docs/block-editor#BlockTypes) |
|
|
446
|
+
| `className` | `string` | ❌ | CSS class to apply to the container |
|
|
447
|
+
| `style` | `CSSProperties` | ❌ | Inline styles for the container |
|
|
448
|
+
|
|
449
|
+
#### Usage
|
|
450
|
+
|
|
451
|
+
```typescript
|
|
452
|
+
import { DotCMSBasicContentlet } from '@dotcms/types';
|
|
453
|
+
import { DotCMSBlockEditorRenderer } from '@dotcms/angular';
|
|
454
|
+
|
|
455
|
+
const CUSTOM_RENDERERS = {
|
|
456
|
+
customBlock: import('./custom-block.component').then((c) => c.CustomBlockComponent),
|
|
457
|
+
h1: import('./custom-h1.component').then((c) => c.CustomH1Component)
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
@Component({
|
|
461
|
+
selector: 'app-your-component',
|
|
462
|
+
imports: [DotCMSShowWhen],
|
|
463
|
+
template: `
|
|
464
|
+
<dotcms-block-editor-renderer
|
|
465
|
+
[blocks]="contentlet.myBlockEditorField"
|
|
466
|
+
[customRenderers]="customRenderers()" />
|
|
467
|
+
`
|
|
468
|
+
})
|
|
469
|
+
export class MyBannerComponent {
|
|
470
|
+
@Input() contentlet: DotCMSBasicContentlet;
|
|
471
|
+
readonly customRenderers = signal(CUSTOM_RENDERERS);
|
|
151
472
|
}
|
|
152
473
|
```
|
|
153
474
|
|
|
154
|
-
|
|
475
|
+
#### Recommendations
|
|
476
|
+
|
|
477
|
+
- Should not be used with [`DotCMSEditableText`](#dotcmseditabletext)
|
|
478
|
+
- Take into account the CSS cascade can affect the look and feel of your blocks.
|
|
479
|
+
- `DotCMSBlockEditorRenderer` only works with [Block Editor fields](https://dev.dotcms.com/docs/block-editor). For other fields, use [`DotCMSEditableText`](#dotcmseditabletext).
|
|
480
|
+
|
|
481
|
+
📘 For advanced examples, customization options, and best practices, refer to the [DotCMSBlockEditorRenderer README](https://github.com/dotCMS/core/tree/master/core-web/libs/sdk/angular/src/lib/components/DotCMSBlockEditorRenderer).
|
|
482
|
+
|
|
155
483
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
484
|
+
### DotCMSShowWhen
|
|
485
|
+
|
|
486
|
+
`DotCMSShowWhen` is a `directive` for conditionally showing content based on the current UVE mode. Useful for mode-based behaviors outside of render logic.
|
|
487
|
+
|
|
488
|
+
| Input | Type | Required | Description |
|
|
489
|
+
|--------|------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
490
|
+
| `when` | `UVE_MODE` | ✅ | The `UVE` mode when content should be displayed: <br/> `UVE_MODE.EDIT`: Only visible in edit mode <br/> `UVE_MODE.PREVIEW`: Only visible in preview mode <br/> `UVE_MODE.PUBLISHED`: Only visible in published mode |
|
|
491
|
+
|
|
492
|
+
#### Usage
|
|
493
|
+
|
|
494
|
+
```typescript
|
|
495
|
+
import { UVE_MODE } from '@dotcms/types';
|
|
496
|
+
import { DotCMSShowWhen } from '@dotcms/angular';
|
|
497
|
+
|
|
498
|
+
@Component({
|
|
499
|
+
selector: 'app-your-component',
|
|
500
|
+
imports: [DotCMSShowWhen],
|
|
501
|
+
template: `
|
|
502
|
+
<div *dotCMSShowWhen="UVE_MODE.EDIT">Only visible in edit mode</div>
|
|
503
|
+
`
|
|
504
|
+
})
|
|
505
|
+
export class YourComponent {}
|
|
162
506
|
```
|
|
163
507
|
|
|
164
|
-
|
|
508
|
+
📚 Learn more about the `UVE_MODE` enum in the [dotCMS UVE Package Documentation](https://dev.dotcms.com/docs/uve).
|
|
509
|
+
|
|
510
|
+
### DotCMSEditablePageService
|
|
511
|
+
|
|
512
|
+
The `DotCMSEditablePageService` enables real-time page updates when using the Universal Visual Editor. It provides a single method `listen` that returns an Observable of page changes.
|
|
165
513
|
|
|
166
|
-
|
|
514
|
+
| Param | Type | Required | Description |
|
|
515
|
+
|----------------|----------------------|----------|-----------------------------------------------|
|
|
516
|
+
| `pageResponse` | `DotCMSPageResponse` | ✅ | The page data object from `client.page.get()` |
|
|
167
517
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
518
|
+
#### Service Lifecycle & Operations
|
|
519
|
+
|
|
520
|
+
When you use the `listen` method, the service:
|
|
521
|
+
|
|
522
|
+
1. Initializes the UVE with your page data
|
|
523
|
+
2. Sets up communication channels with the editor
|
|
524
|
+
3. Tracks content changes in real-time
|
|
525
|
+
4. Updates your page automatically when:
|
|
526
|
+
- Content is edited inline
|
|
527
|
+
- Blocks are added or removed
|
|
528
|
+
- Layout changes are made
|
|
529
|
+
- Components are moved
|
|
530
|
+
5. Cleans up all listeners and connections on destroy
|
|
531
|
+
|
|
532
|
+
#### Usage
|
|
533
|
+
|
|
534
|
+
```typescript
|
|
535
|
+
import { Subscription } from 'rxjs';
|
|
536
|
+
import { Component, OnDestroy, OnInit, signal, inject } from '@angular/core';
|
|
537
|
+
|
|
538
|
+
import { getUVEState } from '@dotcms/uve';
|
|
539
|
+
import { DotCMSPageAsset } from '@dotcms/types';
|
|
540
|
+
import { DotCMSLayoutBody, DotCMSEditablePageService } from '@dotcms/angular';
|
|
541
|
+
import { DOTCMS_CLIENT_TOKEN } from './app.config';
|
|
542
|
+
|
|
543
|
+
@Component({
|
|
544
|
+
imports: [DotCMSLayoutBody],
|
|
545
|
+
providers: [DotCMSEditablePageService],
|
|
546
|
+
template: `
|
|
547
|
+
@if (pageAsset()) {
|
|
548
|
+
<dotcms-layout-body [page]="pageAsset()" [components]="components()" />
|
|
549
|
+
} @else {
|
|
550
|
+
<div>Loading...</div>
|
|
551
|
+
}
|
|
552
|
+
`
|
|
553
|
+
})
|
|
554
|
+
export class PageComponent implements OnInit, OnDestroy {
|
|
555
|
+
private subscription?: Subscription;
|
|
556
|
+
private readonly dotCMSClient = inject(DOTCMS_CLIENT_TOKEN);
|
|
557
|
+
private readonly editablePageService = inject(DotCMSEditablePageService);
|
|
558
|
+
readonly pageAsset = signal<DotCMSPageAsset | null>(null);
|
|
559
|
+
|
|
560
|
+
ngOnInit() {
|
|
561
|
+
this.dotCMSClient.page.get({ url: '/about-us' }).then((pageResponse) => {
|
|
562
|
+
// Only subscribe to changes when in the editor
|
|
563
|
+
if (getUVEState()) {
|
|
564
|
+
this.subscription = this.editablePageService
|
|
565
|
+
.listen(pageResponse)
|
|
566
|
+
.subscribe(({ pageAsset }) => {
|
|
567
|
+
this.pageAsset.set(pageAsset);
|
|
568
|
+
});
|
|
569
|
+
} else {
|
|
570
|
+
const { pageAsset } = pageResponse;
|
|
571
|
+
this.pageAsset.set(pageAsset);
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
ngOnDestroy() {
|
|
577
|
+
this.subscription?.unsubscribe();
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
```
|
|
172
581
|
|
|
173
582
|
## Troubleshooting
|
|
174
583
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
584
|
+
### Common Issues & Solutions
|
|
585
|
+
|
|
586
|
+
#### Universal Visual Editor (UVE)
|
|
587
|
+
|
|
588
|
+
1. **UVE Not Loading**: Page loads but UVE controls are not visible
|
|
589
|
+
- **Possible Causes**:
|
|
590
|
+
- Incorrect UVE configuration
|
|
591
|
+
- Missing API token permissions
|
|
592
|
+
- Missing the `DotCMSEditablePageService` call to enable UVE.
|
|
593
|
+
- **Solutions**:
|
|
594
|
+
- Verify UVE app configuration in dotCMS admin
|
|
595
|
+
- Check API token has edit permissions
|
|
596
|
+
- Ensure `dotcmsUrl` matches your instance URL exactly
|
|
597
|
+
|
|
598
|
+
#### Missing Content
|
|
599
|
+
|
|
600
|
+
1. **Components Not Rendering**: Empty spaces where content should appear
|
|
601
|
+
|
|
602
|
+
- **Possible Causes**:
|
|
603
|
+
- Missing component mappings
|
|
604
|
+
- Incorrect content type variable names
|
|
605
|
+
- **Solutions**:
|
|
606
|
+
- Check component registration in `components` prop
|
|
607
|
+
- Verify content type variable names match exactly
|
|
608
|
+
- Enable `development` mode for detailed logging
|
|
609
|
+
|
|
610
|
+
2. **Asset Loading Issues**: Images or files not loading
|
|
611
|
+
- **Possible Causes**:
|
|
612
|
+
- Proxy configuration issues
|
|
613
|
+
- CORS restrictions
|
|
614
|
+
- **Solutions**:
|
|
615
|
+
- Verify proxy settings in `angular.json`
|
|
616
|
+
- Check network tab for CORS errors
|
|
617
|
+
- Ensure `/dA` path is properly configured
|
|
618
|
+
|
|
619
|
+
#### Development Setup
|
|
620
|
+
|
|
621
|
+
1. **Build Errors**: `npm install` fails
|
|
622
|
+
|
|
623
|
+
- **Solutions**:
|
|
624
|
+
- Clear npm cache: `npm cache clean --force`
|
|
625
|
+
- Delete `node_modules` and reinstall
|
|
626
|
+
- Verify Node.js version compatibility
|
|
627
|
+
|
|
628
|
+
2. **Runtime Errors**: Console errors about missing imports or components not rendering
|
|
629
|
+
- **Solutions**:
|
|
630
|
+
- Check all imports are from `@dotcms/angular`
|
|
631
|
+
- Verify all peer dependencies are installed
|
|
632
|
+
- Update to latest compatible versions
|
|
633
|
+
|
|
634
|
+
### Debugging Tips
|
|
635
|
+
|
|
636
|
+
1. **Enable Development Mode**
|
|
637
|
+
|
|
638
|
+
```typescript
|
|
639
|
+
<dotcms-layout-body
|
|
640
|
+
[page]="pageAsset()"
|
|
641
|
+
[components]="components()"
|
|
642
|
+
mode="development"
|
|
643
|
+
/>
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
This will:
|
|
647
|
+
|
|
648
|
+
- Show detailed error messages
|
|
649
|
+
- Highlight unmapped components
|
|
650
|
+
- Log component lifecycle events
|
|
651
|
+
|
|
652
|
+
2. **Check Browser Console**
|
|
653
|
+
|
|
654
|
+
- Check for errors in the browser console
|
|
655
|
+
- Check for errors in the browser network tab
|
|
656
|
+
|
|
657
|
+
3. **Network Monitoring**
|
|
658
|
+
- Use browser dev tools to monitor API calls
|
|
659
|
+
- Check for 401/403 errors (auth issues)
|
|
660
|
+
- Verify asset loading paths
|
|
661
|
+
|
|
662
|
+
### Still Having Issues?
|
|
663
|
+
|
|
664
|
+
If you're still experiencing problems after trying these solutions:
|
|
665
|
+
|
|
666
|
+
1. Search existing [GitHub issues](https://github.com/dotCMS/core/issues)
|
|
667
|
+
2. Ask questions on the [community forum](https://community.dotcms.com/) to engage with other users.
|
|
668
|
+
3. Create a new issue with:
|
|
669
|
+
- Detailed reproduction steps
|
|
670
|
+
- Environment information
|
|
671
|
+
- Error messages
|
|
672
|
+
- Code samples
|
|
673
|
+
|
|
674
|
+
## dotCMS Support
|
|
675
|
+
|
|
676
|
+
We offer multiple channels to get help with the dotCMS Angular SDK:
|
|
677
|
+
|
|
678
|
+
- **GitHub Issues**: For bug reports and feature requests, please [open an issue](https://github.com/dotCMS/core/issues/new/choose) in the GitHub repository.
|
|
679
|
+
- **Community Forum**: Join our [community discussions](https://community.dotcms.com/) to ask questions and share solutions.
|
|
680
|
+
- **Stack Overflow**: Use the tag `dotcms-angular` when posting questions.
|
|
681
|
+
- **Enterprise Support**: Enterprise customers can access premium support through the [dotCMS Support Portal](https://helpdesk.dotcms.com/support/).
|
|
682
|
+
|
|
683
|
+
When reporting issues, please include:
|
|
684
|
+
|
|
685
|
+
- SDK version you're using
|
|
686
|
+
- Angular version
|
|
687
|
+
- Minimal reproduction steps
|
|
688
|
+
- Expected vs. actual behavior
|
|
689
|
+
|
|
690
|
+
## How To Contribute
|
|
691
|
+
|
|
692
|
+
GitHub pull requests are the preferred method to contribute code to dotCMS. We welcome contributions to the DotCMS UVE SDK! If you'd like to contribute, please follow these steps:
|
|
693
|
+
|
|
694
|
+
1. Fork the repository [dotCMS/core](https://github.com/dotCMS/core)
|
|
695
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
696
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
697
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
698
|
+
5. Open a Pull Request
|
|
699
|
+
|
|
700
|
+
Please ensure your code follows the existing style and includes appropriate tests.
|
|
701
|
+
|
|
702
|
+
## Licensing Information
|
|
703
|
+
|
|
704
|
+
dotCMS comes in multiple editions and as such is dual-licensed. The dotCMS Community Edition is licensed under the GPL 3.0 and is freely available for download, customization, and deployment for use within organizations of all stripes. dotCMS Enterprise Editions (EE) adds several enterprise features and is available via a supported, indemnified commercial license from dotCMS. For the differences between the editions, see [the feature page](http://www.dotcms.com/cms-platform/features).
|
|
705
|
+
|
|
706
|
+
This SDK is part of dotCMS's dual-licensed platform (GPL 3.0 for Community, commercial license for Enterprise).
|
|
707
|
+
|
|
708
|
+
[Learn more ](https://www.dotcms.com)at [dotcms.com](https://www.dotcms.com).
|