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

support-different-text-styles #48

Merged
merged 15 commits into from
Jan 3, 2025
5 changes: 2 additions & 3 deletions .github/workflows/builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ name: Global build & lint & test

on:
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
matrix:
node-version: [ 20.x ]
node-version: [20.x]

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ name: Deployment

on:
push:
branches: [ main ]
branches: [main]

jobs:
build:

runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
matrix:
node-version: [ 20.x ]
node-version: [20.x]

steps:
- name: Checkout
Expand Down
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"semi": true,
"bracketSpacing": true,
"arrowParens": "avoid",
"trailingComma": "all",
"bracketSameLine": true,
"printWidth": 180
}
38 changes: 29 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,31 +97,51 @@ As the signal outputs in angular do not have a possibility to check for observer

The library includes a component to display content of the wysiwyg editor of strapi.

There is a single entry point for the strap called ```@bolzplatzarena/components/strapi```. Everything is standalone no module needs to be imported.

```

### Support

The library is in experimental state and is not recommended for production use because it does not support all types of the strapi content.
The component supports the following types:

- paragraph
- simple text (text content without formatting as child of paragraph)
- simple text
- bold
- italic
- underline
- hyperlink
- headlines 1 - 6
- list
- unordered
- ordered
- quote
- code (no syntax highlighting)
- image (url, width, height, alt)

### How to use it

Normally the data comes from the api and is a property of the control using the wysiwyg editor.

Example data:

```
protected readonly strapiContent: RootNode[] = [{
type: 'paragraph',
children: [{type: 'text', text: 'Hello World!'}, {type: 'text', text: 'This is a test.'}]
}, {
type: 'paragraph',
children: [{type: 'text', text: 'Hello World!'}, {type: 'text', text: 'This is a test.'}]
}];

protected readonly strapiContent: RootNode[] = [{
type: 'paragraph',
children: [{type: 'text', text: 'Hello World!'}, {type: 'text', text: 'This is a test.'}]
}, {
type: 'paragraph',
children: [{type: 'text', text: 'Hello World!'}, {type: 'text', text: 'This is a test.'}]
}];

```

Example template:

```

<bpa-strapi-content [content]="strapiContent"></bpa-strapi-content>
```

```
24 changes: 5 additions & 19 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,11 @@
"outputPath": "dist/bolzplatzarena-components",
"index": "src/index.html",
"browser": "src/main.ts",
"polyfills": [
"src/polyfills.ts"
],
"polyfills": ["src/polyfills.ts"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["./node_modules/@angular/material/prebuilt-themes/indigo-pink.css", "src/styles.scss"],
"scripts": []
},
"configurations": {
Expand Down Expand Up @@ -90,10 +82,7 @@
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
}
},
"deploy": {
Expand Down Expand Up @@ -125,10 +114,7 @@
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/components/**/*.ts",
"projects/components/**/*.html"
]
"lintFilePatterns": ["projects/components/**/*.ts", "projects/components/**/*.html"]
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
preset: 'jest-preset-angular',
setupFilesAfterEnv: ['<rootDir>/../../setup-test.ts']
}
setupFilesAfterEnv: ['<rootDir>/../../setup-test.ts'],
};
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"jest": "^29.7.0",
"jest-preset-angular": "^14.4.2",
"ng-packagr": "^19.0.1",
"prettier": "3.4.2",
"ts-jest": "^29.1.1",
"typescript": "~5.6.3"
}
Expand Down
17 changes: 4 additions & 13 deletions projects/components/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
{
"extends": "../../.eslintrc.json",
"ignorePatterns": [
"!**/*"
],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": [
"*.ts"
],
"files": ["*.ts"],
"parserOptions": {
"project": [
"projects/components/tsconfig.lib.json",
"projects/components/tsconfig.spec.json"
],
"project": ["projects/components/tsconfig.lib.json", "projects/components/tsconfig.spec.json"],
"createDefaultProgram": true
},
"rules": {
Expand All @@ -35,9 +28,7 @@
}
},
{
"files": [
"*.html"
],
"files": ["*.html"],
"rules": {}
}
]
Expand Down
38 changes: 29 additions & 9 deletions projects/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,31 +97,51 @@ As the signal outputs in angular do not have a possibility to check for observer

The library includes a component to display content of the wysiwyg editor of strapi.

There is a single entry point for the strap called ```@bolzplatzarena/components/strapi```. Everything is standalone no module needs to be imported.

```

### Support

The library is in experimental state and is not recommended for production use because it does not support all types of the strapi content.
The component supports the following types:

- paragraph
- simple text (text content without formatting as child of paragraph)
- simple text
- bold
- italic
- underline
- hyperlink
- headlines 1 - 6
- list
- unordered
- ordered
- quote
- code (no syntax highlighting)
- image (url, width, height, alt)

### How to use it

Normally the data comes from the api and is a property of the control using the wysiwyg editor.

Example data:

```
protected readonly strapiContent: RootNode[] = [{
type: 'paragraph',
children: [{type: 'text', text: 'Hello World!'}, {type: 'text', text: 'This is a test.'}]
}, {
type: 'paragraph',
children: [{type: 'text', text: 'Hello World!'}, {type: 'text', text: 'This is a test.'}]
}];

protected readonly strapiContent: RootNode[] = [{
type: 'paragraph',
children: [{type: 'text', text: 'Hello World!'}, {type: 'text', text: 'This is a test.'}]
}, {
type: 'paragraph',
children: [{type: 'text', text: 'Hello World!'}, {type: 'text', text: 'This is a test.'}]
}];

```

Example template:

```

<bpa-strapi-content [content]="strapiContent"></bpa-strapi-content>
```

```
2 changes: 1 addition & 1 deletion projects/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bolzplatzarena/components",
"version": "0.18.0",
"version": "0.19.0",
"author": "Thomas Renger",
"repository": {
"type": "git",
Expand Down
12 changes: 3 additions & 9 deletions projects/components/src/lib/components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,9 @@ import { faSkullCrossbones } from '@fortawesome/free-solid-svg-icons/faSkullCros
import { PaginatorTexts } from './paginator-texts';

@NgModule({
imports: [
BrowserAnimationsModule,
],
exports: [
MatDialogModule,
],
providers: [
{ provide: MatPaginatorIntl, useClass: PaginatorTexts },
],
imports: [BrowserAnimationsModule],
exports: [MatDialogModule],
providers: [{ provide: MatPaginatorIntl, useClass: PaginatorTexts }],
})
export class ComponentsModule {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
<ng-template #content>
<ng-content></ng-content>
@if (loading) {
<mat-spinner
color="primary"
[strokeWidth]="2"
[diameter]="20"
style="position: absolute; left: 50%; top: 0; margin-left: -10px;">
</mat-spinner>
<mat-spinner color="primary" [strokeWidth]="2" [diameter]="20" style="position: absolute; left: 50%; top: 0; margin-left: -10px"> </mat-spinner>
}
</ng-template>
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import {NgTemplateOutlet} from '@angular/common';
import {Component, input} from '@angular/core';
import {MatButtonModule} from '@angular/material/button';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import { NgTemplateOutlet } from '@angular/common';
import { Component, input } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';

@Component({
selector: 'bpa-button',
imports: [
MatButtonModule,
MatProgressSpinnerModule,
NgTemplateOutlet,
],
imports: [MatButtonModule, MatProgressSpinnerModule, NgTemplateOutlet],
templateUrl: './button.component.html',
})
export class ButtonComponent {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
code {
padding: 1rem;
background-color: #e1e1e1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<code>
<ng-content></ng-content>
</code>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {Component} from '@angular/core';

@Component({
selector: 'bpa-code-renderer',
imports: [],
templateUrl: './code-renderer.component.html',
styleUrl: './code-renderer.component.css'
})
export class CodeRendererComponent {
}
Loading
Loading