Skip to content

Commit 0f8b126

Browse files
authored
Merge pull request #34 from philenius/feat/update-to-angular-19
feat: upgrade to Angular 19
2 parents 6567953 + 24e8055 commit 0f8b126

18 files changed

+3946
-4055
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# CHANGELOG
22

3+
## 19.0.0
4+
5+
Pull request: https://github.com/philenius/ngx-annotate-text/pull/34
6+
7+
- Upgrade to Angular 19.2.0
8+
39
## 18.0.0
410

511
Pull request: https://github.com/philenius/ngx-annotate-text/pull/30

README.md

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# ngx-annotate-text
32

43
<img alt="GitHub Workflow Status (branch)" src="https://img.shields.io/github/actions/workflow/status/philenius/ngx-annotate-text/main.yml?branch=main&style=for-the-badge"> <a href="https://github.com/philenius/ngx-annotate-text/issues"><img alt="GitHub issues" src="https://img.shields.io/github/issues/philenius/ngx-annotate-text?style=for-the-badge"></a> <img alt="GitHub" src="https://img.shields.io/github/license/philenius/ngx-annotate-text?style=for-the-badge"> <img alt="npm" src="https://img.shields.io/npm/v/ngx-annotate-text?style=for-the-badge">
@@ -34,25 +33,30 @@ View and edit the live demo Angular app on <a href="https://codesandbox.io/s/ngx
3433
npm install ngx-annotate-text
3534
```
3635

37-
2. Import the Angular module `NgxAnnotateTextModule`:
36+
2. In your Angular component import the `NgxAnnotateTextComponent` and create two properties for the text to be displayed and the list of annotations:
3837

3938
```typescript
40-
import { BrowserModule } from "@angular/platform-browser";
41-
import { NgModule } from "@angular/core";
42-
43-
import { AppComponent } from "./app.component";
44-
import { NgxAnnotateTextModule } from "ngx-annotate-text";
39+
import { Annotation, NgxAnnotateTextComponent } from 'ngx-annotate-text';
4540

46-
@NgModule({
47-
declarations: [AppComponent],
48-
imports: [BrowserModule, NgxAnnotateTextModule],
49-
providers: [],
50-
bootstrap: [AppComponent],
41+
@Component({
42+
selector: 'app-root',
43+
imports: [NgxAnnotateTextComponent],
44+
templateUrl: './app.component.html',
45+
styleUrl: './app.component.css',
5146
})
52-
export class AppModule {}
47+
export class AppComponent {
48+
annotations: Annotation[] = [
49+
new Annotation(3, 11, 'Date', '#0d6efd'),
50+
new Annotation(36, 45, 'City', '#dc3545'),
51+
new Annotation(47, 52, 'Country', '#198754'),
52+
new Annotation(77, 85, 'Time', '#6c757d'),
53+
];
54+
55+
text = 'On August 1, we went on vacation to Barcelona, Spain. Our flight took off at 11:00 am.';
56+
}
5357
```
5458

55-
3. Add the component `ngx-annotate-text` to your template:
59+
3. Add the component `ngx-annotate-text` to your component's template:
5660

5761
```html
5862
<ngx-annotate-text
@@ -65,31 +69,7 @@ View and edit the live demo Angular app on <a href="https://codesandbox.io/s/ngx
6569
</ngx-annotate-text>
6670
```
6771

68-
4. Create properties in your component class for the text to be annotated and an (empty) array of annotations:
69-
70-
```typescript
71-
import { Component, ViewChild } from "@angular/core";
72-
import { Annotation, NgxAnnotateTextComponent } from "ngx-annotate-text";
73-
74-
@Component({
75-
selector: "app-root",
76-
templateUrl: "./app.component.html",
77-
styleUrls: ["./app.component.css"],
78-
})
79-
export class AppComponent {
80-
text: string =
81-
"On August 1, we went on vacation to Barcelona, Spain. Our flight took off at 11:00 am.";
82-
83-
annotations: Annotation[] = [
84-
new Annotation(3, 11, "Date", "#0069d9"),
85-
new Annotation(36, 45, "City", "#dc3545"),
86-
new Annotation(47, 52, "Country", "#28a745"),
87-
new Annotation(77, 85, "Time", "#5a6268"),
88-
];
89-
}
90-
```
91-
92-
5. Having set `annotationClass="my-annotation"`, a custom CSS styling can be applied by combining `::ng-deep` with the class selector `.my-annotation`, e.g., to remove the border-radius:
72+
3. Having set `annotationClass="my-annotation"`, a custom CSS styling can be applied by combining `::ng-deep` with the class selector `.my-annotation`, e.g., to remove the border-radius:
9373
```css
9474
::ng-deep .my-annotation .annotation-parent,
9575
::ng-deep .my-annotation .annotation-content {
@@ -124,16 +104,18 @@ View and edit the live demo Angular app on <a href="https://codesandbox.io/s/ngx
124104
| getCurrentTextSelection | Returns the start index and end index of the currently selected text range. Returns `undefined` if no text is currently selected. | `ISelection|undefined` |
125105
| isOverlappingWithExistingAnnotations | Returns true if the given text selection is (partially) overlapping with an existing annotation. Returns false otherwise. | `boolean` |
126106

107+
---
108+
127109
## Development
128110

129111
### Recreate project from scratch
130112

131113
```bash
132-
npm install -g @angular/cli@^18
114+
npm install -g @angular/cli@^19
133115
ng new ngx-annotate-text-workspace
134116
cd ngx-annotate-text-workspace/
135117
ng generate library ngx-annotate-text
136-
ng add angular-eslint@^18
118+
ng add angular-eslint@^19
137119
ng g angular-eslint:add-eslint-to-project ngx-annotate-text-workspace
138120
ng g angular-eslint:add-eslint-to-project ngx-annotate-text
139121
npm install prettier --save-dev

angular.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
},
3838
{
3939
"type": "anyComponentStyle",
40-
"maximumWarning": "2kB",
41-
"maximumError": "4kB"
40+
"maximumWarning": "4kB",
41+
"maximumError": "8kB"
4242
}
4343
],
4444
"outputHashing": "all"

0 commit comments

Comments
 (0)