@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.
Files changed (65) hide show
  1. package/dist/AlertQuoteEditNode-C55sxsR3.js +267 -0
  2. package/dist/KaTeXRenderer-CQQT3BMw.js +215 -0
  3. package/dist/LinkCardRenderer-CigqFwCv.js +45 -0
  4. package/dist/MermaidPlugin-BrOr-wQi.js +67 -0
  5. package/dist/RubyRenderer-jOkydJHg.js +15 -0
  6. package/dist/SubmitShortcutPlugin-DhyVFzoj.js +2186 -0
  7. package/dist/commands-entry.mjs +54 -74
  8. package/dist/components/decorators/PollEditDecorator.d.ts +13 -0
  9. package/dist/components/decorators/PollEditDecorator.d.ts.map +1 -0
  10. package/dist/components/renderers/PollRenderer.d.ts +3 -0
  11. package/dist/components/renderers/PollRenderer.d.ts.map +1 -0
  12. package/dist/config-B5BuLljq.js +1633 -0
  13. package/dist/config-edit.d.ts.map +1 -1
  14. package/dist/config.d.ts.map +1 -1
  15. package/dist/context/PollDataContext.d.ts +11 -0
  16. package/dist/context/PollDataContext.d.ts.map +1 -0
  17. package/dist/extractPolls-DO31LNrp.js +116 -0
  18. package/dist/grid.css-CJCkLTZc.js +44 -0
  19. package/dist/index.d.ts +5 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.mjs +121 -180
  22. package/dist/katex.css-CIOEOXyd.js +145 -0
  23. package/dist/node-registry-Dz5OTkh4.js +946 -0
  24. package/dist/nodes/PollEditNode.d.ts +14 -0
  25. package/dist/nodes/PollEditNode.d.ts.map +1 -0
  26. package/dist/nodes/PollNode.d.ts +52 -0
  27. package/dist/nodes/PollNode.d.ts.map +1 -0
  28. package/dist/nodes-entry.d.ts +3 -0
  29. package/dist/nodes-entry.d.ts.map +1 -1
  30. package/dist/nodes-entry.mjs +5 -50
  31. package/dist/normalizeSerializedEditorState-B-1wmGzd.js +78 -0
  32. package/dist/plugins-entry.mjs +3 -28
  33. package/dist/renderers-entry.mjs +41 -61
  34. package/dist/rich-editor.css +2 -1
  35. package/dist/static-entry.d.ts +5 -0
  36. package/dist/static-entry.d.ts.map +1 -1
  37. package/dist/static-entry.mjs +16 -66
  38. package/dist/styles/index.d.ts +2 -0
  39. package/dist/styles/index.d.ts.map +1 -1
  40. package/dist/styles/poll-edit.css.d.ts +35 -0
  41. package/dist/styles/poll-edit.css.d.ts.map +1 -0
  42. package/dist/styles/poll.css.d.ts +43 -0
  43. package/dist/styles/poll.css.d.ts.map +1 -0
  44. package/dist/styles-entry.mjs +3 -21
  45. package/dist/theme-B5B2EOWM.js +1099 -0
  46. package/dist/types/poll.d.ts +36 -0
  47. package/dist/types/poll.d.ts.map +1 -0
  48. package/dist/types/renderer-config.d.ts +3 -0
  49. package/dist/types/renderer-config.d.ts.map +1 -1
  50. package/dist/utils/extractPolls.d.ts +4 -0
  51. package/dist/utils/extractPolls.d.ts.map +1 -0
  52. package/package.json +30 -30
  53. package/dist/AlertQuoteEditNode-sPNf3_7P.js +0 -293
  54. package/dist/KaTeXRenderer-CQyQzNTJ.js +0 -218
  55. package/dist/LinkCardRenderer-QmkOlyXb.js +0 -36
  56. package/dist/MermaidPlugin-DKuGUcCG.js +0 -101
  57. package/dist/PresentDialogContext-DRroMIoK.js +0 -71
  58. package/dist/RubyRenderer-CJQmODir.js +0 -14
  59. package/dist/SubmitShortcutPlugin-D9uKYHda.js +0 -2427
  60. package/dist/config-Dl3ZkytB.js +0 -1362
  61. package/dist/grid.css-Md5-Cfx_.js +0 -11
  62. package/dist/katex.css-Csc-7N7u.js +0 -28
  63. package/dist/node-registry-CovhHUB6.js +0 -824
  64. package/dist/normalizeSerializedEditorState-k5G4xSi9.js +0 -85
  65. 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
- };