@haklex/rich-ext-embed 0.24.0 → 0.25.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 +26 -26
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -10,72 +10,72 @@ pnpm add @haklex/rich-ext-embed
|
|
|
10
10
|
|
|
11
11
|
## Peer Dependencies
|
|
12
12
|
|
|
13
|
-
| Package
|
|
14
|
-
|
|
|
15
|
-
| `@lexical/react` | `^0.
|
|
16
|
-
| `lexical`
|
|
17
|
-
| `react`
|
|
18
|
-
| `react-dom`
|
|
19
|
-
| `shiki`
|
|
13
|
+
| Package | Version | Required |
|
|
14
|
+
| ---------------- | --------- | -------- |
|
|
15
|
+
| `@lexical/react` | `^0.45.0` | Yes |
|
|
16
|
+
| `lexical` | `^0.45.0` | Yes |
|
|
17
|
+
| `react` | `>= 19` | Yes |
|
|
18
|
+
| `react-dom` | `>= 19` | Yes |
|
|
19
|
+
| `shiki` | `>= 3` | Optional |
|
|
20
20
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
### Register nodes in your editor config
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
|
-
import { embedEditNodes } from '@haklex/rich-ext-embed'
|
|
26
|
+
import { embedEditNodes } from '@haklex/rich-ext-embed';
|
|
27
27
|
|
|
28
28
|
const editorConfig = {
|
|
29
29
|
nodes: [...embedEditNodes],
|
|
30
|
-
}
|
|
30
|
+
};
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
For static/read-only rendering:
|
|
34
34
|
|
|
35
35
|
```ts
|
|
36
|
-
import { embedNodes } from '@haklex/rich-ext-embed/static'
|
|
36
|
+
import { embedNodes } from '@haklex/rich-ext-embed/static';
|
|
37
37
|
|
|
38
38
|
const staticConfig = {
|
|
39
39
|
nodes: [...embedNodes],
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
### Use the embed plugin
|
|
44
44
|
|
|
45
45
|
```tsx
|
|
46
|
-
import { EmbedPlugin } from '@haklex/rich-ext-embed'
|
|
46
|
+
import { EmbedPlugin } from '@haklex/rich-ext-embed';
|
|
47
47
|
|
|
48
48
|
function EditorPlugins() {
|
|
49
|
-
return <EmbedPlugin
|
|
49
|
+
return <EmbedPlugin />;
|
|
50
50
|
}
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
### Insert embeds programmatically
|
|
54
54
|
|
|
55
55
|
```ts
|
|
56
|
-
import { INSERT_EMBED_COMMAND } from '@haklex/rich-ext-embed'
|
|
56
|
+
import { INSERT_EMBED_COMMAND } from '@haklex/rich-ext-embed';
|
|
57
57
|
|
|
58
|
-
editor.dispatchCommand(INSERT_EMBED_COMMAND, { url: 'https://youtube.com/watch?v=...' })
|
|
58
|
+
editor.dispatchCommand(INSERT_EMBED_COMMAND, { url: 'https://youtube.com/watch?v=...' });
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
### Use renderers
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
|
-
import { EmbedLinkRenderer } from '@haklex/rich-ext-embed'
|
|
65
|
-
import { EmbedStaticRenderer } from '@haklex/rich-ext-embed/static'
|
|
64
|
+
import { EmbedLinkRenderer } from '@haklex/rich-ext-embed';
|
|
65
|
+
import { EmbedStaticRenderer } from '@haklex/rich-ext-embed/static';
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
### Provide custom embed renderers
|
|
69
69
|
|
|
70
70
|
```tsx
|
|
71
|
-
import { EmbedRendererProvider, useEmbedRenderers } from '@haklex/rich-ext-embed'
|
|
71
|
+
import { EmbedRendererProvider, useEmbedRenderers } from '@haklex/rich-ext-embed';
|
|
72
72
|
|
|
73
73
|
function App() {
|
|
74
74
|
return (
|
|
75
75
|
<EmbedRendererProvider>
|
|
76
76
|
<Editor />
|
|
77
77
|
</EmbedRendererProvider>
|
|
78
|
-
)
|
|
78
|
+
);
|
|
79
79
|
}
|
|
80
80
|
```
|
|
81
81
|
|
|
@@ -91,13 +91,13 @@ import {
|
|
|
91
91
|
isGistUrl,
|
|
92
92
|
isGithubFilePreviewUrl,
|
|
93
93
|
createSelfThinkingMatcher,
|
|
94
|
-
} from '@haklex/rich-ext-embed'
|
|
94
|
+
} from '@haklex/rich-ext-embed';
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
### Import styles
|
|
98
98
|
|
|
99
99
|
```ts
|
|
100
|
-
import '@haklex/rich-ext-embed/style.css'
|
|
100
|
+
import '@haklex/rich-ext-embed/style.css';
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
## Exports
|
|
@@ -137,11 +137,11 @@ import '@haklex/rich-ext-embed/style.css'
|
|
|
137
137
|
|
|
138
138
|
### Sub-path Exports
|
|
139
139
|
|
|
140
|
-
| Path
|
|
141
|
-
|
|
|
142
|
-
| `@haklex/rich-ext-embed`
|
|
143
|
-
| `@haklex/rich-ext-embed/static`
|
|
144
|
-
| `@haklex/rich-ext-embed/style.css` | Stylesheet
|
|
140
|
+
| Path | Description |
|
|
141
|
+
| ---------------------------------- | ------------------------------ |
|
|
142
|
+
| `@haklex/rich-ext-embed` | Full exports (edit + static) |
|
|
143
|
+
| `@haklex/rich-ext-embed/static` | Static-only (no heavy UI deps) |
|
|
144
|
+
| `@haklex/rich-ext-embed/style.css` | Stylesheet |
|
|
145
145
|
|
|
146
146
|
## Part of Haklex
|
|
147
147
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-ext-embed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Embed extension for Twitter, YouTube, etc.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"react": ">=19",
|
|
50
50
|
"react-dom": ">=19",
|
|
51
51
|
"shiki": ">=3",
|
|
52
|
-
"@haklex/rich-editor": "0.
|
|
53
|
-
"@haklex/rich-editor-ui": "0.
|
|
54
|
-
"@haklex/rich-style-token": "0.
|
|
52
|
+
"@haklex/rich-editor": "0.25.0",
|
|
53
|
+
"@haklex/rich-editor-ui": "0.25.0",
|
|
54
|
+
"@haklex/rich-style-token": "0.25.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependenciesMeta": {
|
|
57
57
|
"shiki": {
|