@lexion-rte/angular 0.1.0 → 0.1.2
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/CHANGELOG.md +23 -0
- package/README.md +70 -0
- package/package.json +6 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @lexion-rte/angular
|
|
2
|
+
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Refresh package metadata links and expand package-level README documentation.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @lexion-rte/core@0.1.2
|
|
10
|
+
- @lexion-rte/web@0.1.2
|
|
11
|
+
|
|
12
|
+
## 0.1.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Update package metadata and documentation for the `@lexion-rte` package set.
|
|
17
|
+
|
|
18
|
+
- Align repository/homepage/bugs metadata with the current GitHub repository owner.
|
|
19
|
+
- Add package-level README files with package purpose and usage examples.
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
- @lexion-rte/core@0.1.1
|
|
23
|
+
- @lexion-rte/web@0.1.1
|
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @lexion-rte/angular
|
|
2
|
+
|
|
3
|
+
Angular integration helpers for Lexion.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`@lexion-rte/angular` provides an adapter that:
|
|
8
|
+
|
|
9
|
+
- attaches/detaches editor lifecycle to Angular components
|
|
10
|
+
- supports value updates and read-only toggling
|
|
11
|
+
- exposes hooks compatible with form-style change/touched flow
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @lexion-rte/angular @angular/core @angular/forms
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Adapter API
|
|
20
|
+
|
|
21
|
+
Create adapter:
|
|
22
|
+
|
|
23
|
+
- `createLexionAngularAdapter(options?)`
|
|
24
|
+
|
|
25
|
+
Main methods:
|
|
26
|
+
|
|
27
|
+
- `attach(element)`
|
|
28
|
+
- `detach()`
|
|
29
|
+
- `update({ value?, readOnly?, onChange? })`
|
|
30
|
+
- `writeValue(value)`
|
|
31
|
+
- `setDisabledState(disabled)`
|
|
32
|
+
- `registerOnChange(handler)`
|
|
33
|
+
- `registerOnTouched(handler)`
|
|
34
|
+
- `markAsTouched()`
|
|
35
|
+
- `destroy()`
|
|
36
|
+
|
|
37
|
+
## Component Lifecycle Example
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { AfterViewInit, Component, ElementRef, OnDestroy, ViewChild } from "@angular/core";
|
|
41
|
+
import { createLexionAngularAdapter } from "@lexion-rte/angular";
|
|
42
|
+
|
|
43
|
+
@Component({
|
|
44
|
+
selector: "app-editor",
|
|
45
|
+
template: `<div #editorHost></div>`
|
|
46
|
+
})
|
|
47
|
+
export class EditorComponent implements AfterViewInit, OnDestroy {
|
|
48
|
+
@ViewChild("editorHost", { static: true })
|
|
49
|
+
private editorHost!: ElementRef<HTMLElement>;
|
|
50
|
+
|
|
51
|
+
private readonly adapter = createLexionAngularAdapter({
|
|
52
|
+
onChange: (value) => {
|
|
53
|
+
console.log("changed", value);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
ngAfterViewInit(): void {
|
|
58
|
+
this.adapter.attach(this.editorHost.nativeElement);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
ngOnDestroy(): void {
|
|
62
|
+
this.adapter.destroy();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
|
|
69
|
+
- `attach()` is idempotent for the same element.
|
|
70
|
+
- Use `setDisabledState(true)` for read-only behavior in form-driven components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexion-rte/angular",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Angular adapter utilities for the Lexion editor.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"license": "GPL-3.0-only",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "https://github.com/
|
|
18
|
+
"url": "https://github.com/dariusve/lexion.git",
|
|
19
19
|
"directory": "packages/angular"
|
|
20
20
|
},
|
|
21
|
-
"homepage": "https://github.com/
|
|
21
|
+
"homepage": "https://github.com/dariusve/lexion/tree/main/packages/angular",
|
|
22
22
|
"bugs": {
|
|
23
|
-
"url": "https://github.com/
|
|
23
|
+
"url": "https://github.com/dariusve/lexion/issues"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"lexion",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@angular/forms": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@lexion-rte/core": "0.1.
|
|
42
|
-
"@lexion-rte/web": "0.1.
|
|
41
|
+
"@lexion-rte/core": "0.1.2",
|
|
42
|
+
"@lexion-rte/web": "0.1.2"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsc -p tsconfig.json",
|