@haklex/rich-editor 0.1.1 → 0.3.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/dist/AlertQuoteEditNode-C55sxsR3.js +267 -0
- package/dist/KaTeXRenderer-CQQT3BMw.js +215 -0
- package/dist/LinkCardRenderer-CigqFwCv.js +45 -0
- package/dist/MermaidPlugin-BrOr-wQi.js +67 -0
- package/dist/RubyRenderer-jOkydJHg.js +15 -0
- package/dist/SubmitShortcutPlugin-DhyVFzoj.js +2186 -0
- package/dist/commands-entry.mjs +54 -74
- package/dist/components/decorators/PollEditDecorator.d.ts +13 -0
- package/dist/components/decorators/PollEditDecorator.d.ts.map +1 -0
- package/dist/components/renderers/PollRenderer.d.ts +3 -0
- package/dist/components/renderers/PollRenderer.d.ts.map +1 -0
- package/dist/config-B5BuLljq.js +1633 -0
- package/dist/config-edit.d.ts.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/context/PollDataContext.d.ts +11 -0
- package/dist/context/PollDataContext.d.ts.map +1 -0
- package/dist/extractPolls-DO31LNrp.js +116 -0
- package/dist/grid.css-CJCkLTZc.js +44 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +121 -180
- package/dist/katex.css-CIOEOXyd.js +145 -0
- package/dist/node-registry-Dz5OTkh4.js +946 -0
- package/dist/nodes/PollEditNode.d.ts +14 -0
- package/dist/nodes/PollEditNode.d.ts.map +1 -0
- package/dist/nodes/PollNode.d.ts +52 -0
- package/dist/nodes/PollNode.d.ts.map +1 -0
- package/dist/nodes-entry.d.ts +3 -0
- package/dist/nodes-entry.d.ts.map +1 -1
- package/dist/nodes-entry.mjs +5 -50
- package/dist/normalizeSerializedEditorState-B-1wmGzd.js +78 -0
- package/dist/plugins-entry.mjs +3 -28
- package/dist/renderers-entry.mjs +41 -61
- package/dist/rich-editor.css +2 -1
- package/dist/static-entry.d.ts +5 -0
- package/dist/static-entry.d.ts.map +1 -1
- package/dist/static-entry.mjs +16 -66
- package/dist/styles/index.d.ts +2 -0
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/poll-edit.css.d.ts +35 -0
- package/dist/styles/poll-edit.css.d.ts.map +1 -0
- package/dist/styles/poll.css.d.ts +43 -0
- package/dist/styles/poll.css.d.ts.map +1 -0
- package/dist/styles-entry.mjs +3 -21
- package/dist/theme-B5B2EOWM.js +1099 -0
- package/dist/types/poll.d.ts +36 -0
- package/dist/types/poll.d.ts.map +1 -0
- package/dist/types/renderer-config.d.ts +3 -0
- package/dist/types/renderer-config.d.ts.map +1 -1
- package/dist/utils/extractPolls.d.ts +4 -0
- package/dist/utils/extractPolls.d.ts.map +1 -0
- package/package.json +30 -30
- package/dist/AlertQuoteEditNode-sPNf3_7P.js +0 -293
- package/dist/KaTeXRenderer-CQyQzNTJ.js +0 -218
- package/dist/LinkCardRenderer-QmkOlyXb.js +0 -36
- package/dist/MermaidPlugin-DKuGUcCG.js +0 -101
- package/dist/PresentDialogContext-DRroMIoK.js +0 -71
- package/dist/RubyRenderer-CJQmODir.js +0 -14
- package/dist/SubmitShortcutPlugin-D9uKYHda.js +0 -2427
- package/dist/config-Dl3ZkytB.js +0 -1362
- package/dist/grid.css-Md5-Cfx_.js +0 -11
- package/dist/katex.css-Csc-7N7u.js +0 -28
- package/dist/node-registry-CovhHUB6.js +0 -824
- package/dist/normalizeSerializedEditorState-k5G4xSi9.js +0 -85
- package/dist/theme-lEwScxEX.js +0 -1113
|
@@ -1,85 +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
|
-
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
|
-
};
|