@haklex/rich-editor 0.0.101 → 0.0.103
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/dist/{PresentDialogContext-BYyWlFdt.js → PresentDialogContext-DRroMIoK.js} +1 -1
- package/dist/{SubmitShortcutPlugin-CuvP0RxW.js → SubmitShortcutPlugin-CDqj7KHO.js} +5 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +7 -4
- package/dist/normalizeSerializedEditorState-k5G4xSi9.js +85 -0
- package/dist/plugins/MarkdownPastePlugin.d.ts.map +1 -1
- package/dist/plugins/OnChangePlugin.d.ts.map +1 -1
- package/dist/plugins-entry.mjs +1 -1
- package/dist/static-entry.d.ts +1 -0
- package/dist/static-entry.d.ts.map +1 -1
- package/dist/static-entry.mjs +3 -1
- package/dist/utils/comment-anchor.d.ts +7 -1
- package/dist/utils/comment-anchor.d.ts.map +1 -1
- package/dist/utils/normalizeSerializedEditorState.d.ts +3 -0
- package/dist/utils/normalizeSerializedEditorState.d.ts.map +1 -0
- package/package.json +4 -4
- package/dist/favicon-BQgbXF_a.js +0 -43
|
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Mail, Globe } from "lucide-react";
|
|
3
3
|
import { useState, useEffect, createContext, useMemo, use } from "react";
|
|
4
4
|
import { e as clsx, d as sharedStyles, s as semanticClassNames } from "./katex.css-Csc-7N7u.js";
|
|
5
|
-
import { g as getHostname, p as probeFavicon } from "./
|
|
5
|
+
import { g as getHostname, p as probeFavicon } from "./normalizeSerializedEditorState-k5G4xSi9.js";
|
|
6
6
|
function LinkFavicon({
|
|
7
7
|
href,
|
|
8
8
|
source,
|
|
@@ -23,7 +23,7 @@ import { Dialog, DialogPopup, DialogTitle, SegmentedControl, ActionButton, Actio
|
|
|
23
23
|
import { Check, Info, Upload, Link2 } from "lucide-react";
|
|
24
24
|
import { i as computeImageMeta, F as FootnoteDefinitionsProvider } from "./KaTeXRenderer-CQyQzNTJ.js";
|
|
25
25
|
import "./katex.css-Csc-7N7u.js";
|
|
26
|
-
import { g as getHostname, p as probeFavicon } from "./
|
|
26
|
+
import { g as getHostname, p as probeFavicon, n as normalizeSerializedEditorState } from "./normalizeSerializedEditorState-k5G4xSi9.js";
|
|
27
27
|
const URL_REGEX = /https?:\/\/(?:www\.)?[\w#%+.:=@~-]{1,256}\.[A-Za-z]{2}[\w#%&()+./:=?@~-]*/;
|
|
28
28
|
const EMAIL_REGEX = /(?:[\w%+.-]+@[\d.a-z-]+\.[a-z]{2,})/i;
|
|
29
29
|
const URL_MATCHER = createLinkMatcherWithRegExp(URL_REGEX);
|
|
@@ -927,6 +927,7 @@ function MarkdownPastePlugin() {
|
|
|
927
927
|
(event) => {
|
|
928
928
|
const clipboardData = "clipboardData" in event ? event.clipboardData : null;
|
|
929
929
|
if (!clipboardData) return false;
|
|
930
|
+
if (clipboardData.getData("application/x-lexical-editor")) return false;
|
|
930
931
|
if (Array.from(clipboardData.files).some((f) => f.type.startsWith("image/"))) return false;
|
|
931
932
|
const vscodeData = getVSCodePasteData(clipboardData);
|
|
932
933
|
if (vscodeData) {
|
|
@@ -1710,13 +1711,14 @@ function OnChangePlugin({ onChange, debounceMs }) {
|
|
|
1710
1711
|
const unregister = editor.registerUpdateListener(({ editorState }) => {
|
|
1711
1712
|
const fn = onChangeRef.current;
|
|
1712
1713
|
if (!fn) return;
|
|
1714
|
+
const serializedState = normalizeSerializedEditorState(editorState.toJSON());
|
|
1713
1715
|
if (debounceMs && debounceMs > 0) {
|
|
1714
1716
|
clearTimeout(timerRef.current);
|
|
1715
1717
|
timerRef.current = setTimeout(() => {
|
|
1716
|
-
fn(
|
|
1718
|
+
fn(serializedState);
|
|
1717
1719
|
}, debounceMs);
|
|
1718
1720
|
} else {
|
|
1719
|
-
fn(
|
|
1721
|
+
fn(serializedState);
|
|
1720
1722
|
}
|
|
1721
1723
|
});
|
|
1722
1724
|
return () => {
|
package/dist/index.d.ts
CHANGED
|
@@ -21,5 +21,5 @@ export * from './styles';
|
|
|
21
21
|
export type { RichEditorProps, RichEditorVariant } from './types';
|
|
22
22
|
export type { RendererConfig } from './types/renderer-config';
|
|
23
23
|
export type { AnchorError, AnchorResult, BlockAnchor, CommentAnchor, RangeAnchor, } from './utils/comment-anchor';
|
|
24
|
-
export { buildBlockAnchor, buildRangeAnchor } from './utils/comment-anchor';
|
|
24
|
+
export { $getRootBlock, $getTextOffsetInBlock, $resolveSelectionPoint, buildBlockAnchor, buildRangeAnchor, } from './utils/comment-anchor';
|
|
25
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAChF,YAAY,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAC5F,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EAA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C;AACnF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAChF,YAAY,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAC5F,OAAO,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,wCAAwC,CAAC;AAChD,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACzF,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,UAAU,GACX,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAClE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { F as FootnotePlugin, O as OnChangePlugin, S as SubmitShortcutPlugin, E as EditorRefPlugin, a as AutoFocusPlugin, d as ImageUploadProvider, g as defaultImageUpload, C as CorePlugins, I as ImageUploadPlugin, L as LinkFaviconPlugin, c as BlockIdPlugin, f as blockIdState } from "./SubmitShortcutPlugin-
|
|
2
|
-
import { E as ExtraNodesProvider } from "./PresentDialogContext-
|
|
3
|
-
import { L, P, u, a } from "./PresentDialogContext-
|
|
1
|
+
import { F as FootnotePlugin, O as OnChangePlugin, S as SubmitShortcutPlugin, E as EditorRefPlugin, a as AutoFocusPlugin, d as ImageUploadProvider, g as defaultImageUpload, C as CorePlugins, I as ImageUploadPlugin, L as LinkFaviconPlugin, c as BlockIdPlugin, f as blockIdState } from "./SubmitShortcutPlugin-CDqj7KHO.js";
|
|
2
|
+
import { E as ExtraNodesProvider } from "./PresentDialogContext-DRroMIoK.js";
|
|
3
|
+
import { L, P, u, a } from "./PresentDialogContext-DRroMIoK.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { s as setResolvedEditNodes, a as allEditNodes } from "./node-registry-BOSH1oBi.js";
|
|
6
6
|
import { I as ImagePlugin, K as KaTeXPlugin, A as AlertPlugin, M as MermaidPlugin } from "./MermaidPlugin-DI86n71x.js";
|
|
@@ -20,7 +20,7 @@ import { e as clsx, g as getVariantClass } from "./katex.css-Csc-7N7u.js";
|
|
|
20
20
|
import { a as a2, c, k, b as b2, n, r, s, d as d2 } from "./katex.css-Csc-7N7u.js";
|
|
21
21
|
import { d as d3, a as a3, g as g2, b as b3 } from "./grid.css-Md5-Cfx_.js";
|
|
22
22
|
import { articleTheme, commentTheme, noteTheme, vars } from "@haklex/rich-style-token/styles";
|
|
23
|
-
import { $getRoot, $
|
|
23
|
+
import { $getRoot, $isElementNode, $isTextNode, $getSelection, $isRangeSelection, $getState, $isLineBreakNode } from "lexical";
|
|
24
24
|
var contentWrapper = "b94s950";
|
|
25
25
|
var content = "b94s951";
|
|
26
26
|
var placeholder = "b94s952";
|
|
@@ -277,6 +277,9 @@ function buildRangeAnchor(editor) {
|
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
export {
|
|
280
|
+
$getRootBlock,
|
|
281
|
+
$getTextOffsetInBlock,
|
|
282
|
+
$resolveSelectionPoint,
|
|
280
283
|
ColorSchemeProvider,
|
|
281
284
|
CorePlugins,
|
|
282
285
|
ExtraNodesProvider,
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
const FAVICON_VARIANTS = [
|
|
2
|
+
"/favicon.ico",
|
|
3
|
+
"/favicon.png",
|
|
4
|
+
"/favicon.svg",
|
|
5
|
+
"/apple-touch-icon.png",
|
|
6
|
+
"/apple-touch-icon-precomposed.png"
|
|
7
|
+
];
|
|
8
|
+
const faviconCache = /* @__PURE__ */ new Map();
|
|
9
|
+
function getHostname(href) {
|
|
10
|
+
try {
|
|
11
|
+
const url = new URL(href);
|
|
12
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") return null;
|
|
13
|
+
return url.hostname;
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function probeImage(url) {
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
const img = new Image();
|
|
21
|
+
img.onload = () => resolve(url);
|
|
22
|
+
img.onerror = () => resolve(null);
|
|
23
|
+
img.src = url;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async function probeFavicon(hostname) {
|
|
27
|
+
const cached = faviconCache.get(hostname);
|
|
28
|
+
if (cached !== void 0) return cached;
|
|
29
|
+
for (const variant of FAVICON_VARIANTS) {
|
|
30
|
+
const url = `https://${hostname}${variant}`;
|
|
31
|
+
const result = await probeImage(url);
|
|
32
|
+
if (result) {
|
|
33
|
+
faviconCache.set(hostname, result);
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
faviconCache.set(hostname, null);
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const createEmptyParagraphNode = () => ({
|
|
41
|
+
children: [],
|
|
42
|
+
direction: null,
|
|
43
|
+
format: "",
|
|
44
|
+
indent: 0,
|
|
45
|
+
textFormat: 0,
|
|
46
|
+
textStyle: "",
|
|
47
|
+
type: "paragraph",
|
|
48
|
+
version: 1
|
|
49
|
+
});
|
|
50
|
+
function normalizeSerializedEditorState(state) {
|
|
51
|
+
const root = state?.root;
|
|
52
|
+
const children = Array.isArray(root?.children) ? [...root.children] : [];
|
|
53
|
+
if (root?.type === "root" && children.length > 0) {
|
|
54
|
+
return state;
|
|
55
|
+
}
|
|
56
|
+
if (!state) {
|
|
57
|
+
return {
|
|
58
|
+
root: {
|
|
59
|
+
children: [createEmptyParagraphNode()],
|
|
60
|
+
direction: null,
|
|
61
|
+
format: "",
|
|
62
|
+
indent: 0,
|
|
63
|
+
type: "root",
|
|
64
|
+
version: 1
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
...state,
|
|
70
|
+
root: {
|
|
71
|
+
...root,
|
|
72
|
+
children: children.length > 0 ? children : [createEmptyParagraphNode()],
|
|
73
|
+
direction: root?.direction ?? null,
|
|
74
|
+
format: typeof root?.format === "string" ? root.format : "",
|
|
75
|
+
indent: typeof root?.indent === "number" ? root.indent : 0,
|
|
76
|
+
type: "root",
|
|
77
|
+
version: typeof root?.version === "number" ? root.version : 1
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
getHostname as g,
|
|
83
|
+
normalizeSerializedEditorState as n,
|
|
84
|
+
probeFavicon as p
|
|
85
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownPastePlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/MarkdownPastePlugin.tsx"],"names":[],"mappings":"AAwIA,wBAAgB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"MarkdownPastePlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/MarkdownPastePlugin.tsx"],"names":[],"mappings":"AAwIA,wBAAgB,mBAAmB,SA4DlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnChangePlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/OnChangePlugin.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"OnChangePlugin.d.ts","sourceRoot":"","sources":["../../src/plugins/OnChangePlugin.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAKrD,UAAU,mBAAmB;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACnD;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,mBAAmB,QA8B3E"}
|
package/dist/plugins-entry.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, a, b, B, c, C, E, F, H, I, d, L, M, e, O, S, f, g, u } from "./SubmitShortcutPlugin-
|
|
1
|
+
import { A, a, b, B, c, C, E, F, H, I, d, L, M, e, O, S, f, g, u } from "./SubmitShortcutPlugin-CDqj7KHO.js";
|
|
2
2
|
import { A as A2, I as I2, K, M as M2 } from "./MermaidPlugin-DI86n71x.js";
|
|
3
3
|
export {
|
|
4
4
|
A as ALL_TRANSFORMERS,
|
package/dist/static-entry.d.ts
CHANGED
|
@@ -29,5 +29,6 @@ export { editorTheme } from './styles/theme';
|
|
|
29
29
|
export type { RichEditorVariant } from './types';
|
|
30
30
|
export type { RendererConfig } from './types/renderer-config';
|
|
31
31
|
export { extractTextContent } from './utils/extractTextContent';
|
|
32
|
+
export { normalizeSerializedEditorState } from './utils/normalizeSerializedEditorState';
|
|
32
33
|
export { articleTheme, commentTheme, noteTheme, vars } from '@haklex/rich-style-token/styles';
|
|
33
34
|
//# sourceMappingURL=static-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static-entry.d.ts","sourceRoot":"","sources":["../src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WAAW,EACX,kBAAkB,EAClB,KAAK,cAAc,EACnB,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/static-entry.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E, L, P, u, a } from "./PresentDialogContext-
|
|
1
|
+
import { E, L, P, u, a } from "./PresentDialogContext-DRroMIoK.js";
|
|
2
2
|
import { R } from "./RubyRenderer-CJQmODir.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { e as clsx, d as sharedStyles, s as semanticClassNames } from "./katex.css-Csc-7N7u.js";
|
|
@@ -8,6 +8,7 @@ import { N, n as n2, o, u as u2, p } from "./theme-CrJbATnf.js";
|
|
|
8
8
|
import { F, R as R2, a as a3, c as c2, u as u3, b as b2, d, e, f, g as g2 } from "./KaTeXRenderer-CQyQzNTJ.js";
|
|
9
9
|
import { n as n3, k as k2, l, m, u as u4 } from "./config-mAejoug-.js";
|
|
10
10
|
import { d as d2, a as a4, g as g3, b as b3 } from "./grid.css-Md5-Cfx_.js";
|
|
11
|
+
import { n as n4 } from "./normalizeSerializedEditorState-k5G4xSi9.js";
|
|
11
12
|
import { articleTheme, commentTheme, noteTheme, vars } from "@haklex/rich-style-token/styles";
|
|
12
13
|
function TagRenderer({ text }) {
|
|
13
14
|
return /* @__PURE__ */ jsx(
|
|
@@ -48,6 +49,7 @@ export {
|
|
|
48
49
|
b3 as gridStyles,
|
|
49
50
|
k as katexClassNames,
|
|
50
51
|
b as katexStyles,
|
|
52
|
+
n4 as normalizeSerializedEditorState,
|
|
51
53
|
noteTheme,
|
|
52
54
|
n as noteVariant,
|
|
53
55
|
r as richContent,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LexicalEditor } from 'lexical';
|
|
1
|
+
import { ElementNode, LexicalEditor, LexicalNode, RangeSelection } from 'lexical';
|
|
2
2
|
export interface BlockAnchor {
|
|
3
3
|
blockFingerprint: string;
|
|
4
4
|
blockId: string;
|
|
@@ -27,6 +27,12 @@ export type AnchorResult<T> = {
|
|
|
27
27
|
ok: false;
|
|
28
28
|
error: AnchorError;
|
|
29
29
|
};
|
|
30
|
+
export declare function $getRootBlock(node: LexicalNode): ElementNode | null;
|
|
31
|
+
export declare function $resolveSelectionPoint(selection: RangeSelection, which: 'anchor' | 'focus'): {
|
|
32
|
+
node: LexicalNode;
|
|
33
|
+
offset: number;
|
|
34
|
+
};
|
|
35
|
+
export declare function $getTextOffsetInBlock(block: ElementNode, targetNode: LexicalNode, targetOffset: number): number;
|
|
30
36
|
export declare function buildBlockAnchor(editor: LexicalEditor, blockKey?: string): AnchorResult<BlockAnchor>;
|
|
31
37
|
export declare function buildRangeAnchor(editor: LexicalEditor): AnchorResult<RangeAnchor>;
|
|
32
38
|
//# sourceMappingURL=comment-anchor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comment-anchor.d.ts","sourceRoot":"","sources":["../../src/utils/comment-anchor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"comment-anchor.d.ts","sourceRoot":"","sources":["../../src/utils/comment-anchor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAavF,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,E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C,CAyB3B;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAAC,WAAW,CAAC,CA2DjF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeSerializedEditorState.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeSerializedEditorState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAarD,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,qBAAqB,GAAG,IAAI,GAAG,SAAS,GAC9C,qBAAqB,CAiCvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.103",
|
|
4
4
|
"description": "Core rich text editor based on Lexical",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"@lexical/code-core": "^0.42.0",
|
|
50
50
|
"nanoid": "^5.1.6",
|
|
51
51
|
"thumbhash": "^0.1.1",
|
|
52
|
-
"@haklex/rich-
|
|
53
|
-
"@haklex/rich-
|
|
54
|
-
"@haklex/rich-
|
|
52
|
+
"@haklex/rich-headless": "0.0.103",
|
|
53
|
+
"@haklex/rich-editor-ui": "0.0.103",
|
|
54
|
+
"@haklex/rich-style-token": "0.0.103"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@lexical/extension": "^0.42.0",
|
package/dist/favicon-BQgbXF_a.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const FAVICON_VARIANTS = [
|
|
2
|
-
"/favicon.ico",
|
|
3
|
-
"/favicon.png",
|
|
4
|
-
"/favicon.svg",
|
|
5
|
-
"/apple-touch-icon.png",
|
|
6
|
-
"/apple-touch-icon-precomposed.png"
|
|
7
|
-
];
|
|
8
|
-
const faviconCache = /* @__PURE__ */ new Map();
|
|
9
|
-
function getHostname(href) {
|
|
10
|
-
try {
|
|
11
|
-
const url = new URL(href);
|
|
12
|
-
if (url.protocol !== "http:" && url.protocol !== "https:") return null;
|
|
13
|
-
return url.hostname;
|
|
14
|
-
} catch {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function probeImage(url) {
|
|
19
|
-
return new Promise((resolve) => {
|
|
20
|
-
const img = new Image();
|
|
21
|
-
img.onload = () => resolve(url);
|
|
22
|
-
img.onerror = () => resolve(null);
|
|
23
|
-
img.src = url;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
async function probeFavicon(hostname) {
|
|
27
|
-
const cached = faviconCache.get(hostname);
|
|
28
|
-
if (cached !== void 0) return cached;
|
|
29
|
-
for (const variant of FAVICON_VARIANTS) {
|
|
30
|
-
const url = `https://${hostname}${variant}`;
|
|
31
|
-
const result = await probeImage(url);
|
|
32
|
-
if (result) {
|
|
33
|
-
faviconCache.set(hostname, result);
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
faviconCache.set(hostname, null);
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
export {
|
|
41
|
-
getHostname as g,
|
|
42
|
-
probeFavicon as p
|
|
43
|
-
};
|