Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[template/angular-xmcloud] Introduce SXA PageContent component #1892

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ Our versioning strategy is as follows:
* Richtext component ([#1864](https://github.com/Sitecore/jss/pull/1864))
* Container component ([#1872](https://github.com/Sitecore/jss/pull/1872))
* Angular SXA layout ([#1873](https://github.com/Sitecore/jss/pull/1873))([#1880](https://github.com/Sitecore/jss/pull/1880))([#1890](https://github.com/Sitecore/jss/pull/1890))
* Column-Splitter ([#1889](https://github.com/Sitecore/jss/pull/1889))


* Column-Splitter component ([#1889](https://github.com/Sitecore/jss/pull/1889))
* Page-Content component ([#1892](https://github.com/Sitecore/jss/pull/1892))

### 🛠 Breaking Change

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"lerna": "3.22.1",
"packages": ["packages/*", "samples/*"],
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"npmClient": "yarn",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion packages/create-sitecore-jss/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-sitecore-jss",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"description": "Sitecore JSS initializer",
"bin": "./dist/index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="component content {{styles}}" [attr.id]="id">
<div class="component-content">
<div class="field-content">
<div *scRichText="content || contextContent"></div>
addy-pathania marked this conversation as resolved.
Show resolved Hide resolved
</div>
</div>
</div>

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { RichTextField } from '@sitecore-jss/sitecore-jss-angular';
import { JssContextService } from '../../jss-context.service';
import { SxaComponent } from './../sxa.component';
import { Subscription } from 'rxjs';

@Component({
selector: 'app-page-content',
templateUrl: './page-content.component.html',
})
export class PageContentComponent extends SxaComponent implements OnInit, OnDestroy {
content?: RichTextField;
contextContent?: RichTextField;
private contextSubscription: Subscription;

constructor(private jssContext: JssContextService) {
super();
}
ngOnInit() {
super.ngOnInit();

this.content = this.rendering.fields?.Content as RichTextField;
this.contextSubscription = this.jssContext.state.subscribe((newState) => {
this.contextContent =
newState.sitecore && (newState.sitecore.route.fields.Content as RichTextField);
});
}

ngOnDestroy() {
if (this.contextSubscription) {
this.contextSubscription.unsubscribe();
}
}
}
2 changes: 1 addition & 1 deletion packages/sitecore-jss-angular-schematics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-angular-schematics",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"description": "Scaffolding schematics for Sitecore JSS Angular apps",
"scripts": {
"build": "tsc -p tsconfig.json",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-angular",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"description": "",
"scripts": {
"build": "ng-packagr -p ng-package.json",
Expand Down Expand Up @@ -58,7 +58,7 @@
"rxjs": "~7.8.1"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "22.2.0-canary.24"
"@sitecore-jss/sitecore-jss": "22.2.0-canary.25"
},
"main": "dist/esm2022/sitecore-jss-sitecore-jss-angular.mjs",
"module": "dist/esm2022/sitecore-jss-sitecore-jss-angular.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-cli",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"description": "Sitecore JSS command-line",
"main": "dist/cjs/cli.js",
"module": "dist/esm/cli.js",
Expand Down Expand Up @@ -32,7 +32,7 @@
"url": "https://github.com/sitecore/jss/issues"
},
"dependencies": {
"@sitecore-jss/sitecore-jss-dev-tools": "22.2.0-canary.24",
"@sitecore-jss/sitecore-jss-dev-tools": "22.2.0-canary.25",
"chalk": "^4.1.2",
"cross-spawn": "^7.0.3",
"dotenv": "^16.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-dev-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-dev-tools",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"description": "Utilities to assist in the development and deployment of Sitecore JSS apps.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"@babel/parser": "^7.24.0",
"@sitecore-jss/sitecore-jss": "22.2.0-canary.24",
"@sitecore-jss/sitecore-jss": "22.2.0-canary.25",
"axios": "^1.3.2",
"chalk": "^4.1.2",
"chokidar": "^3.6.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-forms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-forms",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down Expand Up @@ -43,7 +43,7 @@
"typescript": "~4.9.5"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "22.2.0-canary.24"
"@sitecore-jss/sitecore-jss": "22.2.0-canary.25"
},
"description": "",
"types": "types/index.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions packages/sitecore-jss-nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-nextjs",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down Expand Up @@ -72,9 +72,9 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "22.2.0-canary.24",
"@sitecore-jss/sitecore-jss-dev-tools": "22.2.0-canary.24",
"@sitecore-jss/sitecore-jss-react": "22.2.0-canary.24",
"@sitecore-jss/sitecore-jss": "22.2.0-canary.25",
"@sitecore-jss/sitecore-jss-dev-tools": "22.2.0-canary.25",
"@sitecore-jss/sitecore-jss-react": "22.2.0-canary.25",
"@vercel/kv": "^0.2.1",
"prop-types": "^15.8.1",
"regex-parser": "^2.2.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss-proxy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-proxy",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"description": "Proxy middleware for express.js server.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-react-forms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-react-forms",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down Expand Up @@ -54,7 +54,7 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@sitecore-jss/sitecore-jss-forms": "22.2.0-canary.24",
"@sitecore-jss/sitecore-jss-forms": "22.2.0-canary.25",
"prop-types": "^15.8.1"
},
"description": "",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-react-native",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"description": "",
"main": "dist/index.js",
"scripts": {
Expand All @@ -27,7 +27,7 @@
"url": "https://github.com/sitecore/jss/issues"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "22.2.0-canary.24",
"@sitecore-jss/sitecore-jss": "22.2.0-canary.25",
"prop-types": "^15.7.2",
"react-native-htmlview": "^0.15.0",
"react-native-svg": "^5.3.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-react",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down Expand Up @@ -61,7 +61,7 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "22.2.0-canary.24",
"@sitecore-jss/sitecore-jss": "22.2.0-canary.25",
"fast-deep-equal": "^3.1.3",
"prop-types": "^15.8.1",
"style-attr": "^1.3.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss-rendering-host/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-rendering-host",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-vue",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"description": "A library for building Sitecore JSS apps using Vue.js",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -48,7 +48,7 @@
"vue": "^3.2.45"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "22.2.0-canary.24",
"@sitecore-jss/sitecore-jss": "22.2.0-canary.25",
"@vue/compiler-sfc": "^3.0.11"
},
"types": "./types/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss",
"version": "22.2.0-canary.24",
"version": "22.2.0-canary.25",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down
2 changes: 1 addition & 1 deletion ref-docs/sitecore-jss-angular-schematics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@

#### Defined in

[index.ts:41](https://github.com/Sitecore/jss/blob/b6b87f350/packages/sitecore-jss-angular-schematics/src/jss-component/index.ts#L41)
[index.ts:41](https://github.com/Sitecore/jss/blob/410e85a33/packages/sitecore-jss-angular-schematics/src/jss-component/index.ts#L41)
4 changes: 2 additions & 2 deletions ref-docs/sitecore-jss-angular/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ packages/sitecore-jss/types/editing/edit-frame.d.ts:57

#### Defined in

[packages/sitecore-jss-angular/src/services/placeholder.token.ts:65](https://github.com/Sitecore/jss/blob/b6b87f350/packages/sitecore-jss-angular/src/services/placeholder.token.ts#L65)
[packages/sitecore-jss-angular/src/services/placeholder.token.ts:65](https://github.com/Sitecore/jss/blob/410e85a33/packages/sitecore-jss-angular/src/services/placeholder.token.ts#L65)

___

Expand Down Expand Up @@ -509,7 +509,7 @@ rendering is HtmlElementRendering

#### Defined in

[packages/sitecore-jss-angular/src/components/rendering.ts:6](https://github.com/Sitecore/jss/blob/b6b87f350/packages/sitecore-jss-angular/src/components/rendering.ts#L6)
[packages/sitecore-jss-angular/src/components/rendering.ts:6](https://github.com/Sitecore/jss/blob/410e85a33/packages/sitecore-jss-angular/src/components/rendering.ts#L6)

___

Expand Down
8 changes: 4 additions & 4 deletions ref-docs/sitecore-jss-angular/classes/ComponentNameAndType.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Registers a statically loaded component

#### Defined in

[packages/sitecore-jss-angular/src/services/placeholder.token.ts:12](https://github.com/Sitecore/jss/blob/b6b87f350/packages/sitecore-jss-angular/src/services/placeholder.token.ts#L12)
[packages/sitecore-jss-angular/src/services/placeholder.token.ts:12](https://github.com/Sitecore/jss/blob/410e85a33/packages/sitecore-jss-angular/src/services/placeholder.token.ts#L12)

___

Expand All @@ -41,7 +41,7 @@ ___

#### Defined in

[packages/sitecore-jss-angular/src/services/placeholder.token.ts:9](https://github.com/Sitecore/jss/blob/b6b87f350/packages/sitecore-jss-angular/src/services/placeholder.token.ts#L9)
[packages/sitecore-jss-angular/src/services/placeholder.token.ts:9](https://github.com/Sitecore/jss/blob/410e85a33/packages/sitecore-jss-angular/src/services/placeholder.token.ts#L9)

___

Expand All @@ -55,7 +55,7 @@ ___

#### Defined in

[packages/sitecore-jss-angular/src/services/placeholder.token.ts:17](https://github.com/Sitecore/jss/blob/b6b87f350/packages/sitecore-jss-angular/src/services/placeholder.token.ts#L17)
[packages/sitecore-jss-angular/src/services/placeholder.token.ts:17](https://github.com/Sitecore/jss/blob/410e85a33/packages/sitecore-jss-angular/src/services/placeholder.token.ts#L17)

___

Expand All @@ -65,4 +65,4 @@ ___

#### Defined in

[packages/sitecore-jss-angular/src/services/placeholder.token.ts:10](https://github.com/Sitecore/jss/blob/b6b87f350/packages/sitecore-jss-angular/src/services/placeholder.token.ts#L10)
[packages/sitecore-jss-angular/src/services/placeholder.token.ts:10](https://github.com/Sitecore/jss/blob/410e85a33/packages/sitecore-jss-angular/src/services/placeholder.token.ts#L10)
Loading
Loading