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.
@@ -5,12 +5,12 @@ import { mergeRegister as ce, $wrapNodeInElement as J } from "@lexical/utils";
5
5
  import { $isTableCellNode as ae } from "@lexical/table";
6
6
  import { $getNodeByKey as T, $createNodeSelection as G, $setSelection as H, $getSelection as S, $isNodeSelection as te, SELECTION_CHANGE_COMMAND as de, COMMAND_PRIORITY_LOW as ne, KEY_ENTER_COMMAND as le, $createParagraphNode as W, $isRootOrShadowRoot as V, PASTE_COMMAND as ue, $isRangeSelection as U, COMMAND_PRIORITY_CRITICAL as me } from "lexical";
7
7
  import { useState as M, useEffect as E, useCallback as _, useRef as Q } from "react";
8
- import { c as fe, E as k, L as pe, a as N, I as ge, C as he, W as be, b as ye, A as xe, d as Ee, e as Ce, f as ve, T as Ne, $ as Z } from "./index-D5W6pnOr.js";
9
- import { createPortal as ke } from "react-dom";
10
- const Ae = fe("Copy", [
8
+ import { c as fe, E as k, L as pe, a as N, I as ge, C as he, W as be, b as ye, A as xe, d as Ee, e as Ce, f as ve, T as Ne, i as ke, $ as Z } from "./index-BDDjWwK4.js";
9
+ import { createPortal as Ae } from "react-dom";
10
+ const Pe = fe("Copy", [
11
11
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
12
12
  ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
13
- ]), K = "cteditor-flex cteditor-items-center cteditor-gap-0.5 cteditor-bg-background/80 cteditor-rounded-md cteditor-shadow-md cteditor-border cteditor-border-border cteditor-p-0.5", w = "cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors cteditor-text-foreground", P = "cteditor-bg-accent", Y = "cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 cteditor-shadow-md cteditor-border cteditor-border-border hover:cteditor-bg-accent cteditor-transition-colors cteditor-text-foreground";
13
+ ]), K = "cteditor-flex cteditor-items-center cteditor-gap-0.5 cteditor-bg-background/80 cteditor-rounded-md cteditor-shadow-md cteditor-border cteditor-border-border cteditor-p-0.5", P = "cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded hover:cteditor-bg-accent cteditor-transition-colors cteditor-text-foreground", w = "cteditor-bg-accent", Y = "cteditor-size-8 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-rounded-md cteditor-bg-background/80 cteditor-shadow-md cteditor-border cteditor-border-border hover:cteditor-bg-accent cteditor-transition-colors cteditor-text-foreground";
14
14
  function we({
15
15
  editor: c,
16
16
  anchorElem: y,
@@ -128,8 +128,8 @@ function we({
128
128
  {
129
129
  type: "button",
130
130
  className: N(
131
- w,
132
- g === "url" && P
131
+ P,
132
+ g === "url" && w
133
133
  ),
134
134
  onClick: (e) => {
135
135
  e.stopPropagation(), C("url");
@@ -143,8 +143,8 @@ function we({
143
143
  {
144
144
  type: "button",
145
145
  className: N(
146
- w,
147
- g === "card" && P
146
+ P,
147
+ g === "card" && w
148
148
  ),
149
149
  onClick: (e) => {
150
150
  e.stopPropagation(), C("card");
@@ -158,8 +158,8 @@ function we({
158
158
  {
159
159
  type: "button",
160
160
  className: N(
161
- w,
162
- g === "embed" && P
161
+ P,
162
+ g === "embed" && w
163
163
  ),
164
164
  onClick: (e) => {
165
165
  e.stopPropagation(), C("embed");
@@ -176,8 +176,8 @@ function we({
176
176
  {
177
177
  type: "button",
178
178
  className: N(
179
- w,
180
- p === "left" && P
179
+ P,
180
+ p === "left" && w
181
181
  ),
182
182
  onClick: (e) => {
183
183
  e.stopPropagation(), q(p === "left" ? "none" : "left");
@@ -191,8 +191,8 @@ function we({
191
191
  {
192
192
  type: "button",
193
193
  className: N(
194
- w,
195
- p === "right" && P
194
+ P,
195
+ p === "right" && w
196
196
  ),
197
197
  onClick: (e) => {
198
198
  e.stopPropagation(), q(p === "right" ? "none" : "right");
@@ -209,8 +209,8 @@ function we({
209
209
  {
210
210
  type: "button",
211
211
  className: N(
212
- w,
213
- A === "left" && P
212
+ P,
213
+ A === "left" && w
214
214
  ),
215
215
  onClick: (e) => {
216
216
  e.stopPropagation(), $("left");
@@ -224,8 +224,8 @@ function we({
224
224
  {
225
225
  type: "button",
226
226
  className: N(
227
- w,
228
- A === "center" && P
227
+ P,
228
+ A === "center" && w
229
229
  ),
230
230
  onClick: (e) => {
231
231
  e.stopPropagation(), $("center");
@@ -239,8 +239,8 @@ function we({
239
239
  {
240
240
  type: "button",
241
241
  className: N(
242
- w,
243
- A === "right" && P
242
+ P,
243
+ A === "right" && w
244
244
  ),
245
245
  onClick: (e) => {
246
246
  e.stopPropagation(), $("right");
@@ -281,14 +281,14 @@ function we({
281
281
  className: Y,
282
282
  onClick: b,
283
283
  title: "Copy",
284
- children: /* @__PURE__ */ o(Ae, { className: "cteditor-size-4" })
284
+ children: /* @__PURE__ */ o(Pe, { className: "cteditor-size-4" })
285
285
  }
286
286
  )
287
287
  ]
288
288
  }
289
289
  );
290
290
  }
291
- function Pe(c, y) {
291
+ function Te(c, y) {
292
292
  const [n, f] = M(null), [u, a] = M(""), d = (t) => t.includes("youtube.com") || t.includes("youtu.be") || t.includes("loom.com") || t.includes("vimeo.com") || t.includes("supercut.video") || t.includes("jam.dev") || t.includes("figma.com");
293
293
  E(() => {
294
294
  const t = (p) => {
@@ -374,7 +374,7 @@ function Pe(c, y) {
374
374
  const A = _(() => {
375
375
  f(null);
376
376
  }, []);
377
- return n ? ke(
377
+ return n ? Ae(
378
378
  /* @__PURE__ */ o(
379
379
  we,
380
380
  {
@@ -388,13 +388,13 @@ function Pe(c, y) {
388
388
  y
389
389
  ) : null;
390
390
  }
391
- function Te({
391
+ function Re({
392
392
  anchorElem: c
393
393
  }) {
394
394
  const [y] = ee(), n = c ?? (typeof document < "u" ? document.body : null);
395
- return n ? Pe(y, n) : null;
395
+ return n ? Te(y, n) : null;
396
396
  }
397
- const Re = [
397
+ const Se = [
398
398
  "youtube.com",
399
399
  "youtu.be",
400
400
  "vimeo.com",
@@ -402,7 +402,7 @@ const Re = [
402
402
  "supercut.video",
403
403
  "jam.dev"
404
404
  ];
405
- function Se(c, y) {
405
+ function Le(c, y) {
406
406
  try {
407
407
  const u = new DOMParser().parseFromString(c, "text/html").body, a = (u.textContent || "").trim().replace(/\s+/g, " "), d = y.trim().replace(/\s+/g, " ");
408
408
  return a && a !== d || !!u.querySelector(
@@ -412,7 +412,7 @@ function Se(c, y) {
412
412
  return !1;
413
413
  }
414
414
  }
415
- const qe = ({
415
+ const Fe = ({
416
416
  floatingAnchorElem: c
417
417
  }) => {
418
418
  const y = c ?? (typeof document < "u" ? document.body : void 0), [n] = ee();
@@ -466,7 +466,8 @@ const qe = ({
466
466
  ue,
467
467
  (f) => {
468
468
  const u = f.clipboardData;
469
- if (!u) return !1;
469
+ if (!u || ke(f.target))
470
+ return !1;
470
471
  const a = S();
471
472
  if (!U(a)) return !1;
472
473
  const d = u.getData("application/x-lexical-editor");
@@ -528,7 +529,7 @@ const qe = ({
528
529
  } catch {
529
530
  }
530
531
  const i = u.getData("text/plain").trim();
531
- if (!i.match(/^https?:\/\//) || g && !Se(g, i))
532
+ if (!i.match(/^https?:\/\//) || g && !Le(g, i))
532
533
  return !1;
533
534
  const A = a.anchor.getNode();
534
535
  let t = !1, p = A;
@@ -541,12 +542,12 @@ const qe = ({
541
542
  }
542
543
  if (t)
543
544
  return a.insertText(i), !0;
544
- const m = Re.some((l) => i.includes(l)), r = Z(i);
545
+ const m = Se.some((l) => i.includes(l)), r = Z(i);
545
546
  return m ? r.setDisplayType("embed") : i.match(/\.(pdf|docx?|xlsx?|pptx?|zip|rar|txt)$/) || i.includes("figma.com") ? r.setDisplayType("card") : r.setDisplayType("url"), a.insertNodes([r]), V(r.getParentOrThrow()) && J(r, W).selectEnd(), !0;
546
547
  },
547
548
  me
548
- ), [n]), /* @__PURE__ */ o(re, { children: /* @__PURE__ */ o(Te, { anchorElem: y }) });
549
+ ), [n]), /* @__PURE__ */ o(re, { children: /* @__PURE__ */ o(Re, { anchorElem: y }) });
549
550
  };
550
551
  export {
551
- qe as default
552
+ Fe as default
552
553
  };