ct-rich-text-editor 1.3.28 → 1.3.29

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.
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
8
8
  import * as React$1 from "react";
9
- import React__default, { createContext, useContext, useState as useState$1, Suspense, useEffect as useEffect$1, forwardRef, createElement, useImperativeHandle, useRef, useMemo, useCallback, useLayoutEffect as useLayoutEffect$1, Component } from "react";
9
+ import React__default, { createContext, useContext, useState as useState$1, useRef, useCallback, useEffect as useEffect$1, Suspense, forwardRef, createElement, useImperativeHandle, useMemo, useLayoutEffect as useLayoutEffect$1, Component } from "react";
10
10
  import axios from "axios";
11
11
  import styled from "@emotion/styled";
12
12
  import { $generateNodesFromDOM, $generateHtmlFromNodes } from "@lexical/html";
@@ -23,8 +23,7 @@ import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
23
23
  import { TablePlugin } from "@lexical/react/LexicalTablePlugin";
24
24
  import { TableNode, TableCellNode, TableRowNode, $createTableNodeWithDimensions, $isTableRowNode, $isTableCellNode, TableCellHeaderStates, $isTableNode, $isTableSelection, $getTableCellNodeFromLexicalNode, $getTableNodeFromLexicalNodeOrThrow, getTableElement, getTableObserverFromTableElement, $getTableRowIndexFromTableCellNode, $getNodeTriplet, $insertTableRow__EXPERIMENTAL, $getTableColumnIndexFromTableCellNode, $insertTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $deleteTableColumn__EXPERIMENTAL, $unmergeCell, $computeTableMapSkipCellCheck, getDOMCellFromTarget, $getTableAndElementByKey } from "@lexical/table";
25
25
  import { mergeRegister, $wrapNodeInElement, $findMatchingParent, $getNearestNodeOfType, $getNearestBlockElementAncestorOrThrow, $insertNodeToNearestRoot, $isEditorIsNestedEditor, mediaFileReader, isMimeType, calculateZoomLevel, CAN_USE_DOM } from "@lexical/utils";
26
- import Stack from "@mui/material/Stack";
27
- import { createCommand, DecoratorNode, createEditor, $applyNodeReplacement, $insertNodes, $isRootOrShadowRoot, $createParagraphNode, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection, $getNearestNodeFromDOMNode, isHTMLElement as isHTMLElement$1, TextNode, $getRoot, $createTextNode, $getNodeByKey, $isParagraphNode, $isTextNode, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, KEY_DOWN_COMMAND, COMMAND_PRIORITY_CRITICAL, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, $isElementNode, SELECTION_CHANGE_COMMAND, UNDO_COMMAND, REDO_COMMAND, KEY_SPACE_COMMAND, $isLineBreakNode, $createRangeSelection, $setSelection, COMMAND_PRIORITY_HIGH, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, KEY_ENTER_COMMAND, $createNodeSelection, $isNodeSelection, getDOMSelection, CLICK_COMMAND, KEY_BACKSPACE_COMMAND, PASTE_COMMAND, ParagraphNode, $createLineBreakNode, isDOMNode } from "lexical";
26
+ import { createCommand, DecoratorNode, createEditor, $applyNodeReplacement, $insertNodes, $isRootOrShadowRoot, $createParagraphNode, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection, $getNearestNodeFromDOMNode, isHTMLElement as isHTMLElement$1, TextNode, $getRoot, $createTextNode, $getNodeByKey, $isParagraphNode, $isTextNode, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, KEY_DOWN_COMMAND, COMMAND_PRIORITY_CRITICAL, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, $isElementNode, SELECTION_CHANGE_COMMAND, UNDO_COMMAND, REDO_COMMAND, KEY_SPACE_COMMAND, $isLineBreakNode, $createRangeSelection, $setSelection, COMMAND_PRIORITY_HIGH, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, KEY_ENTER_COMMAND, $createNodeSelection, $isNodeSelection, PASTE_COMMAND, getDOMSelection, CLICK_COMMAND, KEY_BACKSPACE_COMMAND, ParagraphNode, $createLineBreakNode, isDOMNode } from "lexical";
28
27
  import * as ReactDOM from "react-dom";
29
28
  import ReactDOM__default, { createPortal } from "react-dom";
30
29
  import { $isCodeNode, CodeNode, normalizeCodeLang, getLanguageFriendlyName, CodeHighlightNode, CODE_LANGUAGE_MAP, $createCodeNode, registerCodeHighlighting, $isCodeHighlightNode } from "@lexical/code";
@@ -40,7 +39,6 @@ import InsertDriveFileIcon from "@mui/icons-material/InsertDriveFile";
40
39
  import PictureAsPdfIcon from "@mui/icons-material/PictureAsPdf";
41
40
  import { $isDecoratorBlockNode } from "@lexical/react/LexicalDecoratorBlockNode";
42
41
  import EmojiPicker from "emoji-picker-react";
43
- import { Link as Link$1, CropOriginal, Code as Code$1, FormatAlignLeft, FormatAlignCenter, FormatAlignRight, OpenInNew, Delete, ContentCopy } from "@mui/icons-material";
44
42
  import { LinkPlugin as LinkPlugin$1 } from "@lexical/react/LexicalLinkPlugin";
45
43
  import { useBasicTypeaheadTriggerMatch, LexicalTypeaheadMenuPlugin, MenuOption } from "@lexical/react/LexicalTypeaheadMenuPlugin";
46
44
  import { useLexicalEditable } from "@lexical/react/useLexicalEditable";
@@ -277,6 +275,130 @@ const editorConfig = {
277
275
  ],
278
276
  mentionUserList: []
279
277
  };
278
+ const isReactNativeWebView = () => {
279
+ return typeof window !== "undefined" && !!window.ReactNativeWebView;
280
+ };
281
+ const useReactNativeBridge = (config = {}) => {
282
+ const {
283
+ enabled = true,
284
+ onReady,
285
+ onContentChange,
286
+ onAuthSuccess,
287
+ onAuthError,
288
+ onFocus,
289
+ onBlur,
290
+ onHeightChange
291
+ } = config;
292
+ const isActive = enabled && isReactNativeWebView();
293
+ const hasNotifiedReady = useRef(false);
294
+ const lastHeight = useRef(0);
295
+ const postMessage = useCallback(
296
+ (type, payload) => {
297
+ var _a;
298
+ if (!isActive)
299
+ return;
300
+ const message = { type, payload };
301
+ try {
302
+ (_a = window.ReactNativeWebView) == null ? void 0 : _a.postMessage(JSON.stringify(message));
303
+ } catch (error) {
304
+ console.warn("[ReactNativeBridge] Failed to post message:", error);
305
+ }
306
+ },
307
+ [isActive]
308
+ );
309
+ const notifyReady = useCallback(() => {
310
+ if (hasNotifiedReady.current)
311
+ return;
312
+ hasNotifiedReady.current = true;
313
+ postMessage("EDITOR_READY", { ready: true, timestamp: Date.now() });
314
+ onReady == null ? void 0 : onReady();
315
+ }, [postMessage, onReady]);
316
+ const notifyContentChange = useCallback(
317
+ (content) => {
318
+ postMessage("CONTENT_CHANGE", { content });
319
+ onContentChange == null ? void 0 : onContentChange(content);
320
+ },
321
+ [postMessage, onContentChange]
322
+ );
323
+ const notifyAuthSuccess = useCallback(() => {
324
+ postMessage("AUTH_SUCCESS");
325
+ onAuthSuccess == null ? void 0 : onAuthSuccess();
326
+ }, [postMessage, onAuthSuccess]);
327
+ const notifyAuthError = useCallback(
328
+ (error) => {
329
+ postMessage("AUTH_ERROR", { error });
330
+ onAuthError == null ? void 0 : onAuthError(error);
331
+ },
332
+ [postMessage, onAuthError]
333
+ );
334
+ const notifyFocus = useCallback(() => {
335
+ postMessage("FOCUS");
336
+ onFocus == null ? void 0 : onFocus();
337
+ }, [postMessage, onFocus]);
338
+ const notifyBlur = useCallback(() => {
339
+ postMessage("BLUR");
340
+ onBlur == null ? void 0 : onBlur();
341
+ }, [postMessage, onBlur]);
342
+ const notifyHeightChange = useCallback(
343
+ (height) => {
344
+ if (height === lastHeight.current)
345
+ return;
346
+ lastHeight.current = height;
347
+ postMessage("HEIGHT_CHANGE", { height });
348
+ onHeightChange == null ? void 0 : onHeightChange(height);
349
+ },
350
+ [postMessage, onHeightChange]
351
+ );
352
+ const notifyError = useCallback(
353
+ (message, details) => {
354
+ postMessage("ERROR", { message, ...details });
355
+ },
356
+ [postMessage]
357
+ );
358
+ useEffect$1(() => {
359
+ if (!isActive)
360
+ return;
361
+ const handleMessage = (event) => {
362
+ var _a;
363
+ try {
364
+ const data = typeof event.data === "string" ? JSON.parse(event.data) : event.data;
365
+ switch (data.type) {
366
+ case "SET_CONTENT":
367
+ window.dispatchEvent(
368
+ new CustomEvent("rn-set-content", {
369
+ detail: { content: (_a = data.payload) == null ? void 0 : _a.content }
370
+ })
371
+ );
372
+ break;
373
+ case "GET_CONTENT":
374
+ window.dispatchEvent(new CustomEvent("rn-get-content"));
375
+ break;
376
+ case "SET_FOCUS":
377
+ window.dispatchEvent(new CustomEvent("rn-set-focus"));
378
+ break;
379
+ case "BLUR":
380
+ window.dispatchEvent(new CustomEvent("rn-blur"));
381
+ break;
382
+ }
383
+ } catch {
384
+ }
385
+ };
386
+ window.addEventListener("message", handleMessage);
387
+ return () => window.removeEventListener("message", handleMessage);
388
+ }, [isActive]);
389
+ return {
390
+ isActive,
391
+ postMessage,
392
+ notifyReady,
393
+ notifyContentChange,
394
+ notifyAuthSuccess,
395
+ notifyAuthError,
396
+ notifyFocus,
397
+ notifyBlur,
398
+ notifyHeightChange,
399
+ notifyError
400
+ };
401
+ };
280
402
  const autocomplete = "";
281
403
  function __insertCSS(code) {
282
404
  if (!code || typeof document == "undefined")
@@ -1481,7 +1603,7 @@ const AiTextTransform = async ({ content, apiKey }) => {
1481
1603
  const AI_ACTION_COMMAND = createCommand(
1482
1604
  "AI_ACTION_COMMAND"
1483
1605
  );
1484
- const ImageView = React__default.lazy(() => import("./index-c26337f6.js"));
1606
+ const ImageView = React__default.lazy(() => import("./index-433130d7.js"));
1485
1607
  function isGoogleDocCheckboxImg(img) {
1486
1608
  return img.parentElement != null && img.parentElement.tagName === "LI" && img.previousSibling === null && img.getAttribute("aria-roledescription") === "checkbox";
1487
1609
  }
@@ -7261,6 +7383,16 @@ const Code = createLucideIcon("Code", [
7261
7383
  ["polyline", { points: "16 18 22 12 16 6", key: "z7tu5w" }],
7262
7384
  ["polyline", { points: "8 6 2 12 8 18", key: "1eg1df" }]
7263
7385
  ]);
7386
+ /**
7387
+ * @license lucide-react v0.344.0 - ISC
7388
+ *
7389
+ * This source code is licensed under the ISC license.
7390
+ * See the LICENSE file in the root directory of this source tree.
7391
+ */
7392
+ const Copy = createLucideIcon("Copy", [
7393
+ ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
7394
+ ["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" }]
7395
+ ]);
7264
7396
  /**
7265
7397
  * @license lucide-react v0.344.0 - ISC
7266
7398
  *
@@ -7922,6 +8054,16 @@ const Undo = createLucideIcon("Undo", [
7922
8054
  ["path", { d: "M3 7v6h6", key: "1v2h90" }],
7923
8055
  ["path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13", key: "1r6uu6" }]
7924
8056
  ]);
8057
+ /**
8058
+ * @license lucide-react v0.344.0 - ISC
8059
+ *
8060
+ * This source code is licensed under the ISC license.
8061
+ * See the LICENSE file in the root directory of this source tree.
8062
+ */
8063
+ const UserRound = createLucideIcon("UserRound", [
8064
+ ["circle", { cx: "12", cy: "8", r: "5", key: "1hypcn" }],
8065
+ ["path", { d: "M20 21a8 8 0 0 0-16 0", key: "rfgkzh" }]
8066
+ ]);
7925
8067
  /**
7926
8068
  * @license lucide-react v0.344.0 - ISC
7927
8069
  *
@@ -10192,7 +10334,7 @@ const Card = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
10192
10334
  {
10193
10335
  ref,
10194
10336
  className: cn(
10195
- "rounded-xl border bg-card text-card-foreground shadow",
10337
+ "cteditor-rounded-xl cteditor-border cteditor-bg-card cteditor-text-card-foreground cteditor-shadow",
10196
10338
  className
10197
10339
  ),
10198
10340
  ...props
@@ -10203,7 +10345,7 @@ const CardHeader = React$1.forwardRef(({ className, ...props }, ref) => /* @__PU
10203
10345
  "div",
10204
10346
  {
10205
10347
  ref,
10206
- className: cn("flex flex-col space-y-1.5 p-6", className),
10348
+ className: cn("cteditor-flex cteditor-flex-col cteditor-space-y-1.5 cteditor-p-6", className),
10207
10349
  ...props
10208
10350
  }
10209
10351
  ));
@@ -10212,7 +10354,7 @@ const CardTitle = React$1.forwardRef(({ className, ...props }, ref) => /* @__PUR
10212
10354
  "div",
10213
10355
  {
10214
10356
  ref,
10215
- className: cn("font-semibold leading-none tracking-tight", className),
10357
+ className: cn("cteditor-font-semibold cteditor-leading-none cteditor-tracking-tight", className),
10216
10358
  ...props
10217
10359
  }
10218
10360
  ));
@@ -10221,18 +10363,18 @@ const CardDescription = React$1.forwardRef(({ className, ...props }, ref) => /*
10221
10363
  "div",
10222
10364
  {
10223
10365
  ref,
10224
- className: cn("text-sm text-muted-foreground", className),
10366
+ className: cn("cteditor-text-sm cteditor-text-muted-foreground", className),
10225
10367
  ...props
10226
10368
  }
10227
10369
  ));
10228
10370
  CardDescription.displayName = "CardDescription";
10229
- const CardContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
10371
+ const CardContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("cteditor-p-6 cteditor-pt-0", className), ...props }));
10230
10372
  CardContent.displayName = "CardContent";
10231
10373
  const CardFooter = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
10232
10374
  "div",
10233
10375
  {
10234
10376
  ref,
10235
- className: cn("flex items-center p-6 pt-0", className),
10377
+ className: cn("cteditor-flex cteditor-items-center cteditor-p-6 cteditor-pt-0", className),
10236
10378
  ...props
10237
10379
  }
10238
10380
  ));
@@ -11211,7 +11353,7 @@ const CommentSidebar = ({
11211
11353
  Card,
11212
11354
  {
11213
11355
  className: "cteditor-transition-all cteditor-duration-200 hover:cteditor-shadow-md cteditor-border cteditor-rounded-lg cteditor-border-foreground/15",
11214
- children: /* @__PURE__ */ jsxs(CardContent, { className: "cteditor-p-4", children: [
11356
+ children: /* @__PURE__ */ jsxs(CardContent, { className: "!cteditor-p-4", children: [
11215
11357
  /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-start cteditor-justify-between cteditor-mb-3", children: [
11216
11358
  /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-2", children: [
11217
11359
  /* @__PURE__ */ jsx(Avatar, { className: "cteditor-h-6 cteditor-w-6", children: /* @__PURE__ */ jsx(AvatarFallback, { className: "cteditor-text-xs", children: comment.author.charAt(0) }) }),
@@ -14477,7 +14619,7 @@ const HtmlViewDisplay = () => {
14477
14619
  onBlur: handleTextareaBlur,
14478
14620
  onClick: handleTextareaClick,
14479
14621
  onKeyDown: handleTextareaKeyDown,
14480
- className: " cteditor-w-full cteditor-flex-1\n cteditor-font-mono cteditor-text-[13px] \n cteditor-p-3 \n cteditor-border cteditor-rounded-lg \n cteditor-resize-y cteditor-leading-[1.4] \n cteditor-outline-none cteditor-transition-colors cteditor-duration-200 \n cteditor-whitespace-pre-wrap cteditor-break-words\n",
14622
+ className: " cteditor-w-full cteditor-flex-1\n cteditor-font-mono cteditor-text-[13px] \n cteditor-p-3 \n cteditor-border cteditor-rounded-lg \n cteditor-resize-y cteditor-leading-[1.4] \n cteditor-outline-none cteditor-transition-colors cteditor-duration-200 \n cteditor-whitespace-pre-wrap cteditor-break-words\n dark:cteditor-text-background\n cteditor-text-foreground\n cteditor-bg-foreground/5\n",
14481
14623
  placeholder: "HTML content will appear here... Edit and click 'Sync to Editor' to apply changes."
14482
14624
  }
14483
14625
  )
@@ -14641,14 +14783,18 @@ function $createCommentNode({
14641
14783
  );
14642
14784
  }
14643
14785
  class EmbedNode extends DecoratorNode {
14644
- constructor(url, displayType = "embed", alignment = "left", key) {
14786
+ constructor(url, displayType = "embed", alignment = "left", width = 560, height = 315, key) {
14645
14787
  super(key);
14646
14788
  __publicField(this, "__url");
14647
14789
  __publicField(this, "__displayType");
14648
14790
  __publicField(this, "__alignment");
14791
+ __publicField(this, "__width");
14792
+ __publicField(this, "__height");
14649
14793
  this.__url = url;
14650
14794
  this.__displayType = displayType;
14651
14795
  this.__alignment = alignment;
14796
+ this.__width = width;
14797
+ this.__height = height;
14652
14798
  }
14653
14799
  static getType() {
14654
14800
  return "embed";
@@ -14660,6 +14806,8 @@ class EmbedNode extends DecoratorNode {
14660
14806
  node.__url,
14661
14807
  node.__displayType,
14662
14808
  node.__alignment,
14809
+ node.__width,
14810
+ node.__height,
14663
14811
  node.getKey()
14664
14812
  );
14665
14813
  }
@@ -14678,7 +14826,9 @@ class EmbedNode extends DecoratorNode {
14678
14826
  return new EmbedNode(
14679
14827
  serializedNode.url,
14680
14828
  serializedNode.displayType || "embed",
14681
- serializedNode.alignment || "left"
14829
+ serializedNode.alignment || "left",
14830
+ serializedNode.width || 560,
14831
+ serializedNode.height || 315
14682
14832
  );
14683
14833
  }
14684
14834
  // Exports the node to JSON format
@@ -14688,9 +14838,213 @@ class EmbedNode extends DecoratorNode {
14688
14838
  url: this.__url,
14689
14839
  displayType: this.__displayType,
14690
14840
  alignment: this.__alignment,
14841
+ width: this.__width,
14842
+ height: this.__height,
14691
14843
  version: 1
14692
14844
  };
14693
14845
  }
14846
+ // Exports the node to HTML DOM for preview/export
14847
+ exportDOM() {
14848
+ const url = this.__url;
14849
+ const displayType = this.__displayType;
14850
+ const alignment = this.__alignment;
14851
+ const width = this.__width;
14852
+ const height = this.__height;
14853
+ const wrapper = document.createElement("div");
14854
+ wrapper.className = "embed-export-wrapper";
14855
+ wrapper.style.display = "flex";
14856
+ wrapper.style.width = "100%";
14857
+ wrapper.style.justifyContent = alignment === "left" ? "flex-start" : alignment === "center" ? "center" : "flex-end";
14858
+ wrapper.style.margin = "8px 0";
14859
+ const getYouTubeVideoId = (videoUrl) => {
14860
+ try {
14861
+ const urlObj = new URL(videoUrl);
14862
+ return urlObj.searchParams.get("v") || videoUrl.split("/").pop() || null;
14863
+ } catch {
14864
+ return null;
14865
+ }
14866
+ };
14867
+ if (displayType === "url") {
14868
+ const link = document.createElement("a");
14869
+ link.href = url;
14870
+ link.target = "_blank";
14871
+ link.rel = "noopener noreferrer";
14872
+ link.textContent = url;
14873
+ link.style.color = "#1976d2";
14874
+ link.style.textDecoration = "none";
14875
+ link.style.padding = "8px 12px";
14876
+ link.style.display = "block";
14877
+ wrapper.appendChild(link);
14878
+ return { element: wrapper };
14879
+ }
14880
+ if (displayType === "card") {
14881
+ const card = document.createElement("div");
14882
+ card.style.width = "300px";
14883
+ card.style.border = "1px solid #ccc";
14884
+ card.style.borderRadius = "4px";
14885
+ card.style.overflow = "hidden";
14886
+ card.style.background = "#f9f9f9";
14887
+ if (url.includes("youtube.com") || url.includes("youtu.be") || url.includes("vimeo.com") || url.includes("loom.com")) {
14888
+ const thumbnailContainer = document.createElement("div");
14889
+ thumbnailContainer.style.position = "relative";
14890
+ thumbnailContainer.style.width = "100%";
14891
+ thumbnailContainer.style.height = "150px";
14892
+ thumbnailContainer.style.overflow = "hidden";
14893
+ const thumbnail = document.createElement("img");
14894
+ thumbnail.style.width = "100%";
14895
+ thumbnail.style.height = "100%";
14896
+ thumbnail.style.objectFit = "cover";
14897
+ if (url.includes("youtube.com") || url.includes("youtu.be")) {
14898
+ const videoId = getYouTubeVideoId(url);
14899
+ thumbnail.src = `https://img.youtube.com/vi/${videoId}/hqdefault.jpg`;
14900
+ thumbnail.alt = "YouTube Video";
14901
+ } else if (url.includes("vimeo.com")) {
14902
+ const vimeoId = url.split("/").pop();
14903
+ thumbnail.src = `https://vumbnail.com/${vimeoId}.jpg`;
14904
+ thumbnail.alt = "Vimeo Video";
14905
+ } else if (url.includes("loom.com")) {
14906
+ thumbnail.src = "https://cdn.loom.com/assets/marketing-pages/favicon-loom.png";
14907
+ thumbnail.alt = "Loom Video";
14908
+ thumbnail.style.objectFit = "contain";
14909
+ thumbnail.style.padding = "20px";
14910
+ thumbnail.style.background = "#625df5";
14911
+ }
14912
+ thumbnailContainer.appendChild(thumbnail);
14913
+ card.appendChild(thumbnailContainer);
14914
+ }
14915
+ const urlContainer = document.createElement("div");
14916
+ urlContainer.style.padding = "8px 12px";
14917
+ urlContainer.style.fontSize = "12px";
14918
+ urlContainer.style.color = "#666";
14919
+ urlContainer.style.whiteSpace = "nowrap";
14920
+ urlContainer.style.overflow = "hidden";
14921
+ urlContainer.style.textOverflow = "ellipsis";
14922
+ const link = document.createElement("a");
14923
+ link.href = url;
14924
+ link.target = "_blank";
14925
+ link.rel = "noopener noreferrer";
14926
+ link.textContent = url;
14927
+ link.style.color = "#1976d2";
14928
+ link.style.textDecoration = "none";
14929
+ urlContainer.appendChild(link);
14930
+ card.appendChild(urlContainer);
14931
+ wrapper.appendChild(card);
14932
+ return { element: wrapper };
14933
+ }
14934
+ const container = document.createElement("div");
14935
+ container.style.position = "relative";
14936
+ container.style.display = "inline-flex";
14937
+ container.style.justifyContent = "center";
14938
+ container.style.alignItems = "center";
14939
+ container.style.width = `${width}px`;
14940
+ container.style.height = `${height}px`;
14941
+ container.style.border = "1px solid #ccc";
14942
+ container.style.borderRadius = "4px";
14943
+ container.style.overflow = "hidden";
14944
+ container.style.background = "#f9f9f9";
14945
+ if (url.includes("youtube.com") || url.includes("youtu.be")) {
14946
+ const videoId = getYouTubeVideoId(url);
14947
+ const iframe = document.createElement("iframe");
14948
+ iframe.width = "100%";
14949
+ iframe.height = "100%";
14950
+ iframe.src = `https://www.youtube.com/embed/${videoId}`;
14951
+ iframe.title = "YouTube video player";
14952
+ iframe.frameBorder = "0";
14953
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture";
14954
+ iframe.allowFullscreen = true;
14955
+ container.appendChild(iframe);
14956
+ } else if (url.includes("vimeo.com")) {
14957
+ const vimeoId = url.split("/").pop();
14958
+ const iframe = document.createElement("iframe");
14959
+ iframe.width = "100%";
14960
+ iframe.height = "100%";
14961
+ iframe.src = `https://player.vimeo.com/video/${vimeoId}`;
14962
+ iframe.title = "Vimeo video player";
14963
+ iframe.frameBorder = "0";
14964
+ iframe.allow = "autoplay; fullscreen; picture-in-picture";
14965
+ iframe.allowFullscreen = true;
14966
+ container.appendChild(iframe);
14967
+ } else if (url.includes("loom.com")) {
14968
+ const iframe = document.createElement("iframe");
14969
+ iframe.width = "100%";
14970
+ iframe.height = "100%";
14971
+ iframe.src = url.replace("/share/", "/embed/");
14972
+ iframe.title = "Loom video player";
14973
+ iframe.frameBorder = "0";
14974
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture";
14975
+ iframe.allowFullscreen = true;
14976
+ container.appendChild(iframe);
14977
+ } else if (url.includes("supercut.video")) {
14978
+ const urlParts = url.split("/");
14979
+ const username = urlParts[urlParts.length - 2];
14980
+ const supercutId = urlParts[urlParts.length - 1];
14981
+ const embedUrl = `https://supercut.video/embed/${username}/${supercutId}`;
14982
+ const iframe = document.createElement("iframe");
14983
+ iframe.width = "100%";
14984
+ iframe.height = "100%";
14985
+ iframe.src = embedUrl;
14986
+ iframe.title = "Supercut video player";
14987
+ iframe.frameBorder = "0";
14988
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture";
14989
+ iframe.allowFullscreen = true;
14990
+ container.appendChild(iframe);
14991
+ } else if (url.includes("jam.dev")) {
14992
+ const jamId = url.split("/").pop();
14993
+ const embedUrl = `https://jam.dev/video/${jamId}`;
14994
+ const iframe = document.createElement("iframe");
14995
+ iframe.width = "100%";
14996
+ iframe.height = "100%";
14997
+ iframe.src = embedUrl;
14998
+ iframe.title = "Jam video player";
14999
+ iframe.frameBorder = "0";
15000
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture";
15001
+ iframe.allowFullscreen = true;
15002
+ container.appendChild(iframe);
15003
+ } else if (url.match(/\.(mp4|webm|ogg)$/i)) {
15004
+ const video = document.createElement("video");
15005
+ video.width = 560;
15006
+ video.height = 315;
15007
+ video.controls = true;
15008
+ video.src = url;
15009
+ video.style.maxWidth = "100%";
15010
+ container.appendChild(video);
15011
+ } else if (url.includes("figma.com")) {
15012
+ const link = document.createElement("a");
15013
+ link.href = url;
15014
+ link.target = "_blank";
15015
+ link.rel = "noopener noreferrer";
15016
+ link.style.display = "flex";
15017
+ link.style.alignItems = "center";
15018
+ link.style.justifyContent = "center";
15019
+ link.style.width = "100%";
15020
+ link.style.height = "100%";
15021
+ link.style.textDecoration = "none";
15022
+ const img = document.createElement("img");
15023
+ img.src = "https://static.figma.com/app/icon/1/favicon.png";
15024
+ img.alt = "Open in Figma";
15025
+ img.style.width = "48px";
15026
+ img.style.height = "48px";
15027
+ img.style.objectFit = "contain";
15028
+ link.appendChild(img);
15029
+ container.appendChild(link);
15030
+ container.style.width = "100px";
15031
+ container.style.height = "100px";
15032
+ } else {
15033
+ const link = document.createElement("a");
15034
+ link.href = url;
15035
+ link.target = "_blank";
15036
+ link.rel = "noopener noreferrer";
15037
+ link.textContent = url;
15038
+ link.style.color = "#1976d2";
15039
+ link.style.textDecoration = "none";
15040
+ link.style.padding = "20px";
15041
+ container.appendChild(link);
15042
+ container.style.width = "auto";
15043
+ container.style.height = "auto";
15044
+ }
15045
+ wrapper.appendChild(container);
15046
+ return { element: wrapper };
15047
+ }
14694
15048
  // Getters and setters for properties
14695
15049
  getURL() {
14696
15050
  return this.__url;
@@ -14709,6 +15063,17 @@ class EmbedNode extends DecoratorNode {
14709
15063
  const self2 = this.getWritable();
14710
15064
  self2.__alignment = alignment;
14711
15065
  }
15066
+ getWidth() {
15067
+ return this.__width;
15068
+ }
15069
+ getHeight() {
15070
+ return this.__height;
15071
+ }
15072
+ setDimensions(width, height) {
15073
+ const self2 = this.getWritable();
15074
+ self2.__width = width;
15075
+ self2.__height = height;
15076
+ }
14712
15077
  // Returns the JSX component that should be rendered inside this node
14713
15078
  decorate() {
14714
15079
  return /* @__PURE__ */ jsx(
@@ -14717,13 +15082,15 @@ class EmbedNode extends DecoratorNode {
14717
15082
  url: this.__url,
14718
15083
  displayType: this.__displayType,
14719
15084
  alignment: this.__alignment,
15085
+ width: this.__width,
15086
+ height: this.__height,
14720
15087
  nodeKey: this.getKey()
14721
15088
  }
14722
15089
  );
14723
15090
  }
14724
15091
  }
14725
- function $createEmbedNode(url, displayType = "embed", alignment = "left") {
14726
- return new EmbedNode(url, displayType, alignment);
15092
+ function $createEmbedNode(url, displayType = "embed", alignment = "left", width = 560, height = 315) {
15093
+ return new EmbedNode(url, displayType, alignment, width, height);
14727
15094
  }
14728
15095
  const getFileIcon = (url) => {
14729
15096
  const lower = url.toLowerCase();
@@ -14756,12 +15123,15 @@ const getFileIcon = (url) => {
14756
15123
  return fallbackIcon;
14757
15124
  }
14758
15125
  };
14759
- const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
14760
- const [dimensions, setDimensions] = useState$1({ width: 200, height: 200 });
15126
+ const EmbedComponent = ({ url, displayType, alignment, width: initialWidth, height: initialHeight, nodeKey }) => {
15127
+ const [dimensions, setDimensions] = useState$1({ width: initialWidth, height: initialHeight });
14761
15128
  const containerRef = useRef(null);
14762
15129
  const [editor] = useLexicalComposerContext();
14763
15130
  const [videoTitle, setVideoTitle] = useState$1("");
14764
15131
  const [thumbnailUrl, setThumbnailUrl] = useState$1("");
15132
+ useEffect$1(() => {
15133
+ setDimensions({ width: initialWidth, height: initialHeight });
15134
+ }, [initialWidth, initialHeight]);
14765
15135
  useEffect$1(() => {
14766
15136
  const fetchVideoInfo = async () => {
14767
15137
  try {
@@ -14902,7 +15272,7 @@ const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
14902
15272
  if (node) {
14903
15273
  console.log("Selecting node");
14904
15274
  node.selectNext();
14905
- const isVideoEmbed = url.includes("youtube.com") || url.includes("youtu.be") || url.includes("loom.com") || url.includes("vimeo.com") || url.includes("supercut.video");
15275
+ const isVideoEmbed = url.includes("youtube.com") || url.includes("youtu.be") || url.includes("loom.com") || url.includes("vimeo.com") || url.includes("supercut.video") || url.includes("jam.dev");
14906
15276
  if (isVideoEmbed) {
14907
15277
  const event = new CustomEvent("embedNodeSelected", {
14908
15278
  detail: {
@@ -14925,16 +15295,24 @@ const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
14925
15295
  const startY = e.clientY;
14926
15296
  const startWidth = dimensions.width;
14927
15297
  const startHeight = dimensions.height;
15298
+ let finalWidth = startWidth;
15299
+ let finalHeight = startHeight;
14928
15300
  const handleMouseMove = (event) => {
14929
15301
  requestAnimationFrame(() => {
14930
- const newWidth = Math.max(50, startWidth + (event.clientX - startX));
14931
- const newHeight = Math.max(50, startHeight + (event.clientY - startY));
14932
- setDimensions({ width: newWidth, height: newHeight });
15302
+ finalWidth = Math.max(50, startWidth + (event.clientX - startX));
15303
+ finalHeight = Math.max(50, startHeight + (event.clientY - startY));
15304
+ setDimensions({ width: finalWidth, height: finalHeight });
14933
15305
  });
14934
15306
  };
14935
15307
  const handleMouseUp = () => {
14936
15308
  document.removeEventListener("mousemove", handleMouseMove);
14937
15309
  document.removeEventListener("mouseup", handleMouseUp);
15310
+ editor.update(() => {
15311
+ const node = $getNodeByKey(nodeKey);
15312
+ if (node && node instanceof EmbedNode) {
15313
+ node.setDimensions(finalWidth, finalHeight);
15314
+ }
15315
+ });
14938
15316
  };
14939
15317
  document.addEventListener("mousemove", handleMouseMove);
14940
15318
  document.addEventListener("mouseup", handleMouseUp);
@@ -14969,7 +15347,7 @@ const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
14969
15347
  );
14970
15348
  }
14971
15349
  if (displayType === "card") {
14972
- if (url.includes("youtube.com") || url.includes("youtu.be") || url.includes("vimeo.com") || url.includes("loom.com") || url.includes("supercut.video")) {
15350
+ if (url.includes("youtube.com") || url.includes("youtu.be") || url.includes("vimeo.com") || url.includes("loom.com") || url.includes("supercut.video") || url.includes("jam.dev")) {
14973
15351
  let placeholderImage = "https://placehold.co/300x150/f0f0f0/666666?text=Video";
14974
15352
  let videoType = "";
14975
15353
  if (url.includes("youtube.com") || url.includes("youtu.be")) {
@@ -14984,6 +15362,9 @@ const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
14984
15362
  } else if (url.includes("supercut.video")) {
14985
15363
  placeholderImage = "https://placehold.co/300x150/00a8ff/ffffff?text=Supercut";
14986
15364
  videoType = "Supercut";
15365
+ } else if (url.includes("jam.dev")) {
15366
+ placeholderImage = "https://placehold.co/300x150/7c3aed/ffffff?text=Jam";
15367
+ videoType = "Jam";
14987
15368
  }
14988
15369
  const displayTitle = videoTitle || `${videoType} Video`;
14989
15370
  console.log("Rendering card with:", {
@@ -15193,6 +15574,21 @@ const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
15193
15574
  allowFullScreen: true
15194
15575
  }
15195
15576
  );
15577
+ } else if (url.includes("jam.dev")) {
15578
+ const jamId = url.split("/").pop();
15579
+ const embedUrl = `https://jam.dev/video/${jamId}`;
15580
+ return /* @__PURE__ */ jsx(
15581
+ "iframe",
15582
+ {
15583
+ width: "100%",
15584
+ height: "100%",
15585
+ src: embedUrl,
15586
+ title: "Jam video player",
15587
+ frameBorder: "0",
15588
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
15589
+ allowFullScreen: true
15590
+ }
15591
+ );
15196
15592
  } else if (url.includes("figma.com")) {
15197
15593
  return /* @__PURE__ */ jsx(
15198
15594
  "a",
@@ -15404,7 +15800,7 @@ const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
15404
15800
  },
15405
15801
  className: getContainerClass(),
15406
15802
  "data-lexical-node-key": nodeKey,
15407
- "data-embed-type": url.includes("youtube.com") || url.includes("youtu.be") ? "youtube" : url.includes("loom.com") ? "loom" : url.includes("vimeo.com") ? "vimeo" : "other",
15803
+ "data-embed-type": url.includes("youtube.com") || url.includes("youtu.be") ? "youtube" : url.includes("loom.com") ? "loom" : url.includes("vimeo.com") ? "vimeo" : url.includes("jam.dev") ? "jam" : url.includes("supercut.video") ? "supercut" : "other",
15408
15804
  onClick: handleContainerClick,
15409
15805
  children: [
15410
15806
  renderContent(),
@@ -15429,7 +15825,7 @@ const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
15429
15825
  }
15430
15826
  );
15431
15827
  };
15432
- const FileComponent = React$1.lazy(() => import("./index-03cae849.js"));
15828
+ const FileComponent = React$1.lazy(() => import("./index-0b30b971.js"));
15433
15829
  function convertFileElement(domNode) {
15434
15830
  if (domNode instanceof HTMLDivElement) {
15435
15831
  const dataUrl = domNode.getAttribute("data-lexical-file-src");
@@ -19418,7 +19814,7 @@ Text to transform:
19418
19814
  /* @__PURE__ */ jsxs("div", { className: "cteditor-min-w-[160px]", children: [
19419
19815
  /* @__PURE__ */ jsx("label", { className: "cteditor-block cteditor-text-xs cteditor-text-muted-foreground cteditor-mb-1", children: "AI Provider" }),
19420
19816
  /* @__PURE__ */ jsx("div", { className: "cteditor-relative", children: /* @__PURE__ */ jsxs(Select, { value: provider, onValueChange: (v2) => setProvider(v2), children: [
19421
- /* @__PURE__ */ jsx(SelectTrigger, { className: "w-full", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select provider" }) }),
19817
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "cteditor-w-full", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select provider" }) }),
19422
19818
  /* @__PURE__ */ jsxs(SelectContent, { children: [
19423
19819
  /* @__PURE__ */ jsx(SelectItem, { value: "chatgpt", children: "OpenAI ChatGPT" }),
19424
19820
  /* @__PURE__ */ jsx(SelectItem, { value: "claude", children: "Anthropic Claude" }),
@@ -19487,7 +19883,7 @@ Text to transform:
19487
19883
  }
19488
19884
  },
19489
19885
  className: `cteditor-w-full cteditor-block cteditor-transition-all cteditor-bg-background cteditor-rounded-md cteditor-resize-none cteditor-border cteditor-border-foreground/15 cteditor-outline-0 cteditor-p-2 cteditor-min-h-16 cteditor-text-xs cteditor-overflow-clip
19490
- ${isRecording ? "" : "cteditor-pr-12"}
19886
+ ${isRecording ? "" : "cteditor-max-h-[57vh] cteditor-overflow-y-auto"}
19491
19887
  ${isRecording && !isPaused ? "!cteditor-border-rose-400" : ""}
19492
19888
  ${isPaused ? "!cteditor-border-amber-400" : ""}
19493
19889
  `
@@ -19537,22 +19933,22 @@ Text to transform:
19537
19933
  /* @__PURE__ */ jsx("span", { className: "cteditor-text-red-600 dark:cteditor-text-red-400", children: "⚠️" }),
19538
19934
  /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm cteditor-text-red-700 dark:cteditor-text-red-300", children: voiceError })
19539
19935
  ] }) }),
19540
- errorMessage && /* @__PURE__ */ jsx("div", { className: "p-3 rounded-lg bg-destructive/10 border border-destructive/20", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
19541
- /* @__PURE__ */ jsx("span", { className: "text-destructive", children: "⚠️" }),
19542
- /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: errorMessage })
19936
+ errorMessage && /* @__PURE__ */ jsx("div", { className: "cteditor-p-3 cteditor-rounded-lg cteditor-bg-destructive/10 cteditor-border cteditor-border-destructive/20", children: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-2", children: [
19937
+ /* @__PURE__ */ jsx("span", { className: "cteditor-text-destructive", children: "⚠️" }),
19938
+ /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm cteditor-text-destructive", children: errorMessage })
19543
19939
  ] }) }),
19544
- isLoading && /* @__PURE__ */ jsx("div", { className: "p-4 rounded-lg bg-gray-100 dark:bg-gray-900/50 border border-gray-300 dark:border-gray-700", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
19545
- /* @__PURE__ */ jsx("div", { className: "h-5 w-5 animate-spin rounded-full border-2 border-gray-700 dark:border-gray-300 border-t-transparent" }),
19940
+ isLoading && /* @__PURE__ */ jsx("div", { className: "cteditor-p-4 cteditor-rounded-lg cteditor-bg-gray-100 dark:cteditor-bg-gray-900/50 cteditor-border cteditor-border-gray-300 dark:cteditor-border-gray-700", children: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-3", children: [
19941
+ /* @__PURE__ */ jsx("div", { className: "cteditor-h-5 cteditor-w-5 cteditor-animate-spin cteditor-rounded-full cteditor-border-2 cteditor-border-gray-700 dark:cteditor-border-gray-300 cteditor-border-t-transparent" }),
19546
19942
  /* @__PURE__ */ jsxs("div", { children: [
19547
- /* @__PURE__ */ jsxs("p", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: [
19943
+ /* @__PURE__ */ jsxs("p", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-gray-900 dark:cteditor-text-gray-100", children: [
19548
19944
  getProviderName(provider),
19549
19945
  " is thinking..."
19550
19946
  ] }),
19551
- /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600 dark:text-gray-400 mt-1", children: "This may take a few seconds. Please wait." })
19947
+ /* @__PURE__ */ jsx("p", { className: "cteditor-text-xs cteditor-text-gray-600 dark:cteditor-text-gray-400 cteditor-mt-1", children: "This may take a few seconds. Please wait." })
19552
19948
  ] })
19553
19949
  ] }) })
19554
19950
  ] }),
19555
- /* @__PURE__ */ jsxs(DialogFooter, { className: "gap-2", children: [
19951
+ /* @__PURE__ */ jsxs(DialogFooter, { className: "cteditor-gap-2", children: [
19556
19952
  /* @__PURE__ */ jsx(
19557
19953
  Button,
19558
19954
  {
@@ -19575,7 +19971,7 @@ Text to transform:
19575
19971
  disabled: isLoading,
19576
19972
  title: "Show AI prompt in the editor text area",
19577
19973
  children: [
19578
- /* @__PURE__ */ jsx(PanelBottomOpen, { size: 16 }),
19974
+ /* @__PURE__ */ jsx(PanelBottomOpen, { className: "!cteditor-size-4" }),
19579
19975
  "Show in Editor"
19580
19976
  ]
19581
19977
  }
@@ -19586,7 +19982,7 @@ Text to transform:
19586
19982
  onClick: handleSubmit,
19587
19983
  disabled: isLoading || !inputValue.trim(),
19588
19984
  children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
19589
- /* @__PURE__ */ jsx("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent mr-2" }),
19985
+ /* @__PURE__ */ jsx("div", { className: "cteditor-h-4 cteditor-w-4 cteditor-animate-spin cteditor-rounded-full cteditor-border-2 cteditor-border-white cteditor-border-t-transparent cteditor-mr-2" }),
19590
19986
  "Processing..."
19591
19987
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
19592
19988
  /* @__PURE__ */ jsx(Sparkles, {}),
@@ -19609,6 +20005,7 @@ function InlineAIPrompt({
19609
20005
  const [inputValue, setInputValue] = useState$1("");
19610
20006
  const [isLoading, setIsLoading] = useState$1(false);
19611
20007
  const [status, setStatus] = useState$1("idle");
20008
+ const [showMessage, setShowMessage] = useState$1(true);
19612
20009
  const inputRef = useRef(null);
19613
20010
  const [selectedText, setSelectedText] = useState$1(initialSelectedText);
19614
20011
  useEffect$1(() => {
@@ -19620,6 +20017,7 @@ function InlineAIPrompt({
19620
20017
  if (newSelectedText.trim() !== "") {
19621
20018
  setSelectedText(newSelectedText);
19622
20019
  setStatus("idle");
20020
+ setShowMessage(true);
19623
20021
  }
19624
20022
  }
19625
20023
  });
@@ -19712,12 +20110,14 @@ Text to transform:
19712
20110
  setInputValue("");
19713
20111
  setSelectedText("");
19714
20112
  setStatus("success");
20113
+ setShowMessage(true);
19715
20114
  } catch (error) {
19716
20115
  console.error("Error processing AI action:", error);
19717
20116
  const apiMessage = ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) ?? (error instanceof Error ? error.message : null);
19718
20117
  const safeMessage = apiMessage && !/^Request failed with status code \d+/.test(apiMessage) ? apiMessage : "Error processing your request. Please try again.";
19719
20118
  toast.error(safeMessage);
19720
20119
  setStatus("error");
20120
+ setShowMessage(true);
19721
20121
  } finally {
19722
20122
  setIsLoading(false);
19723
20123
  }
@@ -19734,164 +20134,76 @@ Text to transform:
19734
20134
  const hasSelectedText = selectedText && selectedText.trim() !== "";
19735
20135
  const isCurrentInputImageRequest = isImageGenerationRequest(inputValue);
19736
20136
  const displayText = hasSelectedText ? selectedText.length > 50 ? selectedText.substring(0, 50) + "..." : selectedText : "";
19737
- return /* @__PURE__ */ jsxs(
19738
- "div",
19739
- {
19740
- style: {
19741
- position: "absolute",
19742
- bottom: "12px",
19743
- left: "50%",
19744
- transform: "translateX(-50%)",
19745
- display: "flex",
19746
- flexDirection: "column",
19747
- gap: "8px",
19748
- backgroundColor: "#1a1a1a",
19749
- padding: "12px 16px",
19750
- borderRadius: "12px",
19751
- border: "1px solid #333",
19752
- boxShadow: "0 8px 24px rgba(0,0,0,0.4)",
19753
- zIndex: 10,
19754
- maxWidth: "500px"
19755
- },
19756
- children: [
19757
- /* @__PURE__ */ jsx(
19758
- "div",
19759
- {
19760
- style: {
19761
- display: "flex",
19762
- alignItems: "center",
19763
- gap: "8px",
19764
- padding: "6px 10px",
19765
- backgroundColor: status === "success" ? "#1a2e1a" : status === "error" ? "#2e1a1a" : hasSelectedText ? "#2a2a2a" : isCurrentInputImageRequest ? "#2a3a2a" : "#3a2a2a",
19766
- borderRadius: "6px",
19767
- fontSize: "12px",
19768
- color: "#999",
19769
- border: status === "success" ? "1px solid #3a5a3a" : status === "error" ? "1px solid #5a3a3a" : hasSelectedText ? "none" : isCurrentInputImageRequest ? "1px solid #3a5a3a" : "1px solid #5a3a3a"
19770
- },
19771
- children: status === "success" ? /* @__PURE__ */ jsx("span", { style: { color: "#4ade80" }, children: "✓ Content inserted! Select new text or enter another prompt" }) : status === "error" ? /* @__PURE__ */ jsx("span", { style: { color: "#f87171" }, children: "✗ Request failed. Try again or select different text" }) : hasSelectedText ? /* @__PURE__ */ jsxs(Fragment, { children: [
19772
- /* @__PURE__ */ jsx("span", { style: { color: "#666" }, children: "Selected:" }),
19773
- /* @__PURE__ */ jsxs("span", { style: { color: "#ccc", fontStyle: "italic" }, children: [
19774
- '"',
19775
- displayText,
19776
- '"'
19777
- ] })
19778
- ] }) : isCurrentInputImageRequest ? /* @__PURE__ */ jsx("span", { style: { color: "#4ade80" }, children: "🖼️ Image generation mode - no text selection required" }) : /* @__PURE__ */ jsx("span", { style: { color: "#f87171" }, children: "⚠ Please select some text or enter an image generation prompt" })
19779
- }
19780
- ),
19781
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "10px" }, children: [
19782
- /* @__PURE__ */ jsx(Sparkles, { size: 16, style: { color: "#fff", flexShrink: 0 } }),
19783
- /* @__PURE__ */ jsxs(
19784
- "select",
19785
- {
19786
- value: provider,
19787
- onChange: (e) => setProvider(e.target.value),
19788
- style: {
19789
- width: "100px",
19790
- height: "32px",
19791
- padding: "0 8px",
19792
- fontSize: "13px",
19793
- fontWeight: 500,
19794
- border: "1px solid #444",
19795
- borderRadius: "6px",
19796
- outline: "none",
19797
- backgroundColor: "#2a2a2a",
19798
- color: "#fff",
19799
- cursor: "pointer"
19800
- },
19801
- children: [
19802
- /* @__PURE__ */ jsx("option", { value: "chatgpt", children: "ChatGPT" }),
19803
- /* @__PURE__ */ jsx("option", { value: "claude", children: "Claude" }),
19804
- /* @__PURE__ */ jsx("option", { value: "grok", children: "Grok" })
19805
- ]
19806
- }
19807
- ),
19808
- /* @__PURE__ */ jsx(
19809
- "input",
19810
- {
19811
- ref: inputRef,
19812
- type: "text",
19813
- value: inputValue,
19814
- onChange: (e) => {
19815
- setInputValue(e.target.value);
19816
- if (status !== "idle")
19817
- setStatus("idle");
19818
- },
19819
- onKeyDown: handleKeyDown,
19820
- placeholder: hasSelectedText ? "What do you want to do with this text?" : "Generate image of... or select text",
19821
- disabled: isLoading,
19822
- style: {
19823
- width: "280px",
19824
- height: "32px",
19825
- padding: "0 12px",
19826
- fontSize: "13px",
19827
- border: "1px solid #444",
19828
- borderRadius: "6px",
19829
- outline: "none",
19830
- backgroundColor: "#2a2a2a",
19831
- color: "#fff"
19832
- }
19833
- }
19834
- ),
19835
- /* @__PURE__ */ jsx(
19836
- "button",
19837
- {
19838
- type: "button",
19839
- onClick: handleSubmit,
19840
- disabled: isLoading || !inputValue.trim(),
19841
- style: {
19842
- height: "32px",
19843
- width: "32px",
19844
- backgroundColor: "#fff",
19845
- color: "#1a1a1a",
19846
- borderRadius: "6px",
19847
- border: "none",
19848
- display: "flex",
19849
- alignItems: "center",
19850
- justifyContent: "center",
19851
- cursor: isLoading || !inputValue.trim() ? "not-allowed" : "pointer",
19852
- opacity: isLoading || !inputValue.trim() ? 0.5 : 1,
19853
- flexShrink: 0,
19854
- transition: "background-color 0.2s"
19855
- },
19856
- children: isLoading ? /* @__PURE__ */ jsx("div", { style: {
19857
- height: "14px",
19858
- width: "14px",
19859
- border: "2px solid #1a1a1a",
19860
- borderTopColor: "transparent",
19861
- borderRadius: "50%",
19862
- animation: "spin 1s linear infinite"
19863
- } }) : /* @__PURE__ */ jsx(Send, { size: 14 })
19864
- }
19865
- ),
19866
- /* @__PURE__ */ jsx(
19867
- "button",
19868
- {
19869
- type: "button",
19870
- onClick: onClose,
19871
- style: {
19872
- height: "32px",
19873
- width: "32px",
19874
- backgroundColor: "transparent",
19875
- color: "#888",
19876
- borderRadius: "6px",
19877
- border: "none",
19878
- display: "flex",
19879
- alignItems: "center",
19880
- justifyContent: "center",
19881
- cursor: "pointer",
19882
- flexShrink: 0,
19883
- transition: "color 0.2s"
19884
- },
19885
- title: "Close (Esc)",
19886
- onMouseEnter: (e) => e.currentTarget.style.color = "#fff",
19887
- onMouseLeave: (e) => e.currentTarget.style.color = "#888",
19888
- children: /* @__PURE__ */ jsx(X$1, { size: 16 })
19889
- }
19890
- )
20137
+ return /* @__PURE__ */ jsxs("div", { className: "cteditor-absolute cteditor-bottom-1 cteditor-left-1/2 cteditor--translate-x-1/2 cteditor-flex cteditor-flex-col cteditor-gap-2 cteditor-bg-[#1a1a1a] cteditor-px-2 cteditor-py-2 cteditor-rounded-md cteditor-border cteditor-border-[#333] cteditor-shadow-[0_8px_24px_rgba(0,0,0,0.4)] cteditor-z-10 cteditor-max-w-[500px]", children: [
20138
+ showMessage && /* @__PURE__ */ jsxs("div", { className: `cteditor-relative cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-pl-2.5 cteditor-pr-6 cteditor-py-1.5 cteditor-rounded-md cteditor-text-xs cteditor-text-[#999] ${status === "success" ? "cteditor-bg-[#1a2e1a] cteditor-border cteditor-border-[#3a5a3a]" : status === "error" ? "cteditor-bg-[#2e1a1a] cteditor-border cteditor-border-[#5a3a3a]" : hasSelectedText ? "cteditor-bg-[#2a2a2a]" : isCurrentInputImageRequest ? "cteditor-bg-[#2a3a2a] cteditor-border cteditor-border-[#3a5a3a]" : "cteditor-bg-[#3a2a2a] cteditor-border cteditor-border-[#5a3a3a]"}`, children: [
20139
+ status === "success" ? /* @__PURE__ */ jsx("span", { className: "cteditor-text-[#4ade80]", children: "✓ Content inserted! Select new text or enter another prompt" }) : status === "error" ? /* @__PURE__ */ jsx("span", { className: "cteditor-text-[#f87171]", children: "✗ Request failed. Try again or select different text" }) : hasSelectedText ? /* @__PURE__ */ jsxs(Fragment, { children: [
20140
+ /* @__PURE__ */ jsx("span", { className: "cteditor-text-[#666]", children: "Selected:" }),
20141
+ /* @__PURE__ */ jsxs("span", { className: "cteditor-text-[#ccc] cteditor-italic", children: [
20142
+ '"',
20143
+ displayText,
20144
+ '"'
19891
20145
  ] })
19892
- ]
19893
- }
19894
- );
20146
+ ] }) : isCurrentInputImageRequest ? /* @__PURE__ */ jsx("span", { className: "cteditor-text-[#4ade80]", children: "🖼️ Image generation mode - no text selection required" }) : /* @__PURE__ */ jsx("span", { className: "cteditor-text-[#f87171]", children: "⚠ Please select some text or enter an image generation prompt" }),
20147
+ /* @__PURE__ */ jsx(
20148
+ "button",
20149
+ {
20150
+ type: "button",
20151
+ onClick: () => setShowMessage(false),
20152
+ className: "cteditor-absolute cteditor-right-1 cteditor-top-1/2 cteditor--translate-y-1/2 cteditor-size-4 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-text-[#888] hover:cteditor-text-white cteditor-transition-colors cteditor-duration-200 cteditor-cursor-pointer",
20153
+ title: "Close message",
20154
+ children: /* @__PURE__ */ jsx(X$1, { size: 12 })
20155
+ }
20156
+ )
20157
+ ] }),
20158
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-2", children: [
20159
+ /* @__PURE__ */ jsxs(Select, { value: provider, onValueChange: (v2) => setProvider(v2), children: [
20160
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "cteditor-max-w-[90px] !cteditor-h-8 cteditor-text-xs cteditor-font-medium cteditor-border-[#444] cteditor-bg-[#2a2a2a] cteditor-text-white !cteditor-px-2 !cteditor-py-1", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select provider" }) }),
20161
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
20162
+ /* @__PURE__ */ jsx(SelectItem, { value: "chatgpt", children: "ChatGPT" }),
20163
+ /* @__PURE__ */ jsx(SelectItem, { value: "claude", children: "Claude" }),
20164
+ /* @__PURE__ */ jsx(SelectItem, { value: "grok", children: "Grok" })
20165
+ ] })
20166
+ ] }),
20167
+ /* @__PURE__ */ jsx(
20168
+ "input",
20169
+ {
20170
+ ref: inputRef,
20171
+ type: "text",
20172
+ value: inputValue,
20173
+ onChange: (e) => {
20174
+ setInputValue(e.target.value);
20175
+ if (status !== "idle")
20176
+ setStatus("idle");
20177
+ setShowMessage(true);
20178
+ },
20179
+ onKeyDown: handleKeyDown,
20180
+ placeholder: hasSelectedText ? "What do you want to do with this text?" : "Generate image of... or select text",
20181
+ disabled: isLoading,
20182
+ className: " cteditor-h-8 cteditor-px-2 cteditor-text-xs cteditor-w-full cteditor-border cteditor-border-[#444] cteditor-rounded-md cteditor-outline-none cteditor-bg-[#2a2a2a] cteditor-text-white md:cteditor-w-60"
20183
+ }
20184
+ ),
20185
+ /* @__PURE__ */ jsx(
20186
+ "button",
20187
+ {
20188
+ type: "button",
20189
+ onClick: handleSubmit,
20190
+ disabled: isLoading || !inputValue.trim(),
20191
+ className: `cteditor-h-8 cteditor-w-8 cteditor-bg-white cteditor-text-[#1a1a1a] cteditor-rounded-md cteditor-border-none cteditor-flex cteditor-items-center cteditor-justify-center cteditor-shrink-0 cteditor-transition-colors cteditor-duration-200 ${isLoading || !inputValue.trim() ? "cteditor-cursor-not-allowed cteditor-opacity-50" : "cteditor-cursor-pointer cteditor-opacity-100"}`,
20192
+ children: isLoading ? /* @__PURE__ */ jsx("div", { className: "cteditor-h-3.5 cteditor-w-3.5 cteditor-border-2 cteditor-border-[#1a1a1a] cteditor-border-t-transparent cteditor-rounded-full cteditor-animate-spin" }) : /* @__PURE__ */ jsx(Send, { size: 16 })
20193
+ }
20194
+ ),
20195
+ /* @__PURE__ */ jsx(
20196
+ "button",
20197
+ {
20198
+ type: "button",
20199
+ onClick: onClose,
20200
+ className: "cteditor-size-8 cteditor-bg-background cteditor-text-[#888] cteditor-flex cteditor-items-center cteditor-justify-center cteditor-cursor-pointer cteditor-shrink-0 cteditor-transition-colors cteditor-duration-200 hover:cteditor-text-white cteditor-rounded-md cteditor-border cteditor-border-[#333] cteditor-shadow-[0_8px_24px_rgba(0,0,0,0.4)]",
20201
+ title: "Close (Esc)",
20202
+ children: /* @__PURE__ */ jsx(X$1, { size: 16 })
20203
+ }
20204
+ )
20205
+ ] })
20206
+ ] });
19895
20207
  }
19896
20208
  function useAIChatToolbar(editor, apiKey, anchorElem) {
19897
20209
  const [isVisible, setIsVisible] = useState$1(false);
@@ -20061,6 +20373,94 @@ function TableOptionPlugin() {
20061
20373
  }, [editor, createInstantTable]);
20062
20374
  return /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: createInstantTable, size: "icon-sm", children: /* @__PURE__ */ jsx("span", { className: "[&_svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(Table, {}) }) });
20063
20375
  }
20376
+ const VoiceTranscriptIcon = () => {
20377
+ return /* @__PURE__ */ jsxs(
20378
+ "div",
20379
+ {
20380
+ style: {
20381
+ display: "flex",
20382
+ alignItems: "center",
20383
+ justifyContent: "center",
20384
+ gap: "2px",
20385
+ height: "12px",
20386
+ lineHeight: "12px",
20387
+ verticalAlign: "middle"
20388
+ },
20389
+ children: [
20390
+ /* @__PURE__ */ jsx(
20391
+ "span",
20392
+ {
20393
+ style: {
20394
+ width: "2px",
20395
+ height: "8px",
20396
+ backgroundColor: "#ef4444",
20397
+ borderRadius: "1px",
20398
+ display: "inline-block",
20399
+ animation: "voice-wave 1.2s ease-in-out infinite",
20400
+ animationDelay: "0s"
20401
+ }
20402
+ }
20403
+ ),
20404
+ /* @__PURE__ */ jsx(
20405
+ "span",
20406
+ {
20407
+ style: {
20408
+ width: "2px",
20409
+ height: "10px",
20410
+ backgroundColor: "#ef4444",
20411
+ borderRadius: "1px",
20412
+ display: "inline-block",
20413
+ animation: "voice-wave 1.2s ease-in-out infinite",
20414
+ animationDelay: "0.2s"
20415
+ }
20416
+ }
20417
+ ),
20418
+ /* @__PURE__ */ jsx(
20419
+ "span",
20420
+ {
20421
+ style: {
20422
+ width: "2px",
20423
+ height: "12px",
20424
+ backgroundColor: "#ef4444",
20425
+ borderRadius: "1px",
20426
+ display: "inline-block",
20427
+ animation: "voice-wave 1.2s ease-in-out infinite",
20428
+ animationDelay: "0.4s"
20429
+ }
20430
+ }
20431
+ ),
20432
+ /* @__PURE__ */ jsx(
20433
+ "span",
20434
+ {
20435
+ style: {
20436
+ width: "2px",
20437
+ height: "10px",
20438
+ backgroundColor: "#ef4444",
20439
+ borderRadius: "1px",
20440
+ display: "inline-block",
20441
+ animation: "voice-wave 1.2s ease-in-out infinite",
20442
+ animationDelay: "0.6s"
20443
+ }
20444
+ }
20445
+ ),
20446
+ /* @__PURE__ */ jsx(
20447
+ "span",
20448
+ {
20449
+ style: {
20450
+ width: "2px",
20451
+ height: "8px",
20452
+ backgroundColor: "#ef4444",
20453
+ borderRadius: "1px",
20454
+ display: "inline-block",
20455
+ animation: "voice-wave 1.2s ease-in-out infinite",
20456
+ animationDelay: "0.8s"
20457
+ }
20458
+ }
20459
+ )
20460
+ ]
20461
+ }
20462
+ );
20463
+ };
20064
20464
  createCommand();
20065
20465
  const INSERT_TRANSCRIPT_COMMAND = createCommand();
20066
20466
  const VoiceTranscriptEditorPlugin = () => {
@@ -20164,16 +20564,17 @@ const TextCursorIcon = ({ isRecording, editor }) => {
20164
20564
  style: {
20165
20565
  position: "fixed",
20166
20566
  left: position.x + 5,
20167
- top: position.y - 2,
20567
+ top: position.y + (17 - 12) / 2,
20568
+ // Center align with 17px line height
20168
20569
  zIndex: 9999,
20169
20570
  pointerEvents: "none",
20170
- fontSize: "14px",
20171
- color: "#ef4444",
20172
- animation: "cursor-mic-bounce 1s infinite",
20173
- filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.3))",
20174
- userSelect: "none"
20571
+ userSelect: "none",
20572
+ display: "flex",
20573
+ alignItems: "center",
20574
+ lineHeight: "17px",
20575
+ height: "17px"
20175
20576
  },
20176
- children: "🎤"
20577
+ children: /* @__PURE__ */ jsx(VoiceTranscriptIcon, {})
20177
20578
  }
20178
20579
  );
20179
20580
  };
@@ -20586,10 +20987,10 @@ const PDF_CONFIG = {
20586
20987
  };
20587
20988
  const loadHtml2Pdf = async () => {
20588
20989
  try {
20589
- const mod = await import("./html2pdf.bundle.min-d2f5d9cb.js").then((n) => n.h);
20990
+ const mod = await import("./html2pdf.bundle.min-726a8ef6.js").then((n) => n.h);
20590
20991
  return (mod == null ? void 0 : mod.default) || mod;
20591
20992
  } catch {
20592
- const mod2 = await import("./html2pdf.bundle-0e71462c.js").then((n) => n.h);
20993
+ const mod2 = await import("./html2pdf.bundle-2638cd01.js").then((n) => n.h);
20593
20994
  return (mod2 == null ? void 0 : mod2.default) || mod2;
20594
20995
  }
20595
20996
  };
@@ -23364,12 +23765,8 @@ const ColorPicker$2 = ({
23364
23765
  const [selectedColor, setSelectedColor] = useState$1("#FFFFFF");
23365
23766
  const [open, setOpen] = useState$1(false);
23366
23767
  const [showAdvanced, setShowAdvanced] = useState$1(false);
23367
- const [isInteracting, setIsInteracting] = useState$1(false);
23368
- const colorPickerRef = useRef(null);
23369
- const popoverRef = useRef(null);
23370
- const interactionTimeoutRef = useRef(
23371
- null
23372
- );
23768
+ const isPointerDownRef = useRef(false);
23769
+ const openedAtRef = useRef(0);
23373
23770
  const handleColorSelect = (color) => {
23374
23771
  setSelectedColor(color);
23375
23772
  onChange(color);
@@ -23378,77 +23775,28 @@ const ColorPicker$2 = ({
23378
23775
  handleColorSelect(color);
23379
23776
  setOpen(false);
23380
23777
  };
23381
- const isColorPickerElement = (element) => {
23382
- var _a, _b;
23383
- if (!element)
23384
- return false;
23385
- if ((_a = popoverRef.current) == null ? void 0 : _a.contains(element))
23386
- return true;
23387
- if ((_b = colorPickerRef.current) == null ? void 0 : _b.contains(element))
23388
- return true;
23389
- const colorfulSelectors = [
23390
- ".react-colorful",
23391
- ".react-colorful__saturation",
23392
- ".react-colorful__hue",
23393
- ".react-colorful__pointer",
23394
- ".react-colorful__interactive",
23395
- ".react-colorful__saturation-pointer",
23396
- ".react-colorful__hue-pointer",
23397
- "[data-radix-popper-content-wrapper]",
23398
- "[data-radix-popover-content]"
23399
- ];
23400
- return colorfulSelectors.some(
23401
- (selector) => {
23402
- var _a2, _b2;
23403
- return ((_a2 = element.matches) == null ? void 0 : _a2.call(element, selector)) || ((_b2 = element.closest) == null ? void 0 : _b2.call(element, selector));
23404
- }
23405
- );
23406
- };
23407
23778
  const startInteraction = () => {
23408
- setIsInteracting(true);
23409
- if (interactionTimeoutRef.current) {
23410
- clearTimeout(interactionTimeoutRef.current);
23411
- }
23779
+ isPointerDownRef.current = true;
23412
23780
  };
23413
23781
  const endInteraction = () => {
23414
- interactionTimeoutRef.current = setTimeout(() => {
23415
- setIsInteracting(false);
23416
- }, 300);
23782
+ isPointerDownRef.current = false;
23417
23783
  };
23418
23784
  useEffect$1(() => {
23419
- const handleStart = (e) => {
23420
- if (isColorPickerElement(e.target)) {
23421
- startInteraction();
23422
- }
23423
- };
23424
- const handleEnd = () => {
23425
- endInteraction();
23785
+ const handleGlobalPointerUp = () => {
23786
+ isPointerDownRef.current = false;
23426
23787
  };
23427
- document.addEventListener("mousedown", handleStart, true);
23428
- document.addEventListener("touchstart", handleStart, true);
23429
- document.addEventListener("mouseup", handleEnd, true);
23430
- document.addEventListener("touchend", handleEnd, true);
23431
- document.addEventListener("dragstart", handleStart, true);
23432
- document.addEventListener("dragend", handleEnd, true);
23788
+ document.addEventListener("pointerup", handleGlobalPointerUp);
23789
+ document.addEventListener("pointercancel", handleGlobalPointerUp);
23433
23790
  return () => {
23434
- document.removeEventListener("mousedown", handleStart, true);
23435
- document.removeEventListener("touchstart", handleStart, true);
23436
- document.removeEventListener("mouseup", handleEnd, true);
23437
- document.removeEventListener("touchend", handleEnd, true);
23438
- document.removeEventListener("dragstart", handleStart, true);
23439
- document.removeEventListener("dragend", handleEnd, true);
23440
- if (interactionTimeoutRef.current) {
23441
- clearTimeout(interactionTimeoutRef.current);
23442
- }
23791
+ document.removeEventListener("pointerup", handleGlobalPointerUp);
23792
+ document.removeEventListener("pointercancel", handleGlobalPointerUp);
23443
23793
  };
23444
23794
  }, []);
23445
23795
  useEffect$1(() => {
23446
23796
  if (!open) {
23447
23797
  setShowAdvanced(false);
23448
- setIsInteracting(false);
23449
- if (interactionTimeoutRef.current) {
23450
- clearTimeout(interactionTimeoutRef.current);
23451
- }
23798
+ isPointerDownRef.current = false;
23799
+ openedAtRef.current = 0;
23452
23800
  }
23453
23801
  }, [open]);
23454
23802
  const isValidHexColor = (hex) => {
@@ -23475,7 +23823,18 @@ const ColorPicker$2 = ({
23475
23823
  Popover,
23476
23824
  {
23477
23825
  open,
23478
- onOpenChange: setOpen,
23826
+ onOpenChange: (newOpen) => {
23827
+ if (!newOpen && isPointerDownRef.current) {
23828
+ return;
23829
+ }
23830
+ if (!newOpen && Date.now() - openedAtRef.current < 150) {
23831
+ return;
23832
+ }
23833
+ if (newOpen) {
23834
+ openedAtRef.current = Date.now();
23835
+ }
23836
+ setOpen(newOpen);
23837
+ },
23479
23838
  modal: false,
23480
23839
  children: [
23481
23840
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
@@ -23485,6 +23844,9 @@ const ColorPicker$2 = ({
23485
23844
  size: "icon-sm",
23486
23845
  className: "cteditor-size-[18px]",
23487
23846
  title,
23847
+ onMouseDown: (e) => {
23848
+ e.preventDefault();
23849
+ },
23488
23850
  children: /* @__PURE__ */ jsx(
23489
23851
  "span",
23490
23852
  {
@@ -23498,21 +23860,32 @@ const ColorPicker$2 = ({
23498
23860
  /* @__PURE__ */ jsx(
23499
23861
  PopoverContent,
23500
23862
  {
23501
- ref: popoverRef,
23502
23863
  className: "cteditor-w-auto cteditor-p-0 cteditor-border-none cteditor-shadow-lg cteditor-bg-transparent !cteditor-z-[99999]",
23503
23864
  sideOffset: 5,
23504
23865
  id: "color-picker",
23866
+ onOpenAutoFocus: (e) => e.preventDefault(),
23867
+ onCloseAutoFocus: (e) => e.preventDefault(),
23868
+ onInteractOutside: (e) => {
23869
+ const target = e.target;
23870
+ if (target.closest(".react-colorful") || target.closest(".react-colorful-wrapper") || target.closest("[data-radix-popper-content-wrapper]") || target.closest("#color-picker")) {
23871
+ e.preventDefault();
23872
+ }
23873
+ },
23505
23874
  children: /* @__PURE__ */ jsxs(
23506
23875
  "div",
23507
23876
  {
23508
23877
  className: "cteditor-bg-popover cteditor-rounded-lg cteditor-p-3",
23509
23878
  style: { width: "240px" },
23879
+ onMouseDown: (e) => {
23880
+ e.preventDefault();
23881
+ },
23510
23882
  children: [
23511
23883
  /* @__PURE__ */ jsx("div", { className: "cteditor-grid cteditor-grid-cols-7 cteditor-gap-2 cteditor-mb-4", children: colorPalette.map((color, index2) => /* @__PURE__ */ jsx(
23512
23884
  "button",
23513
23885
  {
23514
23886
  className: `cteditor-w-7 cteditor-h-7 cteditor-rounded cteditor-border-2 hover:cteditor-border-white cteditor-transition-all cteditor-duration-200 cteditor-cursor-pointer hover:cteditor-scale-105 ${selectedColor.toUpperCase() === color.toUpperCase() ? "cteditor-border-white cteditor-shadow-lg" : "cteditor-border-gray-500"}`,
23515
23887
  style: { backgroundColor: color },
23888
+ onMouseDown: (e) => e.preventDefault(),
23516
23889
  onClick: () => handlePresetClick(color),
23517
23890
  title: color
23518
23891
  },
@@ -23521,6 +23894,7 @@ const ColorPicker$2 = ({
23521
23894
  /* @__PURE__ */ jsx("div", { className: "cteditor-flex cteditor-items-center cteditor-justify-between cteditor-mb-2", children: /* @__PURE__ */ jsxs(
23522
23895
  "button",
23523
23896
  {
23897
+ onMouseDown: (e) => e.preventDefault(),
23524
23898
  onClick: () => setShowAdvanced(!showAdvanced),
23525
23899
  className: "cteditor-text-xs cteditor-text-primary/90 hover:cteditor-text-primary cteditor-transition-colors cteditor-flex cteditor-items-center cteditor-gap-2\n",
23526
23900
  children: [
@@ -23532,36 +23906,26 @@ const ColorPicker$2 = ({
23532
23906
  showAdvanced && /* @__PURE__ */ jsx(
23533
23907
  "div",
23534
23908
  {
23535
- ref: colorPickerRef,
23536
- className: "cteditor-mb-2.5 select-none",
23537
- onMouseDown: (e) => {
23538
- e.stopPropagation();
23539
- startInteraction();
23540
- },
23541
- onTouchStart: (e) => {
23542
- e.stopPropagation();
23543
- startInteraction();
23909
+ className: "cteditor-mb-2.5 select-none [&>div]:cteditor-w-full [&>div>div]:cteditor-w-full",
23910
+ onPointerDown: (e) => {
23911
+ const target = e.target;
23912
+ if (target.closest(".react-colorful")) {
23913
+ startInteraction();
23914
+ }
23544
23915
  },
23545
- onMouseUp: () => endInteraction(),
23546
- onTouchEnd: () => endInteraction(),
23547
- onMouseLeave: () => endInteraction(),
23916
+ onPointerUp: endInteraction,
23917
+ onPointerLeave: endInteraction,
23918
+ onPointerCancel: endInteraction,
23548
23919
  style: {
23549
23920
  touchAction: "none",
23550
23921
  userSelect: "none",
23551
23922
  WebkitUserSelect: "none"
23552
23923
  },
23553
23924
  children: /* @__PURE__ */ jsx(
23554
- "div",
23925
+ Z,
23555
23926
  {
23556
- onMouseDown: (e) => e.stopPropagation(),
23557
- onTouchStart: (e) => e.stopPropagation(),
23558
- children: /* @__PURE__ */ jsx(
23559
- Z,
23560
- {
23561
- color: isValidHexColor(selectedColor) ? selectedColor : "#FFFFFF",
23562
- onChange: handleColorSelect
23563
- }
23564
- )
23927
+ color: isValidHexColor(selectedColor) ? selectedColor : "#FFFFFF",
23928
+ onChange: handleColorSelect
23565
23929
  }
23566
23930
  )
23567
23931
  }
@@ -26195,10 +26559,44 @@ const Toolbar = ({
26195
26559
  const [isImageDialogOpen, setIsImageDialogOpen] = useState$1(false);
26196
26560
  const [isChartDialogOpen, setIsChartDialogOpen] = useState$1(false);
26197
26561
  const [isFeatureSuggestionDialogOpen, setIsFeatureSuggestionDialogOpen] = useState$1(false);
26562
+ const [moreMenuSearch, setMoreMenuSearch] = useState$1("");
26563
+ const searchInputRef = useRef(null);
26198
26564
  const classes = useStyles$1();
26199
26565
  const { hasFormat, isEditorEmpty, blockType, clearFormatting } = useEditorToolbar();
26200
26566
  const { clearEditorContent } = useCustomCommands();
26201
26567
  const { toolbarState, updateToolbarState } = useToolbarState();
26568
+ const menuItemsConfig = {
26569
+ blockFormat: { label: "Block Format", keywords: ["paragraph", "heading", "quote", "code", "block"] },
26570
+ fontFamily: { label: "Font Family", keywords: ["font", "family", "typeface", "arial", "times"] },
26571
+ fontSize: { label: "Font Size", keywords: ["size", "text size", "bigger", "smaller"] },
26572
+ alignMenu: { label: "Alignment", keywords: ["align", "left", "center", "right", "justify"] },
26573
+ inlineFormats: { label: "Text Formatting", keywords: ["bold", "italic", "underline", "format"] },
26574
+ codeBlock: { label: "Code Block", keywords: ["code", "programming", "syntax"] },
26575
+ formatTextMenu: { label: "Format Menu", keywords: ["format", "style", "text"] },
26576
+ imageInsert: { label: "Insert Image", keywords: ["image", "picture", "photo", "insert"] },
26577
+ tableOptions: { label: "Table", keywords: ["table", "grid", "rows", "columns"] },
26578
+ chartInsert: { label: "Insert Chart", keywords: ["chart", "graph", "visualization", "data"] },
26579
+ link: { label: "Link", keywords: ["link", "url", "hyperlink", "anchor"] },
26580
+ colorPickers: { label: "Colors", keywords: ["color", "font color", "background", "highlight"] },
26581
+ emoji: { label: "Emoji", keywords: ["emoji", "emoticon", "smiley", "face"] },
26582
+ todo: { label: "Todo List", keywords: ["todo", "checklist", "task", "checkbox"] },
26583
+ notePanels: { label: "Note Panels", keywords: ["note", "panel", "callout", "info", "warning"] },
26584
+ highlight: { label: "Highlight", keywords: ["highlight", "marker", "emphasis"] },
26585
+ insertMenu: { label: "Insert Menu", keywords: ["insert", "add", "embed"] },
26586
+ autocomplete: { label: "Autocorrection", keywords: ["autocomplete", "autocorrect", "spelling", "grammar"] },
26587
+ htmlView: { label: "HTML View", keywords: ["html", "code", "source", "view"] },
26588
+ aiOptions: { label: "AI Options", keywords: ["ai", "artificial intelligence", "magic", "generate", "grammar", "translate", "simplify"] }
26589
+ };
26590
+ const matchesSearch = (itemId) => {
26591
+ if (!moreMenuSearch.trim())
26592
+ return true;
26593
+ const config = menuItemsConfig[itemId];
26594
+ if (!config)
26595
+ return true;
26596
+ const searchLower = moreMenuSearch.toLowerCase();
26597
+ return config.label.toLowerCase().includes(searchLower) || config.keywords.some((keyword) => keyword.toLowerCase().includes(searchLower));
26598
+ };
26599
+ const hasMatchingItems = Array.from(hiddenItemIds).some((id) => matchesSearch(id));
26202
26600
  const { isHtmlView, setIsHtmlView, htmlContent, setHtmlContent } = useHtmlView();
26203
26601
  const { apiKey } = useEditor();
26204
26602
  useEffect$1(() => {
@@ -26702,6 +27100,16 @@ const Toolbar = ({
26702
27100
  ]
26703
27101
  }
26704
27102
  ),
27103
+ /* @__PURE__ */ jsx(
27104
+ "div",
27105
+ {
27106
+ "data-toolbar-item": "voiceTranscript",
27107
+ className: "cteditor-flex cteditor-items-center",
27108
+ children: /* @__PURE__ */ jsx(VoiceTranscriptButton, { editor: activeEditor })
27109
+ }
27110
+ ),
27111
+ /* @__PURE__ */ jsx(VoiceTranscriptPlugin, {}),
27112
+ /* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
26705
27113
  enableTextFormatting && /* @__PURE__ */ jsxs(
26706
27114
  "div",
26707
27115
  {
@@ -26976,7 +27384,7 @@ const Toolbar = ({
26976
27384
  ] }) }),
26977
27385
  /* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
26978
27386
  /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
26979
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
27387
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
26980
27388
  Button,
26981
27389
  {
26982
27390
  "data-toolbar-item": "exportPdf",
@@ -26984,11 +27392,8 @@ const Toolbar = ({
26984
27392
  size: "sm",
26985
27393
  disabled: isExportingPDF,
26986
27394
  onClick: handleExportPDF,
26987
- className: "cteditor-relative",
26988
- children: [
26989
- isExportingPDF ? /* @__PURE__ */ jsx(Loader2, { className: "!cteditor-size-4 cteditor-animate-spin" }) : /* @__PURE__ */ jsx(Download, { className: "!cteditor-size-4" }),
26990
- /* @__PURE__ */ jsx("span", {})
26991
- ]
27395
+ className: "cteditor-relative !cteditor-h-6",
27396
+ children: isExportingPDF ? /* @__PURE__ */ jsx(Loader2, { className: "!cteditor-size-4 cteditor-animate-spin" }) : /* @__PURE__ */ jsx(Download, { className: "!cteditor-size-4" })
26992
27397
  }
26993
27398
  ) }),
26994
27399
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: isExportingPDF ? `Exporting... ${exportProgress}%` : "Export PDF" }) })
@@ -26999,10 +27404,11 @@ const Toolbar = ({
26999
27404
  {
27000
27405
  variant: "outline",
27001
27406
  size: "sm",
27002
- className: "cteditor-px-3 cteditor-gap-2 [&>svg]:!cteditor-size-4 cteditor-bg-gradient-to-r cteditor-from-background cteditor-via-primary/10 cteditor-to-background hover:cteditor-from-background/80 hover:cteditor-via-primary/10 hover:cteditor-to-background/80",
27407
+ className: "cteditor-px-2 cteditor-gap-1 [&>svg]:!cteditor-size-4 cteditor-bg-gradient-to-r cteditor-from-background cteditor-via-primary/10 cteditor-to-background hover:cteditor-from-background/80 hover:cteditor-via-primary/10 hover:cteditor-to-background/80",
27003
27408
  children: [
27004
27409
  /* @__PURE__ */ jsx(MagicoonIcon, {}),
27005
- " Go with AI"
27410
+ " Go with AI ",
27411
+ /* @__PURE__ */ jsx(ChevronDown, { className: "!cteditor-size-4" })
27006
27412
  ]
27007
27413
  }
27008
27414
  ) }),
@@ -27128,430 +27534,6 @@ const Toolbar = ({
27128
27534
  ]
27129
27535
  }
27130
27536
  ),
27131
- showMoreMenu && /* @__PURE__ */ jsx("div", { className: "cteditor-flex-shrink-0 cteditor-h-7", children: /* @__PURE__ */ jsxs(
27132
- DropdownMenu,
27133
- {
27134
- open: isMoreMenuOpen,
27135
- onOpenChange: setIsMoreMenuOpen,
27136
- children: [
27137
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
27138
- Button,
27139
- {
27140
- variant: "ghost",
27141
- className: "!cteditor-px-1 !cteditor-py-0.5 !cteditor-h-7 !cteditor-gap-1 !cteditor-bg-accent",
27142
- children: [
27143
- /* @__PURE__ */ jsx(Plus, { className: "!cteditor-size-5" }),
27144
- /* @__PURE__ */ jsx(ChevronDown, { className: "!cteditor-size-3.5" })
27145
- ]
27146
- }
27147
- ) }),
27148
- /* @__PURE__ */ jsxs(
27149
- DropdownMenuContent,
27150
- {
27151
- align: "end",
27152
- className: "cteditor-w-56 cteditor-max-h-[400px] cteditor-overflow-y-auto",
27153
- onCloseAutoFocus: (e) => e.preventDefault(),
27154
- onPointerDownOutside: (e) => {
27155
- const target = e.target;
27156
- if (target.closest(".react-colorful") || target.closest(".emoji-picker-react") || target.closest("[data-voice-transcript]") || target.closest("[data-radix-popper-content-wrapper]") || target.closest("[data-radix-popover-content]") || target.closest("[data-radix-dropdown-menu-content]") || target.closest("#emoji-picker") || target.closest("#highlight-color-picker") || target.closest("#color-picker")) {
27157
- e.preventDefault();
27158
- }
27159
- },
27160
- onInteractOutside: (e) => {
27161
- const target = e.target;
27162
- if (target.closest(".react-colorful") || target.closest(".emoji-picker-react") || target.closest("[data-voice-transcript]") || target.closest("[data-radix-popper-content-wrapper]") || target.closest("[data-radix-popover-content]") || target.closest("[data-radix-dropdown-menu-content]") || target.closest("#emoji-picker") || target.closest("#highlight-color-picker") || target.closest("#color-picker")) {
27163
- e.preventDefault();
27164
- }
27165
- },
27166
- children: [
27167
- enableTextFormatting && activeEditor === editor && hiddenItemIds.has("blockFormat") && /* @__PURE__ */ jsxs(Fragment, { children: [
27168
- /* @__PURE__ */ jsx(
27169
- DropdownMenuItem,
27170
- {
27171
- asChild: true,
27172
- onSelect: (e) => e.preventDefault(),
27173
- children: /* @__PURE__ */ jsx(
27174
- "div",
27175
- {
27176
- className: "cteditor-w-full",
27177
- onClick: (e) => e.stopPropagation(),
27178
- children: /* @__PURE__ */ jsx(BlockFormatMenu, { blockType })
27179
- }
27180
- )
27181
- }
27182
- ),
27183
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
27184
- ] }),
27185
- enableFontControls && (hiddenItemIds.has("fontFamily") || hiddenItemIds.has("fontSize")) && /* @__PURE__ */ jsxs(Fragment, { children: [
27186
- /* @__PURE__ */ jsx(
27187
- DropdownMenuItem,
27188
- {
27189
- asChild: true,
27190
- onSelect: (e) => e.preventDefault(),
27191
- children: /* @__PURE__ */ jsx(
27192
- "div",
27193
- {
27194
- className: "cteditor-w-full",
27195
- onClick: (e) => e.stopPropagation(),
27196
- children: /* @__PURE__ */ jsx(
27197
- FontFamilyMenu,
27198
- {
27199
- fonts,
27200
- activeEditor
27201
- }
27202
- )
27203
- }
27204
- )
27205
- }
27206
- ),
27207
- /* @__PURE__ */ jsx(
27208
- DropdownMenuItem,
27209
- {
27210
- asChild: true,
27211
- onSelect: (e) => e.preventDefault(),
27212
- children: /* @__PURE__ */ jsx(
27213
- "div",
27214
- {
27215
- className: "cteditor-w-full ",
27216
- onClick: (e) => e.stopPropagation(),
27217
- children: /* @__PURE__ */ jsx(FontSizeControl, {})
27218
- }
27219
- )
27220
- }
27221
- )
27222
- ] }),
27223
- enableImageOptions && activeEditor === editor && hiddenItemIds.has("imageInsert") && /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: openImageDialog, children: [
27224
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4 cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(Image$2, {}) }),
27225
- "Insert Image"
27226
- ] }),
27227
- enableTableOptions && activeEditor === editor && hiddenItemIds.has("tableOptions") && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
27228
- DropdownMenuItem,
27229
- {
27230
- asChild: true,
27231
- onSelect: () => {
27232
- editor.dispatchCommand(
27233
- CREATE_TABLE_COMMAND,
27234
- void 0
27235
- );
27236
- },
27237
- children: /* @__PURE__ */ jsxs(
27238
- "div",
27239
- {
27240
- className: "cteditor-w-full",
27241
- onClick: (e) => e.stopPropagation(),
27242
- children: [
27243
- /* @__PURE__ */ jsx(TableOptionPlugin, {}),
27244
- "Table"
27245
- ]
27246
- }
27247
- )
27248
- }
27249
- ) }),
27250
- activeEditor === editor && hiddenItemIds.has("chartInsert") && /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: openChartDialog, children: [
27251
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4 cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(ChartBarIcon, {}) }),
27252
- "Insert Chart"
27253
- ] }),
27254
- enableTextFormatting && hiddenItemIds.has("inlineFormats") && /* @__PURE__ */ jsxs(
27255
- DropdownMenuItem,
27256
- {
27257
- onClick: () => activeEditor.dispatchCommand(
27258
- FORMAT_TEXT_COMMAND,
27259
- "strikethrough"
27260
- ),
27261
- children: [
27262
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-6", children: /* @__PURE__ */ jsx(StrikethroughIcon, {}) }),
27263
- "Strikethrough"
27264
- ]
27265
- }
27266
- ),
27267
- enableCodeFormat && activeEditor === editor && hiddenItemIds.has("codeBlock") && /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: formatCodeBlock, children: [
27268
- /* @__PURE__ */ jsx("div", { className: " [&>svg]:!cteditor-size-6", children: /* @__PURE__ */ jsx(CodeIcon, {}) }),
27269
- "Code Block"
27270
- ] }),
27271
- enableFormatTextMenu && activeEditor === editor && hiddenItemIds.has("formatTextMenu") && /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-pt-1", children: [
27272
- /* @__PURE__ */ jsx("div", { className: "cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2", children: "Format" }),
27273
- /* @__PURE__ */ jsx(
27274
- FormatTextMenuDrop,
27275
- {
27276
- hasFormat,
27277
- blockType
27278
- }
27279
- ),
27280
- /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "!cteditor-bg-foreground/10" })
27281
- ] }),
27282
- enableColorPicker && activeEditor === editor && hiddenItemIds.has("colorPickers") && /* @__PURE__ */ jsxs(Fragment, { children: [
27283
- /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5 hover:cteditor-bg-foreground/5", children: [
27284
- /* @__PURE__ */ jsx(
27285
- ColorPicker$2,
27286
- {
27287
- title: "Font color",
27288
- onChange: (color) => {
27289
- onFontColorSelect(color);
27290
- setIsMoreMenuOpen(true);
27291
- },
27292
- icon: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center", children: [
27293
- /* @__PURE__ */ jsx("p", { className: "cteditor-text-[11px] cteditor-leading-none", children: "A" }),
27294
- /* @__PURE__ */ jsx(
27295
- "div",
27296
- {
27297
- className: "cteditor-w-[14px] cteditor-h-[2px]",
27298
- style: {
27299
- backgroundColor: toolbarState.fontColor
27300
- }
27301
- }
27302
- )
27303
- ] }),
27304
- bgClassName: "bg-input"
27305
- },
27306
- "color-picker-dropdown"
27307
- ),
27308
- /* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-xs", children: "Font Color" })
27309
- ] }),
27310
- /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5 hover:cteditor-bg-foreground/5", children: [
27311
- /* @__PURE__ */ jsx(
27312
- ColorPicker$2,
27313
- {
27314
- title: "Background color",
27315
- onChange: (color) => {
27316
- onBgColorSelect(color);
27317
- setIsMoreMenuOpen(true);
27318
- }
27319
- },
27320
- "bg-color-picker-dropdown"
27321
- ),
27322
- /* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-xs", children: "Background Color" })
27323
- ] })
27324
- ] }),
27325
- enableLinks && activeEditor === editor && hiddenItemIds.has("link") && /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: insertLink, children: [
27326
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-6", children: /* @__PURE__ */ jsx(LinkIcon, {}) }),
27327
- isLinkActive ? "Remove Link" : "Insert Link"
27328
- ] }),
27329
- enableEmojiPicker && hiddenItemIds.has("emoji") && /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-px-2 cteditor-py-1.5", children: [
27330
- /* @__PURE__ */ jsx(
27331
- EmojiPickerWidget,
27332
- {
27333
- icon: /* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(FaceSmileIcon, {}) }),
27334
- onChange: (emojiData) => {
27335
- handleEmojiClick(emojiData);
27336
- setIsMoreMenuOpen(true);
27337
- }
27338
- },
27339
- "emoji-picker-dropdown"
27340
- ),
27341
- /* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-sm", children: "Emoji" })
27342
- ] }),
27343
- enableInsertMenu && activeEditor === editor && hiddenItemIds.has("insertMenu") && /* @__PURE__ */ jsxs(Fragment, { children: [
27344
- /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full ", children: [
27345
- /* @__PURE__ */ jsx("div", { className: "cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2 cteditor-pt-2", children: "Insert Menu" }),
27346
- /* @__PURE__ */ jsx(InsertMenuDrop, {})
27347
- ] }),
27348
- /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "!cteditor-bg-foreground/10" })
27349
- ] }),
27350
- enableTodoList && activeEditor === editor && hiddenItemIds.has("todo") && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: createTodo, children: [
27351
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(TodoIcon, {}) }),
27352
- "Todo List"
27353
- ] }) }),
27354
- enableNotePanels && activeEditor === editor && hiddenItemIds.has("notePanels") && /* @__PURE__ */ jsx(
27355
- DropdownMenuItem,
27356
- {
27357
- asChild: true,
27358
- onSelect: (e) => e.preventDefault(),
27359
- children: /* @__PURE__ */ jsx(
27360
- "div",
27361
- {
27362
- className: "cteditor-w-full",
27363
- onClick: (e) => e.stopPropagation(),
27364
- children: /* @__PURE__ */ jsxs("div", { className: "[&>svg]:!cteditor-size-4 [&>button]:!cteditor-size-6 cteditor-gap-2 cteditor-flex cteditor-items-center", children: [
27365
- /* @__PURE__ */ jsx(NotePanelMenu, {}),
27366
- "Insert Note Panel"
27367
- ] })
27368
- }
27369
- )
27370
- }
27371
- ),
27372
- hiddenItemIds.has("highlight") && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5 hover:cteditor-bg-foreground/5", children: [
27373
- /* @__PURE__ */ jsx(
27374
- HighlightColorPicker,
27375
- {
27376
- onChange: (color) => {
27377
- onHighlightColorSelect(color);
27378
- setIsMoreMenuOpen(true);
27379
- },
27380
- isActive: toolbarState.isHighlight
27381
- }
27382
- ),
27383
- /* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-sm", children: "Highlight" })
27384
- ] }) }),
27385
- enableAlignment && activeEditor === editor && hiddenItemIds.has("alignMenu") && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-pt-2", children: [
27386
- /* @__PURE__ */ jsx("div", { className: "cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2", children: "Align Menu" }),
27387
- /* @__PURE__ */ jsx(AlignMenuDrop, {})
27388
- ] }) }),
27389
- hiddenItemIds.has("aiOptions") && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full", children: [
27390
- /* @__PURE__ */ jsx("div", { className: "cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2 cteditor-pt-2", children: "Go with AI" }),
27391
- /* @__PURE__ */ jsxs("div", { className: "cteditor-aiOption cteditor-w-full [&>button]:cteditor-relative [&>button]:cteditor-flex [&>button]:cteditor-cursor-pointer [&>button]:cteditor-select-none [&>button]:cteditor-items-center [&>button]:cteditor-gap-2 [&>button]:cteditor-rounded-sm [&>button]:cteditor-px-2 [&>button]:cteditor-py-1.5 [&>button]:cteditor-text-[13px] [&>button]:cteditor-outline-none [&>button]:cteditor-transition-colors focus:[&>button]:cteditor-bg-foreground/5 focus:[&>button]:cteditor-text-accent-foreground hover:[&>button]:cteditor-bg-foreground/5 [&>button]:data-[disabled]:cteditor-pointer-events-none [&>button]:data-[disabled]:cteditor-opacity-50 [&>button>svg]:cteditor-size-4 [&>button>svg]:cteditor-shrink-0", children: [
27392
- /* @__PURE__ */ jsxs(
27393
- "button",
27394
- {
27395
- onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27396
- type: "SPELLING_GRAMMAR"
27397
- }),
27398
- className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27399
- children: [
27400
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(SearchTextIcon, {}) }),
27401
- "Fix Grammar"
27402
- ]
27403
- }
27404
- ),
27405
- /* @__PURE__ */ jsxs(
27406
- "button",
27407
- {
27408
- onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27409
- type: "SIMPLIFY"
27410
- }),
27411
- className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27412
- children: [
27413
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(PenLineIcon, {}) }),
27414
- "Simplify"
27415
- ]
27416
- }
27417
- ),
27418
- /* @__PURE__ */ jsxs(
27419
- "button",
27420
- {
27421
- onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27422
- type: "COMPLETE_SENTENCE"
27423
- }),
27424
- className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27425
- children: [
27426
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(MenuAltIcon, {}) }),
27427
- "Complete Sentence"
27428
- ]
27429
- }
27430
- ),
27431
- /* @__PURE__ */ jsxs(
27432
- "button",
27433
- {
27434
- onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27435
- type: "EMOJIFY"
27436
- }),
27437
- className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27438
- children: [
27439
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(FaceSmileIcon2, {}) }),
27440
- "Emojify"
27441
- ]
27442
- }
27443
- ),
27444
- /* @__PURE__ */ jsxs(
27445
- "button",
27446
- {
27447
- onClick: () => editor.dispatchCommand(
27448
- AI_TRANSLATE_COMMAND,
27449
- void 0
27450
- ),
27451
- className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27452
- children: [
27453
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(TranslateIcon, {}) }),
27454
- "Translate"
27455
- ]
27456
- }
27457
- ),
27458
- /* @__PURE__ */ jsxs(
27459
- "button",
27460
- {
27461
- onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27462
- type: "MAKE_LONGER"
27463
- }),
27464
- className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27465
- children: [
27466
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(Maximize2, {}) }),
27467
- "Make Longer"
27468
- ]
27469
- }
27470
- ),
27471
- /* @__PURE__ */ jsxs(
27472
- "button",
27473
- {
27474
- onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27475
- type: "MAKE_SHORTER"
27476
- }),
27477
- className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27478
- children: [
27479
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(Minimize2, {}) }),
27480
- "Make Shorter"
27481
- ]
27482
- }
27483
- ),
27484
- /* @__PURE__ */ jsxs(
27485
- "button",
27486
- {
27487
- onClick: () => editor.dispatchCommand(
27488
- AI_ADJUST_TONE_COMMAND,
27489
- void 0
27490
- ),
27491
- className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27492
- children: [
27493
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(Volume2, {}) }),
27494
- "Adjust Tone"
27495
- ]
27496
- }
27497
- ),
27498
- /* @__PURE__ */ jsxs(
27499
- "button",
27500
- {
27501
- onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27502
- type: "AI_RESPONSE"
27503
- }),
27504
- className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27505
- children: [
27506
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(SparkleIcon, {}) }),
27507
- "AI"
27508
- ]
27509
- }
27510
- ),
27511
- /* @__PURE__ */ jsxs(
27512
- "button",
27513
- {
27514
- onClick: () => editor.dispatchCommand(AI_IMAGE_COMMAND, void 0),
27515
- className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27516
- children: [
27517
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(ImageIcon, {}) }),
27518
- "Generate Image"
27519
- ]
27520
- }
27521
- )
27522
- ] })
27523
- ] }) }),
27524
- (enableHtmlViewToggle || enableHtmlView) && hiddenItemIds.has("htmlView") && /* @__PURE__ */ jsxs(Fragment, { children: [
27525
- /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "!cteditor-bg-foreground/10" }),
27526
- /* @__PURE__ */ jsxs(
27527
- DropdownMenuItem,
27528
- {
27529
- onClick: toggleHtmlView,
27530
- disabled: !editable,
27531
- children: [
27532
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4 cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(FileCode2, {}) }),
27533
- isHtmlView ? "Switch to Editor View" : "Switch to HTML View"
27534
- ]
27535
- }
27536
- )
27537
- ] }),
27538
- enableAutocompleteToggle && hiddenItemIds.has("autocomplete") && /* @__PURE__ */ jsxs(
27539
- DropdownMenuItem,
27540
- {
27541
- onClick: toggleAutocomplete,
27542
- disabled: !editable,
27543
- children: [
27544
- /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4 cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(SearchTextIcon2, {}) }),
27545
- toolbarState.isAutocompleteEnabled ? "Disable Autocorrection" : "Enable Autocorrection"
27546
- ]
27547
- }
27548
- )
27549
- ]
27550
- }
27551
- )
27552
- ]
27553
- }
27554
- ) }),
27555
27537
  enableAIChat && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
27556
27538
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
27557
27539
  Button,
@@ -27570,15 +27552,6 @@ const Toolbar = ({
27570
27552
  ) }),
27571
27553
  /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "AI Chat" }) })
27572
27554
  ] }) }),
27573
- /* @__PURE__ */ jsx(
27574
- "div",
27575
- {
27576
- "data-toolbar-item": "voiceTranscript",
27577
- className: "cteditor-flex cteditor-items-center",
27578
- children: /* @__PURE__ */ jsx(VoiceTranscriptButton, { editor: activeEditor })
27579
- }
27580
- ),
27581
- /* @__PURE__ */ jsx(VoiceTranscriptPlugin, {}),
27582
27555
  enableClearOptions && /* @__PURE__ */ jsxs(
27583
27556
  "div",
27584
27557
  {
@@ -27662,7 +27635,469 @@ const Toolbar = ({
27662
27635
  ] }) })
27663
27636
  ]
27664
27637
  }
27665
- )
27638
+ ),
27639
+ showMoreMenu && /* @__PURE__ */ jsx("div", { className: "cteditor-flex-shrink-0 cteditor-h-7", children: /* @__PURE__ */ jsxs(
27640
+ DropdownMenu,
27641
+ {
27642
+ open: isMoreMenuOpen,
27643
+ onOpenChange: (open) => {
27644
+ setIsMoreMenuOpen(open);
27645
+ if (!open) {
27646
+ setMoreMenuSearch("");
27647
+ }
27648
+ },
27649
+ children: [
27650
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
27651
+ Button,
27652
+ {
27653
+ variant: "ghost",
27654
+ className: "!cteditor-px-1 !cteditor-py-0.5 !cteditor-h-7 !cteditor-gap-1 !cteditor-bg-accent",
27655
+ children: [
27656
+ /* @__PURE__ */ jsx(Plus, { className: "!cteditor-size-5" }),
27657
+ /* @__PURE__ */ jsx(ChevronDown, { className: "!cteditor-size-3.5" })
27658
+ ]
27659
+ }
27660
+ ) }),
27661
+ /* @__PURE__ */ jsxs(
27662
+ DropdownMenuContent,
27663
+ {
27664
+ align: "end",
27665
+ className: "cteditor-w-64 cteditor-max-h-[450px] cteditor-overflow-hidden cteditor-flex cteditor-flex-col",
27666
+ onCloseAutoFocus: (e) => e.preventDefault(),
27667
+ onPointerDownOutside: (e) => {
27668
+ const target = e.target;
27669
+ if (target.closest(".react-colorful") || target.closest(".emoji-picker-react") || target.closest("[data-voice-transcript]") || target.closest("[data-radix-popper-content-wrapper]") || target.closest("[data-radix-popover-content]") || target.closest("[data-radix-dropdown-menu-content]") || target.closest("#emoji-picker") || target.closest("#highlight-color-picker") || target.closest("#color-picker")) {
27670
+ e.preventDefault();
27671
+ }
27672
+ },
27673
+ onInteractOutside: (e) => {
27674
+ const target = e.target;
27675
+ if (target.closest(".react-colorful") || target.closest(".emoji-picker-react") || target.closest("[data-voice-transcript]") || target.closest("[data-radix-popper-content-wrapper]") || target.closest("[data-radix-popover-content]") || target.closest("[data-radix-dropdown-menu-content]") || target.closest("#emoji-picker") || target.closest("#highlight-color-picker") || target.closest("#color-picker")) {
27676
+ e.preventDefault();
27677
+ }
27678
+ },
27679
+ children: [
27680
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-p-2 cteditor-border-b cteditor-border-border/50 cteditor-bg-gradient-to-r cteditor-from-background cteditor-via-primary/5 cteditor-to-background cteditor-sticky cteditor-top-0 cteditor-z-10", children: [
27681
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-relative", children: [
27682
+ /* @__PURE__ */ jsx(Search, { className: "cteditor-absolute cteditor-left-2.5 cteditor-top-1/2 cteditor-transform -cteditor-translate-y-1/2 cteditor-size-3.5 cteditor-text-muted-foreground/60" }),
27683
+ /* @__PURE__ */ jsx(
27684
+ Input$1,
27685
+ {
27686
+ ref: searchInputRef,
27687
+ type: "text",
27688
+ placeholder: "Search tools...",
27689
+ value: moreMenuSearch,
27690
+ onChange: (e) => setMoreMenuSearch(e.target.value),
27691
+ onKeyDown: (e) => e.stopPropagation(),
27692
+ className: "cteditor-h-8 cteditor-pl-8 cteditor-pr-8 cteditor-text-sm cteditor-bg-background/80 cteditor-border-border/40 focus:cteditor-border-primary/50 cteditor-rounded-md cteditor-shadow-sm cteditor-placeholder:text-muted-foreground/50 cteditor-transition-all focus:cteditor-ring-1 focus:cteditor-ring-primary/20"
27693
+ }
27694
+ ),
27695
+ moreMenuSearch && /* @__PURE__ */ jsx(
27696
+ "button",
27697
+ {
27698
+ onClick: () => setMoreMenuSearch(""),
27699
+ className: "cteditor-absolute cteditor-right-2 cteditor-top-1/2 cteditor-transform -cteditor-translate-y-1/2 cteditor-text-muted-foreground/60 hover:cteditor-text-foreground cteditor-transition-colors",
27700
+ children: /* @__PURE__ */ jsx(X$1, { className: "cteditor-size-3.5" })
27701
+ }
27702
+ )
27703
+ ] }),
27704
+ moreMenuSearch && /* @__PURE__ */ jsx("p", { className: "cteditor-text-[10px] cteditor-text-muted-foreground/60 cteditor-mt-1.5 cteditor-px-0.5", children: hasMatchingItems ? "Showing matching tools" : "No tools found" })
27705
+ ] }),
27706
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-overflow-y-auto cteditor-flex-1 cteditor-py-1", children: [
27707
+ !hasMatchingItems && moreMenuSearch && /* @__PURE__ */ jsxs("div", { className: "cteditor-py-8 cteditor-text-center cteditor-text-muted-foreground/60", children: [
27708
+ /* @__PURE__ */ jsx(Search, { className: "cteditor-size-8 cteditor-mx-auto cteditor-mb-2 cteditor-opacity-40" }),
27709
+ /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm", children: "No tools found" }),
27710
+ /* @__PURE__ */ jsx("p", { className: "cteditor-text-xs cteditor-mt-1", children: "Try a different search term" })
27711
+ ] }),
27712
+ enableTextFormatting && activeEditor === editor && hiddenItemIds.has("blockFormat") && matchesSearch("blockFormat") && /* @__PURE__ */ jsxs(Fragment, { children: [
27713
+ /* @__PURE__ */ jsx(
27714
+ DropdownMenuItem,
27715
+ {
27716
+ asChild: true,
27717
+ onSelect: (e) => e.preventDefault(),
27718
+ children: /* @__PURE__ */ jsx(
27719
+ "div",
27720
+ {
27721
+ className: "cteditor-w-full",
27722
+ onClick: (e) => e.stopPropagation(),
27723
+ children: /* @__PURE__ */ jsx(BlockFormatMenu, { blockType })
27724
+ }
27725
+ )
27726
+ }
27727
+ ),
27728
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
27729
+ ] }),
27730
+ enableFontControls && (hiddenItemIds.has("fontFamily") || hiddenItemIds.has("fontSize")) && (matchesSearch("fontFamily") || matchesSearch("fontSize")) && /* @__PURE__ */ jsxs(Fragment, { children: [
27731
+ /* @__PURE__ */ jsx(
27732
+ DropdownMenuItem,
27733
+ {
27734
+ asChild: true,
27735
+ onSelect: (e) => e.preventDefault(),
27736
+ children: /* @__PURE__ */ jsx(
27737
+ "div",
27738
+ {
27739
+ className: "cteditor-w-full",
27740
+ onClick: (e) => e.stopPropagation(),
27741
+ children: /* @__PURE__ */ jsx(
27742
+ FontFamilyMenu,
27743
+ {
27744
+ fonts,
27745
+ activeEditor
27746
+ }
27747
+ )
27748
+ }
27749
+ )
27750
+ }
27751
+ ),
27752
+ /* @__PURE__ */ jsx(
27753
+ DropdownMenuItem,
27754
+ {
27755
+ asChild: true,
27756
+ onSelect: (e) => e.preventDefault(),
27757
+ children: /* @__PURE__ */ jsx(
27758
+ "div",
27759
+ {
27760
+ className: "cteditor-w-full ",
27761
+ onClick: (e) => e.stopPropagation(),
27762
+ children: /* @__PURE__ */ jsx(FontSizeControl, {})
27763
+ }
27764
+ )
27765
+ }
27766
+ )
27767
+ ] }),
27768
+ enableImageOptions && activeEditor === editor && hiddenItemIds.has("imageInsert") && matchesSearch("imageInsert") && /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: openImageDialog, children: [
27769
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4 cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(Image$2, {}) }),
27770
+ "Insert Image"
27771
+ ] }),
27772
+ enableTableOptions && activeEditor === editor && hiddenItemIds.has("tableOptions") && matchesSearch("tableOptions") && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
27773
+ DropdownMenuItem,
27774
+ {
27775
+ asChild: true,
27776
+ onSelect: () => {
27777
+ editor.dispatchCommand(
27778
+ CREATE_TABLE_COMMAND,
27779
+ void 0
27780
+ );
27781
+ },
27782
+ children: /* @__PURE__ */ jsxs(
27783
+ "div",
27784
+ {
27785
+ className: "cteditor-w-full",
27786
+ onClick: (e) => e.stopPropagation(),
27787
+ children: [
27788
+ /* @__PURE__ */ jsx(TableOptionPlugin, {}),
27789
+ "Table"
27790
+ ]
27791
+ }
27792
+ )
27793
+ }
27794
+ ) }),
27795
+ activeEditor === editor && hiddenItemIds.has("chartInsert") && matchesSearch("chartInsert") && /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: openChartDialog, children: [
27796
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4 cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(ChartBarIcon, {}) }),
27797
+ "Insert Chart"
27798
+ ] }),
27799
+ enableTextFormatting && hiddenItemIds.has("inlineFormats") && matchesSearch("inlineFormats") && /* @__PURE__ */ jsxs(
27800
+ DropdownMenuItem,
27801
+ {
27802
+ onClick: () => activeEditor.dispatchCommand(
27803
+ FORMAT_TEXT_COMMAND,
27804
+ "strikethrough"
27805
+ ),
27806
+ children: [
27807
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-6", children: /* @__PURE__ */ jsx(StrikethroughIcon, {}) }),
27808
+ "Strikethrough"
27809
+ ]
27810
+ }
27811
+ ),
27812
+ enableCodeFormat && activeEditor === editor && hiddenItemIds.has("codeBlock") && matchesSearch("codeBlock") && /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: formatCodeBlock, children: [
27813
+ /* @__PURE__ */ jsx("div", { className: " [&>svg]:!cteditor-size-6", children: /* @__PURE__ */ jsx(CodeIcon, {}) }),
27814
+ "Code Block"
27815
+ ] }),
27816
+ enableFormatTextMenu && activeEditor === editor && hiddenItemIds.has("formatTextMenu") && matchesSearch("formatTextMenu") && /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-pt-1", children: [
27817
+ /* @__PURE__ */ jsx("div", { className: "cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2", children: "Format" }),
27818
+ /* @__PURE__ */ jsx(
27819
+ FormatTextMenuDrop,
27820
+ {
27821
+ hasFormat,
27822
+ blockType
27823
+ }
27824
+ ),
27825
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "!cteditor-bg-foreground/10" })
27826
+ ] }),
27827
+ enableColorPicker && activeEditor === editor && hiddenItemIds.has("colorPickers") && matchesSearch("colorPickers") && /* @__PURE__ */ jsxs(Fragment, { children: [
27828
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5 hover:cteditor-bg-foreground/5", children: [
27829
+ /* @__PURE__ */ jsx(
27830
+ ColorPicker$2,
27831
+ {
27832
+ title: "Font color",
27833
+ onChange: (color) => {
27834
+ onFontColorSelect(color);
27835
+ setIsMoreMenuOpen(true);
27836
+ },
27837
+ icon: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center", children: [
27838
+ /* @__PURE__ */ jsx("p", { className: "cteditor-text-[11px] cteditor-leading-none", children: "A" }),
27839
+ /* @__PURE__ */ jsx(
27840
+ "div",
27841
+ {
27842
+ className: "cteditor-w-[14px] cteditor-h-[2px]",
27843
+ style: {
27844
+ backgroundColor: toolbarState.fontColor
27845
+ }
27846
+ }
27847
+ )
27848
+ ] }),
27849
+ bgClassName: "bg-input"
27850
+ },
27851
+ "color-picker-dropdown"
27852
+ ),
27853
+ /* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-xs", children: "Font Color" })
27854
+ ] }),
27855
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5 hover:cteditor-bg-foreground/5", children: [
27856
+ /* @__PURE__ */ jsx(
27857
+ ColorPicker$2,
27858
+ {
27859
+ title: "Background color",
27860
+ onChange: (color) => {
27861
+ onBgColorSelect(color);
27862
+ setIsMoreMenuOpen(true);
27863
+ }
27864
+ },
27865
+ "bg-color-picker-dropdown"
27866
+ ),
27867
+ /* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-xs", children: "Background Color" })
27868
+ ] })
27869
+ ] }),
27870
+ enableLinks && activeEditor === editor && hiddenItemIds.has("link") && matchesSearch("link") && /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: insertLink, children: [
27871
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-6", children: /* @__PURE__ */ jsx(LinkIcon, {}) }),
27872
+ isLinkActive ? "Remove Link" : "Insert Link"
27873
+ ] }),
27874
+ enableEmojiPicker && hiddenItemIds.has("emoji") && matchesSearch("emoji") && /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-px-2 cteditor-py-1.5", children: [
27875
+ /* @__PURE__ */ jsx(
27876
+ EmojiPickerWidget,
27877
+ {
27878
+ icon: /* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(FaceSmileIcon, {}) }),
27879
+ onChange: (emojiData) => {
27880
+ handleEmojiClick(emojiData);
27881
+ setIsMoreMenuOpen(true);
27882
+ }
27883
+ },
27884
+ "emoji-picker-dropdown"
27885
+ ),
27886
+ /* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-sm", children: "Emoji" })
27887
+ ] }),
27888
+ enableInsertMenu && activeEditor === editor && hiddenItemIds.has("insertMenu") && matchesSearch("insertMenu") && /* @__PURE__ */ jsxs(Fragment, { children: [
27889
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full ", children: [
27890
+ /* @__PURE__ */ jsx("div", { className: "cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2 cteditor-pt-2", children: "Insert Menu" }),
27891
+ /* @__PURE__ */ jsx(InsertMenuDrop, {})
27892
+ ] }),
27893
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "!cteditor-bg-foreground/10" })
27894
+ ] }),
27895
+ enableTodoList && activeEditor === editor && hiddenItemIds.has("todo") && matchesSearch("todo") && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: createTodo, children: [
27896
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(TodoIcon, {}) }),
27897
+ "Todo List"
27898
+ ] }) }),
27899
+ enableNotePanels && activeEditor === editor && hiddenItemIds.has("notePanels") && matchesSearch("notePanels") && /* @__PURE__ */ jsx(
27900
+ DropdownMenuItem,
27901
+ {
27902
+ asChild: true,
27903
+ onSelect: (e) => e.preventDefault(),
27904
+ children: /* @__PURE__ */ jsx(
27905
+ "div",
27906
+ {
27907
+ className: "cteditor-w-full",
27908
+ onClick: (e) => e.stopPropagation(),
27909
+ children: /* @__PURE__ */ jsxs("div", { className: "[&>svg]:!cteditor-size-4 [&>button]:!cteditor-size-6 cteditor-gap-2 cteditor-flex cteditor-items-center", children: [
27910
+ /* @__PURE__ */ jsx(NotePanelMenu, {}),
27911
+ "Insert Note Panel"
27912
+ ] })
27913
+ }
27914
+ )
27915
+ }
27916
+ ),
27917
+ hiddenItemIds.has("highlight") && matchesSearch("highlight") && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5 hover:cteditor-bg-foreground/5", children: [
27918
+ /* @__PURE__ */ jsx(
27919
+ HighlightColorPicker,
27920
+ {
27921
+ onChange: (color) => {
27922
+ onHighlightColorSelect(color);
27923
+ setIsMoreMenuOpen(true);
27924
+ },
27925
+ isActive: toolbarState.isHighlight
27926
+ }
27927
+ ),
27928
+ /* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-sm", children: "Highlight" })
27929
+ ] }) }),
27930
+ enableAlignment && activeEditor === editor && hiddenItemIds.has("alignMenu") && matchesSearch("alignMenu") && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-pt-2", children: [
27931
+ /* @__PURE__ */ jsx("div", { className: "cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2", children: "Align Menu" }),
27932
+ /* @__PURE__ */ jsx(AlignMenuDrop, {})
27933
+ ] }) }),
27934
+ hiddenItemIds.has("aiOptions") && matchesSearch("aiOptions") && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full", children: [
27935
+ /* @__PURE__ */ jsx("div", { className: "cteditor-text-xs cteditor-font-medium cteditor-mb-1 cteditor-opacity-60 cteditor-px-2 cteditor-pt-2", children: "Go with AI" }),
27936
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-aiOption cteditor-w-full [&>button]:cteditor-relative [&>button]:cteditor-flex [&>button]:cteditor-cursor-pointer [&>button]:cteditor-select-none [&>button]:cteditor-items-center [&>button]:cteditor-gap-2 [&>button]:cteditor-rounded-sm [&>button]:cteditor-px-2 [&>button]:cteditor-py-1.5 [&>button]:cteditor-text-[13px] [&>button]:cteditor-outline-none [&>button]:cteditor-transition-colors focus:[&>button]:cteditor-bg-foreground/5 focus:[&>button]:cteditor-text-accent-foreground hover:[&>button]:cteditor-bg-foreground/5 [&>button]:data-[disabled]:cteditor-pointer-events-none [&>button]:data-[disabled]:cteditor-opacity-50 [&>button>svg]:cteditor-size-4 [&>button>svg]:cteditor-shrink-0", children: [
27937
+ /* @__PURE__ */ jsxs(
27938
+ "button",
27939
+ {
27940
+ onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27941
+ type: "SPELLING_GRAMMAR"
27942
+ }),
27943
+ className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27944
+ children: [
27945
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(SearchTextIcon, {}) }),
27946
+ "Fix Grammar"
27947
+ ]
27948
+ }
27949
+ ),
27950
+ /* @__PURE__ */ jsxs(
27951
+ "button",
27952
+ {
27953
+ onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27954
+ type: "SIMPLIFY"
27955
+ }),
27956
+ className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27957
+ children: [
27958
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(PenLineIcon, {}) }),
27959
+ "Simplify"
27960
+ ]
27961
+ }
27962
+ ),
27963
+ /* @__PURE__ */ jsxs(
27964
+ "button",
27965
+ {
27966
+ onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27967
+ type: "COMPLETE_SENTENCE"
27968
+ }),
27969
+ className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27970
+ children: [
27971
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(MenuAltIcon, {}) }),
27972
+ "Complete Sentence"
27973
+ ]
27974
+ }
27975
+ ),
27976
+ /* @__PURE__ */ jsxs(
27977
+ "button",
27978
+ {
27979
+ onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
27980
+ type: "EMOJIFY"
27981
+ }),
27982
+ className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27983
+ children: [
27984
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(FaceSmileIcon2, {}) }),
27985
+ "Emojify"
27986
+ ]
27987
+ }
27988
+ ),
27989
+ /* @__PURE__ */ jsxs(
27990
+ "button",
27991
+ {
27992
+ onClick: () => editor.dispatchCommand(
27993
+ AI_TRANSLATE_COMMAND,
27994
+ void 0
27995
+ ),
27996
+ className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
27997
+ children: [
27998
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(TranslateIcon, {}) }),
27999
+ "Translate"
28000
+ ]
28001
+ }
28002
+ ),
28003
+ /* @__PURE__ */ jsxs(
28004
+ "button",
28005
+ {
28006
+ onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
28007
+ type: "MAKE_LONGER"
28008
+ }),
28009
+ className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
28010
+ children: [
28011
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(Maximize2, {}) }),
28012
+ "Make Longer"
28013
+ ]
28014
+ }
28015
+ ),
28016
+ /* @__PURE__ */ jsxs(
28017
+ "button",
28018
+ {
28019
+ onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
28020
+ type: "MAKE_SHORTER"
28021
+ }),
28022
+ className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
28023
+ children: [
28024
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(Minimize2, {}) }),
28025
+ "Make Shorter"
28026
+ ]
28027
+ }
28028
+ ),
28029
+ /* @__PURE__ */ jsxs(
28030
+ "button",
28031
+ {
28032
+ onClick: () => editor.dispatchCommand(
28033
+ AI_ADJUST_TONE_COMMAND,
28034
+ void 0
28035
+ ),
28036
+ className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
28037
+ children: [
28038
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(Volume2, {}) }),
28039
+ "Adjust Tone"
28040
+ ]
28041
+ }
28042
+ ),
28043
+ /* @__PURE__ */ jsxs(
28044
+ "button",
28045
+ {
28046
+ onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, {
28047
+ type: "AI_RESPONSE"
28048
+ }),
28049
+ className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
28050
+ children: [
28051
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(SparkleIcon, {}) }),
28052
+ "AI"
28053
+ ]
28054
+ }
28055
+ ),
28056
+ /* @__PURE__ */ jsxs(
28057
+ "button",
28058
+ {
28059
+ onClick: () => editor.dispatchCommand(AI_IMAGE_COMMAND, void 0),
28060
+ className: "cteditor-w-full cteditor-justify-start cteditor-gap-2",
28061
+ children: [
28062
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:cteditor-size-5 cteditor-size-6 cteditor-flex cteditor-justify-center cteditor-items-center", children: /* @__PURE__ */ jsx(ImageIcon, {}) }),
28063
+ "Generate Image"
28064
+ ]
28065
+ }
28066
+ )
28067
+ ] })
28068
+ ] }) }),
28069
+ (enableHtmlViewToggle || enableHtmlView) && hiddenItemIds.has("htmlView") && matchesSearch("htmlView") && /* @__PURE__ */ jsxs(Fragment, { children: [
28070
+ /* @__PURE__ */ jsx(DropdownMenuSeparator, { className: "!cteditor-bg-foreground/10" }),
28071
+ /* @__PURE__ */ jsxs(
28072
+ DropdownMenuItem,
28073
+ {
28074
+ onClick: toggleHtmlView,
28075
+ disabled: !editable,
28076
+ children: [
28077
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4 cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(FileCode2, {}) }),
28078
+ isHtmlView ? "Switch to Editor View" : "Switch to HTML View"
28079
+ ]
28080
+ }
28081
+ )
28082
+ ] }),
28083
+ enableAutocompleteToggle && hiddenItemIds.has("autocomplete") && matchesSearch("autocomplete") && /* @__PURE__ */ jsxs(
28084
+ DropdownMenuItem,
28085
+ {
28086
+ onClick: toggleAutocomplete,
28087
+ disabled: !editable,
28088
+ children: [
28089
+ /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4 cteditor-size-6 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(SearchTextIcon2, {}) }),
28090
+ toolbarState.isAutocompleteEnabled ? "Disable Autocorrection" : "Enable Autocorrection"
28091
+ ]
28092
+ }
28093
+ )
28094
+ ] })
28095
+ ]
28096
+ }
28097
+ )
28098
+ ]
28099
+ }
28100
+ ) })
27666
28101
  ]
27667
28102
  }
27668
28103
  ),
@@ -28842,8 +29277,8 @@ function CombinedAutocompleteGrammarPlugin({
28842
29277
  setTooltipState(null);
28843
29278
  }, TOOLTIP_CLOSE_DELAY);
28844
29279
  },
28845
- children: /* @__PURE__ */ jsx(Card, { className: "cteditor-w-[340px] cteditor-max-w-[calc(100vw-32px)] cteditor-shadow-2xl cteditor-border-2 cteditor-bg-white dark:cteditor-bg-gray-900 grammar-tooltip-card cteditor-overflow-hidden", children: /* @__PURE__ */ jsxs(CardContent, { className: "cteditor-p-4 sm:cteditor-p-5 cteditor-space-y-3 cteditor-max-h-[70vh] cteditor-overflow-y-auto", children: [
28846
- /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-start cteditor-justify-between cteditor-gap-2", children: [
29280
+ children: /* @__PURE__ */ jsx(Card, { className: "cteditor-w-[340px] cteditor-max-w-[calc(100vw-32px)] cteditor-shadow-2xl cteditor-border-2 cteditor-bg-white dark:cteditor-bg-gray-900 grammar-tooltip-card cteditor-overflow-hidden cteditor-relative", children: /* @__PURE__ */ jsxs(CardContent, { className: "!cteditor-p-4 sm:!cteditor-p-5 cteditor-space-y-3 cteditor-max-h-[70vh] cteditor-overflow-y-auto", children: [
29281
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-start cteditor-justify-between cteditor-gap-2 ", children: [
28847
29282
  /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-min-w-0 cteditor-flex-1", children: [
28848
29283
  /* @__PURE__ */ jsx(
28849
29284
  "div",
@@ -28873,7 +29308,7 @@ function CombinedAutocompleteGrammarPlugin({
28873
29308
  "button",
28874
29309
  {
28875
29310
  onClick: () => setTooltipState(null),
28876
- className: "cteditor-text-gray-400 hover:cteditor-text-gray-600 cteditor-flex-shrink-0 cteditor-p-1",
29311
+ className: "cteditor-text-gray-400 hover:cteditor-text-gray-600 cteditor-flex-shrink-0 cteditor-p-1 cteditor-absolute cteditor-top-1 cteditor-right-1",
28877
29312
  children: /* @__PURE__ */ jsx(X$1, { className: "cteditor-w-4 cteditor-h-4" })
28878
29313
  }
28879
29314
  )
@@ -28923,7 +29358,7 @@ function CombinedAutocompleteGrammarPlugin({
28923
29358
  "button",
28924
29359
  {
28925
29360
  onClick: () => dismissError(error),
28926
- className: "cteditor-w-full cteditor-px-4 cteditor-py-2.5 cteditor-text-sm cteditor-font-medium cteditor-text-gray-700 hover:cteditor-bg-gray-100 cteditor-rounded-lg cteditor-border cteditor-border-gray-300 cteditor-transition-colors",
29361
+ className: "cteditor-w-full cteditor-px-4 cteditor-py-2.5 cteditor-text-sm cteditor-font-medium cteditor-text-gray-700 hover:cteditor-text-gray-700 hover:cteditor-bg-red-50 hover:cteditor-border-red-200 cteditor-rounded-lg cteditor-border cteditor-border-gray-300 cteditor-transition-colors",
28927
29362
  title: "Ignore this suggestion",
28928
29363
  children: "Dismiss"
28929
29364
  }
@@ -28962,7 +29397,7 @@ function CombinedAutocompleteGrammarPlugin({
28962
29397
  "button",
28963
29398
  {
28964
29399
  onClick: () => dismissError(error),
28965
- className: "cteditor-w-full cteditor-px-4 cteditor-py-2.5 cteditor-text-sm cteditor-font-medium cteditor-text-gray-700 hover:cteditor-bg-gray-100 cteditor-rounded-lg cteditor-border cteditor-border-gray-300 cteditor-transition-colors",
29400
+ className: "cteditor-flex-1 cteditor-px-3 cteditor-py-2 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-1.5 cteditor-text-xs cteditor-text-gray-500 hover:cteditor-text-gray-700 hover:cteditor-bg-red-50 hover:cteditor-border-red-200 cteditor-rounded-md cteditor-border cteditor-border-gray-200 cteditor-transition-colors",
28966
29401
  title: "Ignore this suggestion",
28967
29402
  children: "Dismiss"
28968
29403
  }
@@ -28972,7 +29407,7 @@ function CombinedAutocompleteGrammarPlugin({
28972
29407
  "button",
28973
29408
  {
28974
29409
  onClick: () => handleAddToDictionary(error),
28975
- className: "cteditor-flex-1 cteditor-px-3 cteditor-py-2 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-1.5 cteditor-text-xs cteditor-text-gray-500 hover:cteditor-text-gray-700 hover:cteditor-bg-gray-50 cteditor-rounded-md cteditor-border cteditor-border-gray-200 cteditor-transition-colors",
29410
+ className: "cteditor-flex-1 cteditor-px-3 cteditor-py-2 cteditor-flex cteditor-items-center cteditor-justify-center cteditor-gap-1.5 cteditor-text-xs cteditor-text-gray-500 hover:cteditor-text-gray-700 hover:cteditor-bg-green-50 hover:cteditor-border-green-200 cteditor-rounded-md cteditor-border cteditor-border-gray-200 cteditor-transition-colors",
28976
29411
  title: "Add word to your personal dictionary",
28977
29412
  children: [
28978
29413
  /* @__PURE__ */ jsx(BookOpen, { className: "cteditor-w-3.5 cteditor-h-3.5" }),
@@ -29010,7 +29445,7 @@ function CombinedAutocompleteGrammarPlugin({
29010
29445
  {
29011
29446
  ref: menuRef,
29012
29447
  className: "cteditor-w-80 cteditor-max-h-64 cteditor-overflow-hidden cteditor-shadow-xl cteditor-border-2 cteditor-bg-white dark:cteditor-bg-gray-900 autocomplete-menu",
29013
- children: /* @__PURE__ */ jsx(CardContent, { className: "cteditor-p-2", children: /* @__PURE__ */ jsx("div", { className: "cteditor-max-h-56 cteditor-overflow-y-auto cteditor-space-y-1", children: suggestions.map((option, index2) => /* @__PURE__ */ jsxs(
29448
+ children: /* @__PURE__ */ jsx(CardContent, { className: "!cteditor-p-2", children: /* @__PURE__ */ jsx("div", { className: "cteditor-max-h-56 cteditor-overflow-y-auto cteditor-space-y-1", children: suggestions.map((option, index2) => /* @__PURE__ */ jsxs(
29014
29449
  "button",
29015
29450
  {
29016
29451
  className: cn(
@@ -29134,7 +29569,7 @@ const CommentModal = ({
29134
29569
  return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:cteditor-max-w-xl", children: [
29135
29570
  /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { className: "cteditor-flex cteditor-items-center cteditor-gap-3", children: "Add Comment" }) }),
29136
29571
  /* @__PURE__ */ jsxs("div", { className: "cteditor-space-y-4", children: [
29137
- selectedText && /* @__PURE__ */ jsx(Card, { className: "cteditor-bg-primary/5 cteditor-border-primary/20 cteditor-rounded-md", children: /* @__PURE__ */ jsx(CardContent, { className: "cteditor-p-2 cteditor-px-4", children: /* @__PURE__ */ jsxs("div", { className: "cteditor-space-y-1", children: [
29572
+ selectedText && /* @__PURE__ */ jsx(Card, { className: "cteditor-bg-primary/5 cteditor-border-primary/20 cteditor-rounded-md pt-6", children: /* @__PURE__ */ jsx(CardContent, { className: "md:cteditor-p-2 cteditor-p-2 cteditor-px-4 md:cteditor-pt-3 cteditor-pt-2", children: /* @__PURE__ */ jsxs("div", { className: "cteditor-space-y-1", children: [
29138
29573
  /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm cteditor-font-medium", children: "Selected text:" }),
29139
29574
  /* @__PURE__ */ jsxs("p", { className: "cteditor-text-sm cteditor-italic cteditor-text-muted-foreground cteditor-leading-relaxed", children: [
29140
29575
  "“",
@@ -29446,6 +29881,11 @@ function DragDropPaste() {
29446
29881
  return null;
29447
29882
  }
29448
29883
  const FloatingEmbedMenuPlugin$1 = "";
29884
+ const menuSectionClass = "cteditor-w-full";
29885
+ const menuButtonsClass = "cteditor-flex cteditor-w-full";
29886
+ const menuButtonBaseClass = "cteditor-flex cteditor-items-center cteditor-justify-center cteditor-bg-transparent cteditor-border-none cteditor-rounded cteditor-w-6 cteditor-h-6 cteditor-mr-1 cteditor-cursor-pointer cteditor-text-white cteditor-transition-colors cteditor-duration-200 hover:cteditor-bg-[rgba(25,118,210,0.1)]";
29887
+ const menuButtonActiveClass = "cteditor-bg-[hsla(var(--foreground)/0.1)] cteditor-text-white";
29888
+ const menuDividerClass = "cteditor-h-6 cteditor-bg-foreground/20 cteditor-mx-2 cteditor-w-px";
29449
29889
  function FloatingEmbedMenu({
29450
29890
  editor,
29451
29891
  anchorElem,
@@ -29633,7 +30073,7 @@ function FloatingEmbedMenu({
29633
30073
  return /* @__PURE__ */ jsxs(
29634
30074
  "div",
29635
30075
  {
29636
- className: "floating-embed-menu",
30076
+ className: "floating-embed-menu cteditor-bg-accent cteditor-text-sm cteditor-p-1 cteditor-rounded-md cteditor-space-x-1",
29637
30077
  ref: menuRef,
29638
30078
  onClick: handleMenuClick,
29639
30079
  style: {
@@ -29646,110 +30086,128 @@ function FloatingEmbedMenu({
29646
30086
  transition: "opacity 0.15s ease-in-out"
29647
30087
  },
29648
30088
  children: [
29649
- /* @__PURE__ */ jsx("div", { className: "embed-menu-section", children: /* @__PURE__ */ jsxs("div", { className: "embed-menu-buttons", children: [
30089
+ /* @__PURE__ */ jsx("div", { className: menuSectionClass, children: /* @__PURE__ */ jsxs("div", { className: menuButtonsClass, children: [
29650
30090
  /* @__PURE__ */ jsx(
29651
30091
  "button",
29652
30092
  {
29653
- className: `embed-menu-button ${displayType === "url" ? "active" : ""}`,
30093
+ className: cn(
30094
+ menuButtonBaseClass,
30095
+ displayType === "url" && menuButtonActiveClass
30096
+ ),
29654
30097
  onClick: (e) => {
29655
30098
  e.stopPropagation();
29656
30099
  handleDisplayTypeChange("url");
29657
30100
  },
29658
30101
  title: "URL",
29659
- children: /* @__PURE__ */ jsx(Link$1, { fontSize: "small" })
30102
+ children: /* @__PURE__ */ jsx(LinkIcon, {})
29660
30103
  }
29661
30104
  ),
29662
30105
  /* @__PURE__ */ jsx(
29663
30106
  "button",
29664
30107
  {
29665
- className: `embed-menu-button ${displayType === "card" ? "active" : ""}`,
30108
+ className: cn(
30109
+ menuButtonBaseClass,
30110
+ displayType === "card" && menuButtonActiveClass
30111
+ ),
29666
30112
  onClick: (e) => {
29667
30113
  e.stopPropagation();
29668
30114
  handleDisplayTypeChange("card");
29669
30115
  },
29670
30116
  title: "Card",
29671
- children: /* @__PURE__ */ jsx(CropOriginal, { fontSize: "small" })
30117
+ children: /* @__PURE__ */ jsx(Image$2, { className: "cteditor-size-3.5" })
29672
30118
  }
29673
30119
  ),
29674
30120
  /* @__PURE__ */ jsx(
29675
30121
  "button",
29676
30122
  {
29677
- className: `embed-menu-button ${displayType === "embed" ? "active" : ""}`,
30123
+ className: cn(
30124
+ menuButtonBaseClass,
30125
+ displayType === "embed" && menuButtonActiveClass
30126
+ ),
29678
30127
  onClick: (e) => {
29679
30128
  e.stopPropagation();
29680
30129
  handleDisplayTypeChange("embed");
29681
30130
  },
29682
30131
  title: "Embedded",
29683
- children: /* @__PURE__ */ jsx(Code$1, { fontSize: "small" })
30132
+ children: /* @__PURE__ */ jsx(CodeIcon, {})
29684
30133
  }
29685
30134
  )
29686
30135
  ] }) }),
29687
- /* @__PURE__ */ jsx("div", { className: "embed-menu-divider" }),
29688
- /* @__PURE__ */ jsx("div", { className: "embed-menu-section", children: /* @__PURE__ */ jsxs("div", { className: "embed-menu-buttons", children: [
30136
+ /* @__PURE__ */ jsx("div", { className: menuDividerClass }),
30137
+ /* @__PURE__ */ jsx("div", { className: menuSectionClass, children: /* @__PURE__ */ jsxs("div", { className: menuButtonsClass, children: [
29689
30138
  /* @__PURE__ */ jsx(
29690
30139
  "button",
29691
30140
  {
29692
- className: `embed-menu-button ${alignment === "left" ? "active" : ""}`,
30141
+ className: cn(
30142
+ menuButtonBaseClass,
30143
+ alignment === "left" && menuButtonActiveClass
30144
+ ),
29693
30145
  onClick: (e) => {
29694
30146
  e.stopPropagation();
29695
30147
  handleAlignmentChange("left");
29696
30148
  },
29697
30149
  title: "Left",
29698
- children: /* @__PURE__ */ jsx(FormatAlignLeft, { fontSize: "small" })
30150
+ children: /* @__PURE__ */ jsx(AlignLeft, { className: "cteditor-size-4" })
29699
30151
  }
29700
30152
  ),
29701
30153
  /* @__PURE__ */ jsx(
29702
30154
  "button",
29703
30155
  {
29704
- className: `embed-menu-button ${alignment === "center" ? "active" : ""}`,
30156
+ className: cn(
30157
+ menuButtonBaseClass,
30158
+ alignment === "center" && menuButtonActiveClass
30159
+ ),
29705
30160
  onClick: (e) => {
29706
30161
  e.stopPropagation();
29707
30162
  handleAlignmentChange("center");
29708
30163
  },
29709
30164
  title: "Center",
29710
- children: /* @__PURE__ */ jsx(FormatAlignCenter, { fontSize: "small" })
30165
+ children: /* @__PURE__ */ jsx(AlignCenter, { className: "cteditor-size-4" })
29711
30166
  }
29712
30167
  ),
29713
30168
  /* @__PURE__ */ jsx(
29714
30169
  "button",
29715
30170
  {
29716
- className: `embed-menu-button ${alignment === "right" ? "active" : ""}`,
30171
+ className: cn(
30172
+ menuButtonBaseClass,
30173
+ alignment === "right" && menuButtonActiveClass
30174
+ ),
29717
30175
  onClick: (e) => {
29718
30176
  e.stopPropagation();
29719
30177
  handleAlignmentChange("right");
29720
30178
  },
29721
30179
  title: "Right",
29722
- children: /* @__PURE__ */ jsx(FormatAlignRight, { fontSize: "small" })
30180
+ children: /* @__PURE__ */ jsx(AlignRight, { className: "cteditor-size-4" })
29723
30181
  }
29724
30182
  )
29725
30183
  ] }) }),
29726
- /* @__PURE__ */ jsx("div", { className: "embed-menu-divider" }),
29727
- /* @__PURE__ */ jsx("div", { className: "embed-menu-section", children: /* @__PURE__ */ jsxs("div", { className: "embed-menu-buttons", children: [
30184
+ /* @__PURE__ */ jsx("div", { className: menuDividerClass }),
30185
+ /* @__PURE__ */ jsx("div", { className: menuSectionClass, children: /* @__PURE__ */ jsxs("div", { className: menuButtonsClass, children: [
29728
30186
  /* @__PURE__ */ jsx(
29729
30187
  "button",
29730
30188
  {
29731
- className: "embed-menu-button",
30189
+ className: menuButtonBaseClass,
29732
30190
  onClick: handleOpenInNewTab,
29733
30191
  title: "Open in new tab",
29734
- children: /* @__PURE__ */ jsx(OpenInNew, { fontSize: "small" })
30192
+ children: /* @__PURE__ */ jsx(ExternalLink, { className: "cteditor-size-4" })
29735
30193
  }
29736
30194
  ),
29737
30195
  /* @__PURE__ */ jsx(
29738
30196
  "button",
29739
30197
  {
29740
- className: "embed-menu-button",
30198
+ className: menuButtonBaseClass,
29741
30199
  onClick: handleRemoveEmbed,
29742
30200
  title: "Remove",
29743
- children: /* @__PURE__ */ jsx(Delete, { fontSize: "small" })
30201
+ children: /* @__PURE__ */ jsx(Trash2, { className: "cteditor-size-4" })
29744
30202
  }
29745
30203
  ),
29746
30204
  /* @__PURE__ */ jsx(
29747
30205
  "button",
29748
30206
  {
29749
- className: "embed-menu-button",
30207
+ className: menuButtonBaseClass,
29750
30208
  onClick: handleCopyUrl,
29751
30209
  title: "Copy",
29752
- children: /* @__PURE__ */ jsx(ContentCopy, { fontSize: "small" })
30210
+ children: /* @__PURE__ */ jsx(Copy, { className: "cteditor-size-4" })
29753
30211
  }
29754
30212
  )
29755
30213
  ] }) })
@@ -29917,6 +30375,14 @@ function FloatingEmbedMenuPlugin({
29917
30375
  const [editor] = useLexicalComposerContext();
29918
30376
  return useFloatingEmbedMenu(editor, anchorElem);
29919
30377
  }
30378
+ const VIDEO_EMBED_URLS = [
30379
+ "youtube.com",
30380
+ "youtu.be",
30381
+ "vimeo.com",
30382
+ "loom.com",
30383
+ "supercut.video",
30384
+ "jam.dev"
30385
+ ];
29920
30386
  const EmbedPreviewPlugin = ({
29921
30387
  floatingAnchorElem = document.body
29922
30388
  }) => {
@@ -29968,49 +30434,46 @@ const EmbedPreviewPlugin = ({
29968
30434
  };
29969
30435
  }, [editor]);
29970
30436
  useEffect$1(() => {
29971
- const handlePaste = (event) => {
29972
- const clipboardData = event.clipboardData;
29973
- if (!clipboardData)
29974
- return;
29975
- const text = clipboardData.getData("text");
29976
- console.log("Pasted text:", text);
29977
- if (text.includes("supercut.video")) {
29978
- console.log("Detected Supercut URL");
29979
- event.preventDefault();
29980
- editor.update(() => {
29981
- const selection = $getSelection();
29982
- if ($isRangeSelection(selection)) {
29983
- selection.getNodes().forEach((node) => node.remove());
30437
+ return editor.registerCommand(
30438
+ PASTE_COMMAND,
30439
+ (event) => {
30440
+ const clipboardData = event.clipboardData;
30441
+ if (!clipboardData)
30442
+ return false;
30443
+ const text = clipboardData.getData("text/plain").trim();
30444
+ console.log("PASTE_COMMAND - Pasted text:", text);
30445
+ if (!text.match(/^https?:\/\//)) {
30446
+ return false;
30447
+ }
30448
+ const isVideoEmbed = VIDEO_EMBED_URLS.some(
30449
+ (domain) => text.includes(domain)
30450
+ );
30451
+ if (isVideoEmbed) {
30452
+ console.log("Detected video embed URL:", text);
30453
+ const selection2 = $getSelection();
30454
+ if ($isRangeSelection(selection2)) {
29984
30455
  const embedNode = $createEmbedNode(text);
29985
30456
  embedNode.setDisplayType("embed");
29986
- selection.insertNodes([embedNode]);
29987
- console.log("Inserted Supercut embed node");
30457
+ selection2.insertNodes([embedNode]);
30458
+ console.log("Inserted video embed node");
29988
30459
  }
29989
- });
29990
- return;
29991
- }
29992
- if (text.match(/https?:\/\//)) {
29993
- event.preventDefault();
29994
- editor.update(() => {
29995
- const selection = $getSelection();
29996
- if ($isRangeSelection(selection)) {
29997
- selection.getNodes().forEach((node) => node.remove());
29998
- const embedNode = $createEmbedNode(text);
29999
- if (text.includes("youtube.com") || text.includes("youtu.be") || text.includes("vimeo.com") || text.includes("loom.com") || text.includes("supercut.video")) {
30000
- embedNode.setDisplayType("embed");
30001
- } else if (text.match(/\.(pdf|docx?|xlsx?|pptx?|zip|rar|txt)$/)) {
30002
- embedNode.setDisplayType("card");
30003
- } else {
30004
- embedNode.setDisplayType("url");
30005
- }
30006
- selection.insertNodes([embedNode]);
30007
- console.log("Inserted embed node with URL:", text);
30460
+ return true;
30461
+ }
30462
+ const selection = $getSelection();
30463
+ if ($isRangeSelection(selection)) {
30464
+ const embedNode = $createEmbedNode(text);
30465
+ if (text.match(/\.(pdf|docx?|xlsx?|pptx?|zip|rar|txt)$/)) {
30466
+ embedNode.setDisplayType("card");
30467
+ } else {
30468
+ embedNode.setDisplayType("url");
30008
30469
  }
30009
- });
30010
- }
30011
- };
30012
- document.addEventListener("paste", handlePaste);
30013
- return () => document.removeEventListener("paste", handlePaste);
30470
+ selection.insertNodes([embedNode]);
30471
+ console.log("Inserted embed node with URL:", text);
30472
+ }
30473
+ return true;
30474
+ },
30475
+ COMMAND_PRIORITY_HIGH
30476
+ );
30014
30477
  }, [editor]);
30015
30478
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(FloatingEmbedMenuPlugin, { anchorElem: floatingAnchorElem }) });
30016
30479
  };
@@ -30088,121 +30551,93 @@ const TextEnhanceDialog = forwardRef(
30088
30551
  }
30089
30552
  handleClose();
30090
30553
  };
30091
- if (!isOpen)
30092
- return null;
30093
- return createPortal(
30094
- /* @__PURE__ */ jsxs("div", { className: "cteditor-fixed cteditor-inset-0 cteditor-z-[9999] cteditor-flex cteditor-items-start cteditor-justify-end cteditor-p-4", children: [
30095
- /* @__PURE__ */ jsx(
30096
- "div",
30097
- {
30098
- className: "cteditor-absolute cteditor-inset-0 cteditor-bg-black/30 cteditor-backdrop-blur-sm",
30099
- onClick: handleClose
30100
- }
30101
- ),
30102
- /* @__PURE__ */ jsxs("div", { className: "cteditor-relative cteditor-w-full cteditor-max-w-md cteditor-bg-background cteditor-rounded-xl cteditor-shadow-2xl cteditor-border cteditor-border-border cteditor-overflow-hidden cteditor-animate-in cteditor-fade-in cteditor-slide-in-from-right", style: { maxHeight: "calc(100vh - 32px)" }, children: [
30103
- /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-justify-between cteditor-p-4 cteditor-border-b cteditor-border-border", children: [
30104
- /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-2", children: [
30105
- /* @__PURE__ */ jsx("div", { className: "cteditor-w-8 cteditor-h-8 cteditor-rounded-full cteditor-bg-purple-500/10 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(Sparkles, { className: "cteditor-w-4 cteditor-h-4 cteditor-text-purple-500" }) }),
30106
- /* @__PURE__ */ jsx("h2", { className: "cteditor-text-base cteditor-font-semibold cteditor-text-foreground", children: "Enhance Text" })
30107
- ] }),
30108
- /* @__PURE__ */ jsx(
30109
- "button",
30110
- {
30111
- onClick: handleClose,
30112
- className: "cteditor-w-7 cteditor-h-7 cteditor-rounded-lg cteditor-flex cteditor-items-center cteditor-justify-center hover:cteditor-bg-accent cteditor-transition-colors",
30113
- children: /* @__PURE__ */ jsx(X$1, { className: "cteditor-w-4 cteditor-h-4" })
30114
- }
30115
- )
30116
- ] }),
30117
- /* @__PURE__ */ jsxs("div", { className: "cteditor-p-4 cteditor-space-y-4 cteditor-overflow-y-auto", style: { maxHeight: "calc(100vh - 160px)" }, children: [
30118
- /* @__PURE__ */ jsxs("div", { className: "cteditor-space-y-1.5", children: [
30119
- /* @__PURE__ */ jsx("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "Selected Text" }),
30120
- /* @__PURE__ */ jsx("div", { className: "cteditor-p-3 cteditor-bg-accent/50 cteditor-rounded-lg cteditor-border cteditor-border-border cteditor-max-h-24 cteditor-overflow-y-auto", children: /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm cteditor-text-foreground cteditor-leading-relaxed", children: selectedText }) })
30121
- ] }),
30122
- !showResult && /* @__PURE__ */ jsxs("div", { className: "cteditor-space-y-1.5", children: [
30123
- /* @__PURE__ */ jsx("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "How to enhance?" }),
30124
- /* @__PURE__ */ jsx(
30125
- "textarea",
30126
- {
30127
- value: userPrompt,
30128
- onChange: (e) => setUserPrompt(e.target.value),
30129
- placeholder: "E.g., Make it professional, Add details, Simplify...",
30130
- className: "cteditor-w-full cteditor-h-20 cteditor-p-3 cteditor-bg-background cteditor-rounded-lg cteditor-border cteditor-border-border focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-purple-500/50 cteditor-text-sm cteditor-text-foreground cteditor-placeholder-muted-foreground cteditor-resize-none",
30131
- disabled: isLoading,
30132
- onKeyDown: (e) => {
30133
- if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
30134
- handleEnhance();
30135
- }
30136
- }
30554
+ return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:cteditor-max-w-[500px] cteditor-max-h-[650px]", children: [
30555
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
30556
+ /* @__PURE__ */ jsxs(DialogTitle, { className: "cteditor-flex cteditor-items-center cteditor-gap-2", children: [
30557
+ /* @__PURE__ */ jsx(Sparkles, { className: "cteditor-size-5" }),
30558
+ "Enhance Text"
30559
+ ] }),
30560
+ /* @__PURE__ */ jsx(DialogDescription, { children: "Enhance your selected text with AI assistance." })
30561
+ ] }),
30562
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-space-y-4 cteditor-overflow-y-auto cteditor-max-h-[400px] cteditor-pr-2", children: [
30563
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-space-y-1.5", children: [
30564
+ /* @__PURE__ */ jsx("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "Selected Text" }),
30565
+ /* @__PURE__ */ jsx("div", { className: "cteditor-p-3 cteditor-bg-accent/50 cteditor-rounded-lg cteditor-border cteditor-border-border cteditor-max-h-24 cteditor-overflow-y-auto", children: /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm cteditor-text-foreground cteditor-leading-relaxed", children: selectedText }) })
30566
+ ] }),
30567
+ !showResult && /* @__PURE__ */ jsxs("div", { className: "cteditor-space-y-1.5", children: [
30568
+ /* @__PURE__ */ jsx("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "How to enhance?" }),
30569
+ /* @__PURE__ */ jsx(
30570
+ "textarea",
30571
+ {
30572
+ value: userPrompt,
30573
+ onChange: (e) => setUserPrompt(e.target.value),
30574
+ placeholder: "E.g., Make it professional, Add details, Simplify...",
30575
+ className: "cteditor-w-full cteditor-h-20 cteditor-p-3 cteditor-bg-background cteditor-rounded-lg cteditor-border cteditor-border-border focus:cteditor-border-foreground cteditor-outline-none cteditor-text-sm cteditor-text-foreground cteditor-placeholder-muted-foreground cteditor-resize-none",
30576
+ disabled: isLoading,
30577
+ onKeyDown: (e) => {
30578
+ if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
30579
+ handleEnhance();
30137
30580
  }
30138
- ),
30139
- /* @__PURE__ */ jsx("p", { className: "cteditor-text-xs cteditor-text-muted-foreground", children: "Ctrl+Enter to enhance" })
30140
- ] }),
30141
- isLoading && /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-py-8 cteditor-space-y-3", children: [
30142
- /* @__PURE__ */ jsxs("div", { className: "cteditor-relative cteditor-w-14 cteditor-h-14", children: [
30143
- /* @__PURE__ */ jsx(
30144
- "div",
30145
- {
30146
- className: "cteditor-absolute cteditor-inset-0 cteditor-rounded-full cteditor-opacity-75",
30147
- style: {
30148
- background: "linear-gradient(to right, #a855f7, #ec4899, #a855f7)",
30149
- animation: "spin 2s linear infinite",
30150
- padding: "2px",
30151
- WebkitMask: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
30152
- WebkitMaskComposite: "xor",
30153
- maskComposite: "exclude"
30154
- }
30155
- }
30156
- ),
30157
- /* @__PURE__ */ jsx("div", { className: "cteditor-absolute cteditor-inset-0 cteditor-rounded-full cteditor-bg-background cteditor-flex cteditor-items-center cteditor-justify-center cteditor-m-[2px]", children: /* @__PURE__ */ jsx(Sparkles, { className: "cteditor-w-6 cteditor-h-6 cteditor-text-purple-500 cteditor-animate-pulse" }) })
30158
- ] }),
30159
- /* @__PURE__ */ jsx("div", { className: "cteditor-text-center", children: /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-foreground", children: "Enhancing text..." }) })
30160
- ] }),
30161
- showResult && !isLoading && /* @__PURE__ */ jsxs("div", { className: "cteditor-space-y-1.5 cteditor-animate-in cteditor-fade-in cteditor-slide-in-from-bottom-4", children: [
30162
- /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
30163
- /* @__PURE__ */ jsx(Check, { className: "cteditor-w-3.5 cteditor-h-3.5 cteditor-text-green-500" }),
30164
- /* @__PURE__ */ jsx("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "Enhanced Text" })
30165
- ] }),
30166
- /* @__PURE__ */ jsx("div", { className: "cteditor-p-3 cteditor-bg-gradient-to-br cteditor-from-purple-500/5 cteditor-to-pink-500/5 cteditor-rounded-lg cteditor-border cteditor-border-purple-500/20 cteditor-max-h-48 cteditor-overflow-y-auto", children: /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm cteditor-text-foreground cteditor-leading-relaxed", children: enhancedText }) })
30167
- ] })
30168
- ] }),
30169
- /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-justify-end cteditor-gap-2 cteditor-p-3 cteditor-border-t cteditor-border-border cteditor-bg-accent/30", children: [
30170
- /* @__PURE__ */ jsx(
30171
- "button",
30172
- {
30173
- onClick: handleClose,
30174
- className: "cteditor-px-3 cteditor-py-1.5 cteditor-rounded-lg cteditor-text-xs cteditor-font-medium cteditor-text-foreground hover:cteditor-bg-accent cteditor-transition-colors",
30175
- children: "Cancel"
30176
30581
  }
30177
- ),
30178
- !showResult && /* @__PURE__ */ jsxs(
30179
- "button",
30582
+ }
30583
+ ),
30584
+ /* @__PURE__ */ jsx("p", { className: "cteditor-text-xs cteditor-text-muted-foreground", children: "Ctrl+Enter to enhance" })
30585
+ ] }),
30586
+ isLoading && /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center cteditor-py-0 cteditor-space-y-3", children: [
30587
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-relative cteditor-w-14 cteditor-h-14", children: [
30588
+ /* @__PURE__ */ jsx(
30589
+ "div",
30180
30590
  {
30181
- onClick: handleEnhance,
30182
- disabled: !userPrompt.trim() || isLoading,
30183
- className: "cteditor-px-4 cteditor-py-1.5 cteditor-rounded-lg cteditor-text-xs cteditor-font-medium cteditor-bg-purple-500 cteditor-text-white hover:cteditor-bg-purple-600 disabled:cteditor-opacity-50 disabled:cteditor-cursor-not-allowed cteditor-transition-all cteditor-flex cteditor-items-center cteditor-gap-1.5",
30184
- children: [
30185
- /* @__PURE__ */ jsx(Sparkles, { className: "cteditor-w-3.5 cteditor-h-3.5" }),
30186
- "Enhance"
30187
- ]
30591
+ className: "cteditor-absolute cteditor-inset-0 cteditor-rounded-full cteditor-opacity-75",
30592
+ style: {
30593
+ background: "linear-gradient(to right, #a855f7, #ec4899, #a855f7)",
30594
+ animation: "spin 2s linear infinite",
30595
+ padding: "2px",
30596
+ WebkitMask: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
30597
+ WebkitMaskComposite: "xor",
30598
+ maskComposite: "exclude"
30599
+ }
30188
30600
  }
30189
30601
  ),
30190
- showResult && /* @__PURE__ */ jsxs(
30191
- "button",
30192
- {
30193
- onClick: handleInsert,
30194
- className: "cteditor-px-4 cteditor-py-1.5 cteditor-rounded-lg cteditor-text-xs cteditor-font-medium cteditor-bg-green-500 cteditor-text-white hover:cteditor-bg-green-600 cteditor-transition-all cteditor-flex cteditor-items-center cteditor-gap-1.5",
30195
- children: [
30196
- "Insert",
30197
- /* @__PURE__ */ jsx(ArrowRight, { className: "cteditor-w-3.5 cteditor-h-3.5" })
30198
- ]
30199
- }
30200
- )
30201
- ] })
30602
+ /* @__PURE__ */ jsx("div", { className: "cteditor-absolute cteditor-inset-0 cteditor-rounded-full cteditor-bg-background cteditor-flex cteditor-items-center cteditor-justify-center cteditor-m-[2px]", children: /* @__PURE__ */ jsx(Sparkles, { className: "cteditor-w-6 cteditor-h-6 cteditor-text-purple-500 cteditor-animate-pulse" }) })
30603
+ ] }),
30604
+ /* @__PURE__ */ jsx("div", { className: "cteditor-text-center", children: /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm cteditor-font-medium cteditor-text-foreground", children: "Enhancing text..." }) })
30605
+ ] }),
30606
+ showResult && !isLoading && /* @__PURE__ */ jsxs("div", { className: "cteditor-space-y-1.5 cteditor-animate-in cteditor-fade-in cteditor-slide-in-from-bottom-4", children: [
30607
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
30608
+ /* @__PURE__ */ jsx(Check, { className: "cteditor-w-3.5 cteditor-h-3.5 cteditor-text-green-500" }),
30609
+ /* @__PURE__ */ jsx("label", { className: "cteditor-text-xs cteditor-font-medium cteditor-text-foreground", children: "Enhanced Text" })
30610
+ ] }),
30611
+ /* @__PURE__ */ jsx("div", { className: "cteditor-p-3 cteditor-bg-gradient-to-br cteditor-from-purple-500/5 cteditor-to-pink-500/5 cteditor-rounded-lg cteditor-border cteditor-border-purple-500/20 cteditor-max-h-48 cteditor-overflow-y-auto", children: /* @__PURE__ */ jsx("p", { className: "cteditor-text-sm cteditor-text-foreground cteditor-leading-relaxed", children: enhancedText }) })
30202
30612
  ] })
30203
30613
  ] }),
30204
- document.body
30205
- );
30614
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [
30615
+ /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: handleClose, children: "Cancel" }),
30616
+ !showResult && /* @__PURE__ */ jsxs(
30617
+ Button,
30618
+ {
30619
+ onClick: handleEnhance,
30620
+ disabled: !userPrompt.trim() || isLoading,
30621
+ className: "cteditor-gap-2",
30622
+ children: [
30623
+ /* @__PURE__ */ jsx(Sparkles, { className: "cteditor-size-5" }),
30624
+ "Enhance"
30625
+ ]
30626
+ }
30627
+ ),
30628
+ showResult && /* @__PURE__ */ jsxs(
30629
+ Button,
30630
+ {
30631
+ onClick: handleInsert,
30632
+ className: "cteditor-gap-2",
30633
+ children: [
30634
+ "Insert",
30635
+ /* @__PURE__ */ jsx(ArrowRight, { className: "cteditor-size-5" })
30636
+ ]
30637
+ }
30638
+ )
30639
+ ] })
30640
+ ] }) });
30206
30641
  }
30207
30642
  );
30208
30643
  TextEnhanceDialog.displayName = "TextEnhanceDialog";
@@ -30971,11 +31406,26 @@ function TextFormatFloatingToolbar({
30971
31406
  isStrikethrough,
30972
31407
  isSubscript,
30973
31408
  isSuperscript,
31409
+ isHighlight,
30974
31410
  setIsLinkEditMode,
30975
31411
  features
30976
31412
  }) {
30977
31413
  const popupCharStylesEditorRef = useRef(null);
30978
31414
  const { isHtmlView, setIsHtmlView, setHtmlContent } = useHtmlView();
31415
+ const toggleHighlight = useCallback(() => {
31416
+ editor.update(() => {
31417
+ const selection = $getSelection();
31418
+ if ($isRangeSelection(selection)) {
31419
+ if (isHighlight) {
31420
+ editor.dispatchCommand(FORMAT_TEXT_COMMAND, "highlight");
31421
+ $patchStyleText(selection, { "background-color": "transparent" });
31422
+ } else {
31423
+ editor.dispatchCommand(FORMAT_TEXT_COMMAND, "highlight");
31424
+ $patchStyleText(selection, { "background-color": "#ffeb3b" });
31425
+ }
31426
+ }
31427
+ });
31428
+ }, [editor, isHighlight]);
30979
31429
  const insertLink = useCallback(() => {
30980
31430
  if (!isLink) {
30981
31431
  setIsLinkEditMode(true);
@@ -31112,8 +31562,6 @@ function TextFormatFloatingToolbar({
31112
31562
  )
31113
31563
  );
31114
31564
  }, [editor, $updateTextFormatFloatingToolbar]);
31115
- console.log("FloatingTextFormatToolbar features:", features);
31116
- console.log("Improve feature enabled:", features == null ? void 0 : features.improve);
31117
31565
  const popupItems = "cteditor-border-0 hover:cteditor-bg-foreground/10 cteditor-size-6 cteditor-flex cteditor-bg-none cteditor-rounded-sm cteditor-p-[2px] cteditor-cursor-pointer cteditor-align-middle cteditor-flex cteditor-items-center cteditor-justify-center disabled:cursor-not-allowed hover:cteditor-bg-accent ";
31118
31566
  return /* @__PURE__ */ jsx(
31119
31567
  "div",
@@ -31209,6 +31657,20 @@ function TextFormatFloatingToolbar({
31209
31657
  ]
31210
31658
  }
31211
31659
  ),
31660
+ /* @__PURE__ */ jsxs(
31661
+ "button",
31662
+ {
31663
+ type: "button",
31664
+ onClick: toggleHighlight,
31665
+ className: popupItems + (isHighlight ? "cteditor-bg-foreground/20" : ""),
31666
+ title: "Highlight",
31667
+ "aria-label": "Highlight text",
31668
+ children: [
31669
+ /* @__PURE__ */ jsx(Highlighter, { size: 16 }),
31670
+ /* @__PURE__ */ jsx("span", { className: "cteditor-absolute cteditor-bottom-3/4 cteditor-left-1/2 -cteditor-translate-x-1/2 cteditor-font-medium cteditor-text-xs cteditor-rounded cteditor-bg-background cteditor-px-1.5 cteditor-py-1 cteditor-whitespace-nowrap cteditor-w-auto cteditor-pointer-events-none cteditor-transition-all cteditor-opacity-0 cteditor-border cteditor-border-accent", children: "Highlight" })
31671
+ ]
31672
+ }
31673
+ ),
31212
31674
  (features == null ? void 0 : features.comment) && /* @__PURE__ */ jsxs(
31213
31675
  "button",
31214
31676
  {
@@ -31242,6 +31704,7 @@ function useFloatingTextFormatToolbar(editor, anchorElem, setIsLinkEditMode, fea
31242
31704
  const [isSubscript, setIsSubscript] = useState$1(false);
31243
31705
  const [isSuperscript, setIsSuperscript] = useState$1(false);
31244
31706
  const [isCode, setIsCode] = useState$1(false);
31707
+ const [isHighlight, setIsHighlight] = useState$1(false);
31245
31708
  const updatePopup = useCallback(() => {
31246
31709
  editor.getEditorState().read(() => {
31247
31710
  if (editor.isComposing()) {
@@ -31268,6 +31731,7 @@ function useFloatingTextFormatToolbar(editor, anchorElem, setIsLinkEditMode, fea
31268
31731
  setIsSubscript(selection.hasFormat("subscript"));
31269
31732
  setIsSuperscript(selection.hasFormat("superscript"));
31270
31733
  setIsCode(selection.hasFormat("code"));
31734
+ setIsHighlight(selection.hasFormat("highlight"));
31271
31735
  const parent = node.getParent();
31272
31736
  if ($isLinkNode(parent) || $isLinkNode(node)) {
31273
31737
  setIsLink(true);
@@ -31324,6 +31788,7 @@ function useFloatingTextFormatToolbar(editor, anchorElem, setIsLinkEditMode, fea
31324
31788
  isSuperscript,
31325
31789
  isUnderline,
31326
31790
  isCode,
31791
+ isHighlight,
31327
31792
  setIsLinkEditMode,
31328
31793
  features
31329
31794
  }
@@ -31348,7 +31813,8 @@ function FloatingTextFormatToolbarPlugin({
31348
31813
  link: true,
31349
31814
  aiChat: true,
31350
31815
  comment: true,
31351
- improve: true
31816
+ improve: true,
31817
+ highlight: true
31352
31818
  }
31353
31819
  }) {
31354
31820
  const [editor] = useLexicalComposerContext();
@@ -31383,7 +31849,7 @@ const HtmlViewTogglePlugin = () => {
31383
31849
  }
31384
31850
  };
31385
31851
  return /* @__PURE__ */ jsxs("div", { children: [
31386
- /* @__PURE__ */ jsx(Button, { onClick: toggleView, className: "my-2.5", children: isHtmlView ? "Switch to Editor View" : "Switch to HTML View" }),
31852
+ /* @__PURE__ */ jsx(Button, { onClick: toggleView, className: "cteditor-my-2.5", children: isHtmlView ? "Switch to Editor View" : "Switch to HTML View" }),
31387
31853
  isHtmlView ? /* @__PURE__ */ jsx("div", { className: "editorView", children: /* @__PURE__ */ jsx(
31388
31854
  "textarea",
31389
31855
  {
@@ -32525,7 +32991,7 @@ function NewMentionsPlugin({
32525
32991
  });
32526
32992
  const options = useMemo(
32527
32993
  () => results.map(
32528
- (result) => new MentionTypeaheadOption(result, /* @__PURE__ */ jsx("i", { className: "icon user" }))
32994
+ (result) => new MentionTypeaheadOption(result, /* @__PURE__ */ jsx("i", { className: "icon user", children: /* @__PURE__ */ jsx(UserRound, { size: 14 }) }))
32529
32995
  ).slice(0, SUGGESTION_LIST_LENGTH_LIMIT),
32530
32996
  [results]
32531
32997
  );
@@ -32560,7 +33026,7 @@ function NewMentionsPlugin({
32560
33026
  triggerFn: checkForMentionMatch,
32561
33027
  options,
32562
33028
  menuRenderFn: (anchorElementRef, { selectedIndex, selectOptionAndCleanUp, setHighlightedIndex }) => anchorElementRef.current ? ReactDOM.createPortal(
32563
- /* @__PURE__ */ jsx("div", { className: "typeahead-popover mentions-menu", children: options.length > 0 ? /* @__PURE__ */ jsx("ul", { children: options.map((option, i2) => /* @__PURE__ */ jsx(
33029
+ /* @__PURE__ */ jsx("div", { className: "typeahead-popover mentions-menu cteditor-bg-[hsl(var(--cteditorf47ac10b-popover))] cteditor-border cteditor-border-[hsl(var(--cteditorf47ac10b-border))] cteditor-rounded-lg cteditor-shadow-[0_4px_12px_hsla(var(--cteditorf47ac10b-foreground)_/_0.1)] cteditor-p-0 cteditor-max-h-[300px] cteditor-overflow-y-auto cteditor-min-w-[200px] cteditor-z-[1000] cteditor-py-1", children: options.length > 0 ? /* @__PURE__ */ jsx("ul", { children: options.map((option, i2) => /* @__PURE__ */ jsx(
32564
33030
  MentionsTypeaheadMenuItem,
32565
33031
  {
32566
33032
  index: i2,
@@ -38717,36 +39183,16 @@ const WordCountPlugin = () => {
38717
39183
  });
38718
39184
  });
38719
39185
  }, [editor]);
38720
- return /* @__PURE__ */ jsxs(
38721
- "div",
38722
- {
38723
- style: {
38724
- position: "absolute",
38725
- bottom: "10px",
38726
- right: "10px",
38727
- display: "flex",
38728
- gap: "16px",
38729
- fontSize: "12px",
38730
- color: "#666",
38731
- backgroundColor: "rgba(255, 255, 255, 0.9)",
38732
- padding: "6px 12px",
38733
- borderRadius: "4px",
38734
- boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
38735
- zIndex: 5,
38736
- pointerEvents: "none"
38737
- },
38738
- children: [
38739
- /* @__PURE__ */ jsxs("span", { children: [
38740
- "Words: ",
38741
- stats.words
38742
- ] }),
38743
- /* @__PURE__ */ jsxs("span", { children: [
38744
- "Characters: ",
38745
- stats.characters
38746
- ] })
38747
- ]
38748
- }
38749
- );
39186
+ return /* @__PURE__ */ jsxs("div", { className: "cteditor-absolute cteditor-bottom-1 cteditor-right-1 cteditor-flex cteditor-gap-4 cteditor-text-xs cteditor-text-gray-600 cteditor-bg-white/90 cteditor-py-1.5 cteditor-px-3 cteditor-rounded cteditor-shadow-sm cteditor-z-[5] cteditor-pointer-events-none", children: [
39187
+ /* @__PURE__ */ jsxs("span", { children: [
39188
+ "Words: ",
39189
+ stats.words
39190
+ ] }),
39191
+ /* @__PURE__ */ jsxs("span", { children: [
39192
+ "Characters: ",
39193
+ stats.characters
39194
+ ] })
39195
+ ] });
38750
39196
  };
38751
39197
  function exportEditorWithInlineStyle(editor) {
38752
39198
  const rootElement = editor.getRootElement();
@@ -39676,7 +40122,7 @@ const useAutoExpandingHeight = ({
39676
40122
  const useStyles = () => ({
39677
40123
  // container: "cteditor-relative cteditor-w-full cteditor-bg-white cteditor-text-black cteditor-font-normal cteditor-text-left cteditor-border cteditor-border-red-500",
39678
40124
  contentEditable: cn(
39679
- "cteditor-relative cteditor-min-h-[300px] cteditor-rounded-lg cteditor-p-3 !cteditor-h-auto cteditor-resize-none cteditor-outline-0 cteditor-content",
40125
+ "cteditor-relative cteditor-min-h-[300px] cteditor-rounded-lg cteditor-p-3 !cteditor-h-auto cteditor-resize-none cteditor-outline-0 cteditor-content cteditor-pb-12",
39680
40126
  // Ensure strong contrast in both themes
39681
40127
  "cteditor-text-foreground cteditor-bg-background",
39682
40128
  // Default font: Arial 16px to match toolbar defaults and ensure WYSIWYG output
@@ -40143,8 +40589,8 @@ const ConfigurableEditor = ({
40143
40589
  };
40144
40590
  return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(CommentProvider, { currentUser, children: /* @__PURE__ */ jsxs(LexicalComposer, { initialConfig: editorInitialConfig, children: [
40145
40591
  /* @__PURE__ */ jsx(HtmlViewProvider, { children: /* @__PURE__ */ jsxs(ToolbarContext, { children: [
40146
- /* @__PURE__ */ jsxs(Stack, { children: [
40147
- config.enableToolbar && /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-justify-between cteditor-items-center cteditor-mb-2 cteditor-sticky cteditor-top-2 cteditor-z-50", children: [
40592
+ /* @__PURE__ */ jsxs("div", { className: "main-container", children: [
40593
+ config.enableToolbar && /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-justify-between cteditor-items-center cteditor-mb-2 cteditor-sticky cteditor-top-0 cteditor-z-50", children: [
40148
40594
  /* @__PURE__ */ jsx(
40149
40595
  ToolbarWithEditor,
40150
40596
  {
@@ -40163,12 +40609,7 @@ const ConfigurableEditor = ({
40163
40609
  )
40164
40610
  ] }),
40165
40611
  " ",
40166
- /* @__PURE__ */ jsx(NewMentionsPlugin, { userList: mentionUserList }),
40167
- /* @__PURE__ */ jsx(NotePanelPlugin, {}),
40168
- /* @__PURE__ */ jsx(CommentPlugin, {}),
40169
- /* @__PURE__ */ jsx(CommentBubblePlugin, {}),
40170
- /* @__PURE__ */ jsx(CellBackgroundPersistencePlugin, {}),
40171
- /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
40612
+ /* @__PURE__ */ jsxs("div", { className: "cteditor-relative", children: [
40172
40613
  /* @__PURE__ */ jsx(
40173
40614
  RichTextPlugin,
40174
40615
  {
@@ -40189,48 +40630,53 @@ const ConfigurableEditor = ({
40189
40630
  ),
40190
40631
  /* @__PURE__ */ jsx(WordCountPlugin, {}),
40191
40632
  /* @__PURE__ */ jsx(UsageTrackingPlugin, { licenseKey: apiKey })
40192
- ] }),
40193
- /* @__PURE__ */ jsx(HtmlViewDisplay, {}),
40194
- /* @__PURE__ */ jsx(AIRephrasePlugin, {}),
40195
- /* @__PURE__ */ jsx(AIChatPlugin, { apiKey }),
40196
- /* @__PURE__ */ jsx(TextEnhancePlugin, { apiKey }),
40197
- /* @__PURE__ */ jsx(HtmlSyncPlugin, {}),
40198
- /* @__PURE__ */ jsx(AndroidKeyboardFixPlugin, {}),
40199
- /* @__PURE__ */ jsx(CodeHighlightPlugin, {}),
40200
- /* @__PURE__ */ jsx(CodeBlockNormalizerPlugin, {}),
40201
- /* @__PURE__ */ jsx(CodeBlockSelectAllPlugin, {}),
40202
- /* @__PURE__ */ jsx(SlashCommandPlugin, {}),
40203
- /* @__PURE__ */ jsx(MarkdownShortcutsPlugin, {}),
40204
- /* @__PURE__ */ jsx(CombinedPluginWrapper, {}),
40205
- /* @__PURE__ */ jsx(OnChangeWrapper, { onChange }),
40206
- /* @__PURE__ */ jsx(InitialContentPlugin, { initialContent }),
40207
- /* @__PURE__ */ jsx(HistoryPlugin, {}),
40208
- /* @__PURE__ */ jsx(LocalStoragePlugin$1, { namespace: initialConfig.namespace }),
40209
- /* @__PURE__ */ jsx(ListPlugin, {}),
40210
- /* @__PURE__ */ jsx(LinkPlugin, { hasLinkAttributes: false }),
40211
- /* @__PURE__ */ jsx(LinkPreviewPlugin, {}),
40212
- /* @__PURE__ */ jsx(DragDropPaste, {}),
40213
- /* @__PURE__ */ jsx(RichTextPastePlugin, {}),
40214
- /* @__PURE__ */ jsx(PasteOptionsPlugin, {}),
40215
- /* @__PURE__ */ jsx(FilePlugin, {}),
40216
- /* @__PURE__ */ jsx(HorizontalRulePlugin, {}),
40217
- /* @__PURE__ */ jsx(CustomHorizontalRulePlugin, {}),
40218
- /* @__PURE__ */ jsx(CheckListPlugin, {}),
40219
- /* @__PURE__ */ jsx(ImagePlugin, {}),
40220
- /* @__PURE__ */ jsx(SignatureCanvasPlugin, {}),
40221
- /* @__PURE__ */ jsx(
40222
- TablePlugin,
40223
- {
40224
- hasCellMerge: true,
40225
- hasCellBackgroundColor: true,
40226
- hasHorizontalScroll: true
40227
- }
40228
- ),
40229
- /* @__PURE__ */ jsx(TableImageAutoResizePlugin, {}),
40230
- /* @__PURE__ */ jsx(TableCellResizerPlugin, {}),
40231
- /* @__PURE__ */ jsx(EmbedPreviewPlugin, {}),
40232
- config.htmlViewOption && !config.toolbarOptions.enableHtmlViewToggle && /* @__PURE__ */ jsx(HtmlViewTogglePlugin, {})
40633
+ ] })
40233
40634
  ] }),
40635
+ /* @__PURE__ */ jsx(NewMentionsPlugin, { userList: mentionUserList }),
40636
+ /* @__PURE__ */ jsx(NotePanelPlugin, {}),
40637
+ /* @__PURE__ */ jsx(CommentPlugin, {}),
40638
+ /* @__PURE__ */ jsx(CommentBubblePlugin, {}),
40639
+ /* @__PURE__ */ jsx(CellBackgroundPersistencePlugin, {}),
40640
+ /* @__PURE__ */ jsx(HtmlViewDisplay, {}),
40641
+ /* @__PURE__ */ jsx(AIRephrasePlugin, {}),
40642
+ /* @__PURE__ */ jsx(AIChatPlugin, { apiKey }),
40643
+ /* @__PURE__ */ jsx(TextEnhancePlugin, { apiKey }),
40644
+ /* @__PURE__ */ jsx(HtmlSyncPlugin, {}),
40645
+ /* @__PURE__ */ jsx(AndroidKeyboardFixPlugin, {}),
40646
+ /* @__PURE__ */ jsx(CodeHighlightPlugin, {}),
40647
+ /* @__PURE__ */ jsx(CodeBlockNormalizerPlugin, {}),
40648
+ /* @__PURE__ */ jsx(CodeBlockSelectAllPlugin, {}),
40649
+ /* @__PURE__ */ jsx(SlashCommandPlugin, {}),
40650
+ /* @__PURE__ */ jsx(MarkdownShortcutsPlugin, {}),
40651
+ /* @__PURE__ */ jsx(CombinedPluginWrapper, {}),
40652
+ /* @__PURE__ */ jsx(OnChangeWrapper, { onChange }),
40653
+ /* @__PURE__ */ jsx(InitialContentPlugin, { initialContent }),
40654
+ /* @__PURE__ */ jsx(HistoryPlugin, {}),
40655
+ /* @__PURE__ */ jsx(LocalStoragePlugin$1, { namespace: initialConfig.namespace }),
40656
+ /* @__PURE__ */ jsx(ListPlugin, {}),
40657
+ /* @__PURE__ */ jsx(LinkPlugin, { hasLinkAttributes: false }),
40658
+ /* @__PURE__ */ jsx(LinkPreviewPlugin, {}),
40659
+ /* @__PURE__ */ jsx(DragDropPaste, {}),
40660
+ /* @__PURE__ */ jsx(RichTextPastePlugin, {}),
40661
+ /* @__PURE__ */ jsx(PasteOptionsPlugin, {}),
40662
+ /* @__PURE__ */ jsx(FilePlugin, {}),
40663
+ /* @__PURE__ */ jsx(HorizontalRulePlugin, {}),
40664
+ /* @__PURE__ */ jsx(CustomHorizontalRulePlugin, {}),
40665
+ /* @__PURE__ */ jsx(CheckListPlugin, {}),
40666
+ /* @__PURE__ */ jsx(ImagePlugin, {}),
40667
+ /* @__PURE__ */ jsx(SignatureCanvasPlugin, {}),
40668
+ /* @__PURE__ */ jsx(
40669
+ TablePlugin,
40670
+ {
40671
+ hasCellMerge: true,
40672
+ hasCellBackgroundColor: true,
40673
+ hasHorizontalScroll: true
40674
+ }
40675
+ ),
40676
+ /* @__PURE__ */ jsx(TableImageAutoResizePlugin, {}),
40677
+ /* @__PURE__ */ jsx(TableCellResizerPlugin, {}),
40678
+ /* @__PURE__ */ jsx(EmbedPreviewPlugin, {}),
40679
+ config.htmlViewOption && !config.toolbarOptions.enableHtmlViewToggle && /* @__PURE__ */ jsx(HtmlViewTogglePlugin, {}),
40234
40680
  floatingAnchorElem && /* @__PURE__ */ jsxs(Fragment, { children: [
40235
40681
  /* @__PURE__ */ jsx(
40236
40682
  TableActionMenuPlugin,
@@ -40281,7 +40727,7 @@ const ScopedEditorWrapper = ({
40281
40727
  className = "",
40282
40728
  darkMode = false
40283
40729
  }) => {
40284
- return /* @__PURE__ */ jsx("div", { id: "ct-editor-f47ac10b", className: "cteditor-max-w-full", children: /* @__PURE__ */ jsx("div", { className: "cteditor-p-2 cteditor-w-full cteditor-relative", children }) });
40730
+ return /* @__PURE__ */ jsx("div", { id: "ct-editor-f47ac10b", className: "cteditor-max-w-full", children: /* @__PURE__ */ jsx("div", { className: "cteditor-p-2 cteditor-w-full", children: /* @__PURE__ */ jsx("div", { className: "cteditor-relative", children }) }) });
40285
40731
  };
40286
40732
  const trackEditorLoad = async (licenseKey) => {
40287
40733
  try {
@@ -40323,13 +40769,26 @@ const ConfigurableEditorWithAuth = ({
40323
40769
  mentionUserList = editorConfig.mentionUserList || [],
40324
40770
  onAuthSuccess,
40325
40771
  onAuthError,
40326
- customVerifyKey
40772
+ customVerifyKey,
40773
+ enableReactNativeBridge = isReactNativeWebView(),
40774
+ onEditorReady,
40775
+ onFocus,
40776
+ onBlur,
40777
+ onHeightChange
40327
40778
  }) => {
40328
40779
  const { isAuthenticated, isLoading, error, editorConfig: editorConfig2, currentUser, verifyKey } = useEditor();
40329
40780
  const successRef = useRef(onAuthSuccess);
40330
40781
  const errorRef = useRef(onAuthError);
40331
40782
  const hasAttemptedAuthRef = useRef(false);
40332
40783
  const hasTrackedLoadRef = useRef(false);
40784
+ const hasNotifiedReadyRef = useRef(false);
40785
+ const rnBridge = useReactNativeBridge({
40786
+ enabled: enableReactNativeBridge,
40787
+ onReady: onEditorReady,
40788
+ onFocus,
40789
+ onBlur,
40790
+ onHeightChange
40791
+ });
40333
40792
  useEffect$1(() => {
40334
40793
  successRef.current = onAuthSuccess;
40335
40794
  errorRef.current = onAuthError;
@@ -40361,18 +40820,33 @@ const ConfigurableEditorWithAuth = ({
40361
40820
  var _a, _b;
40362
40821
  if (isAuthenticated) {
40363
40822
  (_a = successRef.current) == null ? void 0 : _a.call(successRef);
40823
+ rnBridge.notifyAuthSuccess();
40364
40824
  }
40365
40825
  if (error) {
40366
40826
  (_b = errorRef.current) == null ? void 0 : _b.call(errorRef, error);
40827
+ rnBridge.notifyAuthError(error);
40367
40828
  }
40368
- }, [isAuthenticated, error]);
40829
+ }, [isAuthenticated, error, rnBridge]);
40369
40830
  useEffect$1(() => {
40370
40831
  console.log("isAuthenticated:", isAuthenticated);
40371
40832
  if (isAuthenticated && !hasTrackedLoadRef.current && apiKey) {
40372
40833
  hasTrackedLoadRef.current = true;
40373
40834
  trackEditorLoad(apiKey);
40374
40835
  }
40375
- }, [isAuthenticated, apiKey]);
40836
+ if (isAuthenticated && !hasNotifiedReadyRef.current) {
40837
+ hasNotifiedReadyRef.current = true;
40838
+ setTimeout(() => {
40839
+ rnBridge.notifyReady();
40840
+ }, 100);
40841
+ }
40842
+ }, [isAuthenticated, apiKey, rnBridge]);
40843
+ const handleContentChange = useCallback(
40844
+ (html) => {
40845
+ onChange == null ? void 0 : onChange(html);
40846
+ rnBridge.notifyContentChange(html);
40847
+ },
40848
+ [onChange, rnBridge]
40849
+ );
40376
40850
  if (isLoading) {
40377
40851
  return /* @__PURE__ */ jsx(ScopedEditorWrapper, { children: /* @__PURE__ */ jsx(LoadingMessage, { children: /* @__PURE__ */ jsx("span", { children: "Loading editor..." }) }) });
40378
40852
  }
@@ -40394,7 +40868,7 @@ const ConfigurableEditorWithAuth = ({
40394
40868
  mentionUserList,
40395
40869
  currentUser,
40396
40870
  initialContent,
40397
- onChange
40871
+ onChange: handleContentChange
40398
40872
  }
40399
40873
  ) });
40400
40874
  };
@@ -40428,9 +40902,11 @@ export {
40428
40902
  EditorProvider as p,
40429
40903
  useEditor as q,
40430
40904
  ConfigurableEditor as r,
40431
- editorConfig as s,
40905
+ useReactNativeBridge as s,
40432
40906
  toast as t,
40433
40907
  useHtmlView as u,
40434
- verifyApiKey as v
40908
+ verifyApiKey as v,
40909
+ isReactNativeWebView as w,
40910
+ editorConfig as x
40435
40911
  };
40436
- //# sourceMappingURL=index-0533674e.js.map
40912
+ //# sourceMappingURL=index-0c07c5e0.js.map