ct-rich-text-editor 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/style.css +163 -20
- package/dist/components/AutoExpandingDemo.d.ts +7 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/hooks/useAutoExpandingHeight.d.ts +15 -0
- package/dist/html2pdf.bundle-fa4096e4.js +46128 -0
- package/dist/html2pdf.bundle-fa4096e4.js.map +1 -0
- package/dist/html2pdf.bundle.min-35b40dde.js +21987 -0
- package/dist/html2pdf.bundle.min-35b40dde.js.map +1 -0
- package/dist/{index-5238e1b7.js → index-25cc2475.js} +2580 -1024
- package/dist/index-25cc2475.js.map +1 -0
- package/dist/{index-ffff9c22.js → index-2ca32ea9.js} +18 -7
- package/dist/index-2ca32ea9.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/ui/Icons.d.ts +3 -1
- package/dist/utils/export.d.ts +3 -0
- package/package.json +5 -2
- package/dist/index-5238e1b7.js.map +0 -1
- package/dist/index-ffff9c22.js.map +0 -1
|
@@ -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 from "react";
|
|
9
|
-
import React__default, { createContext, useContext, useState,
|
|
9
|
+
import React__default, { createContext, useContext, useState, forwardRef, createElement, useImperativeHandle, useRef, useEffect, useMemo, useCallback, useLayoutEffect, Suspense, 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,7 +23,7 @@ import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
|
23
23
|
import { TablePlugin } from "@lexical/react/LexicalTablePlugin";
|
|
24
24
|
import { $findMatchingParent, $getNearestNodeOfType, mergeRegister, $getNearestBlockElementAncestorOrThrow, $insertNodeToNearestRoot, $wrapNodeInElement, $isEditorIsNestedEditor, calculateZoomLevel, CAN_USE_DOM } from "@lexical/utils";
|
|
25
25
|
import Stack from "@mui/material/Stack";
|
|
26
|
-
import {
|
|
26
|
+
import { createCommand, COMMAND_PRIORITY_LOW, $getSelection, $isRangeSelection, $insertNodes, $getNearestNodeFromDOMNode, $setSelection, isHTMLElement as isHTMLElement$1, TextNode, $applyNodeReplacement, $getRoot, $createTextNode, $getNodeByKey, DecoratorNode, createEditor, COMMAND_PRIORITY_EDITOR, $createParagraphNode, $isRootOrShadowRoot, $isParagraphNode, $isTextNode, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, $isElementNode, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_CRITICAL, UNDO_COMMAND, REDO_COMMAND, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, KEY_ENTER_COMMAND, $createNodeSelection, $isNodeSelection, CLICK_COMMAND, getDOMSelection, COMMAND_PRIORITY_HIGH, $isLineBreakNode, isDOMNode } from "lexical";
|
|
27
27
|
import * as ReactDOM from "react-dom";
|
|
28
28
|
import ReactDOM__default, { createPortal } from "react-dom";
|
|
29
29
|
import { $isCodeNode, CodeNode, normalizeCodeLang, getLanguageFriendlyName, CodeHighlightNode, CODE_LANGUAGE_MAP, $createCodeNode, registerCodeHighlighting, $isCodeHighlightNode } from "@lexical/code";
|
|
@@ -299,17 +299,6 @@ const AiJsonResponse = async ({ content }) => {
|
|
|
299
299
|
throw error;
|
|
300
300
|
}
|
|
301
301
|
};
|
|
302
|
-
const AiImageResponse = async ({ content }) => {
|
|
303
|
-
try {
|
|
304
|
-
const res = await backendAPI.post(apiEndpoints.chat.imageCreation, {
|
|
305
|
-
content
|
|
306
|
-
});
|
|
307
|
-
return res.data;
|
|
308
|
-
} catch (error) {
|
|
309
|
-
console.error("Error in AiImageResponse:", error);
|
|
310
|
-
throw error;
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
302
|
const AiEditorAction = async ({
|
|
314
303
|
content,
|
|
315
304
|
provider = "chatgpt",
|
|
@@ -339,187 +328,6 @@ const GetCreditsInfo = async ({ apiKey }) => {
|
|
|
339
328
|
return { success: false, costPerPrompt: 1, remainingCredits: 0 };
|
|
340
329
|
}
|
|
341
330
|
};
|
|
342
|
-
const ImageView = React__default.lazy(() => import("./index-ffff9c22.js"));
|
|
343
|
-
function isGoogleDocCheckboxImg(img) {
|
|
344
|
-
return img.parentElement != null && img.parentElement.tagName === "LI" && img.previousSibling === null && img.getAttribute("aria-roledescription") === "checkbox";
|
|
345
|
-
}
|
|
346
|
-
function $convertImageElement(domNode) {
|
|
347
|
-
const img = domNode;
|
|
348
|
-
if (img.src.startsWith("file:///") || isGoogleDocCheckboxImg(img)) {
|
|
349
|
-
return null;
|
|
350
|
-
}
|
|
351
|
-
const { alt: altText, src, width, height } = img;
|
|
352
|
-
const node = $createImageNode({ altText, height, src, width });
|
|
353
|
-
return { node };
|
|
354
|
-
}
|
|
355
|
-
class ImageNode extends DecoratorNode {
|
|
356
|
-
constructor(src, altText, maxWidth, width, height, showCaption, caption, captionsEnabled, key) {
|
|
357
|
-
super(key);
|
|
358
|
-
__publicField(this, "__src");
|
|
359
|
-
__publicField(this, "__altText");
|
|
360
|
-
__publicField(this, "__width");
|
|
361
|
-
__publicField(this, "__height");
|
|
362
|
-
__publicField(this, "__maxWidth");
|
|
363
|
-
__publicField(this, "__showCaption");
|
|
364
|
-
__publicField(this, "__caption");
|
|
365
|
-
// Captions cannot yet be used within editor cells
|
|
366
|
-
__publicField(this, "__captionsEnabled");
|
|
367
|
-
this.__src = src;
|
|
368
|
-
this.__altText = altText;
|
|
369
|
-
this.__maxWidth = maxWidth;
|
|
370
|
-
this.__width = width || "inherit";
|
|
371
|
-
this.__height = height || "inherit";
|
|
372
|
-
this.__showCaption = showCaption || false;
|
|
373
|
-
this.__caption = caption || createEditor({
|
|
374
|
-
nodes: []
|
|
375
|
-
});
|
|
376
|
-
this.__captionsEnabled = captionsEnabled || captionsEnabled === void 0;
|
|
377
|
-
}
|
|
378
|
-
// to identify the image node and must unique too
|
|
379
|
-
static getType() {
|
|
380
|
-
return "image";
|
|
381
|
-
}
|
|
382
|
-
// Clones the ImageNode when needed (during editor updates)
|
|
383
|
-
static clone(node) {
|
|
384
|
-
return new ImageNode(
|
|
385
|
-
node.__src,
|
|
386
|
-
node.__altText,
|
|
387
|
-
node.__maxWidth,
|
|
388
|
-
node.__width,
|
|
389
|
-
node.__height,
|
|
390
|
-
node.__showCaption,
|
|
391
|
-
node.__caption,
|
|
392
|
-
node.__captionsEnabled,
|
|
393
|
-
node.__key
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
// importing to json format
|
|
397
|
-
static importJSON(serializedNode) {
|
|
398
|
-
const { altText, height, width, maxWidth, caption, src, showCaption } = serializedNode;
|
|
399
|
-
const node = $createImageNode({
|
|
400
|
-
altText,
|
|
401
|
-
height,
|
|
402
|
-
maxWidth,
|
|
403
|
-
showCaption,
|
|
404
|
-
src,
|
|
405
|
-
width
|
|
406
|
-
});
|
|
407
|
-
const nestedEditor = node.__caption;
|
|
408
|
-
const editorState = nestedEditor.parseEditorState(caption.editorState);
|
|
409
|
-
if (!editorState.isEmpty()) {
|
|
410
|
-
nestedEditor.setEditorState(editorState);
|
|
411
|
-
}
|
|
412
|
-
return node;
|
|
413
|
-
}
|
|
414
|
-
// Exports this node as an actual <img> tag in the DOM when needed
|
|
415
|
-
exportDOM() {
|
|
416
|
-
const element = document.createElement("img");
|
|
417
|
-
element.setAttribute("src", this.__src);
|
|
418
|
-
element.setAttribute("alt", this.__altText);
|
|
419
|
-
element.setAttribute("width", this.__width.toString());
|
|
420
|
-
element.setAttribute("height", this.__height.toString());
|
|
421
|
-
return { element };
|
|
422
|
-
}
|
|
423
|
-
// convert img tag into image node in the editor using convertImageElement func
|
|
424
|
-
static importDOM() {
|
|
425
|
-
return {
|
|
426
|
-
img: (node) => ({
|
|
427
|
-
conversion: $convertImageElement,
|
|
428
|
-
priority: 0
|
|
429
|
-
})
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
exportJSON() {
|
|
433
|
-
return {
|
|
434
|
-
altText: this.getAltText(),
|
|
435
|
-
caption: this.__caption.toJSON(),
|
|
436
|
-
height: this.__height === "inherit" ? 0 : this.__height,
|
|
437
|
-
maxWidth: this.__maxWidth,
|
|
438
|
-
showCaption: this.__showCaption,
|
|
439
|
-
src: this.getSrc(),
|
|
440
|
-
type: "image",
|
|
441
|
-
version: 1,
|
|
442
|
-
width: this.__width === "inherit" ? 0 : this.__width
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
// setting width and height when resizing
|
|
446
|
-
setWidthAndHeight(width, height) {
|
|
447
|
-
const writable = this.getWritable();
|
|
448
|
-
writable.__width = width;
|
|
449
|
-
writable.__height = height;
|
|
450
|
-
}
|
|
451
|
-
// state to update to show the caption
|
|
452
|
-
setShowCaption(showCaption) {
|
|
453
|
-
const writable = this.getWritable();
|
|
454
|
-
writable.__showCaption = showCaption;
|
|
455
|
-
}
|
|
456
|
-
// To create a dom representation of image view
|
|
457
|
-
createDOM(config) {
|
|
458
|
-
const span = document.createElement("span");
|
|
459
|
-
const theme2 = config.theme;
|
|
460
|
-
const className = theme2.image;
|
|
461
|
-
if (className !== void 0) {
|
|
462
|
-
span.className = className;
|
|
463
|
-
}
|
|
464
|
-
return span;
|
|
465
|
-
}
|
|
466
|
-
updateDOM() {
|
|
467
|
-
return false;
|
|
468
|
-
}
|
|
469
|
-
// to get the image src
|
|
470
|
-
getSrc() {
|
|
471
|
-
return this.__src;
|
|
472
|
-
}
|
|
473
|
-
getAltText() {
|
|
474
|
-
return this.__altText;
|
|
475
|
-
}
|
|
476
|
-
// to render the image tag
|
|
477
|
-
decorate() {
|
|
478
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
479
|
-
ImageView,
|
|
480
|
-
{
|
|
481
|
-
src: this.__src,
|
|
482
|
-
altText: this.__altText,
|
|
483
|
-
width: this.__width,
|
|
484
|
-
height: this.__height,
|
|
485
|
-
maxWidth: this.__maxWidth,
|
|
486
|
-
nodeKey: this.getKey(),
|
|
487
|
-
showCaption: this.__showCaption,
|
|
488
|
-
caption: this.__caption,
|
|
489
|
-
captionsEnabled: this.__captionsEnabled,
|
|
490
|
-
resizable: true
|
|
491
|
-
}
|
|
492
|
-
) });
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
function $createImageNode({
|
|
496
|
-
altText,
|
|
497
|
-
height,
|
|
498
|
-
maxWidth = 500,
|
|
499
|
-
captionsEnabled,
|
|
500
|
-
src,
|
|
501
|
-
width,
|
|
502
|
-
showCaption,
|
|
503
|
-
caption,
|
|
504
|
-
key
|
|
505
|
-
}) {
|
|
506
|
-
return $applyNodeReplacement(
|
|
507
|
-
new ImageNode(
|
|
508
|
-
src,
|
|
509
|
-
altText,
|
|
510
|
-
maxWidth,
|
|
511
|
-
width,
|
|
512
|
-
height,
|
|
513
|
-
showCaption,
|
|
514
|
-
caption,
|
|
515
|
-
captionsEnabled,
|
|
516
|
-
key
|
|
517
|
-
)
|
|
518
|
-
);
|
|
519
|
-
}
|
|
520
|
-
function $isImageNode(node) {
|
|
521
|
-
return node instanceof ImageNode;
|
|
522
|
-
}
|
|
523
331
|
const AI_ACTION_COMMAND = createCommand(
|
|
524
332
|
"AI_ACTION_COMMAND"
|
|
525
333
|
);
|
|
@@ -2718,6 +2526,17 @@ const CornerDownLeft = createLucideIcon("CornerDownLeft", [
|
|
|
2718
2526
|
["polyline", { points: "9 10 4 15 9 20", key: "r3jprv" }],
|
|
2719
2527
|
["path", { d: "M20 4v7a4 4 0 0 1-4 4H4", key: "6o5b7l" }]
|
|
2720
2528
|
]);
|
|
2529
|
+
/**
|
|
2530
|
+
* @license lucide-react v0.344.0 - ISC
|
|
2531
|
+
*
|
|
2532
|
+
* This source code is licensed under the ISC license.
|
|
2533
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
2534
|
+
*/
|
|
2535
|
+
const Download = createLucideIcon("Download", [
|
|
2536
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
2537
|
+
["polyline", { points: "7 10 12 15 17 10", key: "2ggqvy" }],
|
|
2538
|
+
["line", { x1: "12", x2: "12", y1: "15", y2: "3", key: "1vk2je" }]
|
|
2539
|
+
]);
|
|
2721
2540
|
/**
|
|
2722
2541
|
* @license lucide-react v0.344.0 - ISC
|
|
2723
2542
|
*
|
|
@@ -2847,6 +2666,15 @@ const Lightbulb = createLucideIcon("Lightbulb", [
|
|
|
2847
2666
|
["path", { d: "M9 18h6", key: "x1upvd" }],
|
|
2848
2667
|
["path", { d: "M10 22h4", key: "ceow96" }]
|
|
2849
2668
|
]);
|
|
2669
|
+
/**
|
|
2670
|
+
* @license lucide-react v0.344.0 - ISC
|
|
2671
|
+
*
|
|
2672
|
+
* This source code is licensed under the ISC license.
|
|
2673
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
2674
|
+
*/
|
|
2675
|
+
const Loader2 = createLucideIcon("Loader2", [
|
|
2676
|
+
["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
|
|
2677
|
+
]);
|
|
2850
2678
|
/**
|
|
2851
2679
|
* @license lucide-react v0.344.0 - ISC
|
|
2852
2680
|
*
|
|
@@ -5786,7 +5614,7 @@ const getDefaultConfig = () => {
|
|
|
5786
5614
|
};
|
|
5787
5615
|
};
|
|
5788
5616
|
const twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
5789
|
-
function cn(...inputs) {
|
|
5617
|
+
function cn$1(...inputs) {
|
|
5790
5618
|
return twMerge(clsx(inputs));
|
|
5791
5619
|
}
|
|
5792
5620
|
const Dialog = Root$7;
|
|
@@ -5795,7 +5623,7 @@ const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
5795
5623
|
Overlay,
|
|
5796
5624
|
{
|
|
5797
5625
|
ref,
|
|
5798
|
-
className: cn(
|
|
5626
|
+
className: cn$1(
|
|
5799
5627
|
"cteditor-fixed cteditor-inset-0 cteditor-z-[9999] cteditor-bg-black/60 data-[state=open]:cteditor-animate-in data-[state=closed]:cteditor-animate-out data-[state=closed]:cteditor-fade-out-0 data-[state=open]:cteditor-fade-in-0",
|
|
5800
5628
|
className
|
|
5801
5629
|
),
|
|
@@ -5809,7 +5637,7 @@ const DialogContent = React.forwardRef(({ className, children, ...props }, ref)
|
|
|
5809
5637
|
Content$3,
|
|
5810
5638
|
{
|
|
5811
5639
|
ref,
|
|
5812
|
-
className: cn(
|
|
5640
|
+
className: cn$1(
|
|
5813
5641
|
"cteditor-fixed cteditor-left-[50%] cteditor-top-[50%] cteditor-z-[9999] cteditor-grid cteditor-w-full cteditor-max-w-lg cteditor-translate-x-[-50%] cteditor-translate-y-[-50%] cteditor-gap-4 cteditor-border cteditor-bg-background cteditor-p-6 cteditor-shadow-lg cteditor-duration-200 data-[state=open]:cteditor-animate-in data-[state=closed]:cteditor-animate-out data-[state=closed]:cteditor-fade-out-0 data-[state=open]:cteditor-fade-in-0 data-[state=closed]:cteditor-zoom-out-95 data-[state=open]:cteditor-zoom-in-95 data-[state=closed]:cteditor-slide-out-to-left-1/2 data-[state=closed]:cteditor-slide-out-to-top-[48%] data-[state=open]:cteditor-slide-in-from-left-1/2 data-[state=open]:cteditor-slide-in-from-top-[48%] sm:cteditor-rounded-lg",
|
|
5814
5642
|
className
|
|
5815
5643
|
),
|
|
@@ -5837,7 +5665,7 @@ const DialogHeader = ({
|
|
|
5837
5665
|
}) => /* @__PURE__ */ jsx(
|
|
5838
5666
|
"div",
|
|
5839
5667
|
{
|
|
5840
|
-
className: cn(
|
|
5668
|
+
className: cn$1(
|
|
5841
5669
|
"cteditor-flex cteditor-flex-col cteditor-space-y-1.5 cteditor-text-center sm:cteditor-text-left",
|
|
5842
5670
|
className
|
|
5843
5671
|
),
|
|
@@ -5851,7 +5679,7 @@ const DialogFooter = ({
|
|
|
5851
5679
|
}) => /* @__PURE__ */ jsx(
|
|
5852
5680
|
"div",
|
|
5853
5681
|
{
|
|
5854
|
-
className: cn(
|
|
5682
|
+
className: cn$1(
|
|
5855
5683
|
"cteditor-flex cteditor-flex-col-reverse sm:cteditor-flex-row sm:cteditor-justify-end sm:cteditor-space-x-2",
|
|
5856
5684
|
className
|
|
5857
5685
|
),
|
|
@@ -5863,7 +5691,7 @@ const DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
5863
5691
|
Title,
|
|
5864
5692
|
{
|
|
5865
5693
|
ref,
|
|
5866
|
-
className: cn(
|
|
5694
|
+
className: cn$1(
|
|
5867
5695
|
"cteditor-text-lg cteditor-font-semibold cteditor-leading-none cteditor-tracking-tight",
|
|
5868
5696
|
className
|
|
5869
5697
|
),
|
|
@@ -5875,7 +5703,7 @@ const DialogDescription = React.forwardRef(({ className, ...props }, ref) => /*
|
|
|
5875
5703
|
Description,
|
|
5876
5704
|
{
|
|
5877
5705
|
ref,
|
|
5878
|
-
className: cn("cteditor-text-sm cteditor-text-muted-foreground", className),
|
|
5706
|
+
className: cn$1("cteditor-text-sm cteditor-text-muted-foreground", className),
|
|
5879
5707
|
...props
|
|
5880
5708
|
}
|
|
5881
5709
|
));
|
|
@@ -6076,7 +5904,7 @@ const Button = React.forwardRef(
|
|
|
6076
5904
|
return /* @__PURE__ */ jsx(
|
|
6077
5905
|
Comp,
|
|
6078
5906
|
{
|
|
6079
|
-
className: cn(buttonVariants({ variant, size: size2, className })),
|
|
5907
|
+
className: cn$1(buttonVariants({ variant, size: size2, className })),
|
|
6080
5908
|
ref,
|
|
6081
5909
|
...props
|
|
6082
5910
|
}
|
|
@@ -6090,7 +5918,7 @@ const Input$1 = React.forwardRef(
|
|
|
6090
5918
|
"input",
|
|
6091
5919
|
{
|
|
6092
5920
|
type,
|
|
6093
|
-
className: cn(
|
|
5921
|
+
className: cn$1(
|
|
6094
5922
|
"cteditor-flex cteditor-h-9 cteditor-w-full cteditor-rounded-md cteditor-border cteditor-border-input cteditor-text-foreground dark:cteditor-bg-input/30 cteditor-bg-transparent cteditor-px-3 cteditor-py-1 cteditor-text-xs cteditor-shadow-sm cteditor-transition-all cteditor-duration-200 file:cteditor-border-0 file:cteditor-bg-transparent file:cteditor-text-sm file:cteditor-font-medium file:cteditor-text-foreground placeholder:cteditor-text-muted-foreground focus-visible:cteditor-outline-none focus-visible:cteditor-ring-1 focus-visible:cteditor-ring-ring disabled:cteditor-cursor-not-allowed disabled:cteditor-opacity-50",
|
|
6095
5923
|
className
|
|
6096
5924
|
),
|
|
@@ -6129,7 +5957,7 @@ const Label$2 = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
6129
5957
|
Root$6,
|
|
6130
5958
|
{
|
|
6131
5959
|
ref,
|
|
6132
|
-
className: cn(labelVariants(), className),
|
|
5960
|
+
className: cn$1(labelVariants(), className),
|
|
6133
5961
|
...props
|
|
6134
5962
|
}
|
|
6135
5963
|
));
|
|
@@ -6327,26 +6155,24 @@ const AIRephrasePlugin = () => {
|
|
|
6327
6155
|
};
|
|
6328
6156
|
const generateImageFromPrompt = async (promptText) => {
|
|
6329
6157
|
try {
|
|
6330
|
-
const
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6158
|
+
const response = await AiJsonResponse({ content: `Generate Image: ${promptText}` });
|
|
6159
|
+
const htmlString = response == null ? void 0 : response.data;
|
|
6160
|
+
if (!htmlString) {
|
|
6161
|
+
console.warn("No HTML returned from agent for image generation");
|
|
6162
|
+
throw new Error("Failed to generate image via agent");
|
|
6334
6163
|
}
|
|
6335
6164
|
editor.update(() => {
|
|
6336
|
-
const
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
} else {
|
|
6345
|
-
$insertNodes([imageNode]);
|
|
6346
|
-
}
|
|
6165
|
+
const currentSelection = $getSelection();
|
|
6166
|
+
if (!currentSelection || !$isRangeSelection(currentSelection))
|
|
6167
|
+
return;
|
|
6168
|
+
const parser = new DOMParser();
|
|
6169
|
+
const dom = parser.parseFromString(htmlString, "text/html");
|
|
6170
|
+
const nodes = $generateNodesFromDOM(editor, dom);
|
|
6171
|
+
currentSelection.insertText("");
|
|
6172
|
+
$insertNodes(nodes);
|
|
6347
6173
|
});
|
|
6348
6174
|
} catch (error) {
|
|
6349
|
-
console.error("Error generating image:", error);
|
|
6175
|
+
console.error("Error generating image via agent:", error);
|
|
6350
6176
|
throw error;
|
|
6351
6177
|
}
|
|
6352
6178
|
};
|
|
@@ -7157,7 +6983,7 @@ const Avatar = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
|
|
|
7157
6983
|
Root$5,
|
|
7158
6984
|
{
|
|
7159
6985
|
ref,
|
|
7160
|
-
className: cn(
|
|
6986
|
+
className: cn$1(
|
|
7161
6987
|
"cteditor-relative cteditor-flex cteditor-h-10 cteditor-w-10 cteditor-shrink-0 cteditor-overflow-hidden cteditor-rounded-full",
|
|
7162
6988
|
className
|
|
7163
6989
|
),
|
|
@@ -7169,7 +6995,7 @@ const AvatarImage = React.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
7169
6995
|
Image$1,
|
|
7170
6996
|
{
|
|
7171
6997
|
ref,
|
|
7172
|
-
className: cn(
|
|
6998
|
+
className: cn$1(
|
|
7173
6999
|
"cteditor-aspect-square cteditor-h-full cteditor-w-full",
|
|
7174
7000
|
className
|
|
7175
7001
|
),
|
|
@@ -7181,7 +7007,7 @@ const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
7181
7007
|
Fallback,
|
|
7182
7008
|
{
|
|
7183
7009
|
ref,
|
|
7184
|
-
className: cn(
|
|
7010
|
+
className: cn$1(
|
|
7185
7011
|
"cteditor-flex cteditor-h-full cteditor-w-full cteditor-items-center cteditor-justify-center cteditor-rounded-full cteditor-bg-muted",
|
|
7186
7012
|
className
|
|
7187
7013
|
),
|
|
@@ -7206,13 +7032,13 @@ const badgeVariants = cva(
|
|
|
7206
7032
|
}
|
|
7207
7033
|
);
|
|
7208
7034
|
function Badge({ className, variant, ...props }) {
|
|
7209
|
-
return /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
7035
|
+
return /* @__PURE__ */ jsx("div", { className: cn$1(badgeVariants({ variant }), className), ...props });
|
|
7210
7036
|
}
|
|
7211
7037
|
const Card = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7212
7038
|
"div",
|
|
7213
7039
|
{
|
|
7214
7040
|
ref,
|
|
7215
|
-
className: cn(
|
|
7041
|
+
className: cn$1(
|
|
7216
7042
|
"rounded-xl border bg-card text-card-foreground shadow",
|
|
7217
7043
|
className
|
|
7218
7044
|
),
|
|
@@ -7224,7 +7050,7 @@ const CardHeader = React.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
7224
7050
|
"div",
|
|
7225
7051
|
{
|
|
7226
7052
|
ref,
|
|
7227
|
-
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
7053
|
+
className: cn$1("flex flex-col space-y-1.5 p-6", className),
|
|
7228
7054
|
...props
|
|
7229
7055
|
}
|
|
7230
7056
|
));
|
|
@@ -7233,7 +7059,7 @@ const CardTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
7233
7059
|
"div",
|
|
7234
7060
|
{
|
|
7235
7061
|
ref,
|
|
7236
|
-
className: cn("font-semibold leading-none tracking-tight", className),
|
|
7062
|
+
className: cn$1("font-semibold leading-none tracking-tight", className),
|
|
7237
7063
|
...props
|
|
7238
7064
|
}
|
|
7239
7065
|
));
|
|
@@ -7242,18 +7068,18 @@ const CardDescription = React.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
7242
7068
|
"div",
|
|
7243
7069
|
{
|
|
7244
7070
|
ref,
|
|
7245
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
7071
|
+
className: cn$1("text-sm text-muted-foreground", className),
|
|
7246
7072
|
...props
|
|
7247
7073
|
}
|
|
7248
7074
|
));
|
|
7249
7075
|
CardDescription.displayName = "CardDescription";
|
|
7250
|
-
const CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
7076
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn$1("p-6 pt-0", className), ...props }));
|
|
7251
7077
|
CardContent.displayName = "CardContent";
|
|
7252
7078
|
const CardFooter = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7253
7079
|
"div",
|
|
7254
7080
|
{
|
|
7255
7081
|
ref,
|
|
7256
|
-
className: cn("flex items-center p-6 pt-0", className),
|
|
7082
|
+
className: cn$1("flex items-center p-6 pt-0", className),
|
|
7257
7083
|
...props
|
|
7258
7084
|
}
|
|
7259
7085
|
));
|
|
@@ -7288,7 +7114,7 @@ const Separator$2 = React.forwardRef(
|
|
|
7288
7114
|
ref,
|
|
7289
7115
|
decorative,
|
|
7290
7116
|
orientation,
|
|
7291
|
-
className: cn(
|
|
7117
|
+
className: cn$1(
|
|
7292
7118
|
"cteditor-shrink-0 cteditor-bg-border",
|
|
7293
7119
|
orientation === "horizontal" ? "cteditor-h-[1px] cteditor-w-full" : "cteditor-h-full cteditor-w-[1px]",
|
|
7294
7120
|
className
|
|
@@ -7303,7 +7129,7 @@ const SheetPortal = Portal$5;
|
|
|
7303
7129
|
const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7304
7130
|
Overlay,
|
|
7305
7131
|
{
|
|
7306
|
-
className: cn(
|
|
7132
|
+
className: cn$1(
|
|
7307
7133
|
"cteditor-fixed cteditor-inset-0 cteditor-z-[9999] cteditor-bg-black/80 data-[state=open]:cteditor-animate-in data-[state=closed]:cteditor-animate-out data-[state=closed]:cteditor-fade-out-0 data-[state=open]:cteditor-fade-in-0",
|
|
7308
7134
|
className
|
|
7309
7135
|
),
|
|
@@ -7334,7 +7160,7 @@ const SheetContent = React.forwardRef(({ side = "right", className, children, ..
|
|
|
7334
7160
|
Content$3,
|
|
7335
7161
|
{
|
|
7336
7162
|
ref,
|
|
7337
|
-
className: cn(sheetVariants({ side }), className),
|
|
7163
|
+
className: cn$1(sheetVariants({ side }), className),
|
|
7338
7164
|
...props,
|
|
7339
7165
|
children: [
|
|
7340
7166
|
/* @__PURE__ */ jsxs(Close, { className: "cteditor-absolute cteditor-right-4 cteditor-top-4 cteditor-rounded-sm cteditor-opacity-70 cteditor-ring-offset-background cteditor-transition-opacity hover:cteditor-opacity-100 focus:cteditor-outline-none focus:cteditor-ring-2 focus:cteditor-ring-ring focus:cteditor-ring-offset-2 disabled:cteditor-pointer-events-none data-[state=open]:cteditor-bg-secondary cteditor-text-foreground", children: [
|
|
@@ -7353,7 +7179,7 @@ const SheetHeader = ({
|
|
|
7353
7179
|
}) => /* @__PURE__ */ jsx(
|
|
7354
7180
|
"div",
|
|
7355
7181
|
{
|
|
7356
|
-
className: cn(
|
|
7182
|
+
className: cn$1(
|
|
7357
7183
|
"cteditor-flex cteditor-flex-col cteditor-space-y-2 cteditor-text-center sm:cteditor-text-left",
|
|
7358
7184
|
className
|
|
7359
7185
|
),
|
|
@@ -7365,7 +7191,7 @@ const SheetTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
7365
7191
|
Title,
|
|
7366
7192
|
{
|
|
7367
7193
|
ref,
|
|
7368
|
-
className: cn(
|
|
7194
|
+
className: cn$1(
|
|
7369
7195
|
"cteditor-text-lg cteditor-font-semibold cteditor-text-foreground",
|
|
7370
7196
|
className
|
|
7371
7197
|
),
|
|
@@ -7377,7 +7203,7 @@ const SheetDescription = React.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
7377
7203
|
Description,
|
|
7378
7204
|
{
|
|
7379
7205
|
ref,
|
|
7380
|
-
className: cn("cteditor-text-sm cteditor-text-muted-foreground", className),
|
|
7206
|
+
className: cn$1("cteditor-text-sm cteditor-text-muted-foreground", className),
|
|
7381
7207
|
...props
|
|
7382
7208
|
}
|
|
7383
7209
|
));
|
|
@@ -7844,7 +7670,7 @@ const TabsList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
7844
7670
|
List,
|
|
7845
7671
|
{
|
|
7846
7672
|
ref,
|
|
7847
|
-
className: cn(
|
|
7673
|
+
className: cn$1(
|
|
7848
7674
|
"cteditor-inline-flex cteditor-h-9 cteditor-items-center cteditor-justify-center cteditor-rounded-lg cteditor-bg-muted cteditor-p-1 cteditor-text-muted-foreground",
|
|
7849
7675
|
className
|
|
7850
7676
|
),
|
|
@@ -7856,7 +7682,7 @@ const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
7856
7682
|
Trigger$4,
|
|
7857
7683
|
{
|
|
7858
7684
|
ref,
|
|
7859
|
-
className: cn(
|
|
7685
|
+
className: cn$1(
|
|
7860
7686
|
"cteditor-inline-flex cteditor-items-center cteditor-justify-center cteditor-whitespace-nowrap cteditor-rounded-md cteditor-px-3 cteditor-py-1 cteditor-text-sm cteditor-font-medium cteditor-ring-offset-background cteditor-transition-all focus-visible:cteditor-outline-none focus-visible:cteditor-ring-2 focus-visible:cteditor-ring-ring focus-visible:cteditor-ring-offset-2 disabled:cteditor-pointer-events-none disabled:cteditor-opacity-50 data-[state=active]:cteditor-bg-background data-[state=active]:cteditor-text-foreground data-[state=active]:cteditor-shadow",
|
|
7861
7687
|
className
|
|
7862
7688
|
),
|
|
@@ -7868,7 +7694,7 @@ const TabsContent = React.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
7868
7694
|
Content$2,
|
|
7869
7695
|
{
|
|
7870
7696
|
ref,
|
|
7871
|
-
className: cn(
|
|
7697
|
+
className: cn$1(
|
|
7872
7698
|
"cteditor-mt-2 cteditor-ring-offset-background focus-visible:cteditor-outline-none focus-visible:cteditor-ring-2 focus-visible:cteditor-ring-ring focus-visible:cteditor-ring-offset-2",
|
|
7873
7699
|
className
|
|
7874
7700
|
),
|
|
@@ -7880,7 +7706,7 @@ const Textarea = React.forwardRef(({ className, ...props }, ref) => {
|
|
|
7880
7706
|
return /* @__PURE__ */ jsx(
|
|
7881
7707
|
"textarea",
|
|
7882
7708
|
{
|
|
7883
|
-
className: cn(
|
|
7709
|
+
className: cn$1(
|
|
7884
7710
|
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
7885
7711
|
className
|
|
7886
7712
|
),
|
|
@@ -10989,7 +10815,7 @@ const TooltipContent = React.forwardRef(({ className, sideOffset = 8, ...props }
|
|
|
10989
10815
|
{
|
|
10990
10816
|
ref,
|
|
10991
10817
|
sideOffset,
|
|
10992
|
-
className: cn(
|
|
10818
|
+
className: cn$1(
|
|
10993
10819
|
"cteditor-z-[9999] cteditor-overflow-hidden cteditor-rounded-md cteditor-bg-primary cteditor-px-3 cteditor-py-1.5 cteditor-text-xs cteditor-text-primary-foreground cteditor-animate-in cteditor-fade-in-0 cteditor-zoom-in-95 data-[state=closed]:cteditor-animate-out data-[state=closed]:cteditor-fade-out-0 data-[state=closed]:cteditor-zoom-out-95 data-[side=bottom]:cteditor-slide-in-from-top-2 data-[side=left]:cteditor-slide-in-from-right-2 data-[side=right]:cteditor-slide-in-from-left-2 data-[side=top]:cteditor-slide-in-from-bottom-2 cteditor-origin-[--radix-tooltip-content-transform-origin]",
|
|
10994
10820
|
className
|
|
10995
10821
|
),
|
|
@@ -11013,7 +10839,7 @@ const CommentToggle = ({
|
|
|
11013
10839
|
variant: "ghost",
|
|
11014
10840
|
size: "icon-sm",
|
|
11015
10841
|
onClick,
|
|
11016
|
-
className: cn(
|
|
10842
|
+
className: cn$1(
|
|
11017
10843
|
"cteditor-relative cteditor-transition-all cteditor-duration-200",
|
|
11018
10844
|
isOpen && "cteditor-bg-primary text-primary-foreground"
|
|
11019
10845
|
),
|
|
@@ -11319,45 +11145,1416 @@ const HtmlViewDisplay = () => {
|
|
|
11319
11145
|
)
|
|
11320
11146
|
] });
|
|
11321
11147
|
};
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
}
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
}
|
|
11359
|
-
|
|
11360
|
-
|
|
11148
|
+
function __insertCSS(code) {
|
|
11149
|
+
if (!code || typeof document == "undefined")
|
|
11150
|
+
return;
|
|
11151
|
+
let head = document.head || document.getElementsByTagName("head")[0];
|
|
11152
|
+
let style = document.createElement("style");
|
|
11153
|
+
style.type = "text/css";
|
|
11154
|
+
head.appendChild(style);
|
|
11155
|
+
style.styleSheet ? style.styleSheet.cssText = code : style.appendChild(document.createTextNode(code));
|
|
11156
|
+
}
|
|
11157
|
+
const getAsset = (type) => {
|
|
11158
|
+
switch (type) {
|
|
11159
|
+
case "success":
|
|
11160
|
+
return SuccessIcon;
|
|
11161
|
+
case "info":
|
|
11162
|
+
return InfoIcon;
|
|
11163
|
+
case "warning":
|
|
11164
|
+
return WarningIcon;
|
|
11165
|
+
case "error":
|
|
11166
|
+
return ErrorIcon;
|
|
11167
|
+
default:
|
|
11168
|
+
return null;
|
|
11169
|
+
}
|
|
11170
|
+
};
|
|
11171
|
+
const bars = Array(12).fill(0);
|
|
11172
|
+
const Loader = ({ visible, className }) => {
|
|
11173
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
11174
|
+
className: [
|
|
11175
|
+
"sonner-loading-wrapper",
|
|
11176
|
+
className
|
|
11177
|
+
].filter(Boolean).join(" "),
|
|
11178
|
+
"data-visible": visible
|
|
11179
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
11180
|
+
className: "sonner-spinner"
|
|
11181
|
+
}, bars.map((_, i2) => /* @__PURE__ */ React__default.createElement("div", {
|
|
11182
|
+
className: "sonner-loading-bar",
|
|
11183
|
+
key: `spinner-bar-${i2}`
|
|
11184
|
+
}))));
|
|
11185
|
+
};
|
|
11186
|
+
const SuccessIcon = /* @__PURE__ */ React__default.createElement("svg", {
|
|
11187
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11188
|
+
viewBox: "0 0 20 20",
|
|
11189
|
+
fill: "currentColor",
|
|
11190
|
+
height: "20",
|
|
11191
|
+
width: "20"
|
|
11192
|
+
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
11193
|
+
fillRule: "evenodd",
|
|
11194
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
11195
|
+
clipRule: "evenodd"
|
|
11196
|
+
}));
|
|
11197
|
+
const WarningIcon = /* @__PURE__ */ React__default.createElement("svg", {
|
|
11198
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11199
|
+
viewBox: "0 0 24 24",
|
|
11200
|
+
fill: "currentColor",
|
|
11201
|
+
height: "20",
|
|
11202
|
+
width: "20"
|
|
11203
|
+
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
11204
|
+
fillRule: "evenodd",
|
|
11205
|
+
d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
11206
|
+
clipRule: "evenodd"
|
|
11207
|
+
}));
|
|
11208
|
+
const InfoIcon = /* @__PURE__ */ React__default.createElement("svg", {
|
|
11209
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11210
|
+
viewBox: "0 0 20 20",
|
|
11211
|
+
fill: "currentColor",
|
|
11212
|
+
height: "20",
|
|
11213
|
+
width: "20"
|
|
11214
|
+
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
11215
|
+
fillRule: "evenodd",
|
|
11216
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
11217
|
+
clipRule: "evenodd"
|
|
11218
|
+
}));
|
|
11219
|
+
const ErrorIcon = /* @__PURE__ */ React__default.createElement("svg", {
|
|
11220
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11221
|
+
viewBox: "0 0 20 20",
|
|
11222
|
+
fill: "currentColor",
|
|
11223
|
+
height: "20",
|
|
11224
|
+
width: "20"
|
|
11225
|
+
}, /* @__PURE__ */ React__default.createElement("path", {
|
|
11226
|
+
fillRule: "evenodd",
|
|
11227
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
|
|
11228
|
+
clipRule: "evenodd"
|
|
11229
|
+
}));
|
|
11230
|
+
const CloseIcon = /* @__PURE__ */ React__default.createElement("svg", {
|
|
11231
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11232
|
+
width: "12",
|
|
11233
|
+
height: "12",
|
|
11234
|
+
viewBox: "0 0 24 24",
|
|
11235
|
+
fill: "none",
|
|
11236
|
+
stroke: "currentColor",
|
|
11237
|
+
strokeWidth: "1.5",
|
|
11238
|
+
strokeLinecap: "round",
|
|
11239
|
+
strokeLinejoin: "round"
|
|
11240
|
+
}, /* @__PURE__ */ React__default.createElement("line", {
|
|
11241
|
+
x1: "18",
|
|
11242
|
+
y1: "6",
|
|
11243
|
+
x2: "6",
|
|
11244
|
+
y2: "18"
|
|
11245
|
+
}), /* @__PURE__ */ React__default.createElement("line", {
|
|
11246
|
+
x1: "6",
|
|
11247
|
+
y1: "6",
|
|
11248
|
+
x2: "18",
|
|
11249
|
+
y2: "18"
|
|
11250
|
+
}));
|
|
11251
|
+
const useIsDocumentHidden = () => {
|
|
11252
|
+
const [isDocumentHidden, setIsDocumentHidden] = React__default.useState(document.hidden);
|
|
11253
|
+
React__default.useEffect(() => {
|
|
11254
|
+
const callback = () => {
|
|
11255
|
+
setIsDocumentHidden(document.hidden);
|
|
11256
|
+
};
|
|
11257
|
+
document.addEventListener("visibilitychange", callback);
|
|
11258
|
+
return () => window.removeEventListener("visibilitychange", callback);
|
|
11259
|
+
}, []);
|
|
11260
|
+
return isDocumentHidden;
|
|
11261
|
+
};
|
|
11262
|
+
let toastsCounter = 1;
|
|
11263
|
+
class Observer {
|
|
11264
|
+
constructor() {
|
|
11265
|
+
this.subscribe = (subscriber) => {
|
|
11266
|
+
this.subscribers.push(subscriber);
|
|
11267
|
+
return () => {
|
|
11268
|
+
const index2 = this.subscribers.indexOf(subscriber);
|
|
11269
|
+
this.subscribers.splice(index2, 1);
|
|
11270
|
+
};
|
|
11271
|
+
};
|
|
11272
|
+
this.publish = (data) => {
|
|
11273
|
+
this.subscribers.forEach((subscriber) => subscriber(data));
|
|
11274
|
+
};
|
|
11275
|
+
this.addToast = (data) => {
|
|
11276
|
+
this.publish(data);
|
|
11277
|
+
this.toasts = [
|
|
11278
|
+
...this.toasts,
|
|
11279
|
+
data
|
|
11280
|
+
];
|
|
11281
|
+
};
|
|
11282
|
+
this.create = (data) => {
|
|
11283
|
+
var _data_id;
|
|
11284
|
+
const { message, ...rest } = data;
|
|
11285
|
+
const id = typeof (data == null ? void 0 : data.id) === "number" || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
|
|
11286
|
+
const alreadyExists = this.toasts.find((toast2) => {
|
|
11287
|
+
return toast2.id === id;
|
|
11288
|
+
});
|
|
11289
|
+
const dismissible = data.dismissible === void 0 ? true : data.dismissible;
|
|
11290
|
+
if (this.dismissedToasts.has(id)) {
|
|
11291
|
+
this.dismissedToasts.delete(id);
|
|
11292
|
+
}
|
|
11293
|
+
if (alreadyExists) {
|
|
11294
|
+
this.toasts = this.toasts.map((toast2) => {
|
|
11295
|
+
if (toast2.id === id) {
|
|
11296
|
+
this.publish({
|
|
11297
|
+
...toast2,
|
|
11298
|
+
...data,
|
|
11299
|
+
id,
|
|
11300
|
+
title: message
|
|
11301
|
+
});
|
|
11302
|
+
return {
|
|
11303
|
+
...toast2,
|
|
11304
|
+
...data,
|
|
11305
|
+
id,
|
|
11306
|
+
dismissible,
|
|
11307
|
+
title: message
|
|
11308
|
+
};
|
|
11309
|
+
}
|
|
11310
|
+
return toast2;
|
|
11311
|
+
});
|
|
11312
|
+
} else {
|
|
11313
|
+
this.addToast({
|
|
11314
|
+
title: message,
|
|
11315
|
+
...rest,
|
|
11316
|
+
dismissible,
|
|
11317
|
+
id
|
|
11318
|
+
});
|
|
11319
|
+
}
|
|
11320
|
+
return id;
|
|
11321
|
+
};
|
|
11322
|
+
this.dismiss = (id) => {
|
|
11323
|
+
if (id) {
|
|
11324
|
+
this.dismissedToasts.add(id);
|
|
11325
|
+
requestAnimationFrame(() => this.subscribers.forEach((subscriber) => subscriber({
|
|
11326
|
+
id,
|
|
11327
|
+
dismiss: true
|
|
11328
|
+
})));
|
|
11329
|
+
} else {
|
|
11330
|
+
this.toasts.forEach((toast2) => {
|
|
11331
|
+
this.subscribers.forEach((subscriber) => subscriber({
|
|
11332
|
+
id: toast2.id,
|
|
11333
|
+
dismiss: true
|
|
11334
|
+
}));
|
|
11335
|
+
});
|
|
11336
|
+
}
|
|
11337
|
+
return id;
|
|
11338
|
+
};
|
|
11339
|
+
this.message = (message, data) => {
|
|
11340
|
+
return this.create({
|
|
11341
|
+
...data,
|
|
11342
|
+
message
|
|
11343
|
+
});
|
|
11344
|
+
};
|
|
11345
|
+
this.error = (message, data) => {
|
|
11346
|
+
return this.create({
|
|
11347
|
+
...data,
|
|
11348
|
+
message,
|
|
11349
|
+
type: "error"
|
|
11350
|
+
});
|
|
11351
|
+
};
|
|
11352
|
+
this.success = (message, data) => {
|
|
11353
|
+
return this.create({
|
|
11354
|
+
...data,
|
|
11355
|
+
type: "success",
|
|
11356
|
+
message
|
|
11357
|
+
});
|
|
11358
|
+
};
|
|
11359
|
+
this.info = (message, data) => {
|
|
11360
|
+
return this.create({
|
|
11361
|
+
...data,
|
|
11362
|
+
type: "info",
|
|
11363
|
+
message
|
|
11364
|
+
});
|
|
11365
|
+
};
|
|
11366
|
+
this.warning = (message, data) => {
|
|
11367
|
+
return this.create({
|
|
11368
|
+
...data,
|
|
11369
|
+
type: "warning",
|
|
11370
|
+
message
|
|
11371
|
+
});
|
|
11372
|
+
};
|
|
11373
|
+
this.loading = (message, data) => {
|
|
11374
|
+
return this.create({
|
|
11375
|
+
...data,
|
|
11376
|
+
type: "loading",
|
|
11377
|
+
message
|
|
11378
|
+
});
|
|
11379
|
+
};
|
|
11380
|
+
this.promise = (promise, data) => {
|
|
11381
|
+
if (!data) {
|
|
11382
|
+
return;
|
|
11383
|
+
}
|
|
11384
|
+
let id = void 0;
|
|
11385
|
+
if (data.loading !== void 0) {
|
|
11386
|
+
id = this.create({
|
|
11387
|
+
...data,
|
|
11388
|
+
promise,
|
|
11389
|
+
type: "loading",
|
|
11390
|
+
message: data.loading,
|
|
11391
|
+
description: typeof data.description !== "function" ? data.description : void 0
|
|
11392
|
+
});
|
|
11393
|
+
}
|
|
11394
|
+
const p2 = Promise.resolve(promise instanceof Function ? promise() : promise);
|
|
11395
|
+
let shouldDismiss = id !== void 0;
|
|
11396
|
+
let result;
|
|
11397
|
+
const originalPromise = p2.then(async (response) => {
|
|
11398
|
+
result = [
|
|
11399
|
+
"resolve",
|
|
11400
|
+
response
|
|
11401
|
+
];
|
|
11402
|
+
const isReactElementResponse = React__default.isValidElement(response);
|
|
11403
|
+
if (isReactElementResponse) {
|
|
11404
|
+
shouldDismiss = false;
|
|
11405
|
+
this.create({
|
|
11406
|
+
id,
|
|
11407
|
+
type: "default",
|
|
11408
|
+
message: response
|
|
11409
|
+
});
|
|
11410
|
+
} else if (isHttpResponse(response) && !response.ok) {
|
|
11411
|
+
shouldDismiss = false;
|
|
11412
|
+
const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
|
|
11413
|
+
const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
|
|
11414
|
+
const isExtendedResult = typeof promiseData === "object" && !React__default.isValidElement(promiseData);
|
|
11415
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
11416
|
+
message: promiseData
|
|
11417
|
+
};
|
|
11418
|
+
this.create({
|
|
11419
|
+
id,
|
|
11420
|
+
type: "error",
|
|
11421
|
+
description,
|
|
11422
|
+
...toastSettings
|
|
11423
|
+
});
|
|
11424
|
+
} else if (response instanceof Error) {
|
|
11425
|
+
shouldDismiss = false;
|
|
11426
|
+
const promiseData = typeof data.error === "function" ? await data.error(response) : data.error;
|
|
11427
|
+
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
11428
|
+
const isExtendedResult = typeof promiseData === "object" && !React__default.isValidElement(promiseData);
|
|
11429
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
11430
|
+
message: promiseData
|
|
11431
|
+
};
|
|
11432
|
+
this.create({
|
|
11433
|
+
id,
|
|
11434
|
+
type: "error",
|
|
11435
|
+
description,
|
|
11436
|
+
...toastSettings
|
|
11437
|
+
});
|
|
11438
|
+
} else if (data.success !== void 0) {
|
|
11439
|
+
shouldDismiss = false;
|
|
11440
|
+
const promiseData = typeof data.success === "function" ? await data.success(response) : data.success;
|
|
11441
|
+
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
11442
|
+
const isExtendedResult = typeof promiseData === "object" && !React__default.isValidElement(promiseData);
|
|
11443
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
11444
|
+
message: promiseData
|
|
11445
|
+
};
|
|
11446
|
+
this.create({
|
|
11447
|
+
id,
|
|
11448
|
+
type: "success",
|
|
11449
|
+
description,
|
|
11450
|
+
...toastSettings
|
|
11451
|
+
});
|
|
11452
|
+
}
|
|
11453
|
+
}).catch(async (error) => {
|
|
11454
|
+
result = [
|
|
11455
|
+
"reject",
|
|
11456
|
+
error
|
|
11457
|
+
];
|
|
11458
|
+
if (data.error !== void 0) {
|
|
11459
|
+
shouldDismiss = false;
|
|
11460
|
+
const promiseData = typeof data.error === "function" ? await data.error(error) : data.error;
|
|
11461
|
+
const description = typeof data.description === "function" ? await data.description(error) : data.description;
|
|
11462
|
+
const isExtendedResult = typeof promiseData === "object" && !React__default.isValidElement(promiseData);
|
|
11463
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
11464
|
+
message: promiseData
|
|
11465
|
+
};
|
|
11466
|
+
this.create({
|
|
11467
|
+
id,
|
|
11468
|
+
type: "error",
|
|
11469
|
+
description,
|
|
11470
|
+
...toastSettings
|
|
11471
|
+
});
|
|
11472
|
+
}
|
|
11473
|
+
}).finally(() => {
|
|
11474
|
+
if (shouldDismiss) {
|
|
11475
|
+
this.dismiss(id);
|
|
11476
|
+
id = void 0;
|
|
11477
|
+
}
|
|
11478
|
+
data.finally == null ? void 0 : data.finally.call(data);
|
|
11479
|
+
});
|
|
11480
|
+
const unwrap = () => new Promise((resolve, reject) => originalPromise.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject));
|
|
11481
|
+
if (typeof id !== "string" && typeof id !== "number") {
|
|
11482
|
+
return {
|
|
11483
|
+
unwrap
|
|
11484
|
+
};
|
|
11485
|
+
} else {
|
|
11486
|
+
return Object.assign(id, {
|
|
11487
|
+
unwrap
|
|
11488
|
+
});
|
|
11489
|
+
}
|
|
11490
|
+
};
|
|
11491
|
+
this.custom = (jsx2, data) => {
|
|
11492
|
+
const id = (data == null ? void 0 : data.id) || toastsCounter++;
|
|
11493
|
+
this.create({
|
|
11494
|
+
jsx: jsx2(id),
|
|
11495
|
+
id,
|
|
11496
|
+
...data
|
|
11497
|
+
});
|
|
11498
|
+
return id;
|
|
11499
|
+
};
|
|
11500
|
+
this.getActiveToasts = () => {
|
|
11501
|
+
return this.toasts.filter((toast2) => !this.dismissedToasts.has(toast2.id));
|
|
11502
|
+
};
|
|
11503
|
+
this.subscribers = [];
|
|
11504
|
+
this.toasts = [];
|
|
11505
|
+
this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
11506
|
+
}
|
|
11507
|
+
}
|
|
11508
|
+
const ToastState = new Observer();
|
|
11509
|
+
const toastFunction = (message, data) => {
|
|
11510
|
+
const id = (data == null ? void 0 : data.id) || toastsCounter++;
|
|
11511
|
+
ToastState.addToast({
|
|
11512
|
+
title: message,
|
|
11513
|
+
...data,
|
|
11514
|
+
id
|
|
11515
|
+
});
|
|
11516
|
+
return id;
|
|
11517
|
+
};
|
|
11518
|
+
const isHttpResponse = (data) => {
|
|
11519
|
+
return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
|
|
11520
|
+
};
|
|
11521
|
+
const basicToast = toastFunction;
|
|
11522
|
+
const getHistory = () => ToastState.toasts;
|
|
11523
|
+
const getToasts = () => ToastState.getActiveToasts();
|
|
11524
|
+
const toast = Object.assign(basicToast, {
|
|
11525
|
+
success: ToastState.success,
|
|
11526
|
+
info: ToastState.info,
|
|
11527
|
+
warning: ToastState.warning,
|
|
11528
|
+
error: ToastState.error,
|
|
11529
|
+
custom: ToastState.custom,
|
|
11530
|
+
message: ToastState.message,
|
|
11531
|
+
promise: ToastState.promise,
|
|
11532
|
+
dismiss: ToastState.dismiss,
|
|
11533
|
+
loading: ToastState.loading
|
|
11534
|
+
}, {
|
|
11535
|
+
getHistory,
|
|
11536
|
+
getToasts
|
|
11537
|
+
});
|
|
11538
|
+
__insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}[data-sonner-toaster][data-lifted=true]{transform:translateY(-8px)}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
|
|
11539
|
+
function isAction(action) {
|
|
11540
|
+
return action.label !== void 0;
|
|
11541
|
+
}
|
|
11542
|
+
const VISIBLE_TOASTS_AMOUNT = 3;
|
|
11543
|
+
const VIEWPORT_OFFSET = "24px";
|
|
11544
|
+
const MOBILE_VIEWPORT_OFFSET = "16px";
|
|
11545
|
+
const TOAST_LIFETIME = 4e3;
|
|
11546
|
+
const TOAST_WIDTH = 356;
|
|
11547
|
+
const GAP = 14;
|
|
11548
|
+
const SWIPE_THRESHOLD = 45;
|
|
11549
|
+
const TIME_BEFORE_UNMOUNT = 200;
|
|
11550
|
+
function cn(...classes) {
|
|
11551
|
+
return classes.filter(Boolean).join(" ");
|
|
11552
|
+
}
|
|
11553
|
+
function getDefaultSwipeDirections(position) {
|
|
11554
|
+
const [y2, x2] = position.split("-");
|
|
11555
|
+
const directions = [];
|
|
11556
|
+
if (y2) {
|
|
11557
|
+
directions.push(y2);
|
|
11558
|
+
}
|
|
11559
|
+
if (x2) {
|
|
11560
|
+
directions.push(x2);
|
|
11561
|
+
}
|
|
11562
|
+
return directions;
|
|
11563
|
+
}
|
|
11564
|
+
const Toast = (props) => {
|
|
11565
|
+
var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
|
|
11566
|
+
const { invert: ToasterInvert, toast: toast2, unstyled, interacting, setHeights, visibleToasts, heights, index: index2, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = "", descriptionClassName = "", duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = "Close toast" } = props;
|
|
11567
|
+
const [swipeDirection, setSwipeDirection] = React__default.useState(null);
|
|
11568
|
+
const [swipeOutDirection, setSwipeOutDirection] = React__default.useState(null);
|
|
11569
|
+
const [mounted, setMounted] = React__default.useState(false);
|
|
11570
|
+
const [removed, setRemoved] = React__default.useState(false);
|
|
11571
|
+
const [swiping, setSwiping] = React__default.useState(false);
|
|
11572
|
+
const [swipeOut, setSwipeOut] = React__default.useState(false);
|
|
11573
|
+
const [isSwiped, setIsSwiped] = React__default.useState(false);
|
|
11574
|
+
const [offsetBeforeRemove, setOffsetBeforeRemove] = React__default.useState(0);
|
|
11575
|
+
const [initialHeight, setInitialHeight] = React__default.useState(0);
|
|
11576
|
+
const remainingTime = React__default.useRef(toast2.duration || durationFromToaster || TOAST_LIFETIME);
|
|
11577
|
+
const dragStartTime = React__default.useRef(null);
|
|
11578
|
+
const toastRef = React__default.useRef(null);
|
|
11579
|
+
const isFront = index2 === 0;
|
|
11580
|
+
const isVisible = index2 + 1 <= visibleToasts;
|
|
11581
|
+
const toastType = toast2.type;
|
|
11582
|
+
const dismissible = toast2.dismissible !== false;
|
|
11583
|
+
const toastClassname = toast2.className || "";
|
|
11584
|
+
const toastDescriptionClassname = toast2.descriptionClassName || "";
|
|
11585
|
+
const heightIndex = React__default.useMemo(() => heights.findIndex((height) => height.toastId === toast2.id) || 0, [
|
|
11586
|
+
heights,
|
|
11587
|
+
toast2.id
|
|
11588
|
+
]);
|
|
11589
|
+
const closeButton = React__default.useMemo(() => {
|
|
11590
|
+
var _toast_closeButton;
|
|
11591
|
+
return (_toast_closeButton = toast2.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
|
|
11592
|
+
}, [
|
|
11593
|
+
toast2.closeButton,
|
|
11594
|
+
closeButtonFromToaster
|
|
11595
|
+
]);
|
|
11596
|
+
const duration = React__default.useMemo(() => toast2.duration || durationFromToaster || TOAST_LIFETIME, [
|
|
11597
|
+
toast2.duration,
|
|
11598
|
+
durationFromToaster
|
|
11599
|
+
]);
|
|
11600
|
+
const closeTimerStartTimeRef = React__default.useRef(0);
|
|
11601
|
+
const offset2 = React__default.useRef(0);
|
|
11602
|
+
const lastCloseTimerStartTimeRef = React__default.useRef(0);
|
|
11603
|
+
const pointerStartRef = React__default.useRef(null);
|
|
11604
|
+
const [y2, x2] = position.split("-");
|
|
11605
|
+
const toastsHeightBefore = React__default.useMemo(() => {
|
|
11606
|
+
return heights.reduce((prev, curr, reducerIndex) => {
|
|
11607
|
+
if (reducerIndex >= heightIndex) {
|
|
11608
|
+
return prev;
|
|
11609
|
+
}
|
|
11610
|
+
return prev + curr.height;
|
|
11611
|
+
}, 0);
|
|
11612
|
+
}, [
|
|
11613
|
+
heights,
|
|
11614
|
+
heightIndex
|
|
11615
|
+
]);
|
|
11616
|
+
const isDocumentHidden = useIsDocumentHidden();
|
|
11617
|
+
const invert = toast2.invert || ToasterInvert;
|
|
11618
|
+
const disabled = toastType === "loading";
|
|
11619
|
+
offset2.current = React__default.useMemo(() => heightIndex * gap + toastsHeightBefore, [
|
|
11620
|
+
heightIndex,
|
|
11621
|
+
toastsHeightBefore
|
|
11622
|
+
]);
|
|
11623
|
+
React__default.useEffect(() => {
|
|
11624
|
+
remainingTime.current = duration;
|
|
11625
|
+
}, [
|
|
11626
|
+
duration
|
|
11627
|
+
]);
|
|
11628
|
+
React__default.useEffect(() => {
|
|
11629
|
+
setMounted(true);
|
|
11630
|
+
}, []);
|
|
11631
|
+
React__default.useEffect(() => {
|
|
11632
|
+
const toastNode = toastRef.current;
|
|
11633
|
+
if (toastNode) {
|
|
11634
|
+
const height = toastNode.getBoundingClientRect().height;
|
|
11635
|
+
setInitialHeight(height);
|
|
11636
|
+
setHeights((h2) => [
|
|
11637
|
+
{
|
|
11638
|
+
toastId: toast2.id,
|
|
11639
|
+
height,
|
|
11640
|
+
position: toast2.position
|
|
11641
|
+
},
|
|
11642
|
+
...h2
|
|
11643
|
+
]);
|
|
11644
|
+
return () => setHeights((h2) => h2.filter((height2) => height2.toastId !== toast2.id));
|
|
11645
|
+
}
|
|
11646
|
+
}, [
|
|
11647
|
+
setHeights,
|
|
11648
|
+
toast2.id
|
|
11649
|
+
]);
|
|
11650
|
+
React__default.useLayoutEffect(() => {
|
|
11651
|
+
if (!mounted)
|
|
11652
|
+
return;
|
|
11653
|
+
const toastNode = toastRef.current;
|
|
11654
|
+
const originalHeight = toastNode.style.height;
|
|
11655
|
+
toastNode.style.height = "auto";
|
|
11656
|
+
const newHeight = toastNode.getBoundingClientRect().height;
|
|
11657
|
+
toastNode.style.height = originalHeight;
|
|
11658
|
+
setInitialHeight(newHeight);
|
|
11659
|
+
setHeights((heights2) => {
|
|
11660
|
+
const alreadyExists = heights2.find((height) => height.toastId === toast2.id);
|
|
11661
|
+
if (!alreadyExists) {
|
|
11662
|
+
return [
|
|
11663
|
+
{
|
|
11664
|
+
toastId: toast2.id,
|
|
11665
|
+
height: newHeight,
|
|
11666
|
+
position: toast2.position
|
|
11667
|
+
},
|
|
11668
|
+
...heights2
|
|
11669
|
+
];
|
|
11670
|
+
} else {
|
|
11671
|
+
return heights2.map((height) => height.toastId === toast2.id ? {
|
|
11672
|
+
...height,
|
|
11673
|
+
height: newHeight
|
|
11674
|
+
} : height);
|
|
11675
|
+
}
|
|
11676
|
+
});
|
|
11677
|
+
}, [
|
|
11678
|
+
mounted,
|
|
11679
|
+
toast2.title,
|
|
11680
|
+
toast2.description,
|
|
11681
|
+
setHeights,
|
|
11682
|
+
toast2.id
|
|
11683
|
+
]);
|
|
11684
|
+
const deleteToast = React__default.useCallback(() => {
|
|
11685
|
+
setRemoved(true);
|
|
11686
|
+
setOffsetBeforeRemove(offset2.current);
|
|
11687
|
+
setHeights((h2) => h2.filter((height) => height.toastId !== toast2.id));
|
|
11688
|
+
setTimeout(() => {
|
|
11689
|
+
removeToast(toast2);
|
|
11690
|
+
}, TIME_BEFORE_UNMOUNT);
|
|
11691
|
+
}, [
|
|
11692
|
+
toast2,
|
|
11693
|
+
removeToast,
|
|
11694
|
+
setHeights,
|
|
11695
|
+
offset2
|
|
11696
|
+
]);
|
|
11697
|
+
React__default.useEffect(() => {
|
|
11698
|
+
if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading")
|
|
11699
|
+
return;
|
|
11700
|
+
let timeoutId;
|
|
11701
|
+
const pauseTimer = () => {
|
|
11702
|
+
if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
|
|
11703
|
+
const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;
|
|
11704
|
+
remainingTime.current = remainingTime.current - elapsedTime;
|
|
11705
|
+
}
|
|
11706
|
+
lastCloseTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
|
|
11707
|
+
};
|
|
11708
|
+
const startTimer = () => {
|
|
11709
|
+
if (remainingTime.current === Infinity)
|
|
11710
|
+
return;
|
|
11711
|
+
closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
|
|
11712
|
+
timeoutId = setTimeout(() => {
|
|
11713
|
+
toast2.onAutoClose == null ? void 0 : toast2.onAutoClose.call(toast2, toast2);
|
|
11714
|
+
deleteToast();
|
|
11715
|
+
}, remainingTime.current);
|
|
11716
|
+
};
|
|
11717
|
+
if (expanded || interacting || isDocumentHidden) {
|
|
11718
|
+
pauseTimer();
|
|
11719
|
+
} else {
|
|
11720
|
+
startTimer();
|
|
11721
|
+
}
|
|
11722
|
+
return () => clearTimeout(timeoutId);
|
|
11723
|
+
}, [
|
|
11724
|
+
expanded,
|
|
11725
|
+
interacting,
|
|
11726
|
+
toast2,
|
|
11727
|
+
toastType,
|
|
11728
|
+
isDocumentHidden,
|
|
11729
|
+
deleteToast
|
|
11730
|
+
]);
|
|
11731
|
+
React__default.useEffect(() => {
|
|
11732
|
+
if (toast2.delete) {
|
|
11733
|
+
deleteToast();
|
|
11734
|
+
}
|
|
11735
|
+
}, [
|
|
11736
|
+
deleteToast,
|
|
11737
|
+
toast2.delete
|
|
11738
|
+
]);
|
|
11739
|
+
function getLoadingIcon() {
|
|
11740
|
+
var _toast_classNames9;
|
|
11741
|
+
if (icons == null ? void 0 : icons.loading) {
|
|
11742
|
+
var _toast_classNames12;
|
|
11743
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
11744
|
+
className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames12 = toast2.classNames) == null ? void 0 : _toast_classNames12.loader, "sonner-loader"),
|
|
11745
|
+
"data-visible": toastType === "loading"
|
|
11746
|
+
}, icons.loading);
|
|
11747
|
+
}
|
|
11748
|
+
return /* @__PURE__ */ React__default.createElement(Loader, {
|
|
11749
|
+
className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames9 = toast2.classNames) == null ? void 0 : _toast_classNames9.loader),
|
|
11750
|
+
visible: toastType === "loading"
|
|
11751
|
+
});
|
|
11752
|
+
}
|
|
11753
|
+
const icon = toast2.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
|
|
11754
|
+
var _toast_richColors, _icons_close;
|
|
11755
|
+
return /* @__PURE__ */ React__default.createElement("li", {
|
|
11756
|
+
tabIndex: 0,
|
|
11757
|
+
ref: toastRef,
|
|
11758
|
+
className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast2 == null ? void 0 : (_toast_classNames = toast2.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast2 == null ? void 0 : (_toast_classNames1 = toast2.classNames) == null ? void 0 : _toast_classNames1[toastType]),
|
|
11759
|
+
"data-sonner-toast": "",
|
|
11760
|
+
"data-rich-colors": (_toast_richColors = toast2.richColors) != null ? _toast_richColors : defaultRichColors,
|
|
11761
|
+
"data-styled": !Boolean(toast2.jsx || toast2.unstyled || unstyled),
|
|
11762
|
+
"data-mounted": mounted,
|
|
11763
|
+
"data-promise": Boolean(toast2.promise),
|
|
11764
|
+
"data-swiped": isSwiped,
|
|
11765
|
+
"data-removed": removed,
|
|
11766
|
+
"data-visible": isVisible,
|
|
11767
|
+
"data-y-position": y2,
|
|
11768
|
+
"data-x-position": x2,
|
|
11769
|
+
"data-index": index2,
|
|
11770
|
+
"data-front": isFront,
|
|
11771
|
+
"data-swiping": swiping,
|
|
11772
|
+
"data-dismissible": dismissible,
|
|
11773
|
+
"data-type": toastType,
|
|
11774
|
+
"data-invert": invert,
|
|
11775
|
+
"data-swipe-out": swipeOut,
|
|
11776
|
+
"data-swipe-direction": swipeOutDirection,
|
|
11777
|
+
"data-expanded": Boolean(expanded || expandByDefault && mounted),
|
|
11778
|
+
style: {
|
|
11779
|
+
"--index": index2,
|
|
11780
|
+
"--toasts-before": index2,
|
|
11781
|
+
"--z-index": toasts.length - index2,
|
|
11782
|
+
"--offset": `${removed ? offsetBeforeRemove : offset2.current}px`,
|
|
11783
|
+
"--initial-height": expandByDefault ? "auto" : `${initialHeight}px`,
|
|
11784
|
+
...style,
|
|
11785
|
+
...toast2.style
|
|
11786
|
+
},
|
|
11787
|
+
onDragEnd: () => {
|
|
11788
|
+
setSwiping(false);
|
|
11789
|
+
setSwipeDirection(null);
|
|
11790
|
+
pointerStartRef.current = null;
|
|
11791
|
+
},
|
|
11792
|
+
onPointerDown: (event) => {
|
|
11793
|
+
if (disabled || !dismissible)
|
|
11794
|
+
return;
|
|
11795
|
+
dragStartTime.current = /* @__PURE__ */ new Date();
|
|
11796
|
+
setOffsetBeforeRemove(offset2.current);
|
|
11797
|
+
event.target.setPointerCapture(event.pointerId);
|
|
11798
|
+
if (event.target.tagName === "BUTTON")
|
|
11799
|
+
return;
|
|
11800
|
+
setSwiping(true);
|
|
11801
|
+
pointerStartRef.current = {
|
|
11802
|
+
x: event.clientX,
|
|
11803
|
+
y: event.clientY
|
|
11804
|
+
};
|
|
11805
|
+
},
|
|
11806
|
+
onPointerUp: () => {
|
|
11807
|
+
var _toastRef_current, _toastRef_current1, _dragStartTime_current;
|
|
11808
|
+
if (swipeOut || !dismissible)
|
|
11809
|
+
return;
|
|
11810
|
+
pointerStartRef.current = null;
|
|
11811
|
+
const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0);
|
|
11812
|
+
const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0);
|
|
11813
|
+
const timeTaken = (/* @__PURE__ */ new Date()).getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
|
|
11814
|
+
const swipeAmount = swipeDirection === "x" ? swipeAmountX : swipeAmountY;
|
|
11815
|
+
const velocity = Math.abs(swipeAmount) / timeTaken;
|
|
11816
|
+
if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
|
|
11817
|
+
setOffsetBeforeRemove(offset2.current);
|
|
11818
|
+
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
11819
|
+
if (swipeDirection === "x") {
|
|
11820
|
+
setSwipeOutDirection(swipeAmountX > 0 ? "right" : "left");
|
|
11821
|
+
} else {
|
|
11822
|
+
setSwipeOutDirection(swipeAmountY > 0 ? "down" : "up");
|
|
11823
|
+
}
|
|
11824
|
+
deleteToast();
|
|
11825
|
+
setSwipeOut(true);
|
|
11826
|
+
return;
|
|
11827
|
+
} else {
|
|
11828
|
+
var _toastRef_current2, _toastRef_current3;
|
|
11829
|
+
(_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty("--swipe-amount-x", `0px`);
|
|
11830
|
+
(_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty("--swipe-amount-y", `0px`);
|
|
11831
|
+
}
|
|
11832
|
+
setIsSwiped(false);
|
|
11833
|
+
setSwiping(false);
|
|
11834
|
+
setSwipeDirection(null);
|
|
11835
|
+
},
|
|
11836
|
+
onPointerMove: (event) => {
|
|
11837
|
+
var _window_getSelection, _toastRef_current, _toastRef_current1;
|
|
11838
|
+
if (!pointerStartRef.current || !dismissible)
|
|
11839
|
+
return;
|
|
11840
|
+
const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
|
|
11841
|
+
if (isHighlighted)
|
|
11842
|
+
return;
|
|
11843
|
+
const yDelta = event.clientY - pointerStartRef.current.y;
|
|
11844
|
+
const xDelta = event.clientX - pointerStartRef.current.x;
|
|
11845
|
+
var _props_swipeDirections;
|
|
11846
|
+
const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
|
|
11847
|
+
if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
|
|
11848
|
+
setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y");
|
|
11849
|
+
}
|
|
11850
|
+
let swipeAmount = {
|
|
11851
|
+
x: 0,
|
|
11852
|
+
y: 0
|
|
11853
|
+
};
|
|
11854
|
+
const getDampening = (delta) => {
|
|
11855
|
+
const factor = Math.abs(delta) / 20;
|
|
11856
|
+
return 1 / (1.5 + factor);
|
|
11857
|
+
};
|
|
11858
|
+
if (swipeDirection === "y") {
|
|
11859
|
+
if (swipeDirections.includes("top") || swipeDirections.includes("bottom")) {
|
|
11860
|
+
if (swipeDirections.includes("top") && yDelta < 0 || swipeDirections.includes("bottom") && yDelta > 0) {
|
|
11861
|
+
swipeAmount.y = yDelta;
|
|
11862
|
+
} else {
|
|
11863
|
+
const dampenedDelta = yDelta * getDampening(yDelta);
|
|
11864
|
+
swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
|
|
11865
|
+
}
|
|
11866
|
+
}
|
|
11867
|
+
} else if (swipeDirection === "x") {
|
|
11868
|
+
if (swipeDirections.includes("left") || swipeDirections.includes("right")) {
|
|
11869
|
+
if (swipeDirections.includes("left") && xDelta < 0 || swipeDirections.includes("right") && xDelta > 0) {
|
|
11870
|
+
swipeAmount.x = xDelta;
|
|
11871
|
+
} else {
|
|
11872
|
+
const dampenedDelta = xDelta * getDampening(xDelta);
|
|
11873
|
+
swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
|
|
11874
|
+
}
|
|
11875
|
+
}
|
|
11876
|
+
}
|
|
11877
|
+
if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
|
|
11878
|
+
setIsSwiped(true);
|
|
11879
|
+
}
|
|
11880
|
+
(_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
|
|
11881
|
+
(_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
|
|
11882
|
+
}
|
|
11883
|
+
}, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */ React__default.createElement("button", {
|
|
11884
|
+
"aria-label": closeButtonAriaLabel,
|
|
11885
|
+
"data-disabled": disabled,
|
|
11886
|
+
"data-close-button": true,
|
|
11887
|
+
onClick: disabled || !dismissible ? () => {
|
|
11888
|
+
} : () => {
|
|
11889
|
+
deleteToast();
|
|
11890
|
+
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
11891
|
+
},
|
|
11892
|
+
className: cn(classNames == null ? void 0 : classNames.closeButton, toast2 == null ? void 0 : (_toast_classNames2 = toast2.classNames) == null ? void 0 : _toast_classNames2.closeButton)
|
|
11893
|
+
}, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */ React__default.createElement("div", {
|
|
11894
|
+
"data-icon": "",
|
|
11895
|
+
className: cn(classNames == null ? void 0 : classNames.icon, toast2 == null ? void 0 : (_toast_classNames3 = toast2.classNames) == null ? void 0 : _toast_classNames3.icon)
|
|
11896
|
+
}, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */ React__default.createElement("div", {
|
|
11897
|
+
"data-content": "",
|
|
11898
|
+
className: cn(classNames == null ? void 0 : classNames.content, toast2 == null ? void 0 : (_toast_classNames4 = toast2.classNames) == null ? void 0 : _toast_classNames4.content)
|
|
11899
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
11900
|
+
"data-title": "",
|
|
11901
|
+
className: cn(classNames == null ? void 0 : classNames.title, toast2 == null ? void 0 : (_toast_classNames5 = toast2.classNames) == null ? void 0 : _toast_classNames5.title)
|
|
11902
|
+
}, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */ React__default.createElement("div", {
|
|
11903
|
+
"data-description": "",
|
|
11904
|
+
className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast2 == null ? void 0 : (_toast_classNames6 = toast2.classNames) == null ? void 0 : _toast_classNames6.description)
|
|
11905
|
+
}, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */ React__default.isValidElement(toast2.cancel) ? toast2.cancel : toast2.cancel && isAction(toast2.cancel) ? /* @__PURE__ */ React__default.createElement("button", {
|
|
11906
|
+
"data-button": true,
|
|
11907
|
+
"data-cancel": true,
|
|
11908
|
+
style: toast2.cancelButtonStyle || cancelButtonStyle,
|
|
11909
|
+
onClick: (event) => {
|
|
11910
|
+
if (!isAction(toast2.cancel))
|
|
11911
|
+
return;
|
|
11912
|
+
if (!dismissible)
|
|
11913
|
+
return;
|
|
11914
|
+
toast2.cancel.onClick == null ? void 0 : toast2.cancel.onClick.call(toast2.cancel, event);
|
|
11915
|
+
deleteToast();
|
|
11916
|
+
},
|
|
11917
|
+
className: cn(classNames == null ? void 0 : classNames.cancelButton, toast2 == null ? void 0 : (_toast_classNames7 = toast2.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
|
|
11918
|
+
}, toast2.cancel.label) : null, /* @__PURE__ */ React__default.isValidElement(toast2.action) ? toast2.action : toast2.action && isAction(toast2.action) ? /* @__PURE__ */ React__default.createElement("button", {
|
|
11919
|
+
"data-button": true,
|
|
11920
|
+
"data-action": true,
|
|
11921
|
+
style: toast2.actionButtonStyle || actionButtonStyle,
|
|
11922
|
+
onClick: (event) => {
|
|
11923
|
+
if (!isAction(toast2.action))
|
|
11924
|
+
return;
|
|
11925
|
+
toast2.action.onClick == null ? void 0 : toast2.action.onClick.call(toast2.action, event);
|
|
11926
|
+
if (event.defaultPrevented)
|
|
11927
|
+
return;
|
|
11928
|
+
deleteToast();
|
|
11929
|
+
},
|
|
11930
|
+
className: cn(classNames == null ? void 0 : classNames.actionButton, toast2 == null ? void 0 : (_toast_classNames8 = toast2.classNames) == null ? void 0 : _toast_classNames8.actionButton)
|
|
11931
|
+
}, toast2.action.label) : null);
|
|
11932
|
+
};
|
|
11933
|
+
function getDocumentDirection() {
|
|
11934
|
+
if (typeof window === "undefined")
|
|
11935
|
+
return "ltr";
|
|
11936
|
+
if (typeof document === "undefined")
|
|
11937
|
+
return "ltr";
|
|
11938
|
+
const dirAttribute = document.documentElement.getAttribute("dir");
|
|
11939
|
+
if (dirAttribute === "auto" || !dirAttribute) {
|
|
11940
|
+
return window.getComputedStyle(document.documentElement).direction;
|
|
11941
|
+
}
|
|
11942
|
+
return dirAttribute;
|
|
11943
|
+
}
|
|
11944
|
+
function assignOffset(defaultOffset, mobileOffset) {
|
|
11945
|
+
const styles = {};
|
|
11946
|
+
[
|
|
11947
|
+
defaultOffset,
|
|
11948
|
+
mobileOffset
|
|
11949
|
+
].forEach((offset2, index2) => {
|
|
11950
|
+
const isMobile = index2 === 1;
|
|
11951
|
+
const prefix = isMobile ? "--mobile-offset" : "--offset";
|
|
11952
|
+
const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
|
|
11953
|
+
function assignAll(offset3) {
|
|
11954
|
+
[
|
|
11955
|
+
"top",
|
|
11956
|
+
"right",
|
|
11957
|
+
"bottom",
|
|
11958
|
+
"left"
|
|
11959
|
+
].forEach((key) => {
|
|
11960
|
+
styles[`${prefix}-${key}`] = typeof offset3 === "number" ? `${offset3}px` : offset3;
|
|
11961
|
+
});
|
|
11962
|
+
}
|
|
11963
|
+
if (typeof offset2 === "number" || typeof offset2 === "string") {
|
|
11964
|
+
assignAll(offset2);
|
|
11965
|
+
} else if (typeof offset2 === "object") {
|
|
11966
|
+
[
|
|
11967
|
+
"top",
|
|
11968
|
+
"right",
|
|
11969
|
+
"bottom",
|
|
11970
|
+
"left"
|
|
11971
|
+
].forEach((key) => {
|
|
11972
|
+
if (offset2[key] === void 0) {
|
|
11973
|
+
styles[`${prefix}-${key}`] = defaultValue;
|
|
11974
|
+
} else {
|
|
11975
|
+
styles[`${prefix}-${key}`] = typeof offset2[key] === "number" ? `${offset2[key]}px` : offset2[key];
|
|
11976
|
+
}
|
|
11977
|
+
});
|
|
11978
|
+
} else {
|
|
11979
|
+
assignAll(defaultValue);
|
|
11980
|
+
}
|
|
11981
|
+
});
|
|
11982
|
+
return styles;
|
|
11983
|
+
}
|
|
11984
|
+
const Toaster = /* @__PURE__ */ React__default.forwardRef(function Toaster2(props, ref) {
|
|
11985
|
+
const { invert, position = "bottom-right", hotkey = [
|
|
11986
|
+
"altKey",
|
|
11987
|
+
"KeyT"
|
|
11988
|
+
], expand, closeButton, className, offset: offset2, mobileOffset, theme: theme2 = "light", richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = "Notifications" } = props;
|
|
11989
|
+
const [toasts, setToasts] = React__default.useState([]);
|
|
11990
|
+
const possiblePositions = React__default.useMemo(() => {
|
|
11991
|
+
return Array.from(new Set([
|
|
11992
|
+
position
|
|
11993
|
+
].concat(toasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
|
|
11994
|
+
}, [
|
|
11995
|
+
toasts,
|
|
11996
|
+
position
|
|
11997
|
+
]);
|
|
11998
|
+
const [heights, setHeights] = React__default.useState([]);
|
|
11999
|
+
const [expanded, setExpanded] = React__default.useState(false);
|
|
12000
|
+
const [interacting, setInteracting] = React__default.useState(false);
|
|
12001
|
+
const [actualTheme, setActualTheme] = React__default.useState(theme2 !== "system" ? theme2 : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light");
|
|
12002
|
+
const listRef = React__default.useRef(null);
|
|
12003
|
+
const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
12004
|
+
const lastFocusedElementRef = React__default.useRef(null);
|
|
12005
|
+
const isFocusWithinRef = React__default.useRef(false);
|
|
12006
|
+
const removeToast = React__default.useCallback((toastToRemove) => {
|
|
12007
|
+
setToasts((toasts2) => {
|
|
12008
|
+
var _toasts_find;
|
|
12009
|
+
if (!((_toasts_find = toasts2.find((toast2) => toast2.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
|
|
12010
|
+
ToastState.dismiss(toastToRemove.id);
|
|
12011
|
+
}
|
|
12012
|
+
return toasts2.filter(({ id }) => id !== toastToRemove.id);
|
|
12013
|
+
});
|
|
12014
|
+
}, []);
|
|
12015
|
+
React__default.useEffect(() => {
|
|
12016
|
+
return ToastState.subscribe((toast2) => {
|
|
12017
|
+
if (toast2.dismiss) {
|
|
12018
|
+
requestAnimationFrame(() => {
|
|
12019
|
+
setToasts((toasts2) => toasts2.map((t) => t.id === toast2.id ? {
|
|
12020
|
+
...t,
|
|
12021
|
+
delete: true
|
|
12022
|
+
} : t));
|
|
12023
|
+
});
|
|
12024
|
+
return;
|
|
12025
|
+
}
|
|
12026
|
+
setTimeout(() => {
|
|
12027
|
+
ReactDOM__default.flushSync(() => {
|
|
12028
|
+
setToasts((toasts2) => {
|
|
12029
|
+
const indexOfExistingToast = toasts2.findIndex((t) => t.id === toast2.id);
|
|
12030
|
+
if (indexOfExistingToast !== -1) {
|
|
12031
|
+
return [
|
|
12032
|
+
...toasts2.slice(0, indexOfExistingToast),
|
|
12033
|
+
{
|
|
12034
|
+
...toasts2[indexOfExistingToast],
|
|
12035
|
+
...toast2
|
|
12036
|
+
},
|
|
12037
|
+
...toasts2.slice(indexOfExistingToast + 1)
|
|
12038
|
+
];
|
|
12039
|
+
}
|
|
12040
|
+
return [
|
|
12041
|
+
toast2,
|
|
12042
|
+
...toasts2
|
|
12043
|
+
];
|
|
12044
|
+
});
|
|
12045
|
+
});
|
|
12046
|
+
});
|
|
12047
|
+
});
|
|
12048
|
+
}, [
|
|
12049
|
+
toasts
|
|
12050
|
+
]);
|
|
12051
|
+
React__default.useEffect(() => {
|
|
12052
|
+
if (theme2 !== "system") {
|
|
12053
|
+
setActualTheme(theme2);
|
|
12054
|
+
return;
|
|
12055
|
+
}
|
|
12056
|
+
if (theme2 === "system") {
|
|
12057
|
+
if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
|
12058
|
+
setActualTheme("dark");
|
|
12059
|
+
} else {
|
|
12060
|
+
setActualTheme("light");
|
|
12061
|
+
}
|
|
12062
|
+
}
|
|
12063
|
+
if (typeof window === "undefined")
|
|
12064
|
+
return;
|
|
12065
|
+
const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
12066
|
+
try {
|
|
12067
|
+
darkMediaQuery.addEventListener("change", ({ matches }) => {
|
|
12068
|
+
if (matches) {
|
|
12069
|
+
setActualTheme("dark");
|
|
12070
|
+
} else {
|
|
12071
|
+
setActualTheme("light");
|
|
12072
|
+
}
|
|
12073
|
+
});
|
|
12074
|
+
} catch (error) {
|
|
12075
|
+
darkMediaQuery.addListener(({ matches }) => {
|
|
12076
|
+
try {
|
|
12077
|
+
if (matches) {
|
|
12078
|
+
setActualTheme("dark");
|
|
12079
|
+
} else {
|
|
12080
|
+
setActualTheme("light");
|
|
12081
|
+
}
|
|
12082
|
+
} catch (e) {
|
|
12083
|
+
console.error(e);
|
|
12084
|
+
}
|
|
12085
|
+
});
|
|
12086
|
+
}
|
|
12087
|
+
}, [
|
|
12088
|
+
theme2
|
|
12089
|
+
]);
|
|
12090
|
+
React__default.useEffect(() => {
|
|
12091
|
+
if (toasts.length <= 1) {
|
|
12092
|
+
setExpanded(false);
|
|
12093
|
+
}
|
|
12094
|
+
}, [
|
|
12095
|
+
toasts
|
|
12096
|
+
]);
|
|
12097
|
+
React__default.useEffect(() => {
|
|
12098
|
+
const handleKeyDown = (event) => {
|
|
12099
|
+
var _listRef_current;
|
|
12100
|
+
const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
|
|
12101
|
+
if (isHotkeyPressed) {
|
|
12102
|
+
var _listRef_current1;
|
|
12103
|
+
setExpanded(true);
|
|
12104
|
+
(_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
|
|
12105
|
+
}
|
|
12106
|
+
if (event.code === "Escape" && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {
|
|
12107
|
+
setExpanded(false);
|
|
12108
|
+
}
|
|
12109
|
+
};
|
|
12110
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
12111
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
12112
|
+
}, [
|
|
12113
|
+
hotkey
|
|
12114
|
+
]);
|
|
12115
|
+
React__default.useEffect(() => {
|
|
12116
|
+
if (listRef.current) {
|
|
12117
|
+
return () => {
|
|
12118
|
+
if (lastFocusedElementRef.current) {
|
|
12119
|
+
lastFocusedElementRef.current.focus({
|
|
12120
|
+
preventScroll: true
|
|
12121
|
+
});
|
|
12122
|
+
lastFocusedElementRef.current = null;
|
|
12123
|
+
isFocusWithinRef.current = false;
|
|
12124
|
+
}
|
|
12125
|
+
};
|
|
12126
|
+
}
|
|
12127
|
+
}, [
|
|
12128
|
+
listRef.current
|
|
12129
|
+
]);
|
|
12130
|
+
return (
|
|
12131
|
+
// Remove item from normal navigation flow, only available via hotkey
|
|
12132
|
+
/* @__PURE__ */ React__default.createElement("section", {
|
|
12133
|
+
ref,
|
|
12134
|
+
"aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
|
|
12135
|
+
tabIndex: -1,
|
|
12136
|
+
"aria-live": "polite",
|
|
12137
|
+
"aria-relevant": "additions text",
|
|
12138
|
+
"aria-atomic": "false",
|
|
12139
|
+
suppressHydrationWarning: true
|
|
12140
|
+
}, possiblePositions.map((position2, index2) => {
|
|
12141
|
+
var _heights_;
|
|
12142
|
+
const [y2, x2] = position2.split("-");
|
|
12143
|
+
if (!toasts.length)
|
|
12144
|
+
return null;
|
|
12145
|
+
return /* @__PURE__ */ React__default.createElement("ol", {
|
|
12146
|
+
key: position2,
|
|
12147
|
+
dir: dir === "auto" ? getDocumentDirection() : dir,
|
|
12148
|
+
tabIndex: -1,
|
|
12149
|
+
ref: listRef,
|
|
12150
|
+
className,
|
|
12151
|
+
"data-sonner-toaster": true,
|
|
12152
|
+
"data-sonner-theme": actualTheme,
|
|
12153
|
+
"data-y-position": y2,
|
|
12154
|
+
"data-lifted": expanded && toasts.length > 1 && !expand,
|
|
12155
|
+
"data-x-position": x2,
|
|
12156
|
+
style: {
|
|
12157
|
+
"--front-toast-height": `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
|
|
12158
|
+
"--width": `${TOAST_WIDTH}px`,
|
|
12159
|
+
"--gap": `${gap}px`,
|
|
12160
|
+
...style,
|
|
12161
|
+
...assignOffset(offset2, mobileOffset)
|
|
12162
|
+
},
|
|
12163
|
+
onBlur: (event) => {
|
|
12164
|
+
if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
|
|
12165
|
+
isFocusWithinRef.current = false;
|
|
12166
|
+
if (lastFocusedElementRef.current) {
|
|
12167
|
+
lastFocusedElementRef.current.focus({
|
|
12168
|
+
preventScroll: true
|
|
12169
|
+
});
|
|
12170
|
+
lastFocusedElementRef.current = null;
|
|
12171
|
+
}
|
|
12172
|
+
}
|
|
12173
|
+
},
|
|
12174
|
+
onFocus: (event) => {
|
|
12175
|
+
const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
|
|
12176
|
+
if (isNotDismissible)
|
|
12177
|
+
return;
|
|
12178
|
+
if (!isFocusWithinRef.current) {
|
|
12179
|
+
isFocusWithinRef.current = true;
|
|
12180
|
+
lastFocusedElementRef.current = event.relatedTarget;
|
|
12181
|
+
}
|
|
12182
|
+
},
|
|
12183
|
+
onMouseEnter: () => setExpanded(true),
|
|
12184
|
+
onMouseMove: () => setExpanded(true),
|
|
12185
|
+
onMouseLeave: () => {
|
|
12186
|
+
if (!interacting) {
|
|
12187
|
+
setExpanded(false);
|
|
12188
|
+
}
|
|
12189
|
+
},
|
|
12190
|
+
onDragEnd: () => setExpanded(false),
|
|
12191
|
+
onPointerDown: (event) => {
|
|
12192
|
+
const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
|
|
12193
|
+
if (isNotDismissible)
|
|
12194
|
+
return;
|
|
12195
|
+
setInteracting(true);
|
|
12196
|
+
},
|
|
12197
|
+
onPointerUp: () => setInteracting(false)
|
|
12198
|
+
}, toasts.filter((toast2) => !toast2.position && index2 === 0 || toast2.position === position2).map((toast2, index3) => {
|
|
12199
|
+
var _toastOptions_duration, _toastOptions_closeButton;
|
|
12200
|
+
return /* @__PURE__ */ React__default.createElement(Toast, {
|
|
12201
|
+
key: toast2.id,
|
|
12202
|
+
icons,
|
|
12203
|
+
index: index3,
|
|
12204
|
+
toast: toast2,
|
|
12205
|
+
defaultRichColors: richColors,
|
|
12206
|
+
duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration,
|
|
12207
|
+
className: toastOptions == null ? void 0 : toastOptions.className,
|
|
12208
|
+
descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
|
|
12209
|
+
invert,
|
|
12210
|
+
visibleToasts,
|
|
12211
|
+
closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
|
|
12212
|
+
interacting,
|
|
12213
|
+
position: position2,
|
|
12214
|
+
style: toastOptions == null ? void 0 : toastOptions.style,
|
|
12215
|
+
unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
|
|
12216
|
+
classNames: toastOptions == null ? void 0 : toastOptions.classNames,
|
|
12217
|
+
cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
|
|
12218
|
+
actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
|
|
12219
|
+
closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
|
|
12220
|
+
removeToast,
|
|
12221
|
+
toasts: toasts.filter((t) => t.position == toast2.position),
|
|
12222
|
+
heights: heights.filter((h2) => h2.position == toast2.position),
|
|
12223
|
+
setHeights,
|
|
12224
|
+
expandByDefault: expand,
|
|
12225
|
+
gap,
|
|
12226
|
+
expanded,
|
|
12227
|
+
swipeDirections: props.swipeDirections
|
|
12228
|
+
});
|
|
12229
|
+
}));
|
|
12230
|
+
}))
|
|
12231
|
+
);
|
|
12232
|
+
});
|
|
12233
|
+
const PDF_CONFIG = {
|
|
12234
|
+
A4_WIDTH: "210mm",
|
|
12235
|
+
MARGIN: 12,
|
|
12236
|
+
// mm
|
|
12237
|
+
RENDER_DELAY: 100,
|
|
12238
|
+
// ms
|
|
12239
|
+
HIGHLIGHT_PADDING: {
|
|
12240
|
+
TOP: "0.03em",
|
|
12241
|
+
BOTTOM: "0.18em",
|
|
12242
|
+
VERTICAL_OFFSET: "0.10em"
|
|
12243
|
+
},
|
|
12244
|
+
COLORS: {
|
|
12245
|
+
DEFAULT_HIGHLIGHT: "rgba(255,212,0,0.45)",
|
|
12246
|
+
WHITE_THRESHOLD: 240,
|
|
12247
|
+
NEAR_BLACK: "#111111"
|
|
12248
|
+
}
|
|
12249
|
+
};
|
|
12250
|
+
const loadHtml2Pdf = async () => {
|
|
12251
|
+
try {
|
|
12252
|
+
const mod = await import("./html2pdf.bundle.min-35b40dde.js").then((n) => n.h);
|
|
12253
|
+
return (mod == null ? void 0 : mod.default) || mod;
|
|
12254
|
+
} catch {
|
|
12255
|
+
const mod2 = await import("./html2pdf.bundle-fa4096e4.js").then((n) => n.h);
|
|
12256
|
+
return (mod2 == null ? void 0 : mod2.default) || mod2;
|
|
12257
|
+
}
|
|
12258
|
+
};
|
|
12259
|
+
async function exportEditorToPDF(editor, filename = "document.pdf") {
|
|
12260
|
+
if (typeof window === "undefined") {
|
|
12261
|
+
throw new Error("PDF export requires browser environment");
|
|
12262
|
+
}
|
|
12263
|
+
const rootEl = editor.getRootElement();
|
|
12264
|
+
if (!rootEl)
|
|
12265
|
+
throw new Error("Editor root not found");
|
|
12266
|
+
if (!document.body) {
|
|
12267
|
+
throw new Error("Document body not available");
|
|
12268
|
+
}
|
|
12269
|
+
const container = document.createElement("div");
|
|
12270
|
+
container.style.position = "fixed";
|
|
12271
|
+
container.style.left = "-10000px";
|
|
12272
|
+
container.style.top = "0";
|
|
12273
|
+
container.style.width = PDF_CONFIG.A4_WIDTH;
|
|
12274
|
+
container.style.maxWidth = PDF_CONFIG.A4_WIDTH;
|
|
12275
|
+
container.style.padding = `${PDF_CONFIG.MARGIN}mm`;
|
|
12276
|
+
container.style.backgroundColor = "#ffffff";
|
|
12277
|
+
container.style.zIndex = "-1";
|
|
12278
|
+
container.style.overflow = "visible";
|
|
12279
|
+
container.style.opacity = "1";
|
|
12280
|
+
const styleEl = document.createElement("style");
|
|
12281
|
+
styleEl.textContent = `
|
|
12282
|
+
@page { size: A4; margin: 12mm; }
|
|
12283
|
+
#pdf-root {
|
|
12284
|
+
background: #ffffff;
|
|
12285
|
+
color: #000000;
|
|
12286
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
12287
|
+
line-height: 1.6;
|
|
12288
|
+
}
|
|
12289
|
+
#pdf-root * {
|
|
12290
|
+
-webkit-print-color-adjust: exact;
|
|
12291
|
+
print-color-adjust: exact;
|
|
12292
|
+
color-adjust: exact;
|
|
12293
|
+
}
|
|
12294
|
+
/* Preserve text alignment from editor */
|
|
12295
|
+
#pdf-root p[style*="text-align"],
|
|
12296
|
+
#pdf-root h1[style*="text-align"],
|
|
12297
|
+
#pdf-root h2[style*="text-align"],
|
|
12298
|
+
#pdf-root h3[style*="text-align"],
|
|
12299
|
+
#pdf-root h4[style*="text-align"],
|
|
12300
|
+
#pdf-root h5[style*="text-align"],
|
|
12301
|
+
#pdf-root h6[style*="text-align"],
|
|
12302
|
+
#pdf-root div[style*="text-align"] {
|
|
12303
|
+
text-align: inherit !important;
|
|
12304
|
+
}
|
|
12305
|
+
/* Keep links readable; other text colors will be preserved unless near-white */
|
|
12306
|
+
#pdf-root a { color: #0b57d0 !important; }
|
|
12307
|
+
/* Strikethrough will be drawn via JS transform for inline elements. */
|
|
12308
|
+
/* Highlight rendering - positioned background to align with text */
|
|
12309
|
+
#pdf-root .PlaygroundEditorTheme__mark,
|
|
12310
|
+
#pdf-root .mark,
|
|
12311
|
+
#pdf-root mark {
|
|
12312
|
+
display: inline !important;
|
|
12313
|
+
margin: 0 !important;
|
|
12314
|
+
border: none !important;
|
|
12315
|
+
vertical-align: baseline !important;
|
|
12316
|
+
box-decoration-break: clone !important;
|
|
12317
|
+
-webkit-box-decoration-break: clone !important;
|
|
12318
|
+
}
|
|
12319
|
+
#pdf-root img { max-width: 100%; height: auto; }
|
|
12320
|
+
#pdf-root table { width: 100%; border-collapse: collapse; }
|
|
12321
|
+
#pdf-root th, #pdf-root .PlaygroundEditorTheme__tableCellHeader {
|
|
12322
|
+
background: #e8e8e8 !important;
|
|
12323
|
+
color: #000 !important;
|
|
12324
|
+
font-weight: 600 !important;
|
|
12325
|
+
line-height: 1.35 !important;
|
|
12326
|
+
vertical-align: middle !important;
|
|
12327
|
+
padding: 8px 10px !important;
|
|
12328
|
+
overflow: visible !important;
|
|
12329
|
+
white-space: normal !important;
|
|
12330
|
+
}
|
|
12331
|
+
#pdf-root th, #pdf-root td {
|
|
12332
|
+
border: 1px solid #cfcfcf !important;
|
|
12333
|
+
line-height: 1.35 !important;
|
|
12334
|
+
padding: 8px 10px !important;
|
|
12335
|
+
vertical-align: middle !important;
|
|
12336
|
+
overflow: visible !important;
|
|
12337
|
+
white-space: normal !important;
|
|
12338
|
+
word-break: break-word !important;
|
|
12339
|
+
height: auto !important;
|
|
12340
|
+
min-height: 1.2em !important;
|
|
12341
|
+
}
|
|
12342
|
+
/* Checklist styles */
|
|
12343
|
+
#pdf-root .PlaygroundEditorTheme__checklist {
|
|
12344
|
+
list-style: none !important;
|
|
12345
|
+
padding-left: 0 !important;
|
|
12346
|
+
margin-left: 0 !important;
|
|
12347
|
+
}
|
|
12348
|
+
#pdf-root .PlaygroundEditorTheme__checklist .PlaygroundEditorTheme__listItem {
|
|
12349
|
+
position: relative !important;
|
|
12350
|
+
margin: 0 8px 8px 8px !important;
|
|
12351
|
+
padding-left: 26px !important;
|
|
12352
|
+
padding-right: 8px !important;
|
|
12353
|
+
padding-top: 2px !important;
|
|
12354
|
+
padding-bottom: 2px !important;
|
|
12355
|
+
list-style-type: none !important;
|
|
12356
|
+
min-height: 20px !important;
|
|
12357
|
+
display: list-item !important;
|
|
12358
|
+
line-height: 1.5 !important;
|
|
12359
|
+
}
|
|
12360
|
+
#pdf-root .PlaygroundEditorTheme__checklist .PlaygroundEditorTheme__listItemChecked {
|
|
12361
|
+
text-decoration: line-through !important;
|
|
12362
|
+
}
|
|
12363
|
+
#pdf-root .PlaygroundEditorTheme__checklist .PlaygroundEditorTheme__listItem:before {
|
|
12364
|
+
content: "" !important;
|
|
12365
|
+
width: 16px !important;
|
|
12366
|
+
height: 16px !important;
|
|
12367
|
+
top: 2px !important;
|
|
12368
|
+
left: 0px !important;
|
|
12369
|
+
display: inline-block !important;
|
|
12370
|
+
background-size: cover !important;
|
|
12371
|
+
position: absolute !important;
|
|
12372
|
+
flex-shrink: 0 !important;
|
|
12373
|
+
border: 1px solid #999 !important;
|
|
12374
|
+
border-radius: 2px !important;
|
|
12375
|
+
background-color: #fff !important;
|
|
12376
|
+
box-sizing: border-box !important;
|
|
12377
|
+
}
|
|
12378
|
+
#pdf-root .PlaygroundEditorTheme__checklist .PlaygroundEditorTheme__listItemChecked:before {
|
|
12379
|
+
border: 1px solid rgb(61, 135, 245) !important;
|
|
12380
|
+
border-radius: 2px !important;
|
|
12381
|
+
background-color: #3d87f5 !important;
|
|
12382
|
+
background-repeat: no-repeat !important;
|
|
12383
|
+
}
|
|
12384
|
+
#pdf-root .PlaygroundEditorTheme__checklist .PlaygroundEditorTheme__listItemChecked:after {
|
|
12385
|
+
content: "" !important;
|
|
12386
|
+
border-color: #fff !important;
|
|
12387
|
+
border-style: solid !important;
|
|
12388
|
+
position: absolute !important;
|
|
12389
|
+
display: block !important;
|
|
12390
|
+
top: 7px !important;
|
|
12391
|
+
width: 3px !important;
|
|
12392
|
+
left: 7px !important;
|
|
12393
|
+
height: 6px !important;
|
|
12394
|
+
transform: rotate(45deg) !important;
|
|
12395
|
+
border-width: 0 2px 2px 0 !important;
|
|
12396
|
+
}
|
|
12397
|
+
#pdf-root pre, #pdf-root blockquote, #pdf-root table, #pdf-root img { page-break-inside: avoid; }
|
|
12398
|
+
`;
|
|
12399
|
+
const pdfRoot = document.createElement("div");
|
|
12400
|
+
pdfRoot.id = "pdf-root";
|
|
12401
|
+
pdfRoot.innerHTML = rootEl.innerHTML;
|
|
12402
|
+
container.appendChild(styleEl);
|
|
12403
|
+
container.appendChild(pdfRoot);
|
|
12404
|
+
document.body.appendChild(container);
|
|
12405
|
+
await new Promise((resolve) => setTimeout(resolve, PDF_CONFIG.RENDER_DELAY));
|
|
12406
|
+
try {
|
|
12407
|
+
const nodes = Array.from(pdfRoot.querySelectorAll("*"));
|
|
12408
|
+
nodes.forEach((el) => {
|
|
12409
|
+
var _a;
|
|
12410
|
+
if (!el || !el.style)
|
|
12411
|
+
return;
|
|
12412
|
+
const cs = window.getComputedStyle(el);
|
|
12413
|
+
const textAlign = el.style.textAlign || cs.textAlign;
|
|
12414
|
+
if (textAlign && textAlign !== "start") {
|
|
12415
|
+
el.style.textAlign = textAlign;
|
|
12416
|
+
}
|
|
12417
|
+
const tdLine = cs.textDecorationLine || cs.textDecoration;
|
|
12418
|
+
const isInline = cs.display.includes("inline");
|
|
12419
|
+
const isChecklistItem = el.classList.contains("PlaygroundEditorTheme__listItemChecked") || el.classList.contains("PlaygroundEditorTheme__listItemUnchecked");
|
|
12420
|
+
if (tdLine && tdLine.includes("line-through") && isInline && !isChecklistItem) {
|
|
12421
|
+
el.style.textDecoration = "none";
|
|
12422
|
+
el.style.backgroundImage = "linear-gradient(currentColor, currentColor)";
|
|
12423
|
+
el.style.backgroundRepeat = "no-repeat";
|
|
12424
|
+
el.style.backgroundSize = "100% 2px";
|
|
12425
|
+
el.style.display = "inline";
|
|
12426
|
+
el.style.width = "auto";
|
|
12427
|
+
el.style.maxWidth = "none";
|
|
12428
|
+
const isHeading = /^(H1|H2|H3|H4|H5|H6)$/.test(el.tagName);
|
|
12429
|
+
el.style.backgroundPosition = isHeading ? "0 92%" : "0 88%";
|
|
12430
|
+
}
|
|
12431
|
+
const computedBg = cs.backgroundColor;
|
|
12432
|
+
const isMark = el.tagName === "MARK" || el.classList.contains("PlaygroundEditorTheme__mark") || el.classList.contains("mark");
|
|
12433
|
+
if (isMark) {
|
|
12434
|
+
const color2 = el.style.backgroundColor || computedBg || PDF_CONFIG.COLORS.DEFAULT_HIGHLIGHT;
|
|
12435
|
+
el.style.display = "inline-block";
|
|
12436
|
+
el.style.background = color2;
|
|
12437
|
+
el.style.paddingTop = PDF_CONFIG.HIGHLIGHT_PADDING.TOP;
|
|
12438
|
+
el.style.paddingBottom = PDF_CONFIG.HIGHLIGHT_PADDING.BOTTOM;
|
|
12439
|
+
el.style.paddingLeft = "0";
|
|
12440
|
+
el.style.paddingRight = "0";
|
|
12441
|
+
el.style.margin = "0";
|
|
12442
|
+
el.style.verticalAlign = "baseline";
|
|
12443
|
+
el.style.lineHeight = "1.3";
|
|
12444
|
+
el.style.position = "relative";
|
|
12445
|
+
el.style.top = PDF_CONFIG.HIGHLIGHT_PADDING.VERTICAL_OFFSET;
|
|
12446
|
+
el.style.boxDecorationBreak = "clone";
|
|
12447
|
+
el.style["-webkit-box-decoration-break"] = "clone";
|
|
12448
|
+
const childSpans = el.querySelectorAll("span");
|
|
12449
|
+
childSpans.forEach((span) => {
|
|
12450
|
+
span.style.display = "inline";
|
|
12451
|
+
span.style.verticalAlign = "inherit";
|
|
12452
|
+
});
|
|
12453
|
+
}
|
|
12454
|
+
const isInChecklist = el.classList.contains("PlaygroundEditorTheme__listItem") && ((_a = el.parentElement) == null ? void 0 : _a.classList.contains("PlaygroundEditorTheme__checklist"));
|
|
12455
|
+
if (isInChecklist) {
|
|
12456
|
+
el.style.display = "list-item";
|
|
12457
|
+
el.style.position = "relative";
|
|
12458
|
+
el.style.paddingLeft = "26px";
|
|
12459
|
+
el.style.paddingRight = "8px";
|
|
12460
|
+
el.style.paddingTop = "2px";
|
|
12461
|
+
el.style.paddingBottom = "2px";
|
|
12462
|
+
el.style.margin = "0 8px 8px 8px";
|
|
12463
|
+
el.style.listStyleType = "none";
|
|
12464
|
+
el.style.lineHeight = "1.5";
|
|
12465
|
+
el.style.minHeight = "20px";
|
|
12466
|
+
if (el.classList.contains("PlaygroundEditorTheme__listItemChecked")) {
|
|
12467
|
+
el.style.textDecoration = "line-through";
|
|
12468
|
+
}
|
|
12469
|
+
}
|
|
12470
|
+
const color = cs.color || "";
|
|
12471
|
+
const m2 = color.match(/rgba?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
|
|
12472
|
+
if (m2) {
|
|
12473
|
+
const r2 = parseInt(m2[1], 10), g2 = parseInt(m2[2], 10), b2 = parseInt(m2[3], 10);
|
|
12474
|
+
const threshold = PDF_CONFIG.COLORS.WHITE_THRESHOLD;
|
|
12475
|
+
const nearWhite = r2 > threshold && g2 > threshold && b2 > threshold;
|
|
12476
|
+
if (nearWhite) {
|
|
12477
|
+
el.style.color = PDF_CONFIG.COLORS.NEAR_BLACK;
|
|
12478
|
+
}
|
|
12479
|
+
}
|
|
12480
|
+
});
|
|
12481
|
+
const checklistContainers = Array.from(pdfRoot.querySelectorAll(".PlaygroundEditorTheme__checklist"));
|
|
12482
|
+
checklistContainers.forEach((ul) => {
|
|
12483
|
+
ul.style.listStyle = "none";
|
|
12484
|
+
ul.style.paddingLeft = "0";
|
|
12485
|
+
ul.style.marginLeft = "0";
|
|
12486
|
+
});
|
|
12487
|
+
} catch (error) {
|
|
12488
|
+
console.warn("PDF export styling transform failed:", error);
|
|
12489
|
+
}
|
|
12490
|
+
try {
|
|
12491
|
+
const html2pdf = await loadHtml2Pdf();
|
|
12492
|
+
if (typeof html2pdf !== "function") {
|
|
12493
|
+
throw new Error("html2pdf library failed to load properly");
|
|
12494
|
+
}
|
|
12495
|
+
await html2pdf().set({
|
|
12496
|
+
margin: PDF_CONFIG.MARGIN,
|
|
12497
|
+
// Sanitize filename for all platforms (Windows, macOS, Linux)
|
|
12498
|
+
filename: filename.replace(/[\x00-\x1f\x80-\x9f<>:"/\\|?*\u0000-\u001F\u007F]+/g, "_").replace(/^\.+/, "").replace(/[. ]+$/, "").slice(0, 200) || "document.pdf",
|
|
12499
|
+
// Limit length and fallback
|
|
12500
|
+
image: { type: "jpeg", quality: 0.98 },
|
|
12501
|
+
html2canvas: {
|
|
12502
|
+
scale: 2,
|
|
12503
|
+
useCORS: true,
|
|
12504
|
+
allowTaint: false,
|
|
12505
|
+
// Security: prevent tainted canvas
|
|
12506
|
+
backgroundColor: "#ffffff"
|
|
12507
|
+
// Ensure white background
|
|
12508
|
+
},
|
|
12509
|
+
jsPDF: { unit: "mm", format: "a4", orientation: "portrait" },
|
|
12510
|
+
pagebreak: { mode: ["css", "legacy"] }
|
|
12511
|
+
}).from(pdfRoot).save();
|
|
12512
|
+
} catch (error) {
|
|
12513
|
+
console.error("PDF generation failed:", error);
|
|
12514
|
+
throw new Error(`PDF export failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
12515
|
+
} finally {
|
|
12516
|
+
container.remove();
|
|
12517
|
+
}
|
|
12518
|
+
}
|
|
12519
|
+
const CommentView = ({
|
|
12520
|
+
text,
|
|
12521
|
+
author,
|
|
12522
|
+
timestamp,
|
|
12523
|
+
nodeKey
|
|
12524
|
+
}) => {
|
|
12525
|
+
const [editor] = useLexicalComposerContext();
|
|
12526
|
+
useState(false);
|
|
12527
|
+
const [isEditing, setIsEditing] = useState(false);
|
|
12528
|
+
const [editText, setEditText] = useState(text);
|
|
12529
|
+
useCallback(() => {
|
|
12530
|
+
editor.update(() => {
|
|
12531
|
+
const node = $getNodeByKey(nodeKey);
|
|
12532
|
+
if (node) {
|
|
12533
|
+
node.remove();
|
|
12534
|
+
}
|
|
12535
|
+
});
|
|
12536
|
+
}, [editor, nodeKey]);
|
|
12537
|
+
useCallback(() => {
|
|
12538
|
+
setIsEditing(true);
|
|
12539
|
+
setEditText(text);
|
|
12540
|
+
}, [text]);
|
|
12541
|
+
useCallback(() => {
|
|
12542
|
+
if (editText.trim()) {
|
|
12543
|
+
editor.update(() => {
|
|
12544
|
+
const node = $getNodeByKey(nodeKey);
|
|
12545
|
+
if (node instanceof CommentNode) {
|
|
12546
|
+
node.setText(editText.trim());
|
|
12547
|
+
}
|
|
12548
|
+
});
|
|
12549
|
+
setIsEditing(false);
|
|
12550
|
+
}
|
|
12551
|
+
}, [editor, nodeKey, editText]);
|
|
12552
|
+
useCallback(() => {
|
|
12553
|
+
setIsEditing(false);
|
|
12554
|
+
setEditText(text);
|
|
12555
|
+
}, [text]);
|
|
12556
|
+
return null;
|
|
12557
|
+
};
|
|
11361
12558
|
function $convertCommentElement(domNode) {
|
|
11362
12559
|
const div = domNode;
|
|
11363
12560
|
if (div.classList.contains("comment-node")) {
|
|
@@ -12245,7 +13442,188 @@ const EmbedComponent = ({ url, displayType, alignment, nodeKey }) => {
|
|
|
12245
13442
|
)
|
|
12246
13443
|
}
|
|
12247
13444
|
);
|
|
12248
|
-
};
|
|
13445
|
+
};
|
|
13446
|
+
const ImageView = React__default.lazy(() => import("./index-2ca32ea9.js"));
|
|
13447
|
+
function isGoogleDocCheckboxImg(img) {
|
|
13448
|
+
return img.parentElement != null && img.parentElement.tagName === "LI" && img.previousSibling === null && img.getAttribute("aria-roledescription") === "checkbox";
|
|
13449
|
+
}
|
|
13450
|
+
function $convertImageElement(domNode) {
|
|
13451
|
+
const img = domNode;
|
|
13452
|
+
if (img.src.startsWith("file:///") || isGoogleDocCheckboxImg(img)) {
|
|
13453
|
+
return null;
|
|
13454
|
+
}
|
|
13455
|
+
const { alt: altText, src, width, height } = img;
|
|
13456
|
+
const node = $createImageNode({ altText, height, src, width });
|
|
13457
|
+
return { node };
|
|
13458
|
+
}
|
|
13459
|
+
class ImageNode extends DecoratorNode {
|
|
13460
|
+
constructor(src, altText, maxWidth, width, height, showCaption, caption, captionsEnabled, key) {
|
|
13461
|
+
super(key);
|
|
13462
|
+
__publicField(this, "__src");
|
|
13463
|
+
__publicField(this, "__altText");
|
|
13464
|
+
__publicField(this, "__width");
|
|
13465
|
+
__publicField(this, "__height");
|
|
13466
|
+
__publicField(this, "__maxWidth");
|
|
13467
|
+
__publicField(this, "__showCaption");
|
|
13468
|
+
__publicField(this, "__caption");
|
|
13469
|
+
// Captions cannot yet be used within editor cells
|
|
13470
|
+
__publicField(this, "__captionsEnabled");
|
|
13471
|
+
this.__src = src;
|
|
13472
|
+
this.__altText = altText;
|
|
13473
|
+
this.__maxWidth = maxWidth;
|
|
13474
|
+
this.__width = width || "inherit";
|
|
13475
|
+
this.__height = height || "inherit";
|
|
13476
|
+
this.__showCaption = showCaption || false;
|
|
13477
|
+
this.__caption = caption || createEditor({
|
|
13478
|
+
nodes: []
|
|
13479
|
+
});
|
|
13480
|
+
this.__captionsEnabled = captionsEnabled || captionsEnabled === void 0;
|
|
13481
|
+
}
|
|
13482
|
+
// to identify the image node and must unique too
|
|
13483
|
+
static getType() {
|
|
13484
|
+
return "image";
|
|
13485
|
+
}
|
|
13486
|
+
// Clones the ImageNode when needed (during editor updates)
|
|
13487
|
+
static clone(node) {
|
|
13488
|
+
return new ImageNode(
|
|
13489
|
+
node.__src,
|
|
13490
|
+
node.__altText,
|
|
13491
|
+
node.__maxWidth,
|
|
13492
|
+
node.__width,
|
|
13493
|
+
node.__height,
|
|
13494
|
+
node.__showCaption,
|
|
13495
|
+
node.__caption,
|
|
13496
|
+
node.__captionsEnabled,
|
|
13497
|
+
node.__key
|
|
13498
|
+
);
|
|
13499
|
+
}
|
|
13500
|
+
// importing to json format
|
|
13501
|
+
static importJSON(serializedNode) {
|
|
13502
|
+
const { altText, height, width, maxWidth, caption, src, showCaption } = serializedNode;
|
|
13503
|
+
const node = $createImageNode({
|
|
13504
|
+
altText,
|
|
13505
|
+
height,
|
|
13506
|
+
maxWidth,
|
|
13507
|
+
showCaption,
|
|
13508
|
+
src,
|
|
13509
|
+
width
|
|
13510
|
+
});
|
|
13511
|
+
const nestedEditor = node.__caption;
|
|
13512
|
+
const editorState = nestedEditor.parseEditorState(caption.editorState);
|
|
13513
|
+
if (!editorState.isEmpty()) {
|
|
13514
|
+
nestedEditor.setEditorState(editorState);
|
|
13515
|
+
}
|
|
13516
|
+
return node;
|
|
13517
|
+
}
|
|
13518
|
+
// Exports this node as an actual <img> tag in the DOM when needed
|
|
13519
|
+
exportDOM() {
|
|
13520
|
+
const element = document.createElement("img");
|
|
13521
|
+
element.setAttribute("src", this.__src);
|
|
13522
|
+
element.setAttribute("alt", this.__altText);
|
|
13523
|
+
element.setAttribute("width", this.__width.toString());
|
|
13524
|
+
element.setAttribute("height", this.__height.toString());
|
|
13525
|
+
return { element };
|
|
13526
|
+
}
|
|
13527
|
+
// convert img tag into image node in the editor using convertImageElement func
|
|
13528
|
+
static importDOM() {
|
|
13529
|
+
return {
|
|
13530
|
+
img: (node) => ({
|
|
13531
|
+
conversion: $convertImageElement,
|
|
13532
|
+
priority: 0
|
|
13533
|
+
})
|
|
13534
|
+
};
|
|
13535
|
+
}
|
|
13536
|
+
exportJSON() {
|
|
13537
|
+
return {
|
|
13538
|
+
altText: this.getAltText(),
|
|
13539
|
+
caption: this.__caption.toJSON(),
|
|
13540
|
+
height: this.__height === "inherit" ? 0 : this.__height,
|
|
13541
|
+
maxWidth: this.__maxWidth,
|
|
13542
|
+
showCaption: this.__showCaption,
|
|
13543
|
+
src: this.getSrc(),
|
|
13544
|
+
type: "image",
|
|
13545
|
+
version: 1,
|
|
13546
|
+
width: this.__width === "inherit" ? 0 : this.__width
|
|
13547
|
+
};
|
|
13548
|
+
}
|
|
13549
|
+
// setting width and height when resizing
|
|
13550
|
+
setWidthAndHeight(width, height) {
|
|
13551
|
+
const writable = this.getWritable();
|
|
13552
|
+
writable.__width = width;
|
|
13553
|
+
writable.__height = height;
|
|
13554
|
+
}
|
|
13555
|
+
// state to update to show the caption
|
|
13556
|
+
setShowCaption(showCaption) {
|
|
13557
|
+
const writable = this.getWritable();
|
|
13558
|
+
writable.__showCaption = showCaption;
|
|
13559
|
+
}
|
|
13560
|
+
// To create a dom representation of image view
|
|
13561
|
+
createDOM(config) {
|
|
13562
|
+
const span = document.createElement("span");
|
|
13563
|
+
const theme2 = config.theme;
|
|
13564
|
+
const className = theme2.image;
|
|
13565
|
+
if (className !== void 0) {
|
|
13566
|
+
span.className = className;
|
|
13567
|
+
}
|
|
13568
|
+
return span;
|
|
13569
|
+
}
|
|
13570
|
+
updateDOM() {
|
|
13571
|
+
return false;
|
|
13572
|
+
}
|
|
13573
|
+
// to get the image src
|
|
13574
|
+
getSrc() {
|
|
13575
|
+
return this.__src;
|
|
13576
|
+
}
|
|
13577
|
+
getAltText() {
|
|
13578
|
+
return this.__altText;
|
|
13579
|
+
}
|
|
13580
|
+
// to render the image tag
|
|
13581
|
+
decorate() {
|
|
13582
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(
|
|
13583
|
+
ImageView,
|
|
13584
|
+
{
|
|
13585
|
+
src: this.__src,
|
|
13586
|
+
altText: this.__altText,
|
|
13587
|
+
width: this.__width,
|
|
13588
|
+
height: this.__height,
|
|
13589
|
+
maxWidth: this.__maxWidth,
|
|
13590
|
+
nodeKey: this.getKey(),
|
|
13591
|
+
showCaption: this.__showCaption,
|
|
13592
|
+
caption: this.__caption,
|
|
13593
|
+
captionsEnabled: this.__captionsEnabled,
|
|
13594
|
+
resizable: true
|
|
13595
|
+
}
|
|
13596
|
+
) });
|
|
13597
|
+
}
|
|
13598
|
+
}
|
|
13599
|
+
function $createImageNode({
|
|
13600
|
+
altText,
|
|
13601
|
+
height,
|
|
13602
|
+
maxWidth = 500,
|
|
13603
|
+
captionsEnabled,
|
|
13604
|
+
src,
|
|
13605
|
+
width,
|
|
13606
|
+
showCaption,
|
|
13607
|
+
caption,
|
|
13608
|
+
key
|
|
13609
|
+
}) {
|
|
13610
|
+
return $applyNodeReplacement(
|
|
13611
|
+
new ImageNode(
|
|
13612
|
+
src,
|
|
13613
|
+
altText,
|
|
13614
|
+
maxWidth,
|
|
13615
|
+
width,
|
|
13616
|
+
height,
|
|
13617
|
+
showCaption,
|
|
13618
|
+
caption,
|
|
13619
|
+
captionsEnabled,
|
|
13620
|
+
key
|
|
13621
|
+
)
|
|
13622
|
+
);
|
|
13623
|
+
}
|
|
13624
|
+
function $isImageNode(node) {
|
|
13625
|
+
return node instanceof ImageNode;
|
|
13626
|
+
}
|
|
12249
13627
|
function $convertMentionElement(domNode) {
|
|
12250
13628
|
const textContent = domNode.textContent;
|
|
12251
13629
|
const mentionName = domNode.getAttribute("data-lexical-mention-name");
|
|
@@ -12431,7 +13809,7 @@ const NotePanelView = ({
|
|
|
12431
13809
|
return /* @__PURE__ */ jsxs(
|
|
12432
13810
|
"div",
|
|
12433
13811
|
{
|
|
12434
|
-
className: cn(
|
|
13812
|
+
className: cn$1(
|
|
12435
13813
|
"cteditor-relative group cteditor-my-4 cteditor-rounded-md cteditor-border cteditor-border-l-4 cteditor-p-4 cteditor-shadow-sm cteditor-transition-all cteditor-duration-200 hover:cteditor-shadow-md",
|
|
12436
13814
|
config.containerClass,
|
|
12437
13815
|
config.borderClass
|
|
@@ -12447,7 +13825,7 @@ const NotePanelView = ({
|
|
|
12447
13825
|
variant: "ghost",
|
|
12448
13826
|
size: "icon",
|
|
12449
13827
|
onClick: handleDeletePanel,
|
|
12450
|
-
className: cn(
|
|
13828
|
+
className: cn$1(
|
|
12451
13829
|
"cteditor-absolute cteditor-top-2 cteditor-right-2 cteditor-h-6 cteditor-w-6 cteditor-rounded-full cteditor-transition-all cteditor-duration-200 hover:cteditor-bg-background/80",
|
|
12452
13830
|
isHovered ? "cteditor-opacity-100" : "cteditor-opacity-0",
|
|
12453
13831
|
config.iconClass
|
|
@@ -12460,7 +13838,7 @@ const NotePanelView = ({
|
|
|
12460
13838
|
/* @__PURE__ */ jsx(
|
|
12461
13839
|
"div",
|
|
12462
13840
|
{
|
|
12463
|
-
className: cn(
|
|
13841
|
+
className: cn$1(
|
|
12464
13842
|
"cteditor-flex-shrink-0 cteditor-mt-0.5",
|
|
12465
13843
|
config.iconClass
|
|
12466
13844
|
),
|
|
@@ -12471,7 +13849,7 @@ const NotePanelView = ({
|
|
|
12471
13849
|
title && /* @__PURE__ */ jsx(
|
|
12472
13850
|
"div",
|
|
12473
13851
|
{
|
|
12474
|
-
className: cn(
|
|
13852
|
+
className: cn$1(
|
|
12475
13853
|
"cteditor-font-semibold cteditor-text-sm cteditor-leading-none",
|
|
12476
13854
|
config.titleClass
|
|
12477
13855
|
),
|
|
@@ -12482,7 +13860,7 @@ const NotePanelView = ({
|
|
|
12482
13860
|
"div",
|
|
12483
13861
|
{
|
|
12484
13862
|
contentEditable: true,
|
|
12485
|
-
className: cn(
|
|
13863
|
+
className: cn$1(
|
|
12486
13864
|
"cteditor-min-h-[1.25rem] cteditor-text-sm cteditor-leading-relaxed cteditor-outline-none focus:cteditor-outline-none",
|
|
12487
13865
|
config.contentClass,
|
|
12488
13866
|
"empty:before:cteditor-content-[attr(data-placeholder)] empty:before:cteditor-text-muted-foreground/60"
|
|
@@ -13125,32 +14503,7 @@ const TodoIcon = () => /* @__PURE__ */ jsxs(
|
|
|
13125
14503
|
]
|
|
13126
14504
|
}
|
|
13127
14505
|
);
|
|
13128
|
-
const NoteIcon = () => /* @__PURE__ */
|
|
13129
|
-
"svg",
|
|
13130
|
-
{
|
|
13131
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
13132
|
-
width: 24,
|
|
13133
|
-
height: 24,
|
|
13134
|
-
viewBox: "0 0 24 24",
|
|
13135
|
-
fill: "none",
|
|
13136
|
-
children: [
|
|
13137
|
-
/* @__PURE__ */ jsx(
|
|
13138
|
-
"path",
|
|
13139
|
-
{
|
|
13140
|
-
d: "M15.459 5.48027L18.5413 8.56569L19.6025 7.50557L16.5202 4.42015L15.459 5.48027ZM9.2693 18.8989L5.15261 14.7781L4.09141 15.8382L8.2081 19.9591L9.2693 18.8989ZM17.3034 14.2922L15.3863 15.0125L15.9139 16.4167L17.831 15.6964L17.3034 14.2922ZM9.03674 8.6398L9.7312 6.74439L8.32276 6.22835L7.6283 8.12376L9.03674 8.6398ZM6.0447 11.3965C6.75616 11.2003 7.29751 11.0625 7.7402 10.7438L6.86379 9.52647C6.69085 9.65098 6.46633 9.72429 5.64603 9.95045L6.0447 11.3965ZM7.6283 8.12376C7.33535 8.92333 7.2437 9.14154 7.10532 9.30392L8.24698 10.2768C8.60073 9.86176 8.78262 9.33338 9.03674 8.6398L7.6283 8.12376ZM7.7402 10.7438C7.92729 10.6091 8.09744 10.4523 8.24698 10.2768L7.10532 9.30392C7.03402 9.38758 6.95293 9.4623 6.86379 9.52647L7.7402 10.7438ZM15.3863 15.0125C14.6972 15.2714 14.1719 15.4571 13.7603 15.8135L14.7423 16.9475C14.9031 16.8082 15.1195 16.7152 15.9139 16.4167L15.3863 15.0125ZM14.104 18.4001C14.3293 17.5813 14.4024 17.3569 14.5265 17.1838L13.3078 16.3094C12.9905 16.7517 12.8532 17.2919 12.6577 18.0022L14.104 18.4001ZM13.7603 15.8135C13.5906 15.9605 13.4387 16.1269 13.3078 16.3094L14.5265 17.1838C14.589 17.0968 14.6614 17.0175 14.7423 16.9475L13.7603 15.8135ZM5.15261 14.7781C4.50648 14.1313 4.06831 13.691 3.78399 13.3338C3.49867 12.9753 3.46921 12.8201 3.46877 12.7505L1.9688 12.76C1.97248 13.3422 2.2616 13.8297 2.61035 14.2679C2.96009 14.7073 3.47148 15.2176 4.09141 15.8382L5.15261 14.7781ZM5.64603 9.95045C4.80081 10.1835 4.10428 10.3743 3.58329 10.5835C3.06374 10.792 2.57149 11.0732 2.28086 11.5778L3.5807 12.3264C3.61532 12.2663 3.71725 12.146 4.14212 11.9755C4.56556 11.8055 5.1637 11.6394 6.0447 11.3965L5.64603 9.95045ZM3.46877 12.7505C3.46783 12.6016 3.50648 12.4553 3.5807 12.3264L2.28086 11.5778C2.07387 11.9372 1.96618 12.3452 1.9688 12.76L3.46877 12.7505ZM8.2081 19.9591C8.83197 20.5836 9.34497 21.0987 9.78679 21.4506C10.2273 21.8015 10.7182 22.0922 11.3044 22.0931L11.3066 20.5931C11.2372 20.593 11.0817 20.5644 10.7213 20.2773C10.3621 19.9912 9.91956 19.5499 9.2693 18.8989L8.2081 19.9591ZM12.6577 18.0022C12.4135 18.8897 12.2465 19.4924 12.0754 19.9188C11.9036 20.3467 11.7824 20.4487 11.7218 20.4833L12.4653 21.7861C12.9743 21.4956 13.2575 21.0004 13.4674 20.4775C13.6779 19.9532 13.8697 19.2516 14.104 18.4001L12.6577 18.0022ZM11.3044 22.0931C11.7115 22.0937 12.1117 21.9879 12.4653 21.7861L11.7218 20.4833C11.5953 20.5555 11.4522 20.5933 11.3066 20.5931L11.3044 22.0931ZM18.5413 8.56569C19.6048 9.63023 20.3405 10.3695 20.792 10.9788C21.2355 11.5774 21.2866 11.8959 21.2324 12.1464L22.6985 12.4634C22.8884 11.5854 22.5385 10.8162 21.9972 10.0857C21.4638 9.36593 20.6308 8.53487 19.6025 7.50557L18.5413 8.56569ZM17.831 15.6964C19.1924 15.1849 20.2943 14.773 21.0773 14.3384C21.8721 13.8973 22.5086 13.3416 22.6985 12.4634L21.2324 12.1464C21.1782 12.3968 21.0004 12.6655 20.3494 13.0268C19.6867 13.3946 18.7115 13.7632 17.3034 14.2922L17.831 15.6964ZM16.5202 4.42015C15.4843 3.38321 14.6483 2.54354 13.9248 2.00639C13.1911 1.46166 12.4177 1.10913 11.5359 1.30368L11.8591 2.76846C12.1088 2.71336 12.428 2.76331 13.0307 3.21076C13.6436 3.6658 14.3879 4.40802 15.459 5.48027L16.5202 4.42015ZM9.7312 6.74439C10.2528 5.32076 10.6164 4.33404 10.9815 3.66316C11.3405 3.00339 11.6093 2.82358 11.8591 2.76846L11.5359 1.30368C10.6543 1.4982 10.1008 2.14333 9.66395 2.94619C9.23311 3.73794 8.8272 4.85155 8.32276 6.22835L9.7312 6.74439Z",
|
|
13141
|
-
fill: "currentColor"
|
|
13142
|
-
}
|
|
13143
|
-
),
|
|
13144
|
-
/* @__PURE__ */ jsx(
|
|
13145
|
-
"path",
|
|
13146
|
-
{
|
|
13147
|
-
d: "M1.4694 21.4697C1.17666 21.7627 1.1769 22.2376 1.46994 22.5304C1.76298 22.8231 2.23786 22.8229 2.5306 22.5298L1.4694 21.4697ZM7.18383 17.8719C7.47657 17.5788 7.47633 17.1039 7.18329 16.8112C6.89024 16.5185 6.41537 16.5187 6.12263 16.8117L7.18383 17.8719ZM2.5306 22.5298L7.18383 17.8719L6.12263 16.8117L1.4694 21.4697L2.5306 22.5298Z",
|
|
13148
|
-
fill: "currentColor"
|
|
13149
|
-
}
|
|
13150
|
-
)
|
|
13151
|
-
]
|
|
13152
|
-
}
|
|
13153
|
-
);
|
|
14506
|
+
const NoteIcon = () => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M19.6402 9.02826L14.9718 4.36058C14.8575 4.24627 14.7218 4.15558 14.5725 4.09371C14.4231 4.03184 14.2631 4 14.1014 4C13.9398 4 13.7797 4.03184 13.6304 4.09371C13.481 4.15558 13.3453 4.24627 13.231 4.36058L9.10566 8.49903C8.28566 8.24211 6.41336 7.93211 4.45951 9.5098C4.32484 9.61809 4.21448 9.75353 4.13562 9.9073C4.05676 10.0611 4.01117 10.2297 4.00181 10.4023C3.99245 10.5748 4.01953 10.7474 4.08129 10.9088C4.14306 11.0702 4.23812 11.2168 4.36028 11.339L8.0772 15.0544L4.79567 18.3336C4.6802 18.4491 4.61533 18.6057 4.61533 18.769C4.61533 18.9323 4.6802 19.0889 4.79567 19.2044C4.91114 19.3199 5.06775 19.3847 5.23105 19.3847C5.39435 19.3847 5.55096 19.3199 5.66643 19.2044L8.94566 15.9229L12.6603 19.6375C12.7745 19.7521 12.9101 19.8432 13.0596 19.9053C13.209 19.9675 13.3692 19.9996 13.531 19.9998H13.618C13.7934 19.9876 13.9642 19.9378 14.1187 19.8538C14.2732 19.7698 14.4078 19.6535 14.5133 19.5129C16.0241 17.5052 15.8787 15.8729 15.5279 14.8975L19.641 10.769C19.7553 10.6547 19.8459 10.519 19.9077 10.3696C19.9695 10.2202 20.0013 10.0601 20.0012 9.89849C20.0011 9.73684 19.9692 9.57678 19.9073 9.42747C19.8454 9.27815 19.7546 9.1425 19.6402 9.02826ZM18.7695 9.89903L14.3641 14.319C14.2731 14.4103 14.2131 14.5279 14.1926 14.6552C14.172 14.7824 14.1919 14.9129 14.2495 15.0282C14.9772 16.4844 14.111 17.9967 13.531 18.7682L5.23105 10.4675C6.16028 9.71826 7.04951 9.52057 7.72951 9.52057C8.16099 9.51461 8.58893 9.59926 8.98566 9.76903C9.1014 9.82696 9.23247 9.84692 9.36022 9.82606C9.48796 9.80521 9.60588 9.74461 9.69719 9.65288L14.1018 5.23058L18.7695 9.89826V9.89903Z", fill: "currentColor" }) });
|
|
13154
14507
|
const FaceSmileIcon = () => /* @__PURE__ */ jsx(
|
|
13155
14508
|
"svg",
|
|
13156
14509
|
{
|
|
@@ -13168,23 +14521,7 @@ const FaceSmileIcon = () => /* @__PURE__ */ jsx(
|
|
|
13168
14521
|
)
|
|
13169
14522
|
}
|
|
13170
14523
|
);
|
|
13171
|
-
const MagicoonIcon = () => /* @__PURE__ */ jsx(
|
|
13172
|
-
"svg",
|
|
13173
|
-
{
|
|
13174
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
13175
|
-
width: "17",
|
|
13176
|
-
height: "16",
|
|
13177
|
-
viewBox: "0 0 17 16",
|
|
13178
|
-
fill: "none",
|
|
13179
|
-
children: /* @__PURE__ */ jsx(
|
|
13180
|
-
"path",
|
|
13181
|
-
{
|
|
13182
|
-
d: "M15.4155 7.68006C15.3289 7.47339 15.1689 7.32006 14.9155 7.21339L13.1889 6.72006C11.7889 6.32672 10.6689 5.21339 10.2755 3.81339L9.78221 2.09339C9.70221 1.82005 9.49552 1.61339 9.22219 1.53339C9.00886 1.47339 8.78886 1.50006 8.60219 1.60672C8.40886 1.71339 8.27552 1.88672 8.21552 2.09339L7.72219 3.81339C7.32886 5.21339 6.20885 6.32672 4.80219 6.72006L3.07554 7.21339C2.80221 7.28673 2.58886 7.50672 2.51552 7.77339C2.39552 8.20672 2.64221 8.66005 3.07554 8.78005L4.80219 9.27339C6.20218 9.66672 7.32218 10.7801 7.71552 12.1801L8.20888 13.9001C8.30888 14.2467 8.62887 14.4934 8.98887 14.4934C9.34887 14.4934 9.66887 14.2534 9.77553 13.9001L10.2689 12.1734C10.6622 10.7734 11.7822 9.66005 13.1889 9.26005L14.9622 8.75339C15.1688 8.67339 15.3355 8.50672 15.4155 8.30005C15.5022 8.09338 15.4955 7.86672 15.4155 7.66672V7.68006ZM12.9155 8.31339C11.1822 8.80005 9.80219 10.1801 9.30886 11.9134L8.99554 13.0201L8.67552 11.9134C8.18218 10.1801 6.8022 8.80005 5.06887 8.31339L3.96218 8.00005L5.06887 7.68672C6.8022 7.20005 8.18218 5.82006 8.67552 4.08672L8.99554 2.98005L9.30886 4.08672C9.80219 5.82006 11.1822 7.20005 12.9155 7.68672L14.0222 8.00005L12.9155 8.31339ZM6.57554 12.1601C6.59554 12.2134 6.57553 12.2667 6.5222 12.2867L6.00222 12.4334C5.52888 12.5667 5.15553 12.9334 5.0222 13.4067L4.87555 13.9267C4.87555 13.9267 4.84219 13.98 4.80886 13.9934C4.75552 14.0067 4.7022 13.9801 4.68886 13.9267L4.54222 13.4067C4.40888 12.9334 4.03553 12.5667 3.56219 12.4334L3.04222 12.2867C3.04222 12.2867 2.98886 12.2534 2.97552 12.2201C2.96219 12.1667 2.98888 12.12 3.04222 12.1L3.56219 11.9534C4.03553 11.82 4.40888 11.4534 4.54222 10.9801L4.68886 10.4601C4.68886 10.4601 4.72218 10.4067 4.75551 10.3934C4.80885 10.3801 4.86222 10.4067 4.87555 10.4601L5.0222 10.9801C5.15553 11.4534 5.52888 11.82 6.00222 11.9534L6.5222 12.1C6.5222 12.1 6.56221 12.1267 6.57554 12.1534V12.1601ZM12.6288 3.25339C12.6288 3.25339 12.5955 3.23339 12.5888 3.21339C12.5822 3.18006 12.5955 3.14672 12.6288 3.13339L12.9755 3.03339C13.2889 2.94672 13.5355 2.70005 13.6288 2.38672L13.7289 2.04005C13.7289 2.04005 13.7489 2.00672 13.7689 2.00005C13.8022 1.99339 13.8355 2.00672 13.8489 2.04005L13.9489 2.38672C14.0355 2.70005 14.2822 2.94672 14.6022 3.03339L14.9489 3.13339C14.9489 3.13339 14.9755 3.15339 14.9822 3.16672C14.9955 3.20005 14.9822 3.24006 14.9489 3.25339L14.6022 3.35339C14.2889 3.44005 14.0422 3.68672 13.9489 4.00005L13.8489 4.34672C13.8489 4.34672 13.8289 4.38005 13.8089 4.38672C13.7755 4.39339 13.7422 4.38006 13.7289 4.34672L13.6288 4.00005C13.5422 3.68672 13.2955 3.44005 12.9755 3.35339L12.6288 3.25339Z",
|
|
13183
|
-
fill: "currentColor"
|
|
13184
|
-
}
|
|
13185
|
-
)
|
|
13186
|
-
}
|
|
13187
|
-
);
|
|
14524
|
+
const MagicoonIcon = () => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M19.4777 11.5301C19.374 11.2782 19.1825 11.0913 18.8792 10.9613L16.8124 10.36C15.1366 9.88058 13.7959 8.52361 13.325 6.81725L12.7346 4.72086C12.6388 4.3877 12.3914 4.13582 12.0642 4.03831C11.8089 3.96518 11.5455 3.99769 11.3221 4.12769C11.0907 4.2577 10.931 4.46896 10.8592 4.72086L10.2687 6.81725C9.79788 8.52361 8.45722 9.88058 6.77343 10.36L4.70661 10.9613C4.37943 11.0507 4.12405 11.3188 4.03626 11.6438C3.89262 12.172 4.18791 12.7245 4.70661 12.8708L6.77343 13.4721C8.44923 13.9515 9.78989 15.3085 10.2607 17.0149L10.8513 19.1112C10.971 19.5337 11.354 19.8344 11.7849 19.8344C12.2159 19.8344 12.5989 19.5419 12.7266 19.1112L13.3171 17.0067C13.7879 15.3003 15.1286 13.9433 16.8124 13.4558L18.9351 12.8383C19.1824 12.7408 19.3819 12.5376 19.4777 12.2857C19.5815 12.0338 19.5734 11.7576 19.4777 11.5138V11.5301ZM16.4852 12.302C14.4104 12.8951 12.7585 14.5772 12.168 16.6898L11.7929 18.0387L11.4098 16.6898C10.8193 14.5772 9.16746 12.8951 7.09265 12.302L5.76793 11.9201L7.09265 11.5382C9.16746 10.945 10.8193 9.26304 11.4098 7.15039L11.7929 5.80155L12.168 7.15039C12.7585 9.26304 14.4104 10.945 16.4852 11.5382L17.8099 11.9201L16.4852 12.302ZM8.89615 16.9905C8.92009 17.0554 8.89614 17.1204 8.8323 17.1448L8.20988 17.3236C7.64329 17.4861 7.19638 17.933 7.03678 18.5099L6.86124 19.1437C6.86124 19.1437 6.82131 19.2086 6.78141 19.225C6.71757 19.2412 6.65374 19.2088 6.63777 19.1437L6.46224 18.5099C6.30263 17.933 5.85573 17.4861 5.28914 17.3236L4.66673 17.1448C4.66673 17.1448 4.60285 17.1042 4.58689 17.0636C4.57093 16.9985 4.60288 16.9416 4.66673 16.9172L5.28914 16.7385C5.85573 16.576 6.30263 16.1291 6.46224 15.5523L6.63777 14.9185C6.63777 14.9185 6.67766 14.8534 6.71755 14.8372C6.7814 14.821 6.84529 14.8534 6.86124 14.9185L7.03678 15.5523C7.19638 16.1291 7.64329 16.576 8.20988 16.7385L8.8323 16.9172C8.8323 16.9172 8.88019 16.9498 8.89615 16.9823V16.9905ZM16.142 6.1347C16.142 6.1347 16.1021 6.11033 16.0941 6.08595C16.0862 6.04533 16.1021 6.00469 16.142 5.98844L16.557 5.86656C16.9321 5.76093 17.2273 5.46028 17.339 5.07838L17.4588 4.65585C17.4588 4.65585 17.4827 4.61522 17.5067 4.60709C17.5465 4.59898 17.5864 4.61522 17.6024 4.65585L17.7221 5.07838C17.8258 5.46028 18.1211 5.76093 18.5041 5.86656L18.9192 5.98844C18.9192 5.98844 18.951 6.01282 18.959 6.02907C18.9749 6.06969 18.959 6.11846 18.9192 6.1347L18.5041 6.25659C18.1291 6.36221 17.8338 6.66286 17.7221 7.04476L17.6024 7.46729C17.6024 7.46729 17.5785 7.50791 17.5546 7.51604C17.5146 7.52417 17.4747 7.50793 17.4588 7.46729L17.339 7.04476C17.2353 6.66286 16.94 6.36221 16.557 6.25659L16.142 6.1347Z", fill: "currentColor" }) });
|
|
13188
14525
|
const PerspectiveIcon = () => /* @__PURE__ */ jsx(
|
|
13189
14526
|
"svg",
|
|
13190
14527
|
{
|
|
@@ -13310,23 +14647,7 @@ const SuperscriptIcon = () => /* @__PURE__ */ jsxs(
|
|
|
13310
14647
|
]
|
|
13311
14648
|
}
|
|
13312
14649
|
);
|
|
13313
|
-
const MessageEditIcon = () => /* @__PURE__ */ jsx(
|
|
13314
|
-
"svg",
|
|
13315
|
-
{
|
|
13316
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
13317
|
-
width: "25",
|
|
13318
|
-
height: "24",
|
|
13319
|
-
viewBox: "0 0 25 24",
|
|
13320
|
-
fill: "none",
|
|
13321
|
-
children: /* @__PURE__ */ jsx(
|
|
13322
|
-
"path",
|
|
13323
|
-
{
|
|
13324
|
-
d: "M18.9824 2.25H6.98242C4.56442 2.25 3.23242 3.582 3.23242 6V21C3.23242 21.303 3.41531 21.577 3.69531 21.693C3.78831 21.732 3.88542 21.75 3.98242 21.75C4.17742 21.75 4.36945 21.674 4.51245 21.53L7.29248 18.75H18.9824C21.4004 18.75 22.7324 17.418 22.7324 15V6C22.7324 3.582 21.4004 2.25 18.9824 2.25ZM21.2324 15C21.2324 16.577 20.5594 17.25 18.9824 17.25H6.98242C6.78342 17.25 6.59239 17.329 6.45239 17.47L4.73242 19.1899V6C4.73242 4.423 5.40542 3.75 6.98242 3.75H18.9824C20.5594 3.75 21.2324 4.423 21.2324 6V15ZM16.2615 6.22998C15.9515 5.91998 15.5405 5.75 15.1035 5.75C15.1025 5.75 15.1013 5.75 15.1003 5.75C14.6623 5.75 14.2504 5.92206 13.9424 6.23206L8.45142 11.748C8.31042 11.889 8.23242 12.079 8.23242 12.277V14.499C8.23242 14.913 8.56842 15.249 8.98242 15.249H11.2053C11.4033 15.249 11.5944 15.17 11.7344 15.031L17.2505 9.54004C17.5615 9.23104 17.7314 8.81998 17.7324 8.38098C17.7334 7.94198 17.5624 7.52899 17.2524 7.21899L16.2615 6.22998ZM15.1025 7.25C15.1285 7.25 15.1664 7.25702 15.2014 7.29102L16.1914 8.28101C16.2254 8.31501 16.2324 8.354 16.2324 8.38C16.2324 8.406 16.2254 8.44405 16.1914 8.47705L15.5554 9.11096L14.3723 7.92798L15.0063 7.29102C15.0393 7.25702 15.0775 7.25 15.1025 7.25ZM10.8955 13.75H9.73242V12.587L13.3135 8.98999L14.4915 10.1689L10.8955 13.75Z",
|
|
13325
|
-
fill: "currentColor"
|
|
13326
|
-
}
|
|
13327
|
-
)
|
|
13328
|
-
}
|
|
13329
|
-
);
|
|
14650
|
+
const MessageEditIcon = () => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "25", height: "24", viewBox: "0 0 25 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M17.7211 4H8.02885C6.07585 4 5 5.07585 5 7.02885V19.1442C5 19.389 5.14772 19.6103 5.37387 19.704C5.44899 19.7355 5.52742 19.75 5.60577 19.75C5.76327 19.75 5.91837 19.6886 6.03387 19.5723L8.27928 17.3269H17.7211C19.6741 17.3269 20.75 16.2511 20.75 14.2981V7.02885C20.75 5.07585 19.6741 4 17.7211 4ZM19.5384 14.2981C19.5384 15.5718 18.9949 16.1154 17.7211 16.1154H8.02885C7.86812 16.1154 7.71382 16.1792 7.60075 16.2931L6.21154 17.6822V7.02885C6.21154 5.75512 6.75512 5.21154 8.02885 5.21154H17.7211C18.9949 5.21154 19.5384 5.75512 19.5384 7.02885V14.2981ZM15.5235 7.2146C15.2731 6.96421 14.9411 6.82692 14.5882 6.82692H14.5856C14.2318 6.82692 13.8991 6.96589 13.6504 7.21628L9.21535 11.6715C9.10146 11.7853 9.03846 11.9388 9.03846 12.0987V13.8934C9.03846 14.2278 9.30985 14.4992 9.64423 14.4992H11.4396C11.5996 14.4992 11.7539 14.4354 11.867 14.3231L16.3223 9.88811C16.5735 9.63853 16.7107 9.30652 16.7115 8.95194C16.7123 8.59737 16.5742 8.2638 16.3238 8.01341L15.5235 7.2146ZM14.5874 8.03846C14.6084 8.03846 14.639 8.04413 14.6673 8.07159L15.4669 8.8712C15.4943 8.89866 15.5 8.93015 15.5 8.95115C15.5 8.97215 15.4943 9.00289 15.4669 9.02954L14.9532 9.54154L13.9976 8.58606L14.5097 8.07159C14.5363 8.04413 14.5672 8.03846 14.5874 8.03846ZM11.1894 13.2885H10.25V12.3491L13.1424 9.44384L14.0939 10.396L11.1894 13.2885Z", fill: "currentColor" }) });
|
|
13330
14651
|
const TypeUppercaseIcon = () => /* @__PURE__ */ jsx(
|
|
13331
14652
|
"svg",
|
|
13332
14653
|
{
|
|
@@ -13794,6 +15115,8 @@ const RecordingIcon = () => /* @__PURE__ */ jsx(
|
|
|
13794
15115
|
)
|
|
13795
15116
|
}
|
|
13796
15117
|
);
|
|
15118
|
+
const AddCommentIcon = () => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M19 14.3333C19 14.7459 18.8361 15.1416 18.5444 15.4333C18.2527 15.725 17.857 15.8889 17.4444 15.8889H8.11111L5 19V6.55556C5 6.143 5.16389 5.74733 5.45561 5.45561C5.74733 5.16389 6.143 5 6.55556 5H17.4444C17.857 5 18.2527 5.16389 18.5444 5.45561C18.8361 5.74733 19 6.143 19 6.55556V14.3333Z", stroke: "currentColor", "stroke-width": "1.33333", "stroke-linecap": "round", "stroke-linejoin": "round" }) });
|
|
15119
|
+
const CheckIcon = () => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) });
|
|
13797
15120
|
const EDITOR_NODES = [
|
|
13798
15121
|
CodeNode,
|
|
13799
15122
|
CodeHighlightNode,
|
|
@@ -14550,41 +15873,52 @@ function TableOptionPlugin() {
|
|
|
14550
15873
|
}
|
|
14551
15874
|
)
|
|
14552
15875
|
] }),
|
|
14553
|
-
/* @__PURE__ */
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
|
|
14570
|
-
|
|
14571
|
-
|
|
14572
|
-
|
|
14573
|
-
|
|
14574
|
-
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
|
|
14578
|
-
|
|
14579
|
-
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
15876
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-2", children: /* @__PURE__ */ jsxs(
|
|
15877
|
+
"label",
|
|
15878
|
+
{
|
|
15879
|
+
htmlFor: "include-headers",
|
|
15880
|
+
className: "cteditor-flex cteditor-items-center cteditor-space-x-2 cteditor-cursor-pointer cteditor-select-none",
|
|
15881
|
+
children: [
|
|
15882
|
+
/* @__PURE__ */ jsxs("div", { className: "cteditor-relative cteditor-h-5", children: [
|
|
15883
|
+
/* @__PURE__ */ jsx(
|
|
15884
|
+
"input",
|
|
15885
|
+
{
|
|
15886
|
+
id: "include-headers",
|
|
15887
|
+
type: "checkbox",
|
|
15888
|
+
checked: includeHeaders,
|
|
15889
|
+
onChange: (e) => {
|
|
15890
|
+
const checked = e.target.checked;
|
|
15891
|
+
setIncludeHeaders(checked);
|
|
15892
|
+
const count2 = Number(columns);
|
|
15893
|
+
if (checked && count2 > 0) {
|
|
15894
|
+
setColumnHeadings((prev) => {
|
|
15895
|
+
const next = [...prev];
|
|
15896
|
+
next.length = count2;
|
|
15897
|
+
for (let i2 = 0; i2 < count2; i2++) {
|
|
15898
|
+
if (typeof next[i2] !== "string")
|
|
15899
|
+
next[i2] = "";
|
|
15900
|
+
}
|
|
15901
|
+
return next;
|
|
15902
|
+
});
|
|
15903
|
+
}
|
|
15904
|
+
if (!checked) {
|
|
15905
|
+
setColumnHeadings([]);
|
|
15906
|
+
}
|
|
15907
|
+
},
|
|
15908
|
+
className: "\n cteditor-peer\n cteditor-appearance-none\n cteditor-w-5 cteditor-h-5\n cteditor-border cteditor-border-gray-400 cteditor-rounded\n cteditor-transition-all cteditor-duration-200\n checked:cteditor-bg-blue-600 checked:cteditor-border-blue-600\n hover:cteditor-border-blue-500 [&>span]:checked:cteditor-opacity-100\n \n "
|
|
15909
|
+
}
|
|
15910
|
+
),
|
|
15911
|
+
/* @__PURE__ */ jsx("span", { className: "cteditor-absolute cteditor-top-1/2 cteditor-left-1/2 [&>svg]:cteditor-size-4 -cteditor-translate-x-1/2 -cteditor-translate-y-1/2 cteditor-opacity-0 peer-checked:cteditor-opacity-100", children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
15912
|
+
] }),
|
|
15913
|
+
/* @__PURE__ */ jsx("span", { className: "cteditor-text-sm cteditor-font-medium ", children: "Add column headers" })
|
|
15914
|
+
]
|
|
15915
|
+
}
|
|
15916
|
+
) }),
|
|
14583
15917
|
includeHeaders && Number(columns) > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14584
|
-
/* @__PURE__ */ jsxs("div", { className: "cteditor-grid cteditor-gap-2", children: [
|
|
15918
|
+
/* @__PURE__ */ jsxs("div", { className: "cteditor-grid cteditor-gap-2 cteditor-space-y-1", children: [
|
|
14585
15919
|
/* @__PURE__ */ jsx(Label$2, { children: "Header titles" }),
|
|
14586
15920
|
/* @__PURE__ */ jsx("div", { className: "cteditor-grid cteditor-gap-2", style: { gridTemplateColumns: "repeat(2, minmax(0, 1fr))" }, children: Array.from({ length: Number(columns) }).map((_, i2) => /* @__PURE__ */ jsxs("div", { className: "cteditor-grid cteditor-gap-1", children: [
|
|
14587
|
-
/* @__PURE__ */ jsxs(Label$2, { htmlFor: `col-heading-${i2}`, children: [
|
|
15921
|
+
/* @__PURE__ */ jsxs(Label$2, { className: "cteditor-font-normal", htmlFor: `col-heading-${i2}`, children: [
|
|
14588
15922
|
"Column ",
|
|
14589
15923
|
i2 + 1
|
|
14590
15924
|
] }),
|
|
@@ -14609,26 +15943,17 @@ function TableOptionPlugin() {
|
|
|
14609
15943
|
/* @__PURE__ */ jsxs("div", { className: "cteditor-grid cteditor-gap-2", children: [
|
|
14610
15944
|
/* @__PURE__ */ jsx(Label$2, { htmlFor: "header-color", children: "Header color" }),
|
|
14611
15945
|
/* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-3", children: [
|
|
14612
|
-
/* @__PURE__ */ jsx(
|
|
15946
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-size-9 cteditor-rounded-md cteditor-relative cteditor-overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
14613
15947
|
"input",
|
|
14614
15948
|
{
|
|
14615
15949
|
id: "header-color",
|
|
14616
15950
|
type: "color",
|
|
14617
15951
|
value: headerColor,
|
|
14618
15952
|
onChange: (e) => setHeaderColor(e.target.value),
|
|
14619
|
-
className: "cteditor-w-12 cteditor-h-10 cteditor-border cteditor-border-gray-300 cteditor-rounded cteditor-cursor-pointer"
|
|
15953
|
+
className: "cteditor-w-12 cteditor-h-10 cteditor-border cteditor-border-gray-300 cteditor-rounded cteditor-cursor-pointer cteditor-scale-150"
|
|
14620
15954
|
}
|
|
14621
|
-
),
|
|
14622
|
-
/* @__PURE__ */
|
|
14623
|
-
/* @__PURE__ */ jsx(
|
|
14624
|
-
"div",
|
|
14625
|
-
{
|
|
14626
|
-
className: "cteditor-w-6 cteditor-h-6 cteditor-rounded cteditor-border-2 cteditor-border-gray-300",
|
|
14627
|
-
style: { backgroundColor: headerColor }
|
|
14628
|
-
}
|
|
14629
|
-
),
|
|
14630
|
-
/* @__PURE__ */ jsx("span", { className: "cteditor-text-sm cteditor-text-gray-600", children: headerColor })
|
|
14631
|
-
] })
|
|
15955
|
+
) }),
|
|
15956
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-flex cteditor-items-center cteditor-gap-2", children: /* @__PURE__ */ jsx("span", { className: "cteditor-text-sm ", children: headerColor }) })
|
|
14632
15957
|
] })
|
|
14633
15958
|
] })
|
|
14634
15959
|
] })
|
|
@@ -14777,8 +16102,9 @@ const useVoiceRecording = () => {
|
|
|
14777
16102
|
const audioContextRef = useRef(null);
|
|
14778
16103
|
const processorRef = useRef(null);
|
|
14779
16104
|
const currentTurnRef = useRef(-1);
|
|
14780
|
-
const completeTranscriptRef = useRef("");
|
|
14781
16105
|
const editorRef = useRef(null);
|
|
16106
|
+
const lastInsertedTextRef = useRef("");
|
|
16107
|
+
const currentPartialTextRef = useRef("");
|
|
14782
16108
|
const setEditor = useCallback((editor) => {
|
|
14783
16109
|
editorRef.current = editor;
|
|
14784
16110
|
}, []);
|
|
@@ -14830,23 +16156,67 @@ const useVoiceRecording = () => {
|
|
|
14830
16156
|
if (message.transcript !== void 0) {
|
|
14831
16157
|
if (message.turn_order !== currentTurnRef.current) {
|
|
14832
16158
|
currentTurnRef.current = message.turn_order;
|
|
16159
|
+
lastInsertedTextRef.current = "";
|
|
16160
|
+
currentPartialTextRef.current = "";
|
|
16161
|
+
}
|
|
16162
|
+
const newFullText = message.transcript;
|
|
16163
|
+
const previousText = lastInsertedTextRef.current;
|
|
16164
|
+
if (newFullText.startsWith(previousText)) {
|
|
16165
|
+
const newPart = newFullText.substring(previousText.length);
|
|
16166
|
+
if (newPart && editorRef.current) {
|
|
16167
|
+
editorRef.current.update(() => {
|
|
16168
|
+
const selection = $getSelection();
|
|
16169
|
+
if ($isRangeSelection(selection)) {
|
|
16170
|
+
const textNode = $createTextNode(newPart);
|
|
16171
|
+
selection.insertNodes([textNode]);
|
|
16172
|
+
}
|
|
16173
|
+
});
|
|
16174
|
+
lastInsertedTextRef.current = newFullText;
|
|
16175
|
+
}
|
|
16176
|
+
} else {
|
|
16177
|
+
if (editorRef.current && previousText) {
|
|
16178
|
+
editorRef.current.update(() => {
|
|
16179
|
+
const selection = $getSelection();
|
|
16180
|
+
if ($isRangeSelection(selection)) {
|
|
16181
|
+
for (let i2 = 0; i2 < previousText.length; i2++) {
|
|
16182
|
+
selection.deleteCharacter(true);
|
|
16183
|
+
}
|
|
16184
|
+
const textNode = $createTextNode(newFullText);
|
|
16185
|
+
selection.insertNodes([textNode]);
|
|
16186
|
+
}
|
|
16187
|
+
});
|
|
16188
|
+
lastInsertedTextRef.current = newFullText;
|
|
16189
|
+
} else if (editorRef.current && newFullText) {
|
|
16190
|
+
editorRef.current.update(() => {
|
|
16191
|
+
const selection = $getSelection();
|
|
16192
|
+
if ($isRangeSelection(selection)) {
|
|
16193
|
+
const textNode = $createTextNode(newFullText);
|
|
16194
|
+
selection.insertNodes([textNode]);
|
|
16195
|
+
}
|
|
16196
|
+
});
|
|
16197
|
+
lastInsertedTextRef.current = newFullText;
|
|
16198
|
+
}
|
|
14833
16199
|
}
|
|
14834
16200
|
if (message.end_of_turn) {
|
|
14835
|
-
|
|
14836
|
-
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
16201
|
+
console.log("End of turn - finalizing:", newFullText);
|
|
16202
|
+
if (editorRef.current) {
|
|
16203
|
+
editorRef.current.update(() => {
|
|
16204
|
+
const selection = $getSelection();
|
|
16205
|
+
if ($isRangeSelection(selection)) {
|
|
16206
|
+
const spaceNode = $createTextNode(" ");
|
|
16207
|
+
selection.insertNodes([spaceNode]);
|
|
16208
|
+
}
|
|
16209
|
+
});
|
|
14843
16210
|
}
|
|
16211
|
+
lastInsertedTextRef.current = "";
|
|
16212
|
+
currentPartialTextRef.current = "";
|
|
14844
16213
|
}
|
|
14845
16214
|
}
|
|
14846
16215
|
} else if (message.type === "error") {
|
|
14847
16216
|
setError("Transcription error: " + (message.message || ""));
|
|
14848
16217
|
}
|
|
14849
16218
|
} catch (err) {
|
|
16219
|
+
console.error("WebSocket message error:", err);
|
|
14850
16220
|
}
|
|
14851
16221
|
};
|
|
14852
16222
|
ws.onerror = () => {
|
|
@@ -14983,7 +16353,7 @@ const VoiceTranscriptButton = ({ editor }) => {
|
|
|
14983
16353
|
size: "icon-sm",
|
|
14984
16354
|
onClick: toggleRecording,
|
|
14985
16355
|
disabled: isLoading || !editor,
|
|
14986
|
-
className: cn(
|
|
16356
|
+
className: cn$1(
|
|
14987
16357
|
isRecording && "cteditor-bg-foreground/20",
|
|
14988
16358
|
"[&>svg]:!cteditor-size-5"
|
|
14989
16359
|
),
|
|
@@ -16133,7 +17503,7 @@ const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, .
|
|
|
16133
17503
|
SubTrigger2,
|
|
16134
17504
|
{
|
|
16135
17505
|
ref,
|
|
16136
|
-
className: cn(
|
|
17506
|
+
className: cn$1(
|
|
16137
17507
|
"cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-sm cteditor-outline-none focus:cteditor-bg-secondary data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
16138
17508
|
inset && "cteditor-pl-8",
|
|
16139
17509
|
className
|
|
@@ -16150,7 +17520,7 @@ const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) =
|
|
|
16150
17520
|
SubContent2,
|
|
16151
17521
|
{
|
|
16152
17522
|
ref,
|
|
16153
|
-
className: cn(
|
|
17523
|
+
className: cn$1(
|
|
16154
17524
|
"cteditor-z-[9999] cteditor-min-w-[8rem] cteditor-overflow-hidden cteditor-rounded-md cteditor-border cteditor-bg-popover cteditor-p-1 cteditor-text-popover-foreground cteditor-shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 cteditor-origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
16155
17525
|
className
|
|
16156
17526
|
),
|
|
@@ -16163,7 +17533,7 @@ const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...pr
|
|
|
16163
17533
|
{
|
|
16164
17534
|
ref,
|
|
16165
17535
|
sideOffset,
|
|
16166
|
-
className: cn(
|
|
17536
|
+
className: cn$1(
|
|
16167
17537
|
"cteditor-z-[9999] cteditor-max-h-[var(--radix-dropdown-menu-content-available-height)] cteditor-min-w-[8rem] cteditor-overflow-y-auto cteditor-overflow-x-hidden cteditor-rounded-md cteditor-border cteditor-bg-popover cteditor-p-1 cteditor-text-popover-foreground cteditor-shadow-md",
|
|
16168
17538
|
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 cteditor-origin-[--radix-dropdown-menu-content-transform-origin]",
|
|
16169
17539
|
className
|
|
@@ -16176,7 +17546,7 @@ const DropdownMenuItem$1 = React.forwardRef(({ className, inset, ...props }, ref
|
|
|
16176
17546
|
Item2,
|
|
16177
17547
|
{
|
|
16178
17548
|
ref,
|
|
16179
|
-
className: cn(
|
|
17549
|
+
className: cn$1(
|
|
16180
17550
|
"cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-gap-2 cteditor-rounded-sm cteditor-px-2 cteditor-py-1.5 cteditor-text-[13px] cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-foreground/5 focus:cteditor-text-accent-foreground data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50 [&>svg]:cteditor-size-4 [&>svg]:cteditor-shrink-0",
|
|
16181
17551
|
inset && "cteditor-pl-8",
|
|
16182
17552
|
className
|
|
@@ -16189,7 +17559,7 @@ const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checke
|
|
|
16189
17559
|
CheckboxItem2,
|
|
16190
17560
|
{
|
|
16191
17561
|
ref,
|
|
16192
|
-
className: cn(
|
|
17562
|
+
className: cn$1(
|
|
16193
17563
|
"cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-rounded-sm cteditor-py-1.5 cteditor-pl-8 cteditor-pr-2 cteditor-text-sm cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-secondary focus:cteditor-text-accent-foreground data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50",
|
|
16194
17564
|
className
|
|
16195
17565
|
),
|
|
@@ -16206,7 +17576,7 @@ const DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props
|
|
|
16206
17576
|
RadioItem2,
|
|
16207
17577
|
{
|
|
16208
17578
|
ref,
|
|
16209
|
-
className: cn(
|
|
17579
|
+
className: cn$1(
|
|
16210
17580
|
"cteditor-relative cteditor-flex cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-rounded-sm cteditor-py-1.5 cteditor-pl-8 cteditor-pr-2 cteditor-text-sm cteditor-outline-none cteditor-transition-colors focus:cteditor-bg-secondary focus:cteditor-text-accent-foreground data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50",
|
|
16211
17581
|
className
|
|
16212
17582
|
),
|
|
@@ -16222,7 +17592,7 @@ const DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref)
|
|
|
16222
17592
|
Label2,
|
|
16223
17593
|
{
|
|
16224
17594
|
ref,
|
|
16225
|
-
className: cn(
|
|
17595
|
+
className: cn$1(
|
|
16226
17596
|
"cteditor-px-2 cteditor-py-1.5 cteditor-text-sm cteditor-font-semibold",
|
|
16227
17597
|
inset && "cteditor-pl-8",
|
|
16228
17598
|
className
|
|
@@ -16235,7 +17605,7 @@ const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) =>
|
|
|
16235
17605
|
Separator2,
|
|
16236
17606
|
{
|
|
16237
17607
|
ref,
|
|
16238
|
-
className: cn(
|
|
17608
|
+
className: cn$1(
|
|
16239
17609
|
"cteditor--mx-1 cteditor-my-1 cteditor-h-px cteditor-bg-muted",
|
|
16240
17610
|
className
|
|
16241
17611
|
),
|
|
@@ -16320,10 +17690,14 @@ const useBlockFormat = (props) => {
|
|
|
16320
17690
|
const formatBulletList = () => {
|
|
16321
17691
|
if (blockType !== "bullet") {
|
|
16322
17692
|
console.log("formatBulletList");
|
|
16323
|
-
editor.
|
|
17693
|
+
editor.update(() => {
|
|
17694
|
+
editor.dispatchCommand(INSERT_UNORDERED_LIST_COMMAND, void 0);
|
|
17695
|
+
});
|
|
16324
17696
|
} else {
|
|
16325
17697
|
console.log("removeBulletList");
|
|
16326
|
-
editor.
|
|
17698
|
+
editor.update(() => {
|
|
17699
|
+
editor.dispatchCommand(REMOVE_LIST_COMMAND, void 0);
|
|
17700
|
+
});
|
|
16327
17701
|
}
|
|
16328
17702
|
};
|
|
16329
17703
|
const formatCheckList = () => {
|
|
@@ -16336,9 +17710,13 @@ const useBlockFormat = (props) => {
|
|
|
16336
17710
|
};
|
|
16337
17711
|
const formatNumberedList = () => {
|
|
16338
17712
|
if (blockType !== "number") {
|
|
16339
|
-
editor.
|
|
17713
|
+
editor.update(() => {
|
|
17714
|
+
editor.dispatchCommand(INSERT_ORDERED_LIST_COMMAND, void 0);
|
|
17715
|
+
});
|
|
16340
17716
|
} else {
|
|
16341
|
-
editor.
|
|
17717
|
+
editor.update(() => {
|
|
17718
|
+
editor.dispatchCommand(REMOVE_LIST_COMMAND, void 0);
|
|
17719
|
+
});
|
|
16342
17720
|
}
|
|
16343
17721
|
};
|
|
16344
17722
|
const formatQuote = () => {
|
|
@@ -16493,7 +17871,7 @@ const BlockFormatMenu = ({ blockType }) => {
|
|
|
16493
17871
|
"aria-controls": anchorEl ? "block-format-menu" : void 0,
|
|
16494
17872
|
onClick: handleClickIconButton,
|
|
16495
17873
|
variant: "ghost",
|
|
16496
|
-
className: cn(
|
|
17874
|
+
className: cn$1(
|
|
16497
17875
|
"cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-whitespace-nowrap",
|
|
16498
17876
|
open && "cteditor-bg-slate-100/5"
|
|
16499
17877
|
),
|
|
@@ -16517,7 +17895,7 @@ const BlockFormatMenu = ({ blockType }) => {
|
|
|
16517
17895
|
DropdownMenuItem$1,
|
|
16518
17896
|
{
|
|
16519
17897
|
role: "option",
|
|
16520
|
-
className: cn(
|
|
17898
|
+
className: cn$1(
|
|
16521
17899
|
"cteditor-flex cteditor-items-center !cteditor-gap-2 cteditor-cursor-pointer",
|
|
16522
17900
|
blockType === option.blockType && "cteditor-bg-slate-100/10"
|
|
16523
17901
|
),
|
|
@@ -18112,7 +19490,7 @@ const PopoverContent = React.forwardRef(({ className, align = "center", sideOffs
|
|
|
18112
19490
|
ref,
|
|
18113
19491
|
align,
|
|
18114
19492
|
sideOffset,
|
|
18115
|
-
className: cn(
|
|
19493
|
+
className: cn$1(
|
|
18116
19494
|
"cteditor-z-[9999] cteditor-w-72 cteditor-rounded-md cteditor-border cteditor-bg-popover cteditor-p-4 cteditor-text-popover-foreground cteditor-shadow-md cteditor-outline-none data-[state=open]:cteditor-animate-in data-[state=closed]:cteditor-animate-out data-[state=closed]:cteditor-fade-out-0 data-[state=open]:cteditor-fade-in-0 data-[state=closed]:cteditor-zoom-out-95 data-[state=open]:cteditor-zoom-in-95 data-[state=closed]:cteditor-slide-out-to-top-2 data-[state=left]:cteditor-slide-out-to-right-2 data-[state=right]:cteditor-slide-out-to-left-2 data-[state=top]:cteditor-slide-out-to-bottom-2 cteditor-origin-[--radix-popover-content-transform-origin]",
|
|
18117
19495
|
className
|
|
18118
19496
|
),
|
|
@@ -18279,7 +19657,7 @@ const ColorPicker$2 = ({
|
|
|
18279
19657
|
children: /* @__PURE__ */ jsx(
|
|
18280
19658
|
"span",
|
|
18281
19659
|
{
|
|
18282
|
-
className: `cteditor-rounded-[2px] !cteditor-size-[18px] cteditor-flex cteditor-items-center cteditor-justify-center
|
|
19660
|
+
className: `cteditor-rounded-[2px] !cteditor-size-[18px] cteditor-flex cteditor-items-center cteditor-justify-center ${bgClassName}`,
|
|
18283
19661
|
style: !bgClassName ? { backgroundColor: selectedColor } : void 0,
|
|
18284
19662
|
children: icon
|
|
18285
19663
|
}
|
|
@@ -19597,7 +20975,7 @@ const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref)
|
|
|
19597
20975
|
Trigger,
|
|
19598
20976
|
{
|
|
19599
20977
|
ref,
|
|
19600
|
-
className: cn(
|
|
20978
|
+
className: cn$1(
|
|
19601
20979
|
"cteditor-flex cteditor-gap-1 cteditor-h-9 cteditor-w-full cteditor-items-center cteditor-justify-between cteditor-whitespace-nowrap cteditor-rounded-sm cteditor-border cteditor-border-input cteditor-bg-transparent cteditor-px-3 cteditor-py-2 cteditor-text-sm cteditor-shadow-sm cteditor-ring-offset-background data-[placeholder]:cteditor-text-muted-foreground focus:cteditor-outline-none focus:cteditor-ring-0 focus:cteditor-ring-ring disabled:cteditor-cursor-not-allowed disabled:cteditor-opacity-50 [&>span]:cteditor-line-clamp-1",
|
|
19602
20980
|
className
|
|
19603
20981
|
),
|
|
@@ -19613,7 +20991,7 @@ const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) =>
|
|
|
19613
20991
|
ScrollUpButton,
|
|
19614
20992
|
{
|
|
19615
20993
|
ref,
|
|
19616
|
-
className: cn(
|
|
20994
|
+
className: cn$1(
|
|
19617
20995
|
"cteditor-flex cteditor-cursor-pointer cteditor-items-center cteditor-justify-center cteditor-py-1",
|
|
19618
20996
|
className
|
|
19619
20997
|
),
|
|
@@ -19626,7 +21004,7 @@ const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) =
|
|
|
19626
21004
|
ScrollDownButton,
|
|
19627
21005
|
{
|
|
19628
21006
|
ref,
|
|
19629
|
-
className: cn(
|
|
21007
|
+
className: cn$1(
|
|
19630
21008
|
"cteditor-flex cteditor-cursor-pointer cteditor-items-center cteditor-justify-center cteditor-py-1",
|
|
19631
21009
|
className
|
|
19632
21010
|
),
|
|
@@ -19639,7 +21017,7 @@ const SelectContent = React.forwardRef(({ className, children, position = "poppe
|
|
|
19639
21017
|
Content2,
|
|
19640
21018
|
{
|
|
19641
21019
|
ref,
|
|
19642
|
-
className: cn(
|
|
21020
|
+
className: cn$1(
|
|
19643
21021
|
"cteditor-relative cteditor-z-[9999] cteditor-max-h-[--radix-select-content-available-height] cteditor-min-w-[8rem] cteditor-overflow-y-auto cteditor-overflow-x-hidden cteditor-rounded-md cteditor-border cteditor-bg-popover cteditor-text-popover-foreground cteditor-shadow-md data-[state=open]:cteditor-animate-in data-[state=closed]:cteditor-animate-out data-[state=closed]:cteditor-fade-out-0 data-[state=open]:cteditor-fade-in-0 data-[state=closed]:cteditor-zoom-out-95 data-[state=open]:cteditor-zoom-in-95 data-[side=bottom]:cteditor-slide-in-from-top-2 data-[side=left]:cteditor-slide-in-from-right-2 data-[side=right]:cteditor-slide-in-from-left-2 data-[side=top]:cteditor-slide-in-from-bottom-2 cteditor-origin-[--radix-select-content-transform-origin]",
|
|
19644
21022
|
position === "popper" && "data-[side=bottom]:cteditor-translate-y-1 data-[side=left]:-cteditor-translate-x-1 data-[side=right]:cteditor-translate-x-1 data-[side=top]:-cteditor-translate-y-1",
|
|
19645
21023
|
className
|
|
@@ -19651,7 +21029,7 @@ const SelectContent = React.forwardRef(({ className, children, position = "poppe
|
|
|
19651
21029
|
/* @__PURE__ */ jsx(
|
|
19652
21030
|
Viewport,
|
|
19653
21031
|
{
|
|
19654
|
-
className: cn(
|
|
21032
|
+
className: cn$1(
|
|
19655
21033
|
"cteditor-p-1",
|
|
19656
21034
|
position === "popper" && "cteditor-h-[var(--radix-select-trigger-height)] cteditor-w-full cteditor-min-w-[var(--radix-select-trigger-width)]"
|
|
19657
21035
|
),
|
|
@@ -19667,7 +21045,7 @@ const SelectLabel = React.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
19667
21045
|
Label,
|
|
19668
21046
|
{
|
|
19669
21047
|
ref,
|
|
19670
|
-
className: cn(
|
|
21048
|
+
className: cn$1(
|
|
19671
21049
|
"cteditor-px-2 cteditor-py-1.5 cteditor-text-sm cteditor-font-semibold",
|
|
19672
21050
|
className
|
|
19673
21051
|
),
|
|
@@ -19679,7 +21057,7 @@ const SelectItem = React.forwardRef(({ className, children, ...props }, ref) =>
|
|
|
19679
21057
|
Item,
|
|
19680
21058
|
{
|
|
19681
21059
|
ref,
|
|
19682
|
-
className: cn(
|
|
21060
|
+
className: cn$1(
|
|
19683
21061
|
"cteditor-relative cteditor-flex cteditor-w-full cteditor-cursor-pointer cteditor-select-none cteditor-items-center cteditor-rounded-sm cteditor-py-1.5 cteditor-pl-2 cteditor-pr-8 cteditor-text-[13px] cteditor-outline-none focus:cteditor-bg-secondary focus:cteditor-text-accent-foreground data-[disabled]:cteditor-pointer-events-none data-[disabled]:cteditor-opacity-50",
|
|
19684
21062
|
className
|
|
19685
21063
|
),
|
|
@@ -19695,7 +21073,7 @@ const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
19695
21073
|
Separator,
|
|
19696
21074
|
{
|
|
19697
21075
|
ref,
|
|
19698
|
-
className: cn(
|
|
21076
|
+
className: cn$1(
|
|
19699
21077
|
"cteditor--mx-1 cteditor-my-1 cteditor-h-px cteditor-bg-muted",
|
|
19700
21078
|
className
|
|
19701
21079
|
),
|
|
@@ -19877,7 +21255,7 @@ const FormatTextMenu = ({ hasFormat }) => {
|
|
|
19877
21255
|
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", children: formatMenuItems.map((option, index2) => /* @__PURE__ */ jsxs(
|
|
19878
21256
|
DropdownMenuItem$1,
|
|
19879
21257
|
{
|
|
19880
|
-
className: cn(
|
|
21258
|
+
className: cn$1(
|
|
19881
21259
|
hasFormat[option.payload] && "cteditor-bg-background/50"
|
|
19882
21260
|
),
|
|
19883
21261
|
onClick: () => {
|
|
@@ -21636,7 +23014,7 @@ const NotePanelMenu = ({ className }) => {
|
|
|
21636
23014
|
{
|
|
21637
23015
|
variant: "ghost",
|
|
21638
23016
|
size: "icon-sm",
|
|
21639
|
-
className: cn("cteditor-text-foreground", className),
|
|
23017
|
+
className: cn$1("cteditor-text-foreground", className),
|
|
21640
23018
|
children: /* @__PURE__ */ jsx(NoteIcon, {})
|
|
21641
23019
|
}
|
|
21642
23020
|
) }),
|
|
@@ -21650,7 +23028,7 @@ const NotePanelMenu = ({ className }) => {
|
|
|
21650
23028
|
onClick: () => handleInsertPanel(option.type),
|
|
21651
23029
|
className: "cteditor-flex cteditor-items-center !cteditor-gap-3 cteditor-cursor-pointer",
|
|
21652
23030
|
children: [
|
|
21653
|
-
/* @__PURE__ */ jsx("div", { className: cn("cteditor-flex-shrink-0", option.iconColor), children: /* @__PURE__ */ jsx(IconComponent, { size: 16 }) }),
|
|
23031
|
+
/* @__PURE__ */ jsx("div", { className: cn$1("cteditor-flex-shrink-0", option.iconColor), children: /* @__PURE__ */ jsx(IconComponent, { size: 16 }) }),
|
|
21654
23032
|
/* @__PURE__ */ jsxs("div", { className: "cteditor-flex-1", children: [
|
|
21655
23033
|
/* @__PURE__ */ jsx("div", { className: "cteditor-text-sm cteditor-font-medium", children: option.label }),
|
|
21656
23034
|
/* @__PURE__ */ jsx("div", { className: "cteditor-text-xs cteditor-text-muted-foreground", children: option.description })
|
|
@@ -21700,21 +23078,37 @@ const Toolbar = ({
|
|
|
21700
23078
|
const [selectedElementKey, setSelectedElementKey] = useState(null);
|
|
21701
23079
|
const [showMoreMenu, setShowMoreMenu] = useState(false);
|
|
21702
23080
|
const [isMoreMenuOpen, setIsMoreMenuOpen] = useState(false);
|
|
23081
|
+
const [isExportingPDF, setIsExportingPDF] = useState(false);
|
|
23082
|
+
const [exportProgress, setExportProgress] = useState(0);
|
|
21703
23083
|
const toolbarRef = useRef(null);
|
|
21704
23084
|
const contentRef = useRef(null);
|
|
23085
|
+
const [hiddenItemIds, setHiddenItemIds] = useState(/* @__PURE__ */ new Set());
|
|
21705
23086
|
const classes = useStyles$1();
|
|
21706
23087
|
const { hasFormat, isEditorEmpty, blockType, clearFormatting } = useEditorToolbar();
|
|
21707
23088
|
const { clearEditorContent } = useCustomCommands();
|
|
21708
23089
|
const { toolbarState, updateToolbarState } = useToolbarState();
|
|
21709
23090
|
const { isHtmlView, setIsHtmlView, htmlContent, setHtmlContent } = useHtmlView();
|
|
21710
23091
|
useEffect(() => {
|
|
23092
|
+
const computeHiddenItems = () => {
|
|
23093
|
+
if (!toolbarRef.current || !contentRef.current)
|
|
23094
|
+
return;
|
|
23095
|
+
const contentRect = contentRef.current.getBoundingClientRect();
|
|
23096
|
+
const items = contentRef.current.querySelectorAll("[data-toolbar-item]");
|
|
23097
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
23098
|
+
items.forEach((el) => {
|
|
23099
|
+
const rect = el.getBoundingClientRect();
|
|
23100
|
+
if (rect.right > contentRect.right) {
|
|
23101
|
+
const id = el.getAttribute("data-toolbar-item");
|
|
23102
|
+
if (id)
|
|
23103
|
+
hidden.add(id);
|
|
23104
|
+
}
|
|
23105
|
+
});
|
|
23106
|
+
setHiddenItemIds(hidden);
|
|
23107
|
+
setShowMoreMenu(hidden.size > 0);
|
|
23108
|
+
};
|
|
21711
23109
|
const checkOverflow = () => {
|
|
21712
23110
|
if (toolbarRef.current && contentRef.current) {
|
|
21713
|
-
|
|
21714
|
-
const contentWidth = contentRef.current.scrollWidth;
|
|
21715
|
-
const windowWidth = window.innerWidth;
|
|
21716
|
-
const shouldShowMore = windowWidth <= 1300 && contentWidth > toolbarWidth - 60;
|
|
21717
|
-
setShowMoreMenu(shouldShowMore);
|
|
23111
|
+
requestAnimationFrame(computeHiddenItems);
|
|
21718
23112
|
}
|
|
21719
23113
|
};
|
|
21720
23114
|
checkOverflow();
|
|
@@ -21965,558 +23359,329 @@ const Toolbar = ({
|
|
|
21965
23359
|
}
|
|
21966
23360
|
});
|
|
21967
23361
|
}, [editor]);
|
|
23362
|
+
const handleExportPDF = useCallback(async () => {
|
|
23363
|
+
try {
|
|
23364
|
+
setIsExportingPDF(true);
|
|
23365
|
+
setExportProgress(0);
|
|
23366
|
+
const toastId = toast.loading("Preparing PDF export...", {
|
|
23367
|
+
description: "Initializing export process"
|
|
23368
|
+
});
|
|
23369
|
+
const progressInterval = setInterval(() => {
|
|
23370
|
+
setExportProgress((prev) => {
|
|
23371
|
+
const next = prev + 15;
|
|
23372
|
+
if (next >= 90) {
|
|
23373
|
+
clearInterval(progressInterval);
|
|
23374
|
+
return 90;
|
|
23375
|
+
}
|
|
23376
|
+
if (next > 30 && next <= 60) {
|
|
23377
|
+
toast.loading("Rendering content...", { id: toastId, description: "Converting editor content to PDF format" });
|
|
23378
|
+
} else if (next > 60) {
|
|
23379
|
+
toast.loading("Finalizing PDF...", { id: toastId, description: "Almost done!" });
|
|
23380
|
+
}
|
|
23381
|
+
return next;
|
|
23382
|
+
});
|
|
23383
|
+
}, 200);
|
|
23384
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/[:T]/g, "-");
|
|
23385
|
+
await exportEditorToPDF(activeEditor, `export-${timestamp}.pdf`);
|
|
23386
|
+
clearInterval(progressInterval);
|
|
23387
|
+
setExportProgress(100);
|
|
23388
|
+
toast.success("PDF exported successfully!", {
|
|
23389
|
+
id: toastId,
|
|
23390
|
+
description: `File saved as export-${timestamp}.pdf`,
|
|
23391
|
+
duration: 4e3
|
|
23392
|
+
});
|
|
23393
|
+
} catch (error) {
|
|
23394
|
+
console.error("PDF export failed:", error);
|
|
23395
|
+
const message = error instanceof Error ? error.message : "Unknown error occurred";
|
|
23396
|
+
toast.error("Failed to export PDF", {
|
|
23397
|
+
description: message,
|
|
23398
|
+
duration: 5e3,
|
|
23399
|
+
action: {
|
|
23400
|
+
label: "Try Again",
|
|
23401
|
+
onClick: () => handleExportPDF()
|
|
23402
|
+
}
|
|
23403
|
+
});
|
|
23404
|
+
} finally {
|
|
23405
|
+
setIsExportingPDF(false);
|
|
23406
|
+
setExportProgress(0);
|
|
23407
|
+
}
|
|
23408
|
+
}, [activeEditor]);
|
|
21968
23409
|
if (!editable)
|
|
21969
23410
|
return null;
|
|
21970
|
-
return /* @__PURE__ */ jsxs(
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
style: { scrollbarWidth: "none", msOverflowStyle: "none" },
|
|
21982
|
-
children: [
|
|
21983
|
-
enableUndoRedo && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21984
|
-
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
21985
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
21986
|
-
Button,
|
|
21987
|
-
{
|
|
21988
|
-
variant: "ghost",
|
|
21989
|
-
onClick: () => activeEditor.dispatchCommand(UNDO_COMMAND, void 0),
|
|
21990
|
-
disabled: disableMap["undo"],
|
|
21991
|
-
size: "icon-sm",
|
|
21992
|
-
children: /* @__PURE__ */ jsx(UndoIcon, {})
|
|
21993
|
-
}
|
|
21994
|
-
) }),
|
|
21995
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Undo (Ctrl + Z)" }) })
|
|
21996
|
-
] }) }),
|
|
21997
|
-
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
21998
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
21999
|
-
Button,
|
|
22000
|
-
{
|
|
22001
|
-
variant: "ghost",
|
|
22002
|
-
size: "icon-sm",
|
|
22003
|
-
onClick: () => activeEditor.dispatchCommand(REDO_COMMAND, void 0),
|
|
22004
|
-
disabled: disableMap["redo"],
|
|
22005
|
-
children: /* @__PURE__ */ jsx(RedoIcon, {})
|
|
22006
|
-
}
|
|
22007
|
-
) }),
|
|
22008
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Redo (Ctrl + Y)" }) })
|
|
22009
|
-
] }) }),
|
|
22010
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
22011
|
-
] }),
|
|
22012
|
-
enableTextFormatting && activeEditor === editor && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22013
|
-
/* @__PURE__ */ jsx(BlockFormatMenu, { blockType }),
|
|
22014
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
22015
|
-
] }),
|
|
22016
|
-
enableFontControls && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22017
|
-
/* @__PURE__ */ jsx(FontFamilyMenu, { fonts, activeEditor }),
|
|
22018
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
22019
|
-
/* @__PURE__ */ jsx(FontSizeControl, {}),
|
|
22020
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
22021
|
-
] }),
|
|
22022
|
-
enableTableOptions && activeEditor === editor && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22023
|
-
/* @__PURE__ */ jsx(TableOptionPlugin, {}),
|
|
22024
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
22025
|
-
] }),
|
|
22026
|
-
enableTextFormatting && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22027
|
-
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22028
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22029
|
-
Button,
|
|
22030
|
-
{
|
|
22031
|
-
variant: "ghost",
|
|
22032
|
-
size: "icon-sm",
|
|
22033
|
-
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold"),
|
|
22034
|
-
className: cn(toolbarState.isBold && "cteditor-bg-foreground/20"),
|
|
22035
|
-
children: /* @__PURE__ */ jsx(BoldIcon, {})
|
|
22036
|
-
}
|
|
22037
|
-
) }),
|
|
22038
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Bold (Ctrl + B)" }) })
|
|
22039
|
-
] }) }),
|
|
22040
|
-
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22041
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22042
|
-
Button,
|
|
22043
|
-
{
|
|
22044
|
-
variant: "ghost",
|
|
22045
|
-
size: "icon-sm",
|
|
22046
|
-
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic"),
|
|
22047
|
-
className: cn(toolbarState.isItalic && "cteditor-bg-foreground/20"),
|
|
22048
|
-
children: /* @__PURE__ */ jsx(ItalicIcon, {})
|
|
22049
|
-
}
|
|
22050
|
-
) }),
|
|
22051
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Italic (Ctrl + I)" }) })
|
|
22052
|
-
] }) }),
|
|
22053
|
-
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22054
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22055
|
-
Button,
|
|
22056
|
-
{
|
|
22057
|
-
variant: "ghost",
|
|
22058
|
-
size: "icon-sm",
|
|
22059
|
-
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline"),
|
|
22060
|
-
className: cn(toolbarState.isUnderline && "cteditor-bg-foreground/20"),
|
|
22061
|
-
children: /* @__PURE__ */ jsx(UnderlineIcon, {})
|
|
22062
|
-
}
|
|
22063
|
-
) }),
|
|
22064
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Underline (Ctrl + U)" }) })
|
|
22065
|
-
] }) }),
|
|
22066
|
-
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22067
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22068
|
-
Button,
|
|
22069
|
-
{
|
|
22070
|
-
variant: "ghost",
|
|
22071
|
-
size: "icon-sm",
|
|
22072
|
-
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough"),
|
|
22073
|
-
className: cn(toolbarState.isStrikethrough && "cteditor-bg-foreground/20"),
|
|
22074
|
-
children: /* @__PURE__ */ jsx(StrikethroughIcon, {})
|
|
22075
|
-
}
|
|
22076
|
-
) }),
|
|
22077
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Strikethrough" }) })
|
|
22078
|
-
] }) })
|
|
22079
|
-
] }),
|
|
22080
|
-
enableCodeFormat && activeEditor === editor && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22081
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22082
|
-
Button,
|
|
22083
|
-
{
|
|
22084
|
-
variant: "ghost",
|
|
22085
|
-
size: "icon-sm",
|
|
22086
|
-
onClick: formatCodeBlock,
|
|
22087
|
-
className: cn(toolbarState.isCode && "cteditor-bg-foreground/20"),
|
|
22088
|
-
children: /* @__PURE__ */ jsx(CodeIcon, {})
|
|
22089
|
-
}
|
|
22090
|
-
) }),
|
|
22091
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Insert code block" }) })
|
|
22092
|
-
] }) }),
|
|
22093
|
-
enableFormatTextMenu && activeEditor === editor && /* @__PURE__ */ jsx(FormatTextMenu, { hasFormat }),
|
|
22094
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
22095
|
-
enableColorPicker && activeEditor === editor && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22096
|
-
/* @__PURE__ */ jsx(
|
|
22097
|
-
ColorPicker$2,
|
|
22098
|
-
{
|
|
22099
|
-
title: "Font color",
|
|
22100
|
-
onChange: (color) => {
|
|
22101
|
-
onFontColorSelect(color);
|
|
22102
|
-
},
|
|
22103
|
-
icon: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center", children: [
|
|
22104
|
-
/* @__PURE__ */ jsx("p", { className: "cteditor-text-[11px] cteditor-leading-none", children: "A" }),
|
|
22105
|
-
/* @__PURE__ */ jsx(
|
|
22106
|
-
"div",
|
|
22107
|
-
{
|
|
22108
|
-
className: "cteditor-w-[14px] cteditor-h-[2px]",
|
|
22109
|
-
style: { backgroundColor: toolbarState.fontColor }
|
|
22110
|
-
}
|
|
22111
|
-
)
|
|
22112
|
-
] }),
|
|
22113
|
-
bgClassName: "bg-input"
|
|
22114
|
-
},
|
|
22115
|
-
"color-picker"
|
|
22116
|
-
),
|
|
22117
|
-
/* @__PURE__ */ jsx(
|
|
22118
|
-
ColorPicker$2,
|
|
22119
|
-
{
|
|
22120
|
-
title: "Background color",
|
|
22121
|
-
onChange: (color) => {
|
|
22122
|
-
onBgColorSelect(color);
|
|
22123
|
-
}
|
|
22124
|
-
},
|
|
22125
|
-
"bg-color-picker"
|
|
22126
|
-
),
|
|
22127
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
22128
|
-
] }),
|
|
22129
|
-
enableLinks && activeEditor === editor && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22130
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22131
|
-
Button,
|
|
22132
|
-
{
|
|
22133
|
-
variant: "ghost",
|
|
22134
|
-
size: "icon-sm",
|
|
22135
|
-
onClick: insertLink,
|
|
22136
|
-
className: cn(isLinkActive ? "dark:cteditor-text-blue-500 cteditor-text-blue-700" : "cteditor-text-foreground"),
|
|
22137
|
-
children: /* @__PURE__ */ jsx(LinkIcon, {})
|
|
22138
|
-
}
|
|
22139
|
-
) }),
|
|
22140
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Insert Link" }) })
|
|
22141
|
-
] }) }),
|
|
22142
|
-
enableEmojiPicker && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22143
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22144
|
-
EmojiPickerWidget,
|
|
22145
|
-
{
|
|
22146
|
-
icon: /* @__PURE__ */ jsx(FaceSmileIcon, {}),
|
|
22147
|
-
onChange: (emojiData) => {
|
|
22148
|
-
handleEmojiClick(emojiData);
|
|
22149
|
-
}
|
|
22150
|
-
},
|
|
22151
|
-
"emoji-picker"
|
|
22152
|
-
) }),
|
|
22153
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Emoji picker" }) })
|
|
22154
|
-
] }) }),
|
|
22155
|
-
enableInsertMenu && activeEditor === editor && /* @__PURE__ */ jsx(InsertMenu, {}),
|
|
22156
|
-
enableTodoList && activeEditor === editor && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22157
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22158
|
-
Button,
|
|
22159
|
-
{
|
|
22160
|
-
variant: "ghost",
|
|
22161
|
-
size: "icon-sm",
|
|
22162
|
-
onClick: createTodo,
|
|
22163
|
-
className: "[&>svg]:!cteditor-size-5",
|
|
22164
|
-
children: /* @__PURE__ */ jsx(TodoIcon, {})
|
|
22165
|
-
}
|
|
22166
|
-
) }),
|
|
22167
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Create Todo List" }) })
|
|
22168
|
-
] }) }),
|
|
22169
|
-
enableNotePanels && activeEditor === editor && /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(NotePanelMenu, {}) }),
|
|
22170
|
-
/* @__PURE__ */ jsx(
|
|
22171
|
-
HighlightColorPicker,
|
|
22172
|
-
{
|
|
22173
|
-
onChange: (color) => {
|
|
22174
|
-
onHighlightColorSelect(color);
|
|
22175
|
-
},
|
|
22176
|
-
isActive: toolbarState.isHighlight
|
|
22177
|
-
}
|
|
22178
|
-
),
|
|
22179
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
22180
|
-
enableAlignment && activeEditor === editor && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22181
|
-
/* @__PURE__ */ jsx(AlignMenu, {}),
|
|
22182
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
22183
|
-
] }),
|
|
22184
|
-
enableClearOptions && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22185
|
-
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22186
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22187
|
-
Button,
|
|
22188
|
-
{
|
|
22189
|
-
variant: "ghost",
|
|
22190
|
-
size: "icon-sm",
|
|
22191
|
-
disabled: isEditorEmpty,
|
|
22192
|
-
onClick: handleClearEditorContent,
|
|
22193
|
-
children: /* @__PURE__ */ jsx(X$1, { className: "!cteditor-size-4" })
|
|
22194
|
-
}
|
|
22195
|
-
) }),
|
|
22196
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Clear editor" }) })
|
|
22197
|
-
] }) }),
|
|
22198
|
-
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22199
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22200
|
-
Button,
|
|
22201
|
-
{
|
|
22202
|
-
variant: "ghost",
|
|
22203
|
-
size: "icon-sm",
|
|
22204
|
-
onClick: clearFormatting,
|
|
22205
|
-
children: /* @__PURE__ */ jsx(Trash, { className: "!cteditor-size-4" })
|
|
22206
|
-
}
|
|
22207
|
-
) }),
|
|
22208
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Clear formatting" }) })
|
|
22209
|
-
] }) })
|
|
22210
|
-
] }),
|
|
22211
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-aiOption", children: /* @__PURE__ */ jsxs(DropdownMenu$1, { modal: false, children: [
|
|
22212
|
-
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
22213
|
-
Button,
|
|
22214
|
-
{
|
|
22215
|
-
variant: "outline",
|
|
22216
|
-
size: "sm",
|
|
22217
|
-
className: "cteditor-px-4 cteditor-gap-3 [&>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",
|
|
22218
|
-
children: [
|
|
22219
|
-
/* @__PURE__ */ jsx(MagicoonIcon, {}),
|
|
22220
|
-
" Go with AI"
|
|
22221
|
-
]
|
|
22222
|
-
}
|
|
22223
|
-
) }),
|
|
22224
|
-
/* @__PURE__ */ jsxs(DropdownMenuContent, { children: [
|
|
22225
|
-
/* @__PURE__ */ jsxs(
|
|
22226
|
-
DropdownMenuItem$1,
|
|
22227
|
-
{
|
|
22228
|
-
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "SPELLING_GRAMMAR" }),
|
|
22229
|
-
children: [
|
|
22230
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(SearchTextIcon, {}) }),
|
|
22231
|
-
" ",
|
|
22232
|
-
"Fix Grammar"
|
|
22233
|
-
]
|
|
22234
|
-
}
|
|
22235
|
-
),
|
|
22236
|
-
/* @__PURE__ */ jsxs(
|
|
22237
|
-
DropdownMenuItem$1,
|
|
22238
|
-
{
|
|
22239
|
-
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "SIMPLIFY" }),
|
|
22240
|
-
children: [
|
|
22241
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(PenLineIcon, {}) }),
|
|
22242
|
-
" ",
|
|
22243
|
-
"Simplify"
|
|
22244
|
-
]
|
|
22245
|
-
}
|
|
22246
|
-
),
|
|
22247
|
-
/* @__PURE__ */ jsxs(
|
|
22248
|
-
DropdownMenuItem$1,
|
|
22249
|
-
{
|
|
22250
|
-
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "COMPLETE_SENTENCE" }),
|
|
22251
|
-
children: [
|
|
22252
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(MenuAltIcon, {}) }),
|
|
22253
|
-
"Complete Sentence"
|
|
22254
|
-
]
|
|
22255
|
-
}
|
|
22256
|
-
),
|
|
22257
|
-
/* @__PURE__ */ jsxs(
|
|
22258
|
-
DropdownMenuItem$1,
|
|
22259
|
-
{
|
|
22260
|
-
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "EMOJIFY" }),
|
|
22261
|
-
children: [
|
|
22262
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(FaceSmileIcon2, {}) }),
|
|
22263
|
-
"Emojify"
|
|
22264
|
-
]
|
|
22265
|
-
}
|
|
22266
|
-
),
|
|
22267
|
-
/* @__PURE__ */ jsxs(
|
|
22268
|
-
DropdownMenuItem$1,
|
|
22269
|
-
{
|
|
22270
|
-
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "TRANSLATE" }),
|
|
22271
|
-
children: [
|
|
22272
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(TranslateIcon, {}) }),
|
|
22273
|
-
"Translate"
|
|
22274
|
-
]
|
|
22275
|
-
}
|
|
22276
|
-
),
|
|
22277
|
-
/* @__PURE__ */ jsxs(
|
|
22278
|
-
DropdownMenuItem$1,
|
|
22279
|
-
{
|
|
22280
|
-
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "AI_RESPONSE" }),
|
|
22281
|
-
children: [
|
|
22282
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(SparkleIcon, {}) }),
|
|
22283
|
-
"AI"
|
|
22284
|
-
]
|
|
22285
|
-
}
|
|
22286
|
-
),
|
|
22287
|
-
/* @__PURE__ */ jsxs(
|
|
22288
|
-
DropdownMenuItem$1,
|
|
22289
|
-
{
|
|
22290
|
-
onClick: () => editor.dispatchCommand(AI_IMAGE_COMMAND, { type: "CREATE_IMAGE" }),
|
|
22291
|
-
children: [
|
|
22292
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(ImageIcon, {}) }),
|
|
22293
|
-
"Generate Image"
|
|
22294
|
-
]
|
|
22295
|
-
}
|
|
22296
|
-
)
|
|
22297
|
-
] })
|
|
22298
|
-
] }) }),
|
|
22299
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
22300
|
-
enableAIChat && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22301
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22302
|
-
Button,
|
|
22303
|
-
{
|
|
22304
|
-
variant: "ghost",
|
|
22305
|
-
size: "icon-sm",
|
|
22306
|
-
onClick: toggleAIChat,
|
|
22307
|
-
disabled: !editable,
|
|
22308
|
-
className: cn(classes.toolbarButton, "[&>svg]:!cteditor-size-5"),
|
|
22309
|
-
children: /* @__PURE__ */ jsx(MessageEditIcon, {})
|
|
22310
|
-
}
|
|
22311
|
-
) }),
|
|
22312
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "AI Chat" }) })
|
|
22313
|
-
] }) }),
|
|
22314
|
-
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22315
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(VoiceTranscriptButton, { editor: activeEditor }) }),
|
|
22316
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Voice Transcript" }) })
|
|
22317
|
-
] }) }),
|
|
22318
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
22319
|
-
enableAutocompleteToggle && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22320
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22321
|
-
Button,
|
|
22322
|
-
{
|
|
22323
|
-
variant: "ghost",
|
|
22324
|
-
size: "icon-sm",
|
|
22325
|
-
onClick: toggleAutocomplete,
|
|
22326
|
-
disabled: !editable,
|
|
22327
|
-
className: cn(
|
|
22328
|
-
classes.toolbarButton,
|
|
22329
|
-
toolbarState.isAutocompleteEnabled && "cteditor-bg-foreground/20",
|
|
22330
|
-
"[&>svg]:!cteditor-size-4"
|
|
22331
|
-
),
|
|
22332
|
-
children: /* @__PURE__ */ jsx(SearchTextIcon2, {})
|
|
22333
|
-
}
|
|
22334
|
-
) }),
|
|
22335
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: toolbarState.isAutocompleteEnabled ? "Disable Autocorrection" : "Enable Autocorrection" }) })
|
|
22336
|
-
] }) }),
|
|
22337
|
-
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
22338
|
-
(enableHtmlViewToggle || enableHtmlView) && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
22339
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22340
|
-
Button,
|
|
22341
|
-
{
|
|
22342
|
-
variant: "ghost",
|
|
22343
|
-
size: "icon-sm",
|
|
22344
|
-
onClick: toggleHtmlView,
|
|
22345
|
-
disabled: !editable,
|
|
22346
|
-
className: cn(classes.toolbarButton, isHtmlView && "cteditor-bg-foreground/20"),
|
|
22347
|
-
children: /* @__PURE__ */ jsx(FileCode2, { className: "!cteditor-size-4" })
|
|
22348
|
-
}
|
|
22349
|
-
) }),
|
|
22350
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: isHtmlView ? "Switch to Editor View" : "Switch to HTML View" }) })
|
|
22351
|
-
] }) })
|
|
22352
|
-
]
|
|
23411
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23412
|
+
/* @__PURE__ */ jsx(
|
|
23413
|
+
Toaster,
|
|
23414
|
+
{
|
|
23415
|
+
position: "top-right",
|
|
23416
|
+
richColors: true,
|
|
23417
|
+
expand: false,
|
|
23418
|
+
closeButton: true,
|
|
23419
|
+
toastOptions: {
|
|
23420
|
+
style: {
|
|
23421
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
22353
23422
|
}
|
|
22354
|
-
|
|
22355
|
-
|
|
22356
|
-
|
|
22357
|
-
|
|
22358
|
-
|
|
22359
|
-
|
|
22360
|
-
|
|
22361
|
-
|
|
22362
|
-
|
|
22363
|
-
|
|
22364
|
-
|
|
22365
|
-
|
|
22366
|
-
|
|
22367
|
-
|
|
22368
|
-
},
|
|
22369
|
-
|
|
22370
|
-
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
},
|
|
22375
|
-
children: [
|
|
22376
|
-
enableTextFormatting && activeEditor === editor && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22377
|
-
/* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(BlockFormatMenu, { blockType }) }) }),
|
|
22378
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
22379
|
-
] }),
|
|
22380
|
-
enableFontControls && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22381
|
-
/* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(FontFamilyMenu, { fonts, activeEditor }) }) }),
|
|
22382
|
-
/* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(FontSizeControl, {}) }) }),
|
|
22383
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
22384
|
-
] }),
|
|
22385
|
-
enableTableOptions && activeEditor === editor && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22386
|
-
/* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(TableOptionPlugin, {}) }) }),
|
|
22387
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
22388
|
-
] }),
|
|
22389
|
-
enableTextFormatting && /* @__PURE__ */ jsxs(
|
|
22390
|
-
DropdownMenuItem$1,
|
|
22391
|
-
{
|
|
22392
|
-
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough"),
|
|
22393
|
-
children: [
|
|
22394
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(StrikethroughIcon, {}) }),
|
|
22395
|
-
"Strikethrough"
|
|
22396
|
-
]
|
|
22397
|
-
}
|
|
22398
|
-
),
|
|
22399
|
-
enableCodeFormat && activeEditor === editor && /* @__PURE__ */ jsxs(
|
|
22400
|
-
DropdownMenuItem$1,
|
|
22401
|
-
{
|
|
22402
|
-
onClick: formatCodeBlock,
|
|
22403
|
-
children: [
|
|
22404
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(CodeIcon, {}) }),
|
|
22405
|
-
"Code Block"
|
|
22406
|
-
]
|
|
22407
|
-
}
|
|
22408
|
-
),
|
|
22409
|
-
enableFormatTextMenu && activeEditor === editor && /* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(FormatTextMenu, { hasFormat }) }) }),
|
|
22410
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
22411
|
-
enableColorPicker && activeEditor === editor && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22412
|
-
/* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5", children: [
|
|
22413
|
-
/* @__PURE__ */ jsx(
|
|
22414
|
-
ColorPicker$2,
|
|
22415
|
-
{
|
|
22416
|
-
title: "Font color",
|
|
22417
|
-
onChange: (color) => {
|
|
22418
|
-
onFontColorSelect(color);
|
|
22419
|
-
setIsMoreMenuOpen(true);
|
|
22420
|
-
},
|
|
22421
|
-
icon: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center", children: [
|
|
22422
|
-
/* @__PURE__ */ jsx("p", { className: "cteditor-text-[11px] cteditor-leading-none", children: "A" }),
|
|
22423
|
-
/* @__PURE__ */ jsx(
|
|
22424
|
-
"div",
|
|
22425
|
-
{
|
|
22426
|
-
className: "cteditor-w-[14px] cteditor-h-[2px]",
|
|
22427
|
-
style: { backgroundColor: toolbarState.fontColor }
|
|
22428
|
-
}
|
|
22429
|
-
)
|
|
22430
|
-
] }),
|
|
22431
|
-
bgClassName: "bg-input"
|
|
22432
|
-
},
|
|
22433
|
-
"color-picker-dropdown"
|
|
22434
|
-
),
|
|
22435
|
-
/* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-sm", children: "Font Color" })
|
|
22436
|
-
] }),
|
|
22437
|
-
/* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5", children: [
|
|
22438
|
-
/* @__PURE__ */ jsx(
|
|
22439
|
-
ColorPicker$2,
|
|
23423
|
+
}
|
|
23424
|
+
}
|
|
23425
|
+
),
|
|
23426
|
+
/* @__PURE__ */ jsxs(
|
|
23427
|
+
"div",
|
|
23428
|
+
{
|
|
23429
|
+
ref: toolbarRef,
|
|
23430
|
+
className: "cteditor-flex cteditor-bg-background cteditor-text-foreground cteditor-px-2.5 cteditor-py-[7px] cteditor-rounded-lg cteditor-items-center cteditor-gap-1.5 cteditor-relative cteditor-w-full cteditor-min-h-11 cteditor-overflow-hidden",
|
|
23431
|
+
children: [
|
|
23432
|
+
/* @__PURE__ */ jsxs(
|
|
23433
|
+
"div",
|
|
23434
|
+
{
|
|
23435
|
+
ref: contentRef,
|
|
23436
|
+
className: "cteditor-flex cteditor-items-center cteditor-gap-1.5 cteditor-flex-1 cteditor-overflow-x-auto cteditor-scrollbar-hide",
|
|
23437
|
+
style: { scrollbarWidth: "none", msOverflowStyle: "none" },
|
|
23438
|
+
children: [
|
|
23439
|
+
enableUndoRedo && /* @__PURE__ */ jsxs("div", { "data-toolbar-item": "undoRedo", className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
|
|
23440
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23441
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23442
|
+
Button,
|
|
22440
23443
|
{
|
|
22441
|
-
|
|
22442
|
-
|
|
22443
|
-
|
|
22444
|
-
|
|
22445
|
-
}
|
|
22446
|
-
}
|
|
22447
|
-
|
|
22448
|
-
)
|
|
22449
|
-
|
|
22450
|
-
|
|
22451
|
-
|
|
23444
|
+
variant: "ghost",
|
|
23445
|
+
onClick: () => activeEditor.dispatchCommand(UNDO_COMMAND, void 0),
|
|
23446
|
+
disabled: disableMap["undo"],
|
|
23447
|
+
size: "icon-sm",
|
|
23448
|
+
children: /* @__PURE__ */ jsx(UndoIcon, {})
|
|
23449
|
+
}
|
|
23450
|
+
) }),
|
|
23451
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Undo (Ctrl + Z)" }) })
|
|
23452
|
+
] }) }),
|
|
23453
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23454
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23455
|
+
Button,
|
|
23456
|
+
{
|
|
23457
|
+
variant: "ghost",
|
|
23458
|
+
size: "icon-sm",
|
|
23459
|
+
onClick: () => activeEditor.dispatchCommand(REDO_COMMAND, void 0),
|
|
23460
|
+
disabled: disableMap["redo"],
|
|
23461
|
+
children: /* @__PURE__ */ jsx(RedoIcon, {})
|
|
23462
|
+
}
|
|
23463
|
+
) }),
|
|
23464
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Redo (Ctrl + Y)" }) })
|
|
23465
|
+
] }) }),
|
|
23466
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
23467
|
+
] }),
|
|
23468
|
+
enableTextFormatting && activeEditor === editor && /* @__PURE__ */ jsxs("div", { "data-toolbar-item": "blockFormat", className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
|
|
23469
|
+
/* @__PURE__ */ jsx(BlockFormatMenu, { blockType }),
|
|
23470
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
22452
23471
|
] }),
|
|
22453
|
-
|
|
22454
|
-
/* @__PURE__ */ jsx("div", {
|
|
22455
|
-
|
|
23472
|
+
enableFontControls && /* @__PURE__ */ jsxs("div", { "data-toolbar-item": "fontControls", className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
|
|
23473
|
+
/* @__PURE__ */ jsx("div", { "data-toolbar-item": "fontFamily", children: /* @__PURE__ */ jsx(FontFamilyMenu, { fonts, activeEditor }) }),
|
|
23474
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
23475
|
+
/* @__PURE__ */ jsx("div", { "data-toolbar-item": "fontSize", children: /* @__PURE__ */ jsx(FontSizeControl, {}) }),
|
|
23476
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
22456
23477
|
] }),
|
|
22457
|
-
|
|
23478
|
+
enableTableOptions && activeEditor === editor && /* @__PURE__ */ jsxs("div", { "data-toolbar-item": "tableOptions", className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
|
|
23479
|
+
/* @__PURE__ */ jsx(TableOptionPlugin, {}),
|
|
23480
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
23481
|
+
] }),
|
|
23482
|
+
enableTextFormatting && /* @__PURE__ */ jsxs("div", { "data-toolbar-item": "inlineFormats", className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
|
|
23483
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23484
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23485
|
+
Button,
|
|
23486
|
+
{
|
|
23487
|
+
variant: "ghost",
|
|
23488
|
+
size: "icon-sm",
|
|
23489
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold"),
|
|
23490
|
+
className: cn$1(toolbarState.isBold && "cteditor-bg-foreground/20"),
|
|
23491
|
+
children: /* @__PURE__ */ jsx(BoldIcon, {})
|
|
23492
|
+
}
|
|
23493
|
+
) }),
|
|
23494
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Bold (Ctrl + B)" }) })
|
|
23495
|
+
] }) }),
|
|
23496
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23497
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23498
|
+
Button,
|
|
23499
|
+
{
|
|
23500
|
+
variant: "ghost",
|
|
23501
|
+
size: "icon-sm",
|
|
23502
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "italic"),
|
|
23503
|
+
className: cn$1(toolbarState.isItalic && "cteditor-bg-foreground/20"),
|
|
23504
|
+
children: /* @__PURE__ */ jsx(ItalicIcon, {})
|
|
23505
|
+
}
|
|
23506
|
+
) }),
|
|
23507
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Italic (Ctrl + I)" }) })
|
|
23508
|
+
] }) }),
|
|
23509
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23510
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23511
|
+
Button,
|
|
23512
|
+
{
|
|
23513
|
+
variant: "ghost",
|
|
23514
|
+
size: "icon-sm",
|
|
23515
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "underline"),
|
|
23516
|
+
className: cn$1(toolbarState.isUnderline && "cteditor-bg-foreground/20"),
|
|
23517
|
+
children: /* @__PURE__ */ jsx(UnderlineIcon, {})
|
|
23518
|
+
}
|
|
23519
|
+
) }),
|
|
23520
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Underline (Ctrl + U)" }) })
|
|
23521
|
+
] }) }),
|
|
23522
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23523
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23524
|
+
Button,
|
|
23525
|
+
{
|
|
23526
|
+
variant: "ghost",
|
|
23527
|
+
size: "icon-sm",
|
|
23528
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough"),
|
|
23529
|
+
className: cn$1(toolbarState.isStrikethrough && "cteditor-bg-foreground/20"),
|
|
23530
|
+
children: /* @__PURE__ */ jsx(StrikethroughIcon, {})
|
|
23531
|
+
}
|
|
23532
|
+
) }),
|
|
23533
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Strikethrough" }) })
|
|
23534
|
+
] }) })
|
|
23535
|
+
] }),
|
|
23536
|
+
enableCodeFormat && activeEditor === editor && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23537
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23538
|
+
Button,
|
|
23539
|
+
{
|
|
23540
|
+
"data-toolbar-item": "codeBlock",
|
|
23541
|
+
variant: "ghost",
|
|
23542
|
+
size: "icon-sm",
|
|
23543
|
+
onClick: formatCodeBlock,
|
|
23544
|
+
className: cn$1(toolbarState.isCode && "cteditor-bg-foreground/20"),
|
|
23545
|
+
children: /* @__PURE__ */ jsx(CodeIcon, {})
|
|
23546
|
+
}
|
|
23547
|
+
) }),
|
|
23548
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Insert code block" }) })
|
|
23549
|
+
] }) }),
|
|
23550
|
+
enableFormatTextMenu && activeEditor === editor && /* @__PURE__ */ jsx("div", { "data-toolbar-item": "formatTextMenu", children: /* @__PURE__ */ jsx(FormatTextMenu, { hasFormat }) }),
|
|
23551
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
23552
|
+
enableColorPicker && activeEditor === editor && /* @__PURE__ */ jsxs("div", { "data-toolbar-item": "colorPickers", className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
|
|
22458
23553
|
/* @__PURE__ */ jsx(
|
|
23554
|
+
ColorPicker$2,
|
|
23555
|
+
{
|
|
23556
|
+
title: "Font color",
|
|
23557
|
+
onChange: (color) => {
|
|
23558
|
+
onFontColorSelect(color);
|
|
23559
|
+
},
|
|
23560
|
+
icon: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center", children: [
|
|
23561
|
+
/* @__PURE__ */ jsx("p", { className: "cteditor-text-[11px] cteditor-leading-none", children: "A" }),
|
|
23562
|
+
/* @__PURE__ */ jsx(
|
|
23563
|
+
"div",
|
|
23564
|
+
{
|
|
23565
|
+
className: "cteditor-w-[14px] cteditor-h-[2px]",
|
|
23566
|
+
style: { backgroundColor: toolbarState.fontColor }
|
|
23567
|
+
}
|
|
23568
|
+
)
|
|
23569
|
+
] }),
|
|
23570
|
+
bgClassName: "bg-input"
|
|
23571
|
+
},
|
|
23572
|
+
"color-picker"
|
|
23573
|
+
),
|
|
23574
|
+
/* @__PURE__ */ jsx("div", { className: "[&>button>span]:cteditor-border [&>button>span]:cteditor-border-black", children: /* @__PURE__ */ jsx(
|
|
23575
|
+
ColorPicker$2,
|
|
23576
|
+
{
|
|
23577
|
+
title: "Background color",
|
|
23578
|
+
onChange: (color) => {
|
|
23579
|
+
onBgColorSelect(color);
|
|
23580
|
+
}
|
|
23581
|
+
},
|
|
23582
|
+
"bg-color-picker"
|
|
23583
|
+
) }),
|
|
23584
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
23585
|
+
] }),
|
|
23586
|
+
enableLinks && activeEditor === editor && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23587
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23588
|
+
Button,
|
|
23589
|
+
{
|
|
23590
|
+
"data-toolbar-item": "link",
|
|
23591
|
+
variant: "ghost",
|
|
23592
|
+
size: "icon-sm",
|
|
23593
|
+
onClick: insertLink,
|
|
23594
|
+
className: cn$1(isLinkActive ? "dark:cteditor-text-blue-500 cteditor-text-blue-700" : "cteditor-text-foreground"),
|
|
23595
|
+
children: /* @__PURE__ */ jsx(LinkIcon, {})
|
|
23596
|
+
}
|
|
23597
|
+
) }),
|
|
23598
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Insert Link" }) })
|
|
23599
|
+
] }) }),
|
|
23600
|
+
enableEmojiPicker && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23601
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
22459
23602
|
EmojiPickerWidget,
|
|
22460
23603
|
{
|
|
22461
|
-
|
|
23604
|
+
"data-toolbar-item": "emoji",
|
|
23605
|
+
icon: /* @__PURE__ */ jsx(FaceSmileIcon, {}),
|
|
22462
23606
|
onChange: (emojiData) => {
|
|
22463
23607
|
handleEmojiClick(emojiData);
|
|
22464
|
-
setIsMoreMenuOpen(true);
|
|
22465
23608
|
}
|
|
22466
23609
|
},
|
|
22467
|
-
"emoji-picker
|
|
22468
|
-
),
|
|
22469
|
-
/* @__PURE__ */ jsx(
|
|
22470
|
-
] }),
|
|
22471
|
-
enableInsertMenu && activeEditor === editor && /* @__PURE__ */ jsx(
|
|
22472
|
-
enableTodoList && activeEditor === editor && /* @__PURE__ */
|
|
22473
|
-
/* @__PURE__ */ jsx(
|
|
22474
|
-
|
|
22475
|
-
] }),
|
|
22476
|
-
enableNotePanels && activeEditor === editor && /* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(NotePanelMenu, {}) }) }) }),
|
|
22477
|
-
/* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5", children: [
|
|
22478
|
-
/* @__PURE__ */ jsx(
|
|
22479
|
-
HighlightColorPicker,
|
|
23610
|
+
"emoji-picker"
|
|
23611
|
+
) }),
|
|
23612
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Emoji picker" }) })
|
|
23613
|
+
] }) }),
|
|
23614
|
+
enableInsertMenu && activeEditor === editor && /* @__PURE__ */ jsx("div", { "data-toolbar-item": "insertMenu", children: /* @__PURE__ */ jsx(InsertMenu, {}) }),
|
|
23615
|
+
enableTodoList && activeEditor === editor && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23616
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23617
|
+
Button,
|
|
22480
23618
|
{
|
|
22481
|
-
|
|
22482
|
-
|
|
22483
|
-
|
|
22484
|
-
|
|
22485
|
-
|
|
23619
|
+
"data-toolbar-item": "todo",
|
|
23620
|
+
variant: "ghost",
|
|
23621
|
+
size: "icon-sm",
|
|
23622
|
+
onClick: createTodo,
|
|
23623
|
+
className: "[&>svg]:!cteditor-size-5",
|
|
23624
|
+
children: /* @__PURE__ */ jsx(TodoIcon, {})
|
|
22486
23625
|
}
|
|
22487
|
-
),
|
|
22488
|
-
/* @__PURE__ */ jsx(
|
|
22489
|
-
] }),
|
|
22490
|
-
/* @__PURE__ */ jsx(
|
|
22491
|
-
|
|
22492
|
-
|
|
22493
|
-
|
|
23626
|
+
) }),
|
|
23627
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Create Todo List" }) })
|
|
23628
|
+
] }) }),
|
|
23629
|
+
enableNotePanels && activeEditor === editor && /* @__PURE__ */ jsx("div", { "data-toolbar-item": "notePanels", className: "[&>button]:!cteditor-size-6 [&>button]:cteditor-outline-none cteditor-block", children: /* @__PURE__ */ jsx(NotePanelMenu, {}) }),
|
|
23630
|
+
/* @__PURE__ */ jsx("div", { "data-toolbar-item": "highlight", children: /* @__PURE__ */ jsx(
|
|
23631
|
+
HighlightColorPicker,
|
|
23632
|
+
{
|
|
23633
|
+
onChange: (color) => {
|
|
23634
|
+
onHighlightColorSelect(color);
|
|
23635
|
+
},
|
|
23636
|
+
isActive: toolbarState.isHighlight
|
|
23637
|
+
}
|
|
23638
|
+
) }),
|
|
23639
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
23640
|
+
enableAlignment && activeEditor === editor && /* @__PURE__ */ jsxs("div", { "data-toolbar-item": "alignMenu", className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
|
|
23641
|
+
/* @__PURE__ */ jsx(AlignMenu, {}),
|
|
23642
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" })
|
|
22494
23643
|
] }),
|
|
22495
|
-
enableClearOptions && /* @__PURE__ */ jsxs(
|
|
22496
|
-
/* @__PURE__ */
|
|
22497
|
-
/* @__PURE__ */ jsx(
|
|
22498
|
-
|
|
22499
|
-
|
|
22500
|
-
|
|
22501
|
-
|
|
22502
|
-
|
|
22503
|
-
|
|
22504
|
-
|
|
23644
|
+
enableClearOptions && /* @__PURE__ */ jsxs("div", { "data-toolbar-item": "clearOptions", className: "cteditor-flex cteditor-items-center cteditor-gap-1.5", children: [
|
|
23645
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23646
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23647
|
+
Button,
|
|
23648
|
+
{
|
|
23649
|
+
variant: "ghost",
|
|
23650
|
+
size: "icon-sm",
|
|
23651
|
+
disabled: isEditorEmpty,
|
|
23652
|
+
onClick: handleClearEditorContent,
|
|
23653
|
+
children: /* @__PURE__ */ jsx(X$1, { className: "!cteditor-size-4" })
|
|
23654
|
+
}
|
|
23655
|
+
) }),
|
|
23656
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Clear editor" }) })
|
|
23657
|
+
] }) }),
|
|
23658
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23659
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23660
|
+
Button,
|
|
23661
|
+
{
|
|
23662
|
+
variant: "ghost",
|
|
23663
|
+
size: "icon-sm",
|
|
23664
|
+
onClick: clearFormatting,
|
|
23665
|
+
children: /* @__PURE__ */ jsx(Trash, { className: "!cteditor-size-4" })
|
|
23666
|
+
}
|
|
23667
|
+
) }),
|
|
23668
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Clear formatting" }) })
|
|
23669
|
+
] }) })
|
|
22505
23670
|
] }),
|
|
22506
|
-
/* @__PURE__ */ jsx(
|
|
23671
|
+
/* @__PURE__ */ jsx("div", { "data-toolbar-item": "aiOptions", className: "cteditor-aiOption", children: /* @__PURE__ */ jsxs(DropdownMenu$1, { modal: false, children: [
|
|
22507
23672
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
22508
23673
|
Button,
|
|
22509
23674
|
{
|
|
22510
23675
|
variant: "outline",
|
|
22511
23676
|
size: "sm",
|
|
22512
|
-
className: "cteditor-
|
|
23677
|
+
className: "cteditor-px-4 cteditor-gap-3 [&>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",
|
|
22513
23678
|
children: [
|
|
22514
23679
|
/* @__PURE__ */ jsx(MagicoonIcon, {}),
|
|
22515
23680
|
" Go with AI"
|
|
22516
23681
|
]
|
|
22517
23682
|
}
|
|
22518
23683
|
) }),
|
|
22519
|
-
/* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
23684
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { children: [
|
|
22520
23685
|
/* @__PURE__ */ jsxs(
|
|
22521
23686
|
DropdownMenuItem$1,
|
|
22522
23687
|
{
|
|
@@ -22590,33 +23755,351 @@ const Toolbar = ({
|
|
|
22590
23755
|
}
|
|
22591
23756
|
)
|
|
22592
23757
|
] })
|
|
22593
|
-
] }) }) }),
|
|
22594
|
-
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
22595
|
-
enableAIChat && /* @__PURE__ */ jsxs(DropdownMenuItem$1, { onClick: toggleAIChat, disabled: !editable, children: [
|
|
22596
|
-
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-5", children: /* @__PURE__ */ jsx(MessageEditIcon, {}) }),
|
|
22597
|
-
"AI Chat"
|
|
22598
|
-
] }),
|
|
22599
|
-
/* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2", onClick: (e) => e.stopPropagation(), children: [
|
|
22600
|
-
/* @__PURE__ */ jsx(VoiceTranscriptButton, { editor: activeEditor }),
|
|
22601
|
-
/* @__PURE__ */ jsx("span", { className: "cteditor-flex-1", children: "Voice Transcript" })
|
|
22602
23758
|
] }) }),
|
|
22603
|
-
/* @__PURE__ */ jsx(
|
|
22604
|
-
|
|
22605
|
-
/* @__PURE__ */ jsx(
|
|
22606
|
-
|
|
22607
|
-
|
|
22608
|
-
|
|
22609
|
-
|
|
22610
|
-
|
|
22611
|
-
|
|
23759
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
23760
|
+
enableAIChat && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23761
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23762
|
+
Button,
|
|
23763
|
+
{
|
|
23764
|
+
"data-toolbar-item": "aiChat",
|
|
23765
|
+
variant: "ghost",
|
|
23766
|
+
size: "icon-sm",
|
|
23767
|
+
onClick: toggleAIChat,
|
|
23768
|
+
disabled: !editable,
|
|
23769
|
+
className: cn$1(classes.toolbarButton, "[&>svg]:!cteditor-size-5"),
|
|
23770
|
+
children: /* @__PURE__ */ jsx(MessageEditIcon, {})
|
|
23771
|
+
}
|
|
23772
|
+
) }),
|
|
23773
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "AI Chat" }) })
|
|
23774
|
+
] }) }),
|
|
23775
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23776
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("div", { "data-toolbar-item": "voiceTranscript", children: /* @__PURE__ */ jsx(VoiceTranscriptButton, { editor: activeEditor }) }) }),
|
|
23777
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Voice Transcript" }) })
|
|
23778
|
+
] }) }),
|
|
23779
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
23780
|
+
enableAutocompleteToggle && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23781
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23782
|
+
Button,
|
|
23783
|
+
{
|
|
23784
|
+
"data-toolbar-item": "autocomplete",
|
|
23785
|
+
variant: "ghost",
|
|
23786
|
+
size: "icon-sm",
|
|
23787
|
+
onClick: toggleAutocomplete,
|
|
23788
|
+
disabled: !editable,
|
|
23789
|
+
className: cn$1(
|
|
23790
|
+
classes.toolbarButton,
|
|
23791
|
+
toolbarState.isAutocompleteEnabled && "cteditor-bg-foreground/20",
|
|
23792
|
+
"[&>svg]:!cteditor-size-4"
|
|
23793
|
+
),
|
|
23794
|
+
children: /* @__PURE__ */ jsx(SearchTextIcon2, {})
|
|
23795
|
+
}
|
|
23796
|
+
) }),
|
|
23797
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: toolbarState.isAutocompleteEnabled ? "Disable Autocorrection" : "Enable Autocorrection" }) })
|
|
23798
|
+
] }) }),
|
|
23799
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
23800
|
+
(enableHtmlViewToggle || enableHtmlView) && /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23801
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
23802
|
+
Button,
|
|
23803
|
+
{
|
|
23804
|
+
"data-toolbar-item": "htmlView",
|
|
23805
|
+
variant: "ghost",
|
|
23806
|
+
size: "icon-sm",
|
|
23807
|
+
onClick: toggleHtmlView,
|
|
23808
|
+
disabled: !editable,
|
|
23809
|
+
className: cn$1(classes.toolbarButton, isHtmlView && "cteditor-bg-foreground/20"),
|
|
23810
|
+
children: /* @__PURE__ */ jsx(FileCode2, { className: "!cteditor-size-4" })
|
|
23811
|
+
}
|
|
23812
|
+
) }),
|
|
23813
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: isHtmlView ? "Switch to Editor View" : "Switch to HTML View" }) })
|
|
23814
|
+
] }) }),
|
|
23815
|
+
/* @__PURE__ */ jsx(Separator$2, { orientation: "vertical", className: "!cteditor-h-7" }),
|
|
23816
|
+
/* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
23817
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
23818
|
+
Button,
|
|
23819
|
+
{
|
|
23820
|
+
"data-toolbar-item": "exportPdf",
|
|
23821
|
+
variant: "ghost",
|
|
23822
|
+
size: "sm",
|
|
23823
|
+
disabled: isExportingPDF,
|
|
23824
|
+
onClick: handleExportPDF,
|
|
23825
|
+
className: "cteditor-relative",
|
|
23826
|
+
children: [
|
|
23827
|
+
isExportingPDF ? /* @__PURE__ */ jsx(Loader2, { className: "!cteditor-size-4 cteditor-animate-spin" }) : /* @__PURE__ */ jsx(Download, { className: "!cteditor-size-4" }),
|
|
23828
|
+
/* @__PURE__ */ jsx("span", { className: "cteditor-ml-1", children: isExportingPDF ? `Exporting... ${exportProgress}%` : "Export" })
|
|
23829
|
+
]
|
|
23830
|
+
}
|
|
23831
|
+
) }),
|
|
23832
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Export to PDF" }) })
|
|
23833
|
+
] }) })
|
|
22612
23834
|
]
|
|
22613
23835
|
}
|
|
22614
|
-
)
|
|
22615
|
-
|
|
22616
|
-
|
|
22617
|
-
|
|
22618
|
-
|
|
22619
|
-
|
|
23836
|
+
),
|
|
23837
|
+
showMoreMenu && /* @__PURE__ */ jsx("div", { className: "cteditor-ml-2 cteditor-flex-shrink-0", children: /* @__PURE__ */ jsxs(DropdownMenu$1, { open: isMoreMenuOpen, onOpenChange: setIsMoreMenuOpen, children: [
|
|
23838
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon-sm", children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "!cteditor-size-4" }) }) }),
|
|
23839
|
+
/* @__PURE__ */ jsxs(
|
|
23840
|
+
DropdownMenuContent,
|
|
23841
|
+
{
|
|
23842
|
+
align: "end",
|
|
23843
|
+
className: "cteditor-w-56 cteditor-max-h-[400px] cteditor-overflow-y-auto",
|
|
23844
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
23845
|
+
onPointerDownOutside: (e) => {
|
|
23846
|
+
const target = e.target;
|
|
23847
|
+
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")) {
|
|
23848
|
+
e.preventDefault();
|
|
23849
|
+
}
|
|
23850
|
+
},
|
|
23851
|
+
onInteractOutside: (e) => {
|
|
23852
|
+
const target = e.target;
|
|
23853
|
+
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")) {
|
|
23854
|
+
e.preventDefault();
|
|
23855
|
+
}
|
|
23856
|
+
},
|
|
23857
|
+
children: [
|
|
23858
|
+
enableTextFormatting && activeEditor === editor && hiddenItemIds.has("blockFormat") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23859
|
+
/* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(BlockFormatMenu, { blockType }) }) }),
|
|
23860
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
23861
|
+
] }),
|
|
23862
|
+
enableFontControls && (hiddenItemIds.has("fontFamily") || hiddenItemIds.has("fontSize")) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23863
|
+
/* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(FontFamilyMenu, { fonts, activeEditor }) }) }),
|
|
23864
|
+
/* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(FontSizeControl, {}) }) }),
|
|
23865
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
23866
|
+
] }),
|
|
23867
|
+
enableTableOptions && activeEditor === editor && hiddenItemIds.has("tableOptions") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23868
|
+
/* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(TableOptionPlugin, {}) }) }),
|
|
23869
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
23870
|
+
] }),
|
|
23871
|
+
enableTextFormatting && hiddenItemIds.has("inlineFormats") && /* @__PURE__ */ jsxs(
|
|
23872
|
+
DropdownMenuItem$1,
|
|
23873
|
+
{
|
|
23874
|
+
onClick: () => activeEditor.dispatchCommand(FORMAT_TEXT_COMMAND, "strikethrough"),
|
|
23875
|
+
children: [
|
|
23876
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(StrikethroughIcon, {}) }),
|
|
23877
|
+
"Strikethrough"
|
|
23878
|
+
]
|
|
23879
|
+
}
|
|
23880
|
+
),
|
|
23881
|
+
enableCodeFormat && activeEditor === editor && hiddenItemIds.has("codeBlock") && /* @__PURE__ */ jsxs(
|
|
23882
|
+
DropdownMenuItem$1,
|
|
23883
|
+
{
|
|
23884
|
+
onClick: formatCodeBlock,
|
|
23885
|
+
children: [
|
|
23886
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(CodeIcon, {}) }),
|
|
23887
|
+
"Code Block"
|
|
23888
|
+
]
|
|
23889
|
+
}
|
|
23890
|
+
),
|
|
23891
|
+
enableFormatTextMenu && activeEditor === editor && hiddenItemIds.has("formatTextMenu") && /* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(FormatTextMenu, { hasFormat }) }) }),
|
|
23892
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
23893
|
+
enableColorPicker && activeEditor === editor && hiddenItemIds.has("colorPickers") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23894
|
+
/* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5", children: [
|
|
23895
|
+
/* @__PURE__ */ jsx(
|
|
23896
|
+
ColorPicker$2,
|
|
23897
|
+
{
|
|
23898
|
+
title: "Font color",
|
|
23899
|
+
onChange: (color) => {
|
|
23900
|
+
onFontColorSelect(color);
|
|
23901
|
+
setIsMoreMenuOpen(true);
|
|
23902
|
+
},
|
|
23903
|
+
icon: /* @__PURE__ */ jsxs("div", { className: "cteditor-flex cteditor-flex-col cteditor-items-center cteditor-justify-center", children: [
|
|
23904
|
+
/* @__PURE__ */ jsx("p", { className: "cteditor-text-[11px] cteditor-leading-none", children: "A" }),
|
|
23905
|
+
/* @__PURE__ */ jsx(
|
|
23906
|
+
"div",
|
|
23907
|
+
{
|
|
23908
|
+
className: "cteditor-w-[14px] cteditor-h-[2px]",
|
|
23909
|
+
style: { backgroundColor: toolbarState.fontColor }
|
|
23910
|
+
}
|
|
23911
|
+
)
|
|
23912
|
+
] }),
|
|
23913
|
+
bgClassName: "bg-input"
|
|
23914
|
+
},
|
|
23915
|
+
"color-picker-dropdown"
|
|
23916
|
+
),
|
|
23917
|
+
/* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-sm", children: "Font Color" })
|
|
23918
|
+
] }),
|
|
23919
|
+
/* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5", children: [
|
|
23920
|
+
/* @__PURE__ */ jsx(
|
|
23921
|
+
ColorPicker$2,
|
|
23922
|
+
{
|
|
23923
|
+
title: "Background color",
|
|
23924
|
+
onChange: (color) => {
|
|
23925
|
+
onBgColorSelect(color);
|
|
23926
|
+
setIsMoreMenuOpen(true);
|
|
23927
|
+
}
|
|
23928
|
+
},
|
|
23929
|
+
"bg-color-picker-dropdown"
|
|
23930
|
+
),
|
|
23931
|
+
/* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-sm", children: "Background Color" })
|
|
23932
|
+
] }),
|
|
23933
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
23934
|
+
] }),
|
|
23935
|
+
enableLinks && activeEditor === editor && hiddenItemIds.has("link") && /* @__PURE__ */ jsxs(DropdownMenuItem$1, { onClick: insertLink, children: [
|
|
23936
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(LinkIcon, {}) }),
|
|
23937
|
+
isLinkActive ? "Remove Link" : "Insert Link"
|
|
23938
|
+
] }),
|
|
23939
|
+
enableEmojiPicker && hiddenItemIds.has("emoji") && /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-px-2 cteditor-py-1.5", children: [
|
|
23940
|
+
/* @__PURE__ */ jsx(
|
|
23941
|
+
EmojiPickerWidget,
|
|
23942
|
+
{
|
|
23943
|
+
icon: /* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(FaceSmileIcon, {}) }),
|
|
23944
|
+
onChange: (emojiData) => {
|
|
23945
|
+
handleEmojiClick(emojiData);
|
|
23946
|
+
setIsMoreMenuOpen(true);
|
|
23947
|
+
}
|
|
23948
|
+
},
|
|
23949
|
+
"emoji-picker-dropdown"
|
|
23950
|
+
),
|
|
23951
|
+
/* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-sm", children: "Emoji" })
|
|
23952
|
+
] }),
|
|
23953
|
+
enableInsertMenu && activeEditor === editor && hiddenItemIds.has("insertMenu") && /* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(InsertMenu, {}) }) }),
|
|
23954
|
+
enableTodoList && activeEditor === editor && hiddenItemIds.has("todo") && /* @__PURE__ */ jsxs(DropdownMenuItem$1, { onClick: createTodo, children: [
|
|
23955
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(TodoIcon, {}) }),
|
|
23956
|
+
"Todo List"
|
|
23957
|
+
] }),
|
|
23958
|
+
enableNotePanels && activeEditor === editor && hiddenItemIds.has("notePanels") && /* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx("div", { className: "[&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(NotePanelMenu, {}) }) }) }),
|
|
23959
|
+
hiddenItemIds.has("highlight") && /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2 cteditor-px-2 cteditor-py-1.5", children: [
|
|
23960
|
+
/* @__PURE__ */ jsx(
|
|
23961
|
+
HighlightColorPicker,
|
|
23962
|
+
{
|
|
23963
|
+
onChange: (color) => {
|
|
23964
|
+
onHighlightColorSelect(color);
|
|
23965
|
+
setIsMoreMenuOpen(true);
|
|
23966
|
+
},
|
|
23967
|
+
isActive: toolbarState.isHighlight
|
|
23968
|
+
}
|
|
23969
|
+
),
|
|
23970
|
+
/* @__PURE__ */ jsx("span", { className: "cteditor-flex-1 cteditor-text-sm", children: "Highlight" })
|
|
23971
|
+
] }),
|
|
23972
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
23973
|
+
enableAlignment && activeEditor === editor && hiddenItemIds.has("alignMenu") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23974
|
+
/* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(AlignMenu, {}) }) }),
|
|
23975
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
23976
|
+
] }),
|
|
23977
|
+
enableClearOptions && hiddenItemIds.has("clearOptions") && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23978
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem$1, { onClick: handleClearEditorContent, disabled: isEditorEmpty, children: [
|
|
23979
|
+
/* @__PURE__ */ jsx(X$1, { className: "!cteditor-size-4 cteditor-mr-2" }),
|
|
23980
|
+
"Clear Editor"
|
|
23981
|
+
] }),
|
|
23982
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem$1, { onClick: clearFormatting, children: [
|
|
23983
|
+
/* @__PURE__ */ jsx(Trash, { className: "!cteditor-size-4 cteditor-mr-2" }),
|
|
23984
|
+
"Clear Formatting"
|
|
23985
|
+
] }),
|
|
23986
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
23987
|
+
] }),
|
|
23988
|
+
hiddenItemIds.has("aiOptions") && /* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsx("div", { className: "cteditor-aiOption cteditor-w-full", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs(DropdownMenu$1, { modal: false, children: [
|
|
23989
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
23990
|
+
Button,
|
|
23991
|
+
{
|
|
23992
|
+
variant: "outline",
|
|
23993
|
+
size: "sm",
|
|
23994
|
+
className: "cteditor-w-full cteditor-px-4 cteditor-gap-3 [&>svg]:!cteditor-size-4",
|
|
23995
|
+
children: [
|
|
23996
|
+
/* @__PURE__ */ jsx(MagicoonIcon, {}),
|
|
23997
|
+
" Go with AI"
|
|
23998
|
+
]
|
|
23999
|
+
}
|
|
24000
|
+
) }),
|
|
24001
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { side: "right", align: "start", children: [
|
|
24002
|
+
/* @__PURE__ */ jsxs(
|
|
24003
|
+
DropdownMenuItem$1,
|
|
24004
|
+
{
|
|
24005
|
+
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "SPELLING_GRAMMAR" }),
|
|
24006
|
+
children: [
|
|
24007
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(SearchTextIcon, {}) }),
|
|
24008
|
+
" ",
|
|
24009
|
+
"Fix Grammar"
|
|
24010
|
+
]
|
|
24011
|
+
}
|
|
24012
|
+
),
|
|
24013
|
+
/* @__PURE__ */ jsxs(
|
|
24014
|
+
DropdownMenuItem$1,
|
|
24015
|
+
{
|
|
24016
|
+
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "SIMPLIFY" }),
|
|
24017
|
+
children: [
|
|
24018
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(PenLineIcon, {}) }),
|
|
24019
|
+
" ",
|
|
24020
|
+
"Simplify"
|
|
24021
|
+
]
|
|
24022
|
+
}
|
|
24023
|
+
),
|
|
24024
|
+
/* @__PURE__ */ jsxs(
|
|
24025
|
+
DropdownMenuItem$1,
|
|
24026
|
+
{
|
|
24027
|
+
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "COMPLETE_SENTENCE" }),
|
|
24028
|
+
children: [
|
|
24029
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(MenuAltIcon, {}) }),
|
|
24030
|
+
"Complete Sentence"
|
|
24031
|
+
]
|
|
24032
|
+
}
|
|
24033
|
+
),
|
|
24034
|
+
/* @__PURE__ */ jsxs(
|
|
24035
|
+
DropdownMenuItem$1,
|
|
24036
|
+
{
|
|
24037
|
+
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "EMOJIFY" }),
|
|
24038
|
+
children: [
|
|
24039
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(FaceSmileIcon2, {}) }),
|
|
24040
|
+
"Emojify"
|
|
24041
|
+
]
|
|
24042
|
+
}
|
|
24043
|
+
),
|
|
24044
|
+
/* @__PURE__ */ jsxs(
|
|
24045
|
+
DropdownMenuItem$1,
|
|
24046
|
+
{
|
|
24047
|
+
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "TRANSLATE" }),
|
|
24048
|
+
children: [
|
|
24049
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(TranslateIcon, {}) }),
|
|
24050
|
+
"Translate"
|
|
24051
|
+
]
|
|
24052
|
+
}
|
|
24053
|
+
),
|
|
24054
|
+
/* @__PURE__ */ jsxs(
|
|
24055
|
+
DropdownMenuItem$1,
|
|
24056
|
+
{
|
|
24057
|
+
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "AI_RESPONSE" }),
|
|
24058
|
+
children: [
|
|
24059
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(SparkleIcon, {}) }),
|
|
24060
|
+
"AI"
|
|
24061
|
+
]
|
|
24062
|
+
}
|
|
24063
|
+
),
|
|
24064
|
+
/* @__PURE__ */ jsxs(
|
|
24065
|
+
DropdownMenuItem$1,
|
|
24066
|
+
{
|
|
24067
|
+
onClick: () => editor.dispatchCommand(AI_IMAGE_COMMAND, { type: "CREATE_IMAGE" }),
|
|
24068
|
+
children: [
|
|
24069
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-1 [&>svg]:cteditor-size-5", children: /* @__PURE__ */ jsx(ImageIcon, {}) }),
|
|
24070
|
+
"Generate Image"
|
|
24071
|
+
]
|
|
24072
|
+
}
|
|
24073
|
+
)
|
|
24074
|
+
] })
|
|
24075
|
+
] }) }) }),
|
|
24076
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
24077
|
+
enableAIChat && hiddenItemIds.has("aiChat") && /* @__PURE__ */ jsxs(DropdownMenuItem$1, { onClick: toggleAIChat, disabled: !editable, children: [
|
|
24078
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-5", children: /* @__PURE__ */ jsx(MessageEditIcon, {}) }),
|
|
24079
|
+
"AI Chat"
|
|
24080
|
+
] }),
|
|
24081
|
+
hiddenItemIds.has("voiceTranscript") && /* @__PURE__ */ jsx(DropdownMenuItem$1, { asChild: true, onSelect: (e) => e.preventDefault(), children: /* @__PURE__ */ jsxs("div", { className: "cteditor-w-full cteditor-flex cteditor-items-center cteditor-gap-2", onClick: (e) => e.stopPropagation(), children: [
|
|
24082
|
+
/* @__PURE__ */ jsx(VoiceTranscriptButton, { editor: activeEditor }),
|
|
24083
|
+
/* @__PURE__ */ jsx("span", { className: "cteditor-flex-1", children: "Voice Transcript" })
|
|
24084
|
+
] }) }),
|
|
24085
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
24086
|
+
enableAutocompleteToggle && hiddenItemIds.has("autocomplete") && /* @__PURE__ */ jsxs(DropdownMenuItem$1, { onClick: toggleAutocomplete, disabled: !editable, children: [
|
|
24087
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-mr-2 [&>svg]:!cteditor-size-4", children: /* @__PURE__ */ jsx(SearchTextIcon2, {}) }),
|
|
24088
|
+
toolbarState.isAutocompleteEnabled ? "Disable Autocorrection" : "Enable Autocorrection"
|
|
24089
|
+
] }),
|
|
24090
|
+
(enableHtmlViewToggle || enableHtmlView) && hiddenItemIds.has("htmlView") && /* @__PURE__ */ jsxs(DropdownMenuItem$1, { onClick: toggleHtmlView, disabled: !editable, children: [
|
|
24091
|
+
/* @__PURE__ */ jsx(FileCode2, { className: "cteditor-mr-2 !cteditor-size-4" }),
|
|
24092
|
+
isHtmlView ? "Switch to Editor View" : "Switch to HTML View"
|
|
24093
|
+
] })
|
|
24094
|
+
]
|
|
24095
|
+
}
|
|
24096
|
+
)
|
|
24097
|
+
] }) }),
|
|
24098
|
+
/* @__PURE__ */ jsx(VoiceTranscriptPlugin, {})
|
|
24099
|
+
]
|
|
24100
|
+
}
|
|
24101
|
+
)
|
|
24102
|
+
] });
|
|
22620
24103
|
};
|
|
22621
24104
|
function Skeleton({
|
|
22622
24105
|
className,
|
|
@@ -22625,7 +24108,7 @@ function Skeleton({
|
|
|
22625
24108
|
return /* @__PURE__ */ jsx(
|
|
22626
24109
|
"div",
|
|
22627
24110
|
{
|
|
22628
|
-
className: cn("animate-pulse rounded-md bg-primary/10", className),
|
|
24111
|
+
className: cn$1("animate-pulse rounded-md bg-primary/10", className),
|
|
22629
24112
|
...props
|
|
22630
24113
|
}
|
|
22631
24114
|
);
|
|
@@ -23299,7 +24782,7 @@ function AutocompletePlugin({
|
|
|
23299
24782
|
/* @__PURE__ */ jsx("div", { className: "cteditor-space-y-1", children: suggestions.map((option, index2) => /* @__PURE__ */ jsxs(
|
|
23300
24783
|
"div",
|
|
23301
24784
|
{
|
|
23302
|
-
className: cn(
|
|
24785
|
+
className: cn$1(
|
|
23303
24786
|
"cteditor-flex cteditor-items-start cteditor-gap-3 cteditor-p-3 cteditor-rounded-md cteditor-cursor-pointer cteditor-transition-colors cteditor-text-sm",
|
|
23304
24787
|
index2 === selectedIndex ? "cteditor-bg-background" : "hover:cteditor-bg-background/50"
|
|
23305
24788
|
),
|
|
@@ -23309,7 +24792,7 @@ function AutocompletePlugin({
|
|
|
23309
24792
|
/* @__PURE__ */ jsx(
|
|
23310
24793
|
"div",
|
|
23311
24794
|
{
|
|
23312
|
-
className: cn(
|
|
24795
|
+
className: cn$1(
|
|
23313
24796
|
"cteditor-mt-0.5",
|
|
23314
24797
|
index2 === selectedIndex ? "cteditor-text-primary" : "cteditor-text-primary"
|
|
23315
24798
|
),
|
|
@@ -24480,11 +25963,11 @@ const DropdownMenu = ({ children, trigger }) => {
|
|
|
24480
25963
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
24481
25964
|
};
|
|
24482
25965
|
}, [isOpen]);
|
|
24483
|
-
return /* @__PURE__ */ jsxs("div", { ref: dropdownRef, className: "relative", children: [
|
|
25966
|
+
return /* @__PURE__ */ jsxs("div", { ref: dropdownRef, className: "cteditor-relative", children: [
|
|
24484
25967
|
/* @__PURE__ */ jsx("div", { onClick: () => setIsOpen(!isOpen), children: trigger }),
|
|
24485
|
-
isOpen && /* @__PURE__ */ jsxs("div", { className: "absolute top-full left-0 mt-2
|
|
24486
|
-
/* @__PURE__ */ jsx("div", { className: "px-2 py-
|
|
24487
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-col", children })
|
|
25968
|
+
isOpen && /* @__PURE__ */ jsxs("div", { className: "cteditor-absolute cteditor-top-full cteditor-left-0 cteditor-mt-2 cteditor-bg-accent cteditor-rounded-lg cteditor-shadow-xl cteditor-z-50 cteditor-min-w-56 cteditor-py-1 improve-dropdown", children: [
|
|
25969
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-px-2 cteditor-py-2 cteditor-text-xs cteditor-font-medium cteditor-uppercase cteditor-tracking-wide cteditor-border-b cteditor-border-foreground/5", children: "AI Tools" }),
|
|
25970
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-flex cteditor-flex-col", children })
|
|
24488
25971
|
] })
|
|
24489
25972
|
] });
|
|
24490
25973
|
};
|
|
@@ -24495,7 +25978,7 @@ const DropdownMenuItem = ({
|
|
|
24495
25978
|
return /* @__PURE__ */ jsx(
|
|
24496
25979
|
"button",
|
|
24497
25980
|
{
|
|
24498
|
-
className: "w-full px-3 py-
|
|
25981
|
+
className: "cteditor-w-full cteditor-px-3 cteditor-py-1.5 cteditor-text-left cteditor-text-xs cteditor-flex cteditor-items-center cteditor-gap-3 cteditor-transition-colors cteditor-duration-150 improve-dropdown-item block hover:cteditor-bg-foreground/5",
|
|
24499
25982
|
onClick,
|
|
24500
25983
|
children
|
|
24501
25984
|
}
|
|
@@ -24650,7 +26133,7 @@ function TextFormatFloatingToolbar({
|
|
|
24650
26133
|
"div",
|
|
24651
26134
|
{
|
|
24652
26135
|
ref: popupCharStylesEditorRef,
|
|
24653
|
-
className: "floating-text-format-popup bg-
|
|
26136
|
+
className: "floating-text-format-popup cteditor-bg-accent cteditor-text-sm [&>button]:cteditor-relative [&>button:hover>span]:cteditor-bottom-full [&>button:hover>span]:cteditor-opacity-100",
|
|
24654
26137
|
children: editor.isEditable() && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24655
26138
|
(features == null ? void 0 : features.bold) && /* @__PURE__ */ jsxs(
|
|
24656
26139
|
"button",
|
|
@@ -24659,12 +26142,12 @@ function TextFormatFloatingToolbar({
|
|
|
24659
26142
|
onClick: () => {
|
|
24660
26143
|
editor.dispatchCommand(FORMAT_TEXT_COMMAND, "bold");
|
|
24661
26144
|
},
|
|
24662
|
-
className: "popup-item spaced
|
|
26145
|
+
className: "popup-item spaced " + (isBold ? "active" : ""),
|
|
24663
26146
|
title: "Bold",
|
|
24664
26147
|
"aria-label": "Format text as bold",
|
|
24665
26148
|
children: [
|
|
24666
26149
|
/* @__PURE__ */ jsx(BoldIcon, {}),
|
|
24667
|
-
/* @__PURE__ */ jsx("span", { children: "Bold" })
|
|
26150
|
+
/* @__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: "Bold" })
|
|
24668
26151
|
]
|
|
24669
26152
|
}
|
|
24670
26153
|
),
|
|
@@ -24680,7 +26163,7 @@ function TextFormatFloatingToolbar({
|
|
|
24680
26163
|
"aria-label": "Format text as italics",
|
|
24681
26164
|
children: [
|
|
24682
26165
|
/* @__PURE__ */ jsx(ItalicIcon, {}),
|
|
24683
|
-
/* @__PURE__ */ jsx("span", { children: "Italic" })
|
|
26166
|
+
/* @__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: "Italic" })
|
|
24684
26167
|
]
|
|
24685
26168
|
}
|
|
24686
26169
|
),
|
|
@@ -24696,7 +26179,7 @@ function TextFormatFloatingToolbar({
|
|
|
24696
26179
|
"aria-label": "Format text to underlined",
|
|
24697
26180
|
children: [
|
|
24698
26181
|
/* @__PURE__ */ jsx(UnderlineIcon, {}),
|
|
24699
|
-
/* @__PURE__ */ jsx("span", { children: "Underline" })
|
|
26182
|
+
/* @__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: "Underline" })
|
|
24700
26183
|
]
|
|
24701
26184
|
}
|
|
24702
26185
|
),
|
|
@@ -24712,7 +26195,7 @@ function TextFormatFloatingToolbar({
|
|
|
24712
26195
|
"aria-label": "Format text with a strikethrough",
|
|
24713
26196
|
children: [
|
|
24714
26197
|
/* @__PURE__ */ jsx(StrikethroughIcon, {}),
|
|
24715
|
-
/* @__PURE__ */ jsx("span", { children: "Strikethrough" })
|
|
26198
|
+
/* @__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: "Strikethrough" })
|
|
24716
26199
|
]
|
|
24717
26200
|
}
|
|
24718
26201
|
),
|
|
@@ -24728,7 +26211,7 @@ function TextFormatFloatingToolbar({
|
|
|
24728
26211
|
"aria-label": "Format Subscript",
|
|
24729
26212
|
children: [
|
|
24730
26213
|
/* @__PURE__ */ jsx(SubscriptIcon, {}),
|
|
24731
|
-
/* @__PURE__ */ jsx("span", { children: "Subscript" })
|
|
26214
|
+
/* @__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: "Subscript" })
|
|
24732
26215
|
]
|
|
24733
26216
|
}
|
|
24734
26217
|
),
|
|
@@ -24744,7 +26227,7 @@ function TextFormatFloatingToolbar({
|
|
|
24744
26227
|
"aria-label": "Format Superscript",
|
|
24745
26228
|
children: [
|
|
24746
26229
|
/* @__PURE__ */ jsx(SuperscriptIcon, {}),
|
|
24747
|
-
/* @__PURE__ */ jsx("span", { children: "Superscript" })
|
|
26230
|
+
/* @__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: "Superscript" })
|
|
24748
26231
|
]
|
|
24749
26232
|
}
|
|
24750
26233
|
),
|
|
@@ -24760,7 +26243,7 @@ function TextFormatFloatingToolbar({
|
|
|
24760
26243
|
"aria-label": "Format text to uppercase",
|
|
24761
26244
|
children: [
|
|
24762
26245
|
/* @__PURE__ */ jsx(TypeUppercaseIcon, {}),
|
|
24763
|
-
/* @__PURE__ */ jsx("span", { children: "Uppercase" })
|
|
26246
|
+
/* @__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: "Uppercase" })
|
|
24764
26247
|
]
|
|
24765
26248
|
}
|
|
24766
26249
|
),
|
|
@@ -24776,7 +26259,7 @@ function TextFormatFloatingToolbar({
|
|
|
24776
26259
|
"aria-label": "Format text to lowercase",
|
|
24777
26260
|
children: [
|
|
24778
26261
|
/* @__PURE__ */ jsx(TypeLowercaseIcon, {}),
|
|
24779
|
-
/* @__PURE__ */ jsx("span", { children: "Lowercase" })
|
|
26262
|
+
/* @__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: "Lowercase" })
|
|
24780
26263
|
]
|
|
24781
26264
|
}
|
|
24782
26265
|
),
|
|
@@ -24792,7 +26275,7 @@ function TextFormatFloatingToolbar({
|
|
|
24792
26275
|
"aria-label": "Format text to capitalize",
|
|
24793
26276
|
children: [
|
|
24794
26277
|
/* @__PURE__ */ jsx(TypeCapitalizeIcon, {}),
|
|
24795
|
-
/* @__PURE__ */ jsx("span", { children: "Capitalize" })
|
|
26278
|
+
/* @__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: "Capitalize" })
|
|
24796
26279
|
]
|
|
24797
26280
|
}
|
|
24798
26281
|
),
|
|
@@ -24806,7 +26289,7 @@ function TextFormatFloatingToolbar({
|
|
|
24806
26289
|
"aria-label": "Insert code block",
|
|
24807
26290
|
children: [
|
|
24808
26291
|
/* @__PURE__ */ jsx(CodeIcon, {}),
|
|
24809
|
-
/* @__PURE__ */ jsx("span", { children: "Code block" })
|
|
26292
|
+
/* @__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: "Code block" })
|
|
24810
26293
|
]
|
|
24811
26294
|
}
|
|
24812
26295
|
),
|
|
@@ -24820,7 +26303,7 @@ function TextFormatFloatingToolbar({
|
|
|
24820
26303
|
"aria-label": "Insert link",
|
|
24821
26304
|
children: [
|
|
24822
26305
|
/* @__PURE__ */ jsx(LinkIcon, {}),
|
|
24823
|
-
/* @__PURE__ */ jsx("span", { children: "Insert link" })
|
|
26306
|
+
/* @__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: "Insert link" })
|
|
24824
26307
|
]
|
|
24825
26308
|
}
|
|
24826
26309
|
),
|
|
@@ -24831,12 +26314,13 @@ function TextFormatFloatingToolbar({
|
|
|
24831
26314
|
onClick: () => {
|
|
24832
26315
|
editor.dispatchCommand(TOGGLE_AI_CHAT_COMMAND, void 0);
|
|
24833
26316
|
},
|
|
24834
|
-
className: "popup-item spaced
|
|
26317
|
+
className: "popup-item spaced cteditor-flex cteditor-items-center cteditor-justify-center",
|
|
24835
26318
|
title: "AI Chat",
|
|
24836
26319
|
"aria-label": "Open AI Chat",
|
|
24837
26320
|
children: [
|
|
24838
26321
|
/* @__PURE__ */ jsx(MessageEditIcon, {}),
|
|
24839
|
-
"
|
|
26322
|
+
" ",
|
|
26323
|
+
/* @__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: "AI Chat" })
|
|
24840
26324
|
]
|
|
24841
26325
|
}
|
|
24842
26326
|
),
|
|
@@ -24847,12 +26331,12 @@ function TextFormatFloatingToolbar({
|
|
|
24847
26331
|
onClick: () => {
|
|
24848
26332
|
editor.dispatchCommand(OPEN_COMMENT_MODAL_COMMAND, void 0);
|
|
24849
26333
|
},
|
|
24850
|
-
className: "popup-item spaced
|
|
26334
|
+
className: "popup-item spaced cteditor-flex cteditor-items-center cteditor-justify-center",
|
|
24851
26335
|
title: "Add Comment",
|
|
24852
26336
|
"aria-label": "Add Comment",
|
|
24853
26337
|
children: [
|
|
24854
|
-
/* @__PURE__ */ jsx(
|
|
24855
|
-
" Add Comment"
|
|
26338
|
+
/* @__PURE__ */ jsx(AddCommentIcon, {}),
|
|
26339
|
+
/* @__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: "Add Comment" })
|
|
24856
26340
|
]
|
|
24857
26341
|
}
|
|
24858
26342
|
),
|
|
@@ -24863,12 +26347,12 @@ function TextFormatFloatingToolbar({
|
|
|
24863
26347
|
"button",
|
|
24864
26348
|
{
|
|
24865
26349
|
type: "button",
|
|
24866
|
-
className: "popup-item spaced [&>
|
|
26350
|
+
className: "popup-item spaced cteditor-flex cteditor-items-center cteditor-justify-center cteditor-relative [&>span]:hover:cteditor-bottom-full [&>span]:hover:cteditor-opacity-100",
|
|
24867
26351
|
title: "Improve with AI",
|
|
24868
26352
|
"aria-label": "Improve with AI",
|
|
24869
26353
|
children: [
|
|
24870
26354
|
/* @__PURE__ */ jsx(MagicoonIcon, {}),
|
|
24871
|
-
" Improve with AI"
|
|
26355
|
+
/* @__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: "Improve with AI" })
|
|
24872
26356
|
]
|
|
24873
26357
|
}
|
|
24874
26358
|
),
|
|
@@ -24878,7 +26362,7 @@ function TextFormatFloatingToolbar({
|
|
|
24878
26362
|
{
|
|
24879
26363
|
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "SPELLING_GRAMMAR" }),
|
|
24880
26364
|
children: [
|
|
24881
|
-
/* @__PURE__ */ jsx("div", { className: "w-5 h-5 flex items-center justify-center", children: /* @__PURE__ */ jsx(SearchTextIcon, {}) }),
|
|
26365
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-w-5 cteditor-h-5 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(SearchTextIcon, {}) }),
|
|
24882
26366
|
/* @__PURE__ */ jsx("span", { children: "Fix Grammar" })
|
|
24883
26367
|
]
|
|
24884
26368
|
}
|
|
@@ -24888,7 +26372,7 @@ function TextFormatFloatingToolbar({
|
|
|
24888
26372
|
{
|
|
24889
26373
|
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "SIMPLIFY" }),
|
|
24890
26374
|
children: [
|
|
24891
|
-
/* @__PURE__ */ jsx("div", { className: "w-5 h-5 flex items-center justify-center", children: /* @__PURE__ */ jsx(PenLineIcon, {}) }),
|
|
26375
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-w-5 cteditor-h-5 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(PenLineIcon, {}) }),
|
|
24892
26376
|
/* @__PURE__ */ jsx("span", { children: "Simplify" })
|
|
24893
26377
|
]
|
|
24894
26378
|
}
|
|
@@ -24898,7 +26382,7 @@ function TextFormatFloatingToolbar({
|
|
|
24898
26382
|
{
|
|
24899
26383
|
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "COMPLETE_SENTENCE" }),
|
|
24900
26384
|
children: [
|
|
24901
|
-
/* @__PURE__ */ jsx("div", { className: "w-5 h-5 flex items-center justify-center", children: /* @__PURE__ */ jsx(MenuAltIcon, {}) }),
|
|
26385
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-w-5 cteditor-h-5 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(MenuAltIcon, {}) }),
|
|
24902
26386
|
/* @__PURE__ */ jsx("span", { children: "Complete Sentence" })
|
|
24903
26387
|
]
|
|
24904
26388
|
}
|
|
@@ -24908,7 +26392,7 @@ function TextFormatFloatingToolbar({
|
|
|
24908
26392
|
{
|
|
24909
26393
|
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "EMOJIFY" }),
|
|
24910
26394
|
children: [
|
|
24911
|
-
/* @__PURE__ */ jsx("div", { className: "w-5 h-5 flex items-center justify-center", children: /* @__PURE__ */ jsx(FaceSmileIcon2, {}) }),
|
|
26395
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-w-5 cteditor-h-5 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(FaceSmileIcon2, {}) }),
|
|
24912
26396
|
/* @__PURE__ */ jsx("span", { children: "Emojify" })
|
|
24913
26397
|
]
|
|
24914
26398
|
}
|
|
@@ -24918,7 +26402,7 @@ function TextFormatFloatingToolbar({
|
|
|
24918
26402
|
{
|
|
24919
26403
|
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "TRANSLATE" }),
|
|
24920
26404
|
children: [
|
|
24921
|
-
/* @__PURE__ */ jsx("div", { className: "w-5 h-5 flex items-center justify-center", children: /* @__PURE__ */ jsx(TranslateIcon, {}) }),
|
|
26405
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-w-5 cteditor-h-5 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(TranslateIcon, {}) }),
|
|
24922
26406
|
/* @__PURE__ */ jsx("span", { children: "Translate" })
|
|
24923
26407
|
]
|
|
24924
26408
|
}
|
|
@@ -24928,7 +26412,7 @@ function TextFormatFloatingToolbar({
|
|
|
24928
26412
|
{
|
|
24929
26413
|
onClick: () => editor.dispatchCommand(AI_ACTION_COMMAND, { type: "AI_RESPONSE" }),
|
|
24930
26414
|
children: [
|
|
24931
|
-
/* @__PURE__ */ jsx("div", { className: "w-5 h-5 flex items-center justify-center", children: /* @__PURE__ */ jsx(SparkleIcon, {}) }),
|
|
26415
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-w-5 cteditor-h-5 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(SparkleIcon, {}) }),
|
|
24932
26416
|
/* @__PURE__ */ jsx("span", { children: "AI Response" })
|
|
24933
26417
|
]
|
|
24934
26418
|
}
|
|
@@ -24938,7 +26422,7 @@ function TextFormatFloatingToolbar({
|
|
|
24938
26422
|
{
|
|
24939
26423
|
onClick: () => editor.dispatchCommand(AI_IMAGE_COMMAND, { type: "CREATE_IMAGE" }),
|
|
24940
26424
|
children: [
|
|
24941
|
-
/* @__PURE__ */ jsx("div", { className: "w-5 h-5 flex items-center justify-center", children: /* @__PURE__ */ jsx(ImageIcon, {}) }),
|
|
26425
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-w-5 cteditor-h-5 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(ImageIcon, {}) }),
|
|
24942
26426
|
/* @__PURE__ */ jsx("span", { children: "Generate Image" })
|
|
24943
26427
|
]
|
|
24944
26428
|
}
|
|
@@ -24948,7 +26432,7 @@ function TextFormatFloatingToolbar({
|
|
|
24948
26432
|
{
|
|
24949
26433
|
onClick: toggleHtmlView,
|
|
24950
26434
|
children: [
|
|
24951
|
-
/* @__PURE__ */ jsx("div", { className: "w-5 h-5 flex items-center justify-center", children: /* @__PURE__ */ jsx(FileCode2, { className: "!cteditor-size-4" }) }),
|
|
26435
|
+
/* @__PURE__ */ jsx("div", { className: "cteditor-w-5 cteditor-h-5 cteditor-flex cteditor-items-center cteditor-justify-center", children: /* @__PURE__ */ jsx(FileCode2, { className: "!cteditor-size-4" }) }),
|
|
24952
26436
|
/* @__PURE__ */ jsx("span", { children: isHtmlView ? "Switch to Editor View" : "Switch to HTML View" })
|
|
24953
26437
|
]
|
|
24954
26438
|
}
|
|
@@ -27569,17 +29053,80 @@ function GrammarCheckPlugin() {
|
|
|
27569
29053
|
}
|
|
27570
29054
|
const useStyles = () => ({
|
|
27571
29055
|
// container: "cteditor-relative cteditor-w-full cteditor-bg-white cteditor-text-black cteditor-font-normal cteditor-text-left cteditor-border cteditor-border-red-500",
|
|
27572
|
-
contentEditable: cn(
|
|
27573
|
-
"cteditor-relative cteditor-min-h-[150px] cteditor-
|
|
27574
|
-
"cteditor-text-base cteditor-caret-[#757575] cteditor-p-[15px] cteditor-
|
|
29056
|
+
contentEditable: cn$1(
|
|
29057
|
+
"cteditor-relative cteditor-min-h-[150px] cteditor-resize-none cteditor-outline-none cteditor-bg-background cteditor-rounded-lg",
|
|
29058
|
+
"cteditor-text-base cteditor-caret-[#757575] cteditor-p-[15px] cteditor-transition-all cteditor-duration-200",
|
|
29059
|
+
"cteditor-w-full cteditor-box-border",
|
|
27575
29060
|
"[&>hr]:cteditor-border-none [&>hr]:cteditor-h-[2px]"
|
|
27576
29061
|
),
|
|
27577
|
-
placeholder: cn(
|
|
29062
|
+
placeholder: cn$1(
|
|
27578
29063
|
"cteditor-absolute cteditor-top-4 cteditor-left-4 cteditor-text-[15px] cteditor-text-[#9e9e9e]",
|
|
27579
29064
|
"cteditor-overflow-hidden cteditor-text-ellipsis cteditor-whitespace-nowrap",
|
|
27580
29065
|
"cteditor-select-none cteditor-pointer-events-none cteditor-inline-block"
|
|
27581
29066
|
)
|
|
27582
29067
|
});
|
|
29068
|
+
const useAutoExpandingHeight = ({
|
|
29069
|
+
minHeight = 150,
|
|
29070
|
+
maxHeight = 800,
|
|
29071
|
+
transitionDuration = 200
|
|
29072
|
+
} = {}) => {
|
|
29073
|
+
const [height, setHeight] = useState(minHeight);
|
|
29074
|
+
const contentRef = useRef(null);
|
|
29075
|
+
const resizeObserverRef = useRef(null);
|
|
29076
|
+
useEffect(() => {
|
|
29077
|
+
const element = contentRef.current;
|
|
29078
|
+
if (!element)
|
|
29079
|
+
return;
|
|
29080
|
+
const updateHeight = () => {
|
|
29081
|
+
const scrollHeight = element.scrollHeight;
|
|
29082
|
+
const newHeight = Math.max(minHeight, Math.min(maxHeight, scrollHeight));
|
|
29083
|
+
if (newHeight !== height) {
|
|
29084
|
+
setHeight(newHeight);
|
|
29085
|
+
}
|
|
29086
|
+
};
|
|
29087
|
+
updateHeight();
|
|
29088
|
+
if (window.ResizeObserver) {
|
|
29089
|
+
resizeObserverRef.current = new ResizeObserver(() => {
|
|
29090
|
+
updateHeight();
|
|
29091
|
+
});
|
|
29092
|
+
resizeObserverRef.current.observe(element);
|
|
29093
|
+
}
|
|
29094
|
+
const mutationObserver = new MutationObserver(() => {
|
|
29095
|
+
updateHeight();
|
|
29096
|
+
const imgs = element.querySelectorAll("img");
|
|
29097
|
+
imgs.forEach((img) => {
|
|
29098
|
+
img.addEventListener("load", updateHeight, { once: true });
|
|
29099
|
+
});
|
|
29100
|
+
});
|
|
29101
|
+
mutationObserver.observe(element, {
|
|
29102
|
+
childList: true,
|
|
29103
|
+
subtree: true,
|
|
29104
|
+
attributes: true,
|
|
29105
|
+
characterData: true
|
|
29106
|
+
});
|
|
29107
|
+
const handleInput = () => updateHeight();
|
|
29108
|
+
element.addEventListener("input", handleInput);
|
|
29109
|
+
element.addEventListener("load", updateHeight, true);
|
|
29110
|
+
return () => {
|
|
29111
|
+
if (resizeObserverRef.current) {
|
|
29112
|
+
resizeObserverRef.current.disconnect();
|
|
29113
|
+
}
|
|
29114
|
+
mutationObserver.disconnect();
|
|
29115
|
+
element.removeEventListener("input", handleInput);
|
|
29116
|
+
element.removeEventListener("load", updateHeight, true);
|
|
29117
|
+
};
|
|
29118
|
+
}, [minHeight, maxHeight, height]);
|
|
29119
|
+
return {
|
|
29120
|
+
height,
|
|
29121
|
+
contentRef,
|
|
29122
|
+
style: {
|
|
29123
|
+
height: `${height}px`,
|
|
29124
|
+
transition: `height ${transitionDuration}ms ease-in-out`,
|
|
29125
|
+
// Avoid clipping content while height recalculates; allow scroll if needed
|
|
29126
|
+
overflow: "auto"
|
|
29127
|
+
}
|
|
29128
|
+
};
|
|
29129
|
+
};
|
|
27583
29130
|
const ToolbarWithEditor = (props) => {
|
|
27584
29131
|
const [editor] = useLexicalComposerContext();
|
|
27585
29132
|
return /* @__PURE__ */ jsx(
|
|
@@ -27642,6 +29189,11 @@ const ConfigurableEditor = ({
|
|
|
27642
29189
|
}) => {
|
|
27643
29190
|
const classes = useStyles();
|
|
27644
29191
|
const [isLinkEditMode, setIsLinkEditMode] = useState(false);
|
|
29192
|
+
const { contentRef, style: autoHeightStyle } = useAutoExpandingHeight({
|
|
29193
|
+
minHeight: 150,
|
|
29194
|
+
maxHeight: 800,
|
|
29195
|
+
transitionDuration: 200
|
|
29196
|
+
});
|
|
27645
29197
|
useState(null);
|
|
27646
29198
|
useState(null);
|
|
27647
29199
|
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
@@ -27701,9 +29253,11 @@ const ConfigurableEditor = ({
|
|
|
27701
29253
|
contentEditable: /* @__PURE__ */ jsx("div", { className: "editor-scroller", children: /* @__PURE__ */ jsx("div", { className: "editor", ref: onRef, children: /* @__PURE__ */ jsx(
|
|
27702
29254
|
ContentEditable,
|
|
27703
29255
|
{
|
|
29256
|
+
ref: contentRef,
|
|
27704
29257
|
className: classes.contentEditable,
|
|
27705
29258
|
style: {
|
|
27706
|
-
tabSize: 1
|
|
29259
|
+
tabSize: 1,
|
|
29260
|
+
...autoHeightStyle
|
|
27707
29261
|
}
|
|
27708
29262
|
}
|
|
27709
29263
|
) }) }),
|
|
@@ -27904,9 +29458,11 @@ export {
|
|
|
27904
29458
|
LocalStoragePlugin$1 as L,
|
|
27905
29459
|
useEditor as a,
|
|
27906
29460
|
ConfigurableEditor as b,
|
|
29461
|
+
commonjsGlobal as c,
|
|
27907
29462
|
editorConfig as e,
|
|
29463
|
+
getDefaultExportFromCjs as g,
|
|
27908
29464
|
initialConfig as i,
|
|
27909
29465
|
useHtmlView as u,
|
|
27910
29466
|
verifyApiKey as v
|
|
27911
29467
|
};
|
|
27912
|
-
//# sourceMappingURL=index-
|
|
29468
|
+
//# sourceMappingURL=index-25cc2475.js.map
|