@haklex/rich-ext-embed 0.0.65 → 0.0.66
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 +127 -35
- package/dist/{EmbedLinkRenderer-D0t-8cUk.js → EmbedLinkRenderer-BoIrH3pE.js} +100 -166
- package/dist/index.mjs +3 -10
- package/dist/nodes/EmbedEditNode.d.ts +1 -1
- package/dist/nodes/EmbedEditNode.d.ts.map +1 -1
- package/dist/renderers/EmbedLinkRenderer.d.ts +2 -2
- package/dist/renderers/EmbedLinkRenderer.d.ts.map +1 -1
- package/dist/renderers/EmbedStaticRenderer.d.ts.map +1 -1
- package/dist/rich-ext-embed.css +1 -1
- package/dist/static.mjs +2 -2
- package/dist/styles.css.d.ts +0 -6
- package/dist/styles.css.d.ts.map +1 -1
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -1,60 +1,152 @@
|
|
|
1
1
|
# @haklex/rich-ext-embed
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
URL embed extension supporting Twitter, YouTube, Bilibili, CodeSandbox, and GitHub Gist.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
pnpm add @haklex/rich-ext-embed
|
|
8
|
+
pnpm add @haklex/rich-ext-embed
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Peer Dependencies
|
|
12
|
+
|
|
13
|
+
| Package | Version | Required |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| `@lexical/react` | `^0.41.0` | Yes |
|
|
16
|
+
| `lexical` | `^0.41.0` | Yes |
|
|
17
|
+
| `react` | `>= 19` | Yes |
|
|
18
|
+
| `react-dom` | `>= 19` | Yes |
|
|
19
|
+
| `shiki` | `>= 3` | Optional |
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Register nodes in your editor config
|
|
12
24
|
|
|
13
25
|
```ts
|
|
14
|
-
|
|
15
|
-
export { EmbedNode } from './nodes/EmbedNode'
|
|
16
|
-
export { $createEmbedNode, $isEmbedNode } from './nodes/EmbedNode'
|
|
17
|
-
export type { SerializedEmbedNode } from './nodes/EmbedNode'
|
|
26
|
+
import { embedEditNodes } from '@haklex/rich-ext-embed'
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
const editorConfig = {
|
|
29
|
+
nodes: [...embedEditNodes],
|
|
30
|
+
}
|
|
31
|
+
```
|
|
21
32
|
|
|
22
|
-
|
|
33
|
+
For static/read-only rendering:
|
|
23
34
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export type { EmbedPluginProps } from './EmbedPlugin'
|
|
35
|
+
```ts
|
|
36
|
+
import { embedNodes } from '@haklex/rich-ext-embed/static'
|
|
27
37
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export type { EmbedLinkRendererProps } from './renderers/EmbedLinkRenderer'
|
|
38
|
+
const staticConfig = {
|
|
39
|
+
nodes: [...embedNodes],
|
|
40
|
+
}
|
|
41
|
+
```
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
export { EmbedRendererProvider, useEmbedRenderers } from './context/EmbedRendererContext'
|
|
36
|
-
export type { EmbedRendererComponent, EmbedRendererMap } from './context/EmbedRendererContext'
|
|
43
|
+
### Use the embed plugin
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
} from './url-matchers'
|
|
45
|
+
```tsx
|
|
46
|
+
import { EmbedPlugin } from '@haklex/rich-ext-embed'
|
|
47
|
+
|
|
48
|
+
function EditorPlugins() {
|
|
49
|
+
return <EmbedPlugin />
|
|
50
|
+
}
|
|
45
51
|
```
|
|
46
52
|
|
|
47
|
-
|
|
53
|
+
### Insert embeds programmatically
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { INSERT_EMBED_COMMAND } from '@haklex/rich-ext-embed'
|
|
57
|
+
|
|
58
|
+
editor.dispatchCommand(INSERT_EMBED_COMMAND, { url: 'https://youtube.com/watch?v=...' })
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Use renderers
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { EmbedLinkRenderer } from '@haklex/rich-ext-embed'
|
|
65
|
+
import { EmbedStaticRenderer } from '@haklex/rich-ext-embed/static'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Provide custom embed renderers
|
|
48
69
|
|
|
49
70
|
```tsx
|
|
50
|
-
import {
|
|
51
|
-
|
|
71
|
+
import { EmbedRendererProvider, useEmbedRenderers } from '@haklex/rich-ext-embed'
|
|
72
|
+
|
|
73
|
+
function App() {
|
|
74
|
+
return (
|
|
75
|
+
<EmbedRendererProvider>
|
|
76
|
+
<Editor />
|
|
77
|
+
</EmbedRendererProvider>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### URL matching utilities
|
|
52
83
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
84
|
+
```ts
|
|
85
|
+
import {
|
|
86
|
+
matchEmbedUrl,
|
|
87
|
+
isTweetUrl,
|
|
88
|
+
isYoutubeUrl,
|
|
89
|
+
isBilibiliVideoUrl,
|
|
90
|
+
isCodesandboxUrl,
|
|
91
|
+
isGistUrl,
|
|
92
|
+
isGithubFilePreviewUrl,
|
|
93
|
+
createSelfThinkingMatcher,
|
|
94
|
+
} from '@haklex/rich-ext-embed'
|
|
56
95
|
```
|
|
57
96
|
|
|
97
|
+
### Import styles
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import '@haklex/rich-ext-embed/style.css'
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Exports
|
|
104
|
+
|
|
105
|
+
### Nodes
|
|
106
|
+
|
|
107
|
+
- `EmbedNode` -- static (read-only) node
|
|
108
|
+
- `EmbedEditNode` -- edit node with interactive UI
|
|
109
|
+
- `$createEmbedNode()` / `$isEmbedNode()` -- Lexical helpers
|
|
110
|
+
- `embedNodes` -- array of static nodes for config registration
|
|
111
|
+
- `embedEditNodes` -- array of edit nodes for config registration
|
|
112
|
+
|
|
113
|
+
### Renderers
|
|
114
|
+
|
|
115
|
+
- `EmbedStaticRenderer` -- static renderer
|
|
116
|
+
- `EmbedLinkRenderer` -- link-style embed renderer
|
|
117
|
+
|
|
118
|
+
### Plugin
|
|
119
|
+
|
|
120
|
+
- `EmbedPlugin` -- editor plugin for embed insertion
|
|
121
|
+
- `INSERT_EMBED_COMMAND` -- Lexical command for programmatic insertion
|
|
122
|
+
|
|
123
|
+
### Context
|
|
124
|
+
|
|
125
|
+
- `EmbedRendererProvider` -- context provider for custom embed renderers
|
|
126
|
+
- `useEmbedRenderers` -- hook to access embed renderer context
|
|
127
|
+
|
|
128
|
+
### URL Matchers
|
|
129
|
+
|
|
130
|
+
- `matchEmbedUrl` -- match a URL against all supported embed types
|
|
131
|
+
- `isTweetUrl`, `isYoutubeUrl`, `isBilibiliVideoUrl`, `isCodesandboxUrl`, `isGistUrl`, `isGithubFilePreviewUrl` -- individual URL matchers
|
|
132
|
+
- `createSelfThinkingMatcher` -- factory for custom URL matchers
|
|
133
|
+
|
|
134
|
+
### Types
|
|
135
|
+
|
|
136
|
+
- `EmbedType` -- enum of supported embed types
|
|
137
|
+
|
|
138
|
+
### Sub-path Exports
|
|
139
|
+
|
|
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
|
+
|
|
146
|
+
## Part of Haklex
|
|
147
|
+
|
|
148
|
+
This package is part of the [Haklex](../../README.md) rich editor ecosystem.
|
|
149
|
+
|
|
58
150
|
## License
|
|
59
151
|
|
|
60
152
|
MIT
|
|
@@ -6,8 +6,9 @@ import { createContext, use, lazy, useState, useMemo, useEffect, Suspense, Compo
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { useColorScheme } from "@haklex/rich-editor";
|
|
8
8
|
import { Github, ExternalLink, Trash2 } from "lucide-react";
|
|
9
|
+
import { ActionBar, ActionButton } from "@haklex/rich-editor-ui";
|
|
9
10
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
10
|
-
var semanticClassNames$1 = { wrapper: "rich-embed-link-wrapper", embed: "rich-embed", badge: "rich-embed__badge", dot: "rich-embed__dot", divider: "rich-embed__divider", input: "rich-embed__input"
|
|
11
|
+
var semanticClassNames$1 = { wrapper: "rich-embed-link-wrapper", embed: "rich-embed", badge: "rich-embed__badge", dot: "rich-embed__dot", divider: "rich-embed__divider", input: "rich-embed__input" };
|
|
11
12
|
var semanticEmbedModifierClass = { generic: "rich-embed--generic", tweet: "rich-embed--tweet", youtube: "rich-embed--youtube", codesandbox: "rich-embed--codesandbox", bilibili: "rich-embed--bilibili", "github-file": "rich-embed--github-file", "github-gist": "rich-embed--github-gist", thinking: "rich-embed--thinking" };
|
|
12
13
|
var wrapper = "_1qucygc1";
|
|
13
14
|
var embed = "_1qucygc2";
|
|
@@ -16,9 +17,6 @@ var badge = "_1qucygcb";
|
|
|
16
17
|
var dot = "_1qucygcc";
|
|
17
18
|
var divider = "_1qucygcd";
|
|
18
19
|
var input = "_1qucygce";
|
|
19
|
-
var actions = "_1qucygcf";
|
|
20
|
-
var actionButton = "_1qucygcg";
|
|
21
|
-
var actionButtonDanger = "_1qucygch";
|
|
22
20
|
const EmbedRendererCtx = createContext({});
|
|
23
21
|
const EmbedRendererProvider = EmbedRendererCtx.Provider;
|
|
24
22
|
function useEmbedRenderers() {
|
|
@@ -95,17 +93,15 @@ function getLangFromPath(path) {
|
|
|
95
93
|
}
|
|
96
94
|
const shikiPromise = import("shiki/bundle/web").catch(() => null);
|
|
97
95
|
const typeLabels$1 = {
|
|
98
|
-
tweet: "X / Twitter",
|
|
99
|
-
youtube: "YouTube",
|
|
100
|
-
codesandbox: "CodeSandbox",
|
|
101
|
-
bilibili: "Bilibili",
|
|
96
|
+
"tweet": "X / Twitter",
|
|
97
|
+
"youtube": "YouTube",
|
|
98
|
+
"codesandbox": "CodeSandbox",
|
|
99
|
+
"bilibili": "Bilibili",
|
|
102
100
|
"github-file": "GitHub File",
|
|
103
101
|
"github-gist": "GitHub Gist",
|
|
104
|
-
thinking: "Thinking"
|
|
102
|
+
"thinking": "Thinking"
|
|
105
103
|
};
|
|
106
|
-
const LazyTweet = lazy(
|
|
107
|
-
() => import("react-tweet").then((mod) => ({ default: mod.IsolatedTweet }))
|
|
108
|
-
);
|
|
104
|
+
const LazyTweet = lazy(() => import("react-tweet").then((mod) => ({ default: mod.IsolatedTweet })));
|
|
109
105
|
class EmbedErrorBoundary extends Component {
|
|
110
106
|
constructor() {
|
|
111
107
|
super(...arguments);
|
|
@@ -125,20 +121,14 @@ function FixedRatioContainer({
|
|
|
125
121
|
children,
|
|
126
122
|
ratio = 58
|
|
127
123
|
}) {
|
|
128
|
-
return /* @__PURE__ */ jsx(
|
|
124
|
+
return /* @__PURE__ */ jsx("div", { className: `${ratioContainer} ${semanticClassNames.ratioContainer}`, children: /* @__PURE__ */ jsx(
|
|
129
125
|
"div",
|
|
130
126
|
{
|
|
131
|
-
className: `${
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
{
|
|
135
|
-
className: `${ratioInner} ${semanticClassNames.ratioInner}`,
|
|
136
|
-
style: { paddingBottom: `${ratio}%` },
|
|
137
|
-
children
|
|
138
|
-
}
|
|
139
|
-
)
|
|
127
|
+
className: `${ratioInner} ${semanticClassNames.ratioInner}`,
|
|
128
|
+
style: { paddingBottom: `${ratio}%` },
|
|
129
|
+
children
|
|
140
130
|
}
|
|
141
|
-
);
|
|
131
|
+
) });
|
|
142
132
|
}
|
|
143
133
|
function FallbackLink({ url, type }) {
|
|
144
134
|
const label = type ? typeLabels$1[type] : "Embed";
|
|
@@ -150,28 +140,17 @@ function FallbackLink({ url, type }) {
|
|
|
150
140
|
{
|
|
151
141
|
className: `${fallback} ${fallbackTypeClass} ${semanticClassNames.fallback} ${semanticModifierClass}`.trim(),
|
|
152
142
|
children: [
|
|
153
|
-
/* @__PURE__ */ jsxs(
|
|
154
|
-
"span",
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
children: [
|
|
158
|
-
/* @__PURE__ */ jsx(
|
|
159
|
-
"span",
|
|
160
|
-
{
|
|
161
|
-
className: `${fallbackDot} ${semanticClassNames.fallbackDot}`
|
|
162
|
-
}
|
|
163
|
-
),
|
|
164
|
-
label
|
|
165
|
-
]
|
|
166
|
-
}
|
|
167
|
-
),
|
|
143
|
+
/* @__PURE__ */ jsxs("span", { className: `${fallbackBadge} ${semanticClassNames.fallbackBadge}`, children: [
|
|
144
|
+
/* @__PURE__ */ jsx("span", { className: `${fallbackDot} ${semanticClassNames.fallbackDot}` }),
|
|
145
|
+
label
|
|
146
|
+
] }),
|
|
168
147
|
/* @__PURE__ */ jsx(
|
|
169
148
|
"a",
|
|
170
149
|
{
|
|
171
150
|
className: `${fallbackLink} ${semanticClassNames.fallbackLink}`,
|
|
172
151
|
href: url,
|
|
173
|
-
target: "_blank",
|
|
174
152
|
rel: "noreferrer",
|
|
153
|
+
target: "_blank",
|
|
175
154
|
children: url
|
|
176
155
|
}
|
|
177
156
|
)
|
|
@@ -181,31 +160,25 @@ function FallbackLink({ url, type }) {
|
|
|
181
160
|
}
|
|
182
161
|
function TweetRenderer({ url }) {
|
|
183
162
|
const colorScheme = useColorScheme();
|
|
184
|
-
let parsedUrl
|
|
163
|
+
let parsedUrl;
|
|
185
164
|
try {
|
|
186
165
|
parsedUrl = new URL(url);
|
|
187
166
|
} catch {
|
|
188
|
-
return /* @__PURE__ */ jsx(FallbackLink, {
|
|
167
|
+
return /* @__PURE__ */ jsx(FallbackLink, { type: "tweet", url });
|
|
189
168
|
}
|
|
190
169
|
const id = parsedUrl.pathname.split("/").pop();
|
|
191
|
-
if (!id) return /* @__PURE__ */ jsx(FallbackLink, {
|
|
192
|
-
const fallback2 = /* @__PURE__ */ jsx(FallbackLink, {
|
|
170
|
+
if (!id) return /* @__PURE__ */ jsx(FallbackLink, { type: "tweet", url });
|
|
171
|
+
const fallback2 = /* @__PURE__ */ jsx(FallbackLink, { type: "tweet", url });
|
|
193
172
|
return /* @__PURE__ */ jsx(EmbedErrorBoundary, { fallback: fallback2, children: /* @__PURE__ */ jsx("div", { className: `${tweet} ${semanticClassNames.tweet}`, children: /* @__PURE__ */ jsx(
|
|
194
173
|
Suspense,
|
|
195
174
|
{
|
|
196
|
-
fallback: /* @__PURE__ */ jsx(
|
|
197
|
-
"div",
|
|
198
|
-
{
|
|
199
|
-
className: `${loading} ${semanticClassNames.loading}`,
|
|
200
|
-
children: "Loading tweet..."
|
|
201
|
-
}
|
|
202
|
-
),
|
|
175
|
+
fallback: /* @__PURE__ */ jsx("div", { className: `${loading} ${semanticClassNames.loading}`, children: "Loading tweet..." }),
|
|
203
176
|
children: /* @__PURE__ */ jsx(
|
|
204
177
|
LazyTweet,
|
|
205
178
|
{
|
|
206
179
|
id,
|
|
207
|
-
|
|
208
|
-
|
|
180
|
+
style: { width: "100%" },
|
|
181
|
+
theme: colorScheme === "dark" ? "dark" : "light"
|
|
209
182
|
}
|
|
210
183
|
)
|
|
211
184
|
}
|
|
@@ -282,76 +255,70 @@ function GithubFileEmbed({ url, href }) {
|
|
|
282
255
|
return /* @__PURE__ */ jsx("div", { className: `${loading} ${semanticClassNames.loading}`, children: "Loading GitHub File Preview..." });
|
|
283
256
|
}
|
|
284
257
|
if (error || content === null) {
|
|
285
|
-
return /* @__PURE__ */ jsx(FallbackLink, {
|
|
258
|
+
return /* @__PURE__ */ jsx(FallbackLink, { type: "github-file", url: href });
|
|
286
259
|
}
|
|
287
260
|
const lines = content.split("\n");
|
|
288
261
|
const end = endLine ?? lines.length;
|
|
289
262
|
const isLong = end - startLine > 20;
|
|
290
|
-
return /* @__PURE__ */ jsxs(
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
/* @__PURE__ */ jsx(
|
|
263
|
+
return /* @__PURE__ */ jsxs("div", { className: `${githubFile} ${semanticClassNames.githubFile}`, children: [
|
|
264
|
+
/* @__PURE__ */ jsx(
|
|
265
|
+
"div",
|
|
266
|
+
{
|
|
267
|
+
className: `${githubFileCode} ${semanticClassNames.githubFileCode} ${isLong ? `${githubFileCodeLong} ${semanticClassNames.githubFileCodeLong}` : ""}`.trim(),
|
|
268
|
+
children: highlightedHtml ? /* @__PURE__ */ jsx(
|
|
296
269
|
"div",
|
|
297
270
|
{
|
|
298
|
-
className: `${
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
{
|
|
302
|
-
className: `${shiki} ${semanticClassNames.shiki}`,
|
|
303
|
-
style: { "--start-line": startLine },
|
|
304
|
-
dangerouslySetInnerHTML: { __html: highlightedHtml }
|
|
305
|
-
}
|
|
306
|
-
) : /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: lines.slice(startLine, end).map((line, i) => /* @__PURE__ */ jsxs(
|
|
307
|
-
"span",
|
|
308
|
-
{
|
|
309
|
-
className: `${githubFileLine} ${semanticClassNames.githubFileLine}`,
|
|
310
|
-
children: [
|
|
311
|
-
/* @__PURE__ */ jsx(
|
|
312
|
-
"span",
|
|
313
|
-
{
|
|
314
|
-
className: `${githubFileLineNum} ${semanticClassNames.githubFileLineNum}`,
|
|
315
|
-
children: startLine + i + 1
|
|
316
|
-
}
|
|
317
|
-
),
|
|
318
|
-
line,
|
|
319
|
-
"\n"
|
|
320
|
-
]
|
|
321
|
-
},
|
|
322
|
-
i
|
|
323
|
-
)) }) })
|
|
271
|
+
className: `${shiki} ${semanticClassNames.shiki}`,
|
|
272
|
+
dangerouslySetInnerHTML: { __html: highlightedHtml },
|
|
273
|
+
style: { "--start-line": startLine }
|
|
324
274
|
}
|
|
325
|
-
),
|
|
326
|
-
|
|
327
|
-
"a",
|
|
275
|
+
) : /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: lines.slice(startLine, end).map((line, i) => /* @__PURE__ */ jsxs(
|
|
276
|
+
"span",
|
|
328
277
|
{
|
|
329
|
-
className: `${
|
|
330
|
-
href,
|
|
331
|
-
target: "_blank",
|
|
332
|
-
rel: "noreferrer",
|
|
278
|
+
className: `${githubFileLine} ${semanticClassNames.githubFileLine}`,
|
|
333
279
|
children: [
|
|
334
|
-
/* @__PURE__ */ jsx(
|
|
335
|
-
|
|
280
|
+
/* @__PURE__ */ jsx(
|
|
281
|
+
"span",
|
|
282
|
+
{
|
|
283
|
+
className: `${githubFileLineNum} ${semanticClassNames.githubFileLineNum}`,
|
|
284
|
+
children: startLine + i + 1
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
line,
|
|
288
|
+
"\n"
|
|
336
289
|
]
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
290
|
+
},
|
|
291
|
+
i
|
|
292
|
+
)) }) })
|
|
293
|
+
}
|
|
294
|
+
),
|
|
295
|
+
/* @__PURE__ */ jsxs(
|
|
296
|
+
"a",
|
|
297
|
+
{
|
|
298
|
+
className: `${sourceLink} ${semanticClassNames.sourceLink}`,
|
|
299
|
+
href,
|
|
300
|
+
rel: "noreferrer",
|
|
301
|
+
target: "_blank",
|
|
302
|
+
children: [
|
|
303
|
+
/* @__PURE__ */ jsx(GitHubSvg, {}),
|
|
304
|
+
/* @__PURE__ */ jsx("span", { children: href })
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
] });
|
|
342
309
|
}
|
|
343
310
|
function EmbedStaticRenderer({ type, url }) {
|
|
344
311
|
const customRenderers = useEmbedRenderers();
|
|
345
312
|
if (!url) return null;
|
|
346
313
|
if (type && customRenderers[type]) {
|
|
347
314
|
const Custom = customRenderers[type];
|
|
348
|
-
return /* @__PURE__ */ jsx(Custom, {
|
|
315
|
+
return /* @__PURE__ */ jsx(Custom, { type, url });
|
|
349
316
|
}
|
|
350
|
-
let parsedUrl
|
|
317
|
+
let parsedUrl;
|
|
351
318
|
try {
|
|
352
319
|
parsedUrl = new URL(url);
|
|
353
320
|
} catch {
|
|
354
|
-
return /* @__PURE__ */ jsx(FallbackLink, {
|
|
321
|
+
return /* @__PURE__ */ jsx(FallbackLink, { type, url });
|
|
355
322
|
}
|
|
356
323
|
switch (type) {
|
|
357
324
|
case "tweet": {
|
|
@@ -359,28 +326,28 @@ function EmbedStaticRenderer({ type, url }) {
|
|
|
359
326
|
}
|
|
360
327
|
case "youtube": {
|
|
361
328
|
const id = parsedUrl.searchParams.get("v");
|
|
362
|
-
if (!id) return /* @__PURE__ */ jsx(FallbackLink, {
|
|
329
|
+
if (!id) return /* @__PURE__ */ jsx(FallbackLink, { type, url });
|
|
363
330
|
return /* @__PURE__ */ jsx(FixedRatioContainer, { children: /* @__PURE__ */ jsx(
|
|
364
331
|
"iframe",
|
|
365
332
|
{
|
|
366
|
-
src: `https://www.youtube.com/embed/${id}`,
|
|
367
|
-
className: `${iframe} ${semanticClassNames.iframe}`,
|
|
368
|
-
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
369
333
|
allowFullScreen: true,
|
|
334
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
335
|
+
className: `${iframe} ${semanticClassNames.iframe}`,
|
|
336
|
+
src: `https://www.youtube.com/embed/${id}`,
|
|
370
337
|
title: "YouTube video player"
|
|
371
338
|
}
|
|
372
339
|
) });
|
|
373
340
|
}
|
|
374
341
|
case "bilibili": {
|
|
375
342
|
const id = parsedUrl.pathname.split("/")[2];
|
|
376
|
-
if (!id) return /* @__PURE__ */ jsx(FallbackLink, {
|
|
343
|
+
if (!id) return /* @__PURE__ */ jsx(FallbackLink, { type, url });
|
|
377
344
|
return /* @__PURE__ */ jsx(FixedRatioContainer, { children: /* @__PURE__ */ jsx(
|
|
378
345
|
"iframe",
|
|
379
346
|
{
|
|
380
|
-
|
|
381
|
-
scrolling: "no",
|
|
347
|
+
allowFullScreen: true,
|
|
382
348
|
className: `${iframe} ${semanticClassNames.iframe}`,
|
|
383
|
-
|
|
349
|
+
scrolling: "no",
|
|
350
|
+
src: `//player.bilibili.com/player.html?bvid=${id}&autoplay=0`
|
|
384
351
|
}
|
|
385
352
|
) });
|
|
386
353
|
}
|
|
@@ -396,13 +363,13 @@ function EmbedStaticRenderer({ type, url }) {
|
|
|
396
363
|
}
|
|
397
364
|
case "github-gist": {
|
|
398
365
|
const [, owner, id] = parsedUrl.pathname.split("/");
|
|
399
|
-
if (!owner || !id) return /* @__PURE__ */ jsx(FallbackLink, {
|
|
366
|
+
if (!owner || !id) return /* @__PURE__ */ jsx(FallbackLink, { type, url });
|
|
400
367
|
return /* @__PURE__ */ jsxs("div", { className: `${gist} ${semanticClassNames.gist}`, children: [
|
|
401
368
|
/* @__PURE__ */ jsx(
|
|
402
369
|
"iframe",
|
|
403
370
|
{
|
|
404
|
-
|
|
405
|
-
|
|
371
|
+
className: `${gistIframe} ${semanticClassNames.gistIframe}`,
|
|
372
|
+
src: `https://gist.github.com/${owner}/${id}.pibb`
|
|
406
373
|
}
|
|
407
374
|
),
|
|
408
375
|
/* @__PURE__ */ jsxs(
|
|
@@ -410,8 +377,8 @@ function EmbedStaticRenderer({ type, url }) {
|
|
|
410
377
|
{
|
|
411
378
|
className: `${sourceLink} ${semanticClassNames.sourceLink}`,
|
|
412
379
|
href: url,
|
|
413
|
-
target: "_blank",
|
|
414
380
|
rel: "noreferrer",
|
|
381
|
+
target: "_blank",
|
|
415
382
|
children: [
|
|
416
383
|
/* @__PURE__ */ jsx(GitHubSvg, {}),
|
|
417
384
|
/* @__PURE__ */ jsx("span", { children: url })
|
|
@@ -421,10 +388,11 @@ function EmbedStaticRenderer({ type, url }) {
|
|
|
421
388
|
] });
|
|
422
389
|
}
|
|
423
390
|
case "github-file": {
|
|
424
|
-
return /* @__PURE__ */ jsx(GithubFileEmbed, {
|
|
391
|
+
return /* @__PURE__ */ jsx(GithubFileEmbed, { href: url, url: parsedUrl });
|
|
392
|
+
}
|
|
393
|
+
default: {
|
|
394
|
+
return /* @__PURE__ */ jsx(FallbackLink, { type, url });
|
|
425
395
|
}
|
|
426
|
-
default:
|
|
427
|
-
return /* @__PURE__ */ jsx(FallbackLink, { url, type });
|
|
428
396
|
}
|
|
429
397
|
}
|
|
430
398
|
class EmbedNode extends DecoratorNode {
|
|
@@ -514,19 +482,15 @@ function matchEmbedUrl(url, selfThinkingMatcher) {
|
|
|
514
482
|
return null;
|
|
515
483
|
}
|
|
516
484
|
const typeLabels = {
|
|
517
|
-
tweet: "X / Twitter",
|
|
518
|
-
youtube: "YouTube",
|
|
519
|
-
codesandbox: "CodeSandbox",
|
|
520
|
-
bilibili: "Bilibili",
|
|
485
|
+
"tweet": "X / Twitter",
|
|
486
|
+
"youtube": "YouTube",
|
|
487
|
+
"codesandbox": "CodeSandbox",
|
|
488
|
+
"bilibili": "Bilibili",
|
|
521
489
|
"github-file": "GitHub File",
|
|
522
490
|
"github-gist": "GitHub Gist",
|
|
523
|
-
thinking: "Thinking"
|
|
491
|
+
"thinking": "Thinking"
|
|
524
492
|
};
|
|
525
|
-
function EmbedLinkRenderer({
|
|
526
|
-
type,
|
|
527
|
-
url,
|
|
528
|
-
nodeKey
|
|
529
|
-
}) {
|
|
493
|
+
function EmbedLinkRenderer({ type, url, nodeKey }) {
|
|
530
494
|
const [editor] = useLexicalComposerContext();
|
|
531
495
|
const [editUrl, setEditUrl] = useState(url);
|
|
532
496
|
const inputRef = useRef(null);
|
|
@@ -593,54 +557,24 @@ function EmbedLinkRenderer({
|
|
|
593
557
|
/* @__PURE__ */ jsx("span", { className: `${dot} ${semanticClassNames$1.dot}` }),
|
|
594
558
|
label
|
|
595
559
|
] }),
|
|
596
|
-
/* @__PURE__ */ jsx(
|
|
597
|
-
"span",
|
|
598
|
-
{
|
|
599
|
-
className: `${divider} ${semanticClassNames$1.divider}`
|
|
600
|
-
}
|
|
601
|
-
),
|
|
560
|
+
/* @__PURE__ */ jsx("span", { className: `${divider} ${semanticClassNames$1.divider}` }),
|
|
602
561
|
/* @__PURE__ */ jsx(
|
|
603
562
|
"input",
|
|
604
563
|
{
|
|
605
|
-
ref: inputRef,
|
|
606
564
|
className: `${input} ${semanticClassNames$1.input}`,
|
|
565
|
+
placeholder: "https://...",
|
|
566
|
+
ref: inputRef,
|
|
607
567
|
type: "url",
|
|
608
568
|
value: editUrl,
|
|
609
|
-
onChange: (e) => setEditUrl(e.target.value),
|
|
610
569
|
onBlur: commitUrl,
|
|
611
|
-
|
|
612
|
-
|
|
570
|
+
onChange: (e) => setEditUrl(e.target.value),
|
|
571
|
+
onKeyDown: handleKeyDown
|
|
613
572
|
}
|
|
614
573
|
),
|
|
615
|
-
/* @__PURE__ */ jsxs(
|
|
616
|
-
"
|
|
617
|
-
{
|
|
618
|
-
|
|
619
|
-
children: [
|
|
620
|
-
/* @__PURE__ */ jsx(
|
|
621
|
-
"button",
|
|
622
|
-
{
|
|
623
|
-
type: "button",
|
|
624
|
-
className: `${actionButton} ${semanticClassNames$1.actionButton}`,
|
|
625
|
-
onClick: handleOpen,
|
|
626
|
-
title: "Open in new tab",
|
|
627
|
-
disabled: !url,
|
|
628
|
-
children: /* @__PURE__ */ jsx(ExternalLink, {})
|
|
629
|
-
}
|
|
630
|
-
),
|
|
631
|
-
/* @__PURE__ */ jsx(
|
|
632
|
-
"button",
|
|
633
|
-
{
|
|
634
|
-
type: "button",
|
|
635
|
-
className: `${actionButton} ${semanticClassNames$1.actionButton} ${actionButtonDanger} ${semanticClassNames$1.actionButtonDanger}`,
|
|
636
|
-
onClick: handleDelete,
|
|
637
|
-
title: "Delete",
|
|
638
|
-
children: /* @__PURE__ */ jsx(Trash2, {})
|
|
639
|
-
}
|
|
640
|
-
)
|
|
641
|
-
]
|
|
642
|
-
}
|
|
643
|
-
)
|
|
574
|
+
/* @__PURE__ */ jsxs(ActionBar, { children: [
|
|
575
|
+
/* @__PURE__ */ jsx(ActionButton, { icon: true, disabled: !url, size: "md", title: "Open in new tab", onClick: handleOpen, children: /* @__PURE__ */ jsx(ExternalLink, {}) }),
|
|
576
|
+
/* @__PURE__ */ jsx(ActionButton, { danger: true, icon: true, size: "md", title: "Delete", onClick: handleDelete, children: /* @__PURE__ */ jsx(Trash2, {}) })
|
|
577
|
+
] })
|
|
644
578
|
]
|
|
645
579
|
}
|
|
646
580
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { E as EmbedNode, a as EmbedLinkRenderer, c as createSelfThinkingMatcher, m as matchEmbedUrl } from "./EmbedLinkRenderer-
|
|
5
|
-
import { $, b, d, e, i, f, g, h, j, k, u } from "./EmbedLinkRenderer-
|
|
4
|
+
import { E as EmbedNode, a as EmbedLinkRenderer, c as createSelfThinkingMatcher, m as matchEmbedUrl } from "./EmbedLinkRenderer-BoIrH3pE.js";
|
|
5
|
+
import { $, b, d, e, i, f, g, h, j, k, u } from "./EmbedLinkRenderer-BoIrH3pE.js";
|
|
6
6
|
import { $insertNodes, createCommand, PASTE_COMMAND, COMMAND_PRIORITY_LOW } from "lexical";
|
|
7
7
|
import { Code } from "lucide-react";
|
|
8
8
|
import { createElement, useMemo, useEffect } from "react";
|
|
@@ -27,14 +27,7 @@ __publicField(_EmbedEditNode, "commandItems", [
|
|
|
27
27
|
title: "Embed",
|
|
28
28
|
icon: createElement(Code, { size: 20 }),
|
|
29
29
|
description: "Embed external content (Tweet, YouTube, Bilibili, etc.)",
|
|
30
|
-
keywords: [
|
|
31
|
-
"embed",
|
|
32
|
-
"tweet",
|
|
33
|
-
"youtube",
|
|
34
|
-
"bilibili",
|
|
35
|
-
"codesandbox",
|
|
36
|
-
"thinking"
|
|
37
|
-
],
|
|
30
|
+
keywords: ["embed", "tweet", "youtube", "bilibili", "codesandbox", "thinking"],
|
|
38
31
|
section: "EMBED",
|
|
39
32
|
placement: ["slash", "toolbar"],
|
|
40
33
|
group: "insert",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandItemConfig } from '@haklex/rich-editor';
|
|
1
|
+
import { CommandItemConfig } from '@haklex/rich-editor/commands';
|
|
2
2
|
import { EditorConfig, LexicalEditor, LexicalNode } from 'lexical';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
4
|
import { EmbedType } from '../url-matchers';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbedEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/EmbedEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"EmbedEditNode.d.ts","sourceRoot":"","sources":["../../src/nodes/EmbedEditNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElE,qBAAa,aAAc,SAAQ,SAAS;IAC1C,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,CAetC;IAEF,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,GAAG,aAAa;IAIhD,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,mBAAmB,GAAG,aAAa;IAIrE,QAAQ,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY;CAOtE;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,GAAG,aAAa,CAEzF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,aAAa,CAE5F"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EmbedType } from '../url-matchers';
|
|
2
2
|
export interface EmbedLinkRendererProps {
|
|
3
|
+
nodeKey: string;
|
|
3
4
|
type: EmbedType | null;
|
|
4
5
|
url: string;
|
|
5
|
-
nodeKey: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function EmbedLinkRenderer({ type, url, nodeKey
|
|
7
|
+
export declare function EmbedLinkRenderer({ type, url, nodeKey }: EmbedLinkRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
//# sourceMappingURL=EmbedLinkRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbedLinkRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/EmbedLinkRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,
|
|
1
|
+
{"version":3,"file":"EmbedLinkRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/EmbedLinkRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAS1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AASjD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AAYD,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,sBAAsB,2CAgG/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbedStaticRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/EmbedStaticRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,
|
|
1
|
+
{"version":3,"file":"EmbedStaticRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/EmbedStaticRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAS1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAuDjD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACb;AAsQD,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,wBAAwB,kDAgG1E"}
|
package/dist/rich-ext-embed.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}:root.dark{--rc-text: #fafafa;--rc-text-secondary: #a1a1aa;--rc-text-tertiary: #71717a;--rc-text-quaternary: #52525b;--rc-bg: #09090b;--rc-bg-secondary: #18181b;--rc-bg-tertiary: #27272a;--rc-fill: #2a2a2f;--rc-fill-secondary: #222226;--rc-fill-tertiary: #1b1b1f;--rc-fill-quaternary: #131316;--rc-border: #27272a;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #e4e4e7;--rc-code-bg: #27272a;--rc-hr-border: #27272a;--rc-quote-border: #60a5fa;--rc-quote-bg: #1e3a5f;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1cz4fjc0{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1cz4fjc1{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.8;--rc-line-height-tight: 1.4;--rc-font-family: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1cz4fjc2{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #a1a1aa;--rc-quote-bg: #fafafa;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: none;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 2px;--rc-space-sm: 4px;--rc-space-md: 10px;--rc-space-lg: 16px;--rc-space-xl: 20px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 14px;--rc-font-size-small: 12px;--rc-line-height: 1.5;--rc-line-height-tight: 1.3;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 3px;--rc-radius-md: 6px;--rc-radius-lg: 8px}.dark ._1cz4fjc0,[data-theme=dark] ._1cz4fjc0,.dark._1cz4fjc0,[data-theme=dark]._1cz4fjc0,.dark ._1cz4fjc1,[data-theme=dark] ._1cz4fjc1,.dark._1cz4fjc1,[data-theme=dark]._1cz4fjc1,.dark ._1cz4fjc2,[data-theme=dark] ._1cz4fjc2,.dark._1cz4fjc2,[data-theme=dark]._1cz4fjc2{--rc-text: #fafafa;--rc-text-secondary: #a1a1aa;--rc-text-tertiary: #71717a;--rc-text-quaternary: #52525b;--rc-bg: #09090b;--rc-bg-secondary: #18181b;--rc-bg-tertiary: #27272a;--rc-fill: #2a2a2f;--rc-fill-secondary: #222226;--rc-fill-tertiary: #1b1b1f;--rc-fill-quaternary: #131316;--rc-border: #27272a;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #e4e4e7;--rc-code-bg: #27272a;--rc-hr-border: #27272a;--rc-quote-border: #60a5fa;--rc-quote-bg: #1e3a5f;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4)}._1qucygc1{margin:8px 0}._1qucygc2{--_1qucygc0: 115, 115, 115;display:flex;align-items:center;gap:0;padding:0 14px;height:48px;border:1px solid color-mix(in srgb,rgb(var(--_1qucygc0)) 25%,transparent);border-radius:12px;background-color:color-mix(in srgb,rgb(var(--_1qucygc0)) 12%,transparent);font-family:var(--rc-font-family);font-size:var(--rc-font-size-md);transition:border-color .15s ease,background-color .15s ease}._1qucygc2:focus-within{border-color:color-mix(in srgb,rgb(var(--_1qucygc0)) 50%,transparent)}._1qucygc4{--_1qucygc0: 29, 155, 240}._1qucygc5{--_1qucygc0: 255, 0, 0}._1qucygc6{--_1qucygc0: 163, 163, 163}._1qucygc7{--_1qucygc0: 0, 161, 214}._1qucygc8,._1qucygc9{--_1qucygc0: 110, 84, 148}._1qucygca{--_1qucygc0: 139, 92, 246}._1qucygcb{display:inline-flex;align-items:center;gap:8px;flex-shrink:0;font-weight:500;font-size:var(--rc-font-size-md);color:var(--rc-text-secondary);white-space:nowrap;user-select:none;padding-right:14px;font-family:var(--rc-font-family-sans)}._1qucygcc{width:8px;height:8px;border-radius:50%;flex-shrink:0;background-color:rgb(var(--_1qucygc0))}._1qucygcd{width:1px;height:20px;background-color:var(--rc-border);flex-shrink:0}._1qucygce{flex:1;min-width:0;height:100%;font-size:var(--rc-font-size-md);font-family:var(--rc-font-mono);color:var(--rc-text);background:transparent;border:none;padding:0 14px;outline:none}._1qucygce::placeholder{color:color-mix(in srgb,var(--rc-text-secondary) 60%,transparent)}._1qucygcf{display:flex;align-items:center;gap:2px;flex-shrink:0}._1qucygcg{display:inline-flex;align-items:center;justify-content:center;appearance:none;border:none;background:none;color:var(--rc-text-secondary);cursor:pointer;padding:6px;border-radius:6px;transition:color .15s ease,background-color .15s ease}._1qucygcg:hover{color:var(--rc-text);background-color:color-mix(in srgb,var(--rc-text) 8%,transparent)}._1qucygcg:disabled{opacity:.3;cursor:default}._1qucygcg:disabled:hover{background:none;color:var(--rc-text-secondary)}._1qucygch:hover{color:var(--rc-alert-caution);background-color:color-mix(in srgb,var(--rc-alert-caution) 10%,transparent)}._1qucygcg svg{width:16px;height:16px}._1xclnej1{margin:8px 0;display:flex;justify-content:center}._1xclnej2{position:relative;height:0;width:100%}._1xclnej3{position:absolute;inset:0;width:100%;height:100%;border:none;border-radius:8px}._1xclnej4{display:flex;flex-direction:column;align-items:center}._1xclnej5{width:100%;height:300px;border:none;overflow:auto}._1xclnej6{display:inline-flex;align-items:flex-start;gap:8px;margin-top:8px;color:var(--rc-text-secondary);font-size:var(--rc-font-size-md);line-height:1.4;text-decoration:none;word-break:break-all}._1xclnej6:hover{color:var(--rc-text)}._1xclnej6 svg{flex-shrink:0;margin-top:2px}._1xclnej7{display:flex;flex-direction:column;align-items:center;width:100%}._1xclnej8{width:100%;overflow:auto}._1xclnej9{max-height:50vh}._1xclnej8 pre{margin:0;padding:16px;background:var(--rc-code-bg);border-radius:8px;font-size:var(--rc-font-size-sm);line-height:1.5;font-family:var(--rc-font-mono);color:var(--rc-text)}._1xclneja{display:block}._1xclnejb{display:inline-block;width:4ch;text-align:right;margin-right:16px;color:color-mix(in srgb,var(--rc-text-secondary) 60%,transparent);user-select:none}._1xclnejc{counter-reset:shiki-line var(--start-line, 0)}._1xclnejc pre{margin:0;padding:16px;border-radius:8px;font-size:var(--rc-font-size-sm);line-height:1.5;font-family:var(--rc-font-mono);overflow-x:auto}._1xclnejc code{font-family:inherit;display:flex;flex-direction:column}._1xclnejc .line{display:flex;line-height:1.5}._1xclnejc .line:before{content:counter(shiki-line);counter-increment:shiki-line;flex-shrink:0;width:4ch;text-align:right;margin-right:16px;color:color-mix(in srgb,var(--rc-text-secondary) 60%,transparent);user-select:none}._1xclnejd{--_1xclnej0: 115, 115, 115;display:flex;align-items:center;gap:0;padding:0 14px;height:48px;border:1px solid color-mix(in srgb,rgb(var(--_1xclnej0)) 25%,transparent);border-radius:12px;background-color:color-mix(in srgb,rgb(var(--_1xclnej0)) 8%,transparent);font-family:var(--rc-font-family);font-size:var(--rc-font-size-md);margin:8px 0}._1xclnejf{--_1xclnej0: 29, 155, 240}._1xclnejg{--_1xclnej0: 255, 0, 0}._1xclnejh{--_1xclnej0: 163, 163, 163}._1xclneji{--_1xclnej0: 0, 161, 214}._1xclnejj,._1xclnejk{--_1xclnej0: 110, 84, 148}._1xclnejl{--_1xclnej0: 139, 92, 246}._1xclnejm{display:inline-flex;align-items:center;gap:8px;flex-shrink:0;font-weight:500;font-size:var(--rc-font-size-md);color:var(--rc-text-secondary);white-space:nowrap;user-select:none;padding-right:14px}._1xclnejn{width:8px;height:8px;border-radius:50%;flex-shrink:0;background-color:rgb(var(--_1xclnej0))}._1xclnejo{flex:1;min-width:0;font-size:var(--rc-font-size-md);font-family:var(--rc-font-mono);color:var(--rc-text-secondary);text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._1xclnejo:hover{color:var(--rc-text);text-decoration:underline}._1xclnejp{display:flex;justify-content:center;margin:8px 0;width:100%}._1xclnejq{display:flex;align-items:center;justify-content:center;height:200px;color:var(--rc-text-secondary);font-size:var(--rc-font-size-md)}
|
|
1
|
+
:root{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}:root.dark{--rc-text: #fafafa;--rc-text-secondary: #a1a1aa;--rc-text-tertiary: #71717a;--rc-text-quaternary: #52525b;--rc-bg: #09090b;--rc-bg-secondary: #18181b;--rc-bg-tertiary: #27272a;--rc-fill: #2a2a2f;--rc-fill-secondary: #222226;--rc-fill-tertiary: #1b1b1f;--rc-fill-quaternary: #131316;--rc-border: #27272a;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #e4e4e7;--rc-code-bg: #27272a;--rc-hr-border: #27272a;--rc-quote-border: #60a5fa;--rc-quote-bg: #1e3a5f;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1cz4fjc0{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.7;--rc-line-height-tight: 1.4;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1cz4fjc1{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #2563eb;--rc-quote-bg: #eff6ff;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: 700px;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 4px;--rc-space-sm: 8px;--rc-space-md: 16px;--rc-space-lg: 24px;--rc-space-xl: 32px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 16px;--rc-font-size-small: 14px;--rc-line-height: 1.8;--rc-line-height-tight: 1.4;--rc-font-family: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-radius-sm: 4px;--rc-radius-md: 8px;--rc-radius-lg: 12px}._1cz4fjc2{--rc-text: #000;--rc-text-secondary: #27272a;--rc-text-tertiary: #71717a;--rc-text-quaternary: #a1a1aa;--rc-bg: #ffffff;--rc-bg-secondary: #fafafa;--rc-bg-tertiary: #f4f4f5;--rc-fill: #e8e8ec;--rc-fill-secondary: #eeeeef;--rc-fill-tertiary: #f4f4f6;--rc-fill-quaternary: #f9f9fa;--rc-border: #f4f4f5;--rc-accent: #2563eb;--rc-accent-light: #2563eb20;--rc-link: #2563eb;--rc-code-text: #3f3f46;--rc-code-bg: #f4f4f5;--rc-hr-border: #e4e4e7;--rc-quote-border: #a1a1aa;--rc-quote-bg: #fafafa;--rc-alert-info: #006bb7;--rc-alert-warning: #cc5500;--rc-alert-tip: #11cc00;--rc-alert-caution: #cc0011;--rc-alert-important: #5500cc;--rc-max-width: none;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.08);--rc-space-xs: 2px;--rc-space-sm: 4px;--rc-space-md: 10px;--rc-space-lg: 16px;--rc-space-xl: 20px;--rc-font-family-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-font-family-serif: "Noto Serif CJK SC", "Source Han Serif SC", "Source Han Serif", "source-han-serif-sc", "Songti SC", STSong, "华文宋体", serif;--rc-font-mono: "SF Mono", SFMono-Regular, ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;--rc-font-size-2xs: .625em;--rc-font-size-xs: .75em;--rc-font-size-sm: .8125em;--rc-font-size-md: .875em;--rc-font-size-lg: 1.25em;--rc-font-size-base: 14px;--rc-font-size-small: 12px;--rc-line-height: 1.5;--rc-line-height-tight: 1.3;--rc-font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Helvetica, "noto sans sc", "hiragino sans gb", -apple-system, system-ui, sans-serif, Apple Color Emoji, Segoe UI Emoji, Not Color Emoji;--rc-radius-sm: 3px;--rc-radius-md: 6px;--rc-radius-lg: 8px}.dark ._1cz4fjc0,[data-theme=dark] ._1cz4fjc0,.dark._1cz4fjc0,[data-theme=dark]._1cz4fjc0,.dark ._1cz4fjc1,[data-theme=dark] ._1cz4fjc1,.dark._1cz4fjc1,[data-theme=dark]._1cz4fjc1,.dark ._1cz4fjc2,[data-theme=dark] ._1cz4fjc2,.dark._1cz4fjc2,[data-theme=dark]._1cz4fjc2{--rc-text: #fafafa;--rc-text-secondary: #a1a1aa;--rc-text-tertiary: #71717a;--rc-text-quaternary: #52525b;--rc-bg: #09090b;--rc-bg-secondary: #18181b;--rc-bg-tertiary: #27272a;--rc-fill: #2a2a2f;--rc-fill-secondary: #222226;--rc-fill-tertiary: #1b1b1f;--rc-fill-quaternary: #131316;--rc-border: #27272a;--rc-accent: #60a5fa;--rc-accent-light: #60a5fa20;--rc-link: #60a5fa;--rc-code-text: #e4e4e7;--rc-code-bg: #27272a;--rc-hr-border: #27272a;--rc-quote-border: #60a5fa;--rc-quote-bg: #1e3a5f;--rc-alert-info: #7db9e5;--rc-alert-warning: #da864a;--rc-alert-tip: #54da48;--rc-alert-caution: #e16973;--rc-alert-important: #9966e0;--rc-shadow-top-bar: 0 8px 30px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .3);--rc-shadow-modal: 0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.35);--rc-shadow-menu: 0 1px 4px rgba(0,0,0,.25), 0 4px 16px rgba(0,0,0,.4)}._1qucygc1{margin:8px 0}._1qucygc2{--_1qucygc0: 115, 115, 115;display:flex;align-items:center;gap:0;padding:0 14px;height:48px;border:1px solid color-mix(in srgb,rgb(var(--_1qucygc0)) 25%,transparent);border-radius:12px;background-color:color-mix(in srgb,rgb(var(--_1qucygc0)) 12%,transparent);font-family:var(--rc-font-family);font-size:var(--rc-font-size-md);transition:border-color .15s ease,background-color .15s ease}._1qucygc2:focus-within{border-color:color-mix(in srgb,rgb(var(--_1qucygc0)) 50%,transparent)}._1qucygc4{--_1qucygc0: 29, 155, 240}._1qucygc5{--_1qucygc0: 255, 0, 0}._1qucygc6{--_1qucygc0: 163, 163, 163}._1qucygc7{--_1qucygc0: 0, 161, 214}._1qucygc8,._1qucygc9{--_1qucygc0: 110, 84, 148}._1qucygca{--_1qucygc0: 139, 92, 246}._1qucygcb{display:inline-flex;align-items:center;gap:8px;flex-shrink:0;font-weight:500;font-size:var(--rc-font-size-md);color:var(--rc-text-secondary);white-space:nowrap;user-select:none;padding-right:14px;font-family:var(--rc-font-family-sans)}._1qucygcc{width:8px;height:8px;border-radius:50%;flex-shrink:0;background-color:rgb(var(--_1qucygc0))}._1qucygcd{width:1px;height:20px;background-color:var(--rc-border);flex-shrink:0}._1qucygce{flex:1;min-width:0;height:100%;font-size:var(--rc-font-size-md);font-family:var(--rc-font-mono);color:var(--rc-text);background:transparent;border:none;padding:0 14px;outline:none}._1qucygce::placeholder{color:color-mix(in srgb,var(--rc-text-secondary) 60%,transparent)}._1xclnej1{margin:8px 0;display:flex;justify-content:center}._1xclnej2{position:relative;height:0;width:100%}._1xclnej3{position:absolute;inset:0;width:100%;height:100%;border:none;border-radius:8px}._1xclnej4{display:flex;flex-direction:column;align-items:center}._1xclnej5{width:100%;height:300px;border:none;overflow:auto}._1xclnej6{display:inline-flex;align-items:flex-start;gap:8px;margin-top:8px;color:var(--rc-text-secondary);font-size:var(--rc-font-size-md);line-height:1.4;text-decoration:none;word-break:break-all}._1xclnej6:hover{color:var(--rc-text)}._1xclnej6 svg{flex-shrink:0;margin-top:2px}._1xclnej7{display:flex;flex-direction:column;align-items:center;width:100%}._1xclnej8{width:100%;overflow:auto}._1xclnej9{max-height:50vh}._1xclnej8 pre{margin:0;padding:16px;background:var(--rc-code-bg);border-radius:8px;font-size:var(--rc-font-size-sm);line-height:1.5;font-family:var(--rc-font-mono);color:var(--rc-text)}._1xclneja{display:block}._1xclnejb{display:inline-block;width:4ch;text-align:right;margin-right:16px;color:color-mix(in srgb,var(--rc-text-secondary) 60%,transparent);user-select:none}._1xclnejc{counter-reset:shiki-line var(--start-line, 0)}._1xclnejc pre{margin:0;padding:16px;border-radius:8px;font-size:var(--rc-font-size-sm);line-height:1.5;font-family:var(--rc-font-mono);overflow-x:auto}._1xclnejc code{font-family:inherit;display:flex;flex-direction:column}._1xclnejc .line{display:flex;line-height:1.5}._1xclnejc .line:before{content:counter(shiki-line);counter-increment:shiki-line;flex-shrink:0;width:4ch;text-align:right;margin-right:16px;color:color-mix(in srgb,var(--rc-text-secondary) 60%,transparent);user-select:none}._1xclnejd{--_1xclnej0: 115, 115, 115;display:flex;align-items:center;gap:0;padding:0 14px;height:48px;border:1px solid color-mix(in srgb,rgb(var(--_1xclnej0)) 25%,transparent);border-radius:12px;background-color:color-mix(in srgb,rgb(var(--_1xclnej0)) 8%,transparent);font-family:var(--rc-font-family);font-size:var(--rc-font-size-md);margin:8px 0}._1xclnejf{--_1xclnej0: 29, 155, 240}._1xclnejg{--_1xclnej0: 255, 0, 0}._1xclnejh{--_1xclnej0: 163, 163, 163}._1xclneji{--_1xclnej0: 0, 161, 214}._1xclnejj,._1xclnejk{--_1xclnej0: 110, 84, 148}._1xclnejl{--_1xclnej0: 139, 92, 246}._1xclnejm{display:inline-flex;align-items:center;gap:8px;flex-shrink:0;font-weight:500;font-size:var(--rc-font-size-md);color:var(--rc-text-secondary);white-space:nowrap;user-select:none;padding-right:14px}._1xclnejn{width:8px;height:8px;border-radius:50%;flex-shrink:0;background-color:rgb(var(--_1xclnej0))}._1xclnejo{flex:1;min-width:0;font-size:var(--rc-font-size-md);font-family:var(--rc-font-mono);color:var(--rc-text-secondary);text-decoration:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._1xclnejo:hover{color:var(--rc-text);text-decoration:underline}._1xclnejp{display:flex;justify-content:center;margin:8px 0;width:100%}._1xclnejq{display:flex;align-items:center;justify-content:center;height:200px;color:var(--rc-text-secondary);font-size:var(--rc-font-size-md)}
|
package/dist/static.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EmbedNode } from "./EmbedLinkRenderer-
|
|
2
|
-
import { $, b, a, d, e, c, i, f, g, h, j, k, m, u } from "./EmbedLinkRenderer-
|
|
1
|
+
import { E as EmbedNode } from "./EmbedLinkRenderer-BoIrH3pE.js";
|
|
2
|
+
import { $, b, a, d, e, c, i, f, g, h, j, k, m, u } from "./EmbedLinkRenderer-BoIrH3pE.js";
|
|
3
3
|
const embedNodes = [EmbedNode];
|
|
4
4
|
export {
|
|
5
5
|
$ as $createEmbedNode,
|
package/dist/styles.css.d.ts
CHANGED
|
@@ -13,9 +13,6 @@ export declare const semanticClassNames: {
|
|
|
13
13
|
readonly dot: "rich-embed__dot";
|
|
14
14
|
readonly divider: "rich-embed__divider";
|
|
15
15
|
readonly input: "rich-embed__input";
|
|
16
|
-
readonly actions: "rich-embed__actions";
|
|
17
|
-
readonly actionButton: "rich-embed__action-btn";
|
|
18
|
-
readonly actionButtonDanger: "rich-embed__action-btn--danger";
|
|
19
16
|
};
|
|
20
17
|
export declare const semanticEmbedModifierClass: {
|
|
21
18
|
readonly generic: "rich-embed--generic";
|
|
@@ -34,7 +31,4 @@ export declare const badge: string;
|
|
|
34
31
|
export declare const dot: string;
|
|
35
32
|
export declare const divider: string;
|
|
36
33
|
export declare const input: string;
|
|
37
|
-
export declare const actions: string;
|
|
38
|
-
export declare const actionButton: string;
|
|
39
|
-
export declare const actionButtonDanger: string;
|
|
40
34
|
//# sourceMappingURL=styles.css.d.ts.map
|
package/dist/styles.css.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../src/styles.css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../src/styles.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;CAerB,CAAA;AAEV,eAAO,MAAM,0BAA0B;;;;;;;;;CAS7B,CAAA;AAEV,eAAO,MAAM,OAAO,QAElB,CAAA;AAEF,eAAO,MAAM,KAAK,QAkBhB,CAAA;AAEF,eAAO,MAAM,SAAS,2HASpB,CAAA;AAEF,eAAO,MAAM,KAAK,QAYhB,CAAA;AAEF,eAAO,MAAM,GAAG,QAMd,CAAA;AAEF,eAAO,MAAM,OAAO,QAKlB,CAAA;AAEF,eAAO,MAAM,KAAK,QAgBhB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-ext-embed",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.66",
|
|
5
5
|
"description": "Embed extension for Twitter, YouTube, etc.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -34,8 +34,9 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"lucide-react": "^0.577.0",
|
|
36
36
|
"react-tweet": "npm:@innei/react-tweet@3.4.2",
|
|
37
|
-
"@haklex/rich-editor": "0.0.
|
|
38
|
-
"@haklex/rich-
|
|
37
|
+
"@haklex/rich-editor": "0.0.66",
|
|
38
|
+
"@haklex/rich-editor-ui": "0.0.66",
|
|
39
|
+
"@haklex/rich-style-token": "0.0.66"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@lexical/react": "^0.41.0",
|
|
@@ -54,6 +55,11 @@
|
|
|
54
55
|
"publishConfig": {
|
|
55
56
|
"access": "public"
|
|
56
57
|
},
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "https://github.com/Innei/haklex.git",
|
|
61
|
+
"directory": "packages/rich-ext-embed"
|
|
62
|
+
},
|
|
57
63
|
"scripts": {
|
|
58
64
|
"build": "vite build",
|
|
59
65
|
"dev:build": "vite build --watch"
|