@typix-editor/extension-auto-link 2.0.0 → 4.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 +48 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @typix-editor/extension-auto-link
|
|
2
|
+
|
|
3
|
+
Automatically converts URLs and email addresses into clickable links as users type.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @typix-editor/extension-auto-link
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { AutoLinkExtension } from "@typix-editor/extension-auto-link";
|
|
15
|
+
|
|
16
|
+
<EditorRoot editorConfig={config}>
|
|
17
|
+
<EditorContent />
|
|
18
|
+
<AutoLinkExtension />
|
|
19
|
+
</EditorRoot>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Custom Matchers
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
const EMAIL_MATCHER = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/;
|
|
26
|
+
|
|
27
|
+
<AutoLinkExtension
|
|
28
|
+
matchers={[
|
|
29
|
+
{ pattern: EMAIL_MATCHER, type: "email" },
|
|
30
|
+
]}
|
|
31
|
+
onChange={(url, prevUrl) => console.log("Link changed:", url)}
|
|
32
|
+
/>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Props
|
|
36
|
+
|
|
37
|
+
| Prop | Type | Default | Description |
|
|
38
|
+
|------|------|---------|-------------|
|
|
39
|
+
| `matchers` | `LinkMatcher[]` | URL + email matchers | Custom regex matchers for auto-linking |
|
|
40
|
+
| `onChange` | `(url: string \| null, prevUrl: string \| null) => void` | - | Callback when a link is created or removed |
|
|
41
|
+
|
|
42
|
+
## Documentation
|
|
43
|
+
|
|
44
|
+
[typix.com/docs/extensions/auto-link](https://typix.com/docs/extensions/auto-link)
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typix-editor/extension-auto-link",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Auto link extension for Typix",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Diyorbek Juraev <mrdiyorbekjuraev@gmail.com>",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"react-dom": "^18.2.0 || ^19.0.0-0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@lexical/react": "^0.
|
|
33
|
-
"@lexical/link": "^0.
|
|
32
|
+
"@lexical/react": "^0.40.0",
|
|
33
|
+
"@lexical/link": "^0.40.0",
|
|
34
34
|
"@types/react": "^19.2.7",
|
|
35
35
|
"@types/react-dom": "^19.2.1",
|
|
36
|
-
"lexical": "^0.
|
|
36
|
+
"lexical": "^0.40.0",
|
|
37
37
|
"react": "^18.2.0 || ^19.0.0-0",
|
|
38
38
|
"react-dom": "^18.2.0 || ^19.0.0-0",
|
|
39
|
-
"@typix-editor/react": "
|
|
39
|
+
"@typix-editor/react": "4.0.0"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tsup",
|