eddyter 1.4.15 → 1.4.16

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.
@@ -1,6 +1,6 @@
1
1
  import { jsx as i, jsxs as b } from "react/jsx-runtime";
2
2
  import { useLexicalComposerContext as k } from "@lexical/react/LexicalComposerContext";
3
- import { c as L, g as I, h as w } from "./index-D5W6pnOr.js";
3
+ import { c as L, g as I, h as w } from "./index-BDDjWwK4.js";
4
4
  import { useBasicTypeaheadTriggerMatch as C, LexicalTypeaheadMenuPlugin as S, MenuOption as R } from "@lexical/react/LexicalTypeaheadMenuPlugin";
5
5
  import { useState as y, useMemo as v, useCallback as g, useEffect as O } from "react";
6
6
  import * as E from "react-dom";
@@ -1,8 +1,8 @@
1
1
  import { jsx as r, jsxs as p } from "react/jsx-runtime";
2
- import { useLexicalComposerContext as T } from "@lexical/react/LexicalComposerContext";
2
+ import { useLexicalComposerContext as j } from "@lexical/react/LexicalComposerContext";
3
3
  import { $getNodeByKey as g } from "lexical";
4
4
  import { useState as B, useEffect as D } from "react";
5
- import { j as k, D as y, T as E, F as h, k as I, l as W } from "./index-D5W6pnOr.js";
5
+ import { k, D as y, T as E, F as m, l as I, m as W } from "./index-BDDjWwK4.js";
6
6
  function $(e, t) {
7
7
  const d = e.split(".").pop()?.toLowerCase();
8
8
  return d === "pdf" || t.startsWith("data:application/pdf") ? "pdf" : d === "docx" || t.startsWith("data:application/vnd.openxmlformats") && e.toLowerCase().endsWith(".docx") ? "docx" : d === "xlsx" || d === "xls" || t.startsWith("data:application/vnd.openxmlformats-officedocument.spreadsheetml") || t.startsWith("data:application/vnd.ms-excel") ? "xlsx" : null;
@@ -16,15 +16,15 @@ function z(e, t) {
16
16
  return;
17
17
  }
18
18
  let l = !1;
19
- return c === "pdf" ? import("./generatePdfThumbnail-C0rDYo5e.js").then(({ generatePdfThumbnail: o }) => o(e)).then((o) => {
19
+ return c === "pdf" ? import("./generatePdfThumbnail-CfDAh39b.js").then(({ generatePdfThumbnail: o }) => o(e)).then((o) => {
20
20
  l || n(o);
21
21
  }).catch(() => {
22
22
  l || n(null);
23
- }) : c === "docx" ? import("./generateDocxThumbnail-fv5LNJIq.js").then(({ generateDocxThumbnail: o }) => o(e)).then((o) => {
23
+ }) : c === "docx" ? import("./generateDocxThumbnail-DJlPLsdY.js").then(({ generateDocxThumbnail: o }) => o(e)).then((o) => {
24
24
  l || n(o);
25
25
  }).catch(() => {
26
26
  l || n(null);
27
- }) : c === "xlsx" && import("./generateXlsxThumbnail-C_vobxPD.js").then(({ generateXlsxThumbnail: o }) => o(e)).then((o) => {
27
+ }) : c === "xlsx" && import("./generateXlsxThumbnail-cRIT4Jyf.js").then(({ generateXlsxThumbnail: o }) => o(e)).then((o) => {
28
28
  l || n(o);
29
29
  }).catch(() => {
30
30
  l || n(null);
@@ -41,7 +41,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
41
41
  return t === "pdf" || t === "docx" || t === "xlsx" || t === "xls";
42
42
  }, C = (e) => {
43
43
  const t = N(e);
44
- return ["pdf", "doc", "docx", "txt", "odt"].includes(t) ? /* @__PURE__ */ r(h, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-blue-600" }) : ["xls", "xlsx", "csv"].includes(t) ? /* @__PURE__ */ r(h, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-green-600" }) : ["ppt", "pptx"].includes(t) ? /* @__PURE__ */ r(h, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-red-600" }) : ["zip", "rar", "7z", "tar", "gz"].includes(t) ? /* @__PURE__ */ r(I, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-orange-500" }) : /* @__PURE__ */ r(W, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-gray-500" });
44
+ return ["pdf", "doc", "docx", "txt", "odt"].includes(t) ? /* @__PURE__ */ r(m, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-blue-600" }) : ["xls", "xlsx", "csv"].includes(t) ? /* @__PURE__ */ r(m, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-green-600" }) : ["ppt", "pptx"].includes(t) ? /* @__PURE__ */ r(m, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-red-600" }) : ["zip", "rar", "7z", "tar", "gz"].includes(t) ? /* @__PURE__ */ r(I, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-orange-500" }) : /* @__PURE__ */ r(W, { className: "cteditor-w-8 cteditor-h-8 cteditor-text-gray-500" });
45
45
  }, H = ({
46
46
  src: e,
47
47
  fileName: t,
@@ -49,7 +49,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
49
49
  displayType: n = "card",
50
50
  nodeKey: c
51
51
  }) => {
52
- const l = n === "inline" ? "inline" : "card", [o] = T(), u = z(F(t) ? e : void 0, t);
52
+ const l = n === "inline" ? "inline" : "card", [o] = j(), u = z(F(t) ? e : void 0, t);
53
53
  if (D(() => {
54
54
  u && o.update(() => {
55
55
  const a = g(c);
@@ -57,7 +57,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
57
57
  });
58
58
  }, [o, c, u]), !e || !t)
59
59
  return console.error("FileView: Missing required props", { src: e, fileName: t, fileSize: d, nodeKey: c }), /* @__PURE__ */ r("div", { className: "cteditor-inline-flex cteditor-items-center cteditor-gap-3 cteditor-px-4 cteditor-py-3 cteditor-my-2 cteditor-border cteditor-border-destructive cteditor-rounded-lg cteditor-bg-destructive/10", children: /* @__PURE__ */ r("div", { className: "cteditor-text-sm cteditor-text-destructive", children: "Error loading file" }) });
60
- const m = (a) => {
60
+ const h = (a) => {
61
61
  a.preventDefault(), a.stopPropagation();
62
62
  try {
63
63
  if (e.startsWith("data:")) {
@@ -66,7 +66,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
66
66
  const w = new Uint8Array(x);
67
67
  for (; x--; )
68
68
  w[x] = b.charCodeAt(x);
69
- const j = new Blob([w], { type: L }), v = URL.createObjectURL(j), s = document.createElement("a");
69
+ const T = new Blob([w], { type: L }), v = URL.createObjectURL(T), s = document.createElement("a");
70
70
  s.href = v, s.download = t, s.style.display = "none", document.body.appendChild(s), s.click(), document.body.removeChild(s), setTimeout(() => URL.revokeObjectURL(v), 100);
71
71
  } else {
72
72
  const i = document.createElement("a");
@@ -95,7 +95,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
95
95
  "button",
96
96
  {
97
97
  type: "button",
98
- onClick: m,
98
+ onClick: h,
99
99
  className: "cteditor-p-1 cteditor-rounded-md hover:cteditor-bg-accent cteditor-transition-colors cteditor-flex-shrink-0",
100
100
  "aria-label": "Download file",
101
101
  title: "Download file",
@@ -130,7 +130,7 @@ const R = (e) => e ? e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFix
130
130
  "button",
131
131
  {
132
132
  type: "button",
133
- onClick: m,
133
+ onClick: h,
134
134
  className: "cteditor-p-1 cteditor-rounded-md cteditor-text-black/80 hover:cteditor-bg-black/10 cteditor-transition-colors",
135
135
  "aria-label": "Download file",
136
136
  title: "Download file",
@@ -15,7 +15,7 @@ import { useLexicalNodeSelection as pt } from "@lexical/react/useLexicalNodeSele
15
15
  import { mergeRegister as ht } from "@lexical/utils";
16
16
  import { $getSelection as P, $isNodeSelection as p, $setSelection as W, SELECTION_CHANGE_COMMAND as bt, COMMAND_PRIORITY_LOW as f, CLICK_COMMAND as Ct, DRAGSTART_COMMAND as Nt, KEY_DELETE_COMMAND as xt, KEY_BACKSPACE_COMMAND as vt, KEY_ENTER_COMMAND as Et, KEY_ESCAPE_COMMAND as yt, RootNode as Rt, TextNode as At, LineBreakNode as kt, ParagraphNode as St, $getNodeByKey as A, $isParagraphNode as T } from "lexical";
17
17
  import { useRef as L, useState as w, useCallback as x, useEffect as Dt } from "react";
18
- import { U as v, W as Pt, b as Lt, A as Mt, d as _t, e as $t, H as zt, T as It, N as Ot, O as Wt } from "./index-D5W6pnOr.js";
18
+ import { V as v, W as Pt, b as Lt, A as Mt, d as _t, e as $t, J as zt, T as It, O as Ot, P as Wt } from "./index-BDDjWwK4.js";
19
19
  function ie({
20
20
  src: j,
21
21
  nodeKey: g,
@@ -25,8 +25,8 @@ function ie({
25
25
  resizable: Y,
26
26
  showCaption: E,
27
27
  caption: b,
28
- captionsEnabled: F,
29
- controls: V = !0,
28
+ captionsEnabled: V,
29
+ controls: F = !0,
30
30
  position: n = "none"
31
31
  }) {
32
32
  const a = L(null), S = L(null), [l, d, C] = pt(g), [s, M] = w(!1), [o] = lt(), [y, H] = w(null), _ = L(null), K = mt(), D = x(
@@ -141,9 +141,9 @@ function ie({
141
141
  const e = A(g);
142
142
  v(e) && e.setWidthAndHeight(t, r);
143
143
  });
144
- }, U = () => {
144
+ }, J = () => {
145
145
  M(!0);
146
- }, q = (t) => {
146
+ }, U = (t) => {
147
147
  t.preventDefault(), t.stopPropagation(), o.update(() => {
148
148
  const r = A(g);
149
149
  if (v(r)) {
@@ -160,7 +160,7 @@ function ie({
160
160
  c && T(c) && (r === "left" ? c.setFormat("left") : r === "right" ? c.setFormat("right") : c.setFormat(""));
161
161
  }
162
162
  });
163
- }, J = x(
163
+ }, q = x(
164
164
  (t) => {
165
165
  if (s || t.target.closest("button"))
166
166
  return;
@@ -207,14 +207,14 @@ function ie({
207
207
  position: "relative",
208
208
  display: "inline-block"
209
209
  },
210
- onClick: J,
210
+ onClick: q,
211
211
  children: [
212
212
  /* @__PURE__ */ i(
213
213
  "video",
214
214
  {
215
215
  ref: a,
216
216
  src: j,
217
- controls: V,
217
+ controls: F,
218
218
  preload: "metadata",
219
219
  className: O ? `focused ${p(y) ? "draggable" : ""}` : void 0,
220
220
  style: Z ? {
@@ -304,7 +304,7 @@ function ie({
304
304
  {
305
305
  type: "button",
306
306
  onClick: (t) => {
307
- t.stopPropagation(), q(t);
307
+ t.stopPropagation(), U(t);
308
308
  },
309
309
  className: "cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors cteditor-shadow-md cteditor-border cteditor-border-border",
310
310
  "aria-label": "Delete video",
@@ -322,9 +322,9 @@ function ie({
322
322
  buttonRef: S,
323
323
  imageRef: a,
324
324
  maxWidth: B,
325
- onResizeStart: U,
325
+ onResizeStart: J,
326
326
  onResizeEnd: G,
327
- captionsEnabled: F
327
+ captionsEnabled: V
328
328
  }
329
329
  )
330
330
  ]
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Y as i, Z as r, _ as t, a0 as s, a1 as o, a2 as d, a3 as v, a4 as u, a5 as f, a6 as n, a7 as l, a8 as w } from "./index-D5W6pnOr.js";
1
+ import { Z as i, _ as r, a0 as t, a1 as s, a2 as o, a3 as d, a4 as v, a5 as u, a6 as f, a7 as n, a8 as l, a9 as w } from "./index-BDDjWwK4.js";
2
2
  export {
3
3
  i as ConfigurableEditor,
4
4
  r as ConfigurableEditorWithAuth,
@@ -3,29 +3,34 @@ export type NotePanelType = "info" | "warning" | "error" | "success" | "note";
3
3
  export interface NotePanelPayload {
4
4
  type: NotePanelType;
5
5
  title?: string;
6
+ bodyHtml?: string;
6
7
  key?: NodeKey;
7
8
  }
8
9
  export type SerializedNotePanelNode = Spread<{
9
10
  panelType: NotePanelType;
10
11
  title: string;
12
+ bodyHtml: string;
11
13
  }, SerializedLexicalNode>;
12
14
  export declare class NotePanelNode extends DecoratorNode<JSX.Element> {
13
15
  __panelType: NotePanelType;
14
16
  __title: string;
17
+ __bodyHtml: string;
15
18
  static getType(): string;
16
19
  static clone(node: NotePanelNode): NotePanelNode;
17
20
  static importJSON(serializedNode: SerializedNotePanelNode): NotePanelNode;
18
21
  exportDOM(): DOMExportOutput;
19
22
  static importDOM(): DOMConversionMap | null;
20
- constructor(type: NotePanelType, title?: string, key?: NodeKey);
23
+ constructor(type: NotePanelType, title?: string, bodyHtml?: string, key?: NodeKey);
21
24
  exportJSON(): SerializedNotePanelNode;
22
25
  setPanelType(type: NotePanelType): void;
23
26
  setTitle(title: string): void;
27
+ setBodyHtml(bodyHtml: string): void;
28
+ getBodyHtml(): string;
24
29
  createDOM(config: EditorConfig): HTMLElement;
25
30
  updateDOM(): false;
26
31
  getPanelType(): NotePanelType;
27
32
  getTitle(): string;
28
33
  decorate(): JSX.Element;
29
34
  }
30
- export declare function $createNotePanelNode({ type, title, key, }: NotePanelPayload): NotePanelNode;
35
+ export declare function $createNotePanelNode({ type, title, bodyHtml, key, }: NotePanelPayload): NotePanelNode;
31
36
  export declare function $isNotePanelNode(node: LexicalNode | null | undefined): node is NotePanelNode;
@@ -0,0 +1,11 @@
1
+ import { NotePanelType } from '../nodes/NotePanelNode';
2
+ export declare function isNotePanelPlaceholderText(text: string): boolean;
3
+ /**
4
+ * Clone the rendered note panel from the editor DOM with computed styles inlined
5
+ * so preview/HTML export matches the text area (icon, colors, borders, layout).
6
+ */
7
+ export declare function cloneNotePanelFromLiveDom(livePanel: HTMLElement): HTMLDivElement | null;
8
+ export declare function buildNotePanelExportElement(type: NotePanelType, title: string, bodyHtml: string): HTMLDivElement;
9
+ /** Prefer live DOM clone; fall back to themed static markup. */
10
+ export declare function buildNotePanelExportFromLiveOrFallback(livePanel: HTMLElement, type: NotePanelType, title: string, bodyHtml: string): HTMLDivElement;
11
+ export declare function readNotePanelBodyFromDom(panel: HTMLElement): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Note panels use a nested contentEditable inside Lexical's root. Paste targets
3
+ * may be a Text node (no `closest`), so resolve to an Element before querying.
4
+ */
5
+ export declare function getEventTargetElement(target: EventTarget | null): Element | null;
6
+ /** Outer Lexical theme wrapper + React panel root (see NotePanelView). */
7
+ export declare function isPasteInsideNotePanelSurface(target: EventTarget | null): boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eddyter",
3
3
  "private": false,
4
- "version": "1.4.15",
4
+ "version": "1.4.16",
5
5
  "description": "Plug and Play AI Rich Text Editor for any website, blog, CRM, ERP, or web app. Built on Lexical with AI writing assistance, dark mode, and real-time collaboration.",
6
6
  "homepage": "https://www.eddyter.com",
7
7
  "repository": {