@brevitaz/brv-text-editor 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -1
- package/dist/brv-text-editor.css +60 -0
- package/dist/brv-text-editor.es.js +607 -252
- package/dist/brv-text-editor.es.js.map +1 -1
- package/dist/brv-text-editor.umd.js +603 -248
- package/dist/brv-text-editor.umd.js.map +1 -1
- package/package.json +30 -35
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import React, { useRef, useState, useDebugValue, useEffect, forwardRef, useLayoutEffect, createContext, useContext, createElement } from "react";
|
|
1
|
+
import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
|
+
import React, { useRef, useState, useDebugValue, useEffect, forwardRef, useLayoutEffect, createContext, useContext, createElement, useMemo } from "react";
|
|
3
3
|
import ReactDOM from "react-dom";
|
|
4
4
|
function OrderedMap(content) {
|
|
5
5
|
this.content = content;
|
|
@@ -16723,7 +16723,7 @@ function requireWithSelector_development() {
|
|
|
16723
16723
|
}
|
|
16724
16724
|
var objectIs = typeof Object.is === "function" ? Object.is : is;
|
|
16725
16725
|
var useSyncExternalStore = shim2.useSyncExternalStore;
|
|
16726
|
-
var useRef2 = React$1.useRef, useEffect2 = React$1.useEffect,
|
|
16726
|
+
var useRef2 = React$1.useRef, useEffect2 = React$1.useEffect, useMemo2 = React$1.useMemo, useDebugValue2 = React$1.useDebugValue;
|
|
16727
16727
|
function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
16728
16728
|
var instRef = useRef2(null);
|
|
16729
16729
|
var inst;
|
|
@@ -16736,7 +16736,7 @@ function requireWithSelector_development() {
|
|
|
16736
16736
|
} else {
|
|
16737
16737
|
inst = instRef.current;
|
|
16738
16738
|
}
|
|
16739
|
-
var _useMemo =
|
|
16739
|
+
var _useMemo = useMemo2(function() {
|
|
16740
16740
|
var hasMemo = false;
|
|
16741
16741
|
var memoizedSnapshot;
|
|
16742
16742
|
var memoizedSelection;
|
|
@@ -20499,18 +20499,111 @@ const TextAlign = Extension.create({
|
|
|
20499
20499
|
};
|
|
20500
20500
|
}
|
|
20501
20501
|
});
|
|
20502
|
+
const CALLOUT_TYPES = [
|
|
20503
|
+
{ key: "info", label: "Info", icon: "ℹ️", color: "#2563eb" },
|
|
20504
|
+
{ key: "success", label: "Success", icon: "✅", color: "#16a34a" },
|
|
20505
|
+
{ key: "warning", label: "Warning", icon: "⚠️", color: "#d97706" },
|
|
20506
|
+
{ key: "danger", label: "Danger", icon: "🚨", color: "#dc2626" },
|
|
20507
|
+
{ key: "tip", label: "Tip", icon: "💡", color: "#7c3aed" },
|
|
20508
|
+
{ key: "note", label: "Note", icon: "📝", color: "#64748b" }
|
|
20509
|
+
];
|
|
20510
|
+
const Callout = Node2.create({
|
|
20511
|
+
name: "callout",
|
|
20512
|
+
group: "block",
|
|
20513
|
+
content: "block+",
|
|
20514
|
+
defining: true,
|
|
20515
|
+
addAttributes() {
|
|
20516
|
+
return {
|
|
20517
|
+
type: {
|
|
20518
|
+
default: "info",
|
|
20519
|
+
parseHTML: (el) => el.getAttribute("data-callout") || "info",
|
|
20520
|
+
renderHTML: (attrs) => ({ "data-callout": attrs.type })
|
|
20521
|
+
}
|
|
20522
|
+
};
|
|
20523
|
+
},
|
|
20524
|
+
parseHTML() {
|
|
20525
|
+
return [
|
|
20526
|
+
{
|
|
20527
|
+
tag: "div[data-callout]"
|
|
20528
|
+
}
|
|
20529
|
+
];
|
|
20530
|
+
},
|
|
20531
|
+
renderHTML({ HTMLAttributes }) {
|
|
20532
|
+
return [
|
|
20533
|
+
"div",
|
|
20534
|
+
mergeAttributes(HTMLAttributes, { class: `rte-callout rte-callout--${HTMLAttributes["data-callout"] || "info"}` }),
|
|
20535
|
+
0
|
|
20536
|
+
];
|
|
20537
|
+
},
|
|
20538
|
+
addCommands() {
|
|
20539
|
+
return {
|
|
20540
|
+
setCallout: (type = "info") => ({ commands: commands2 }) => {
|
|
20541
|
+
return commands2.wrapIn(this.name, { type });
|
|
20542
|
+
},
|
|
20543
|
+
toggleCallout: (type = "info") => ({ commands: commands2, editor }) => {
|
|
20544
|
+
if (editor.isActive(this.name, { type })) {
|
|
20545
|
+
return commands2.lift(this.name);
|
|
20546
|
+
}
|
|
20547
|
+
if (editor.isActive(this.name)) {
|
|
20548
|
+
return commands2.updateAttributes(this.name, { type });
|
|
20549
|
+
}
|
|
20550
|
+
return commands2.wrapIn(this.name, { type });
|
|
20551
|
+
},
|
|
20552
|
+
unsetCallout: () => ({ commands: commands2 }) => {
|
|
20553
|
+
return commands2.lift(this.name);
|
|
20554
|
+
}
|
|
20555
|
+
};
|
|
20556
|
+
},
|
|
20557
|
+
addKeyboardShortcuts() {
|
|
20558
|
+
return {
|
|
20559
|
+
// Allow backspace at the start to unwrap the callout
|
|
20560
|
+
Backspace: ({ editor }) => {
|
|
20561
|
+
const { $anchor } = editor.state.selection;
|
|
20562
|
+
if ($anchor.parentOffset !== 0) return false;
|
|
20563
|
+
if (!editor.isActive(this.name)) return false;
|
|
20564
|
+
return editor.commands.lift(this.name);
|
|
20565
|
+
}
|
|
20566
|
+
};
|
|
20567
|
+
}
|
|
20568
|
+
});
|
|
20502
20569
|
/**
|
|
20503
|
-
* @license lucide-react v0.
|
|
20570
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20504
20571
|
*
|
|
20505
20572
|
* This source code is licensed under the ISC license.
|
|
20506
20573
|
* See the LICENSE file in the root directory of this source tree.
|
|
20507
20574
|
*/
|
|
20508
|
-
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
20509
20575
|
const mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
20510
20576
|
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
20511
20577
|
}).join(" ").trim();
|
|
20512
20578
|
/**
|
|
20513
|
-
* @license lucide-react v0.
|
|
20579
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20580
|
+
*
|
|
20581
|
+
* This source code is licensed under the ISC license.
|
|
20582
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
20583
|
+
*/
|
|
20584
|
+
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
20585
|
+
/**
|
|
20586
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20587
|
+
*
|
|
20588
|
+
* This source code is licensed under the ISC license.
|
|
20589
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
20590
|
+
*/
|
|
20591
|
+
const toCamelCase = (string) => string.replace(
|
|
20592
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
20593
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
20594
|
+
);
|
|
20595
|
+
/**
|
|
20596
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20597
|
+
*
|
|
20598
|
+
* This source code is licensed under the ISC license.
|
|
20599
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
20600
|
+
*/
|
|
20601
|
+
const toPascalCase = (string) => {
|
|
20602
|
+
const camelCase = toCamelCase(string);
|
|
20603
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
20604
|
+
};
|
|
20605
|
+
/**
|
|
20606
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20514
20607
|
*
|
|
20515
20608
|
* This source code is licensed under the ISC license.
|
|
20516
20609
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -20527,7 +20620,21 @@ var defaultAttributes = {
|
|
|
20527
20620
|
strokeLinejoin: "round"
|
|
20528
20621
|
};
|
|
20529
20622
|
/**
|
|
20530
|
-
* @license lucide-react v0.
|
|
20623
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20624
|
+
*
|
|
20625
|
+
* This source code is licensed under the ISC license.
|
|
20626
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
20627
|
+
*/
|
|
20628
|
+
const hasA11yProp = (props) => {
|
|
20629
|
+
for (const prop in props) {
|
|
20630
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
20631
|
+
return true;
|
|
20632
|
+
}
|
|
20633
|
+
}
|
|
20634
|
+
return false;
|
|
20635
|
+
};
|
|
20636
|
+
/**
|
|
20637
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20531
20638
|
*
|
|
20532
20639
|
* This source code is licensed under the ISC license.
|
|
20533
20640
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -20542,28 +20649,27 @@ const Icon = forwardRef(
|
|
|
20542
20649
|
children,
|
|
20543
20650
|
iconNode,
|
|
20544
20651
|
...rest
|
|
20545
|
-
}, ref) =>
|
|
20546
|
-
|
|
20547
|
-
|
|
20548
|
-
|
|
20549
|
-
|
|
20550
|
-
|
|
20551
|
-
|
|
20552
|
-
|
|
20553
|
-
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
|
|
20557
|
-
|
|
20558
|
-
|
|
20559
|
-
|
|
20560
|
-
|
|
20561
|
-
|
|
20562
|
-
|
|
20563
|
-
}
|
|
20652
|
+
}, ref) => createElement(
|
|
20653
|
+
"svg",
|
|
20654
|
+
{
|
|
20655
|
+
ref,
|
|
20656
|
+
...defaultAttributes,
|
|
20657
|
+
width: size,
|
|
20658
|
+
height: size,
|
|
20659
|
+
stroke: color,
|
|
20660
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
20661
|
+
className: mergeClasses("lucide", className),
|
|
20662
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
20663
|
+
...rest
|
|
20664
|
+
},
|
|
20665
|
+
[
|
|
20666
|
+
...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
|
|
20667
|
+
...Array.isArray(children) ? children : [children]
|
|
20668
|
+
]
|
|
20669
|
+
)
|
|
20564
20670
|
);
|
|
20565
20671
|
/**
|
|
20566
|
-
* @license lucide-react v0.
|
|
20672
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20567
20673
|
*
|
|
20568
20674
|
* This source code is licensed under the ISC license.
|
|
20569
20675
|
* See the LICENSE file in the root directory of this source tree.
|
|
@@ -20573,164 +20679,161 @@ const createLucideIcon = (iconName, iconNode) => {
|
|
|
20573
20679
|
({ className, ...props }, ref) => createElement(Icon, {
|
|
20574
20680
|
ref,
|
|
20575
20681
|
iconNode,
|
|
20576
|
-
className: mergeClasses(
|
|
20682
|
+
className: mergeClasses(
|
|
20683
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
20684
|
+
`lucide-${iconName}`,
|
|
20685
|
+
className
|
|
20686
|
+
),
|
|
20577
20687
|
...props
|
|
20578
20688
|
})
|
|
20579
20689
|
);
|
|
20580
|
-
Component.displayName =
|
|
20690
|
+
Component.displayName = toPascalCase(iconName);
|
|
20581
20691
|
return Component;
|
|
20582
20692
|
};
|
|
20583
20693
|
/**
|
|
20584
|
-
* @license lucide-react v0.
|
|
20585
|
-
*
|
|
20586
|
-
* This source code is licensed under the ISC license.
|
|
20587
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
20588
|
-
*/
|
|
20589
|
-
const AlignCenter = createLucideIcon("AlignCenter", [
|
|
20590
|
-
["path", { d: "M17 12H7", key: "16if0g" }],
|
|
20591
|
-
["path", { d: "M19 18H5", key: "18s9l3" }],
|
|
20592
|
-
["path", { d: "M21 6H3", key: "1jwq7v" }]
|
|
20593
|
-
]);
|
|
20594
|
-
/**
|
|
20595
|
-
* @license lucide-react v0.468.0 - ISC
|
|
20694
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20596
20695
|
*
|
|
20597
20696
|
* This source code is licensed under the ISC license.
|
|
20598
20697
|
* See the LICENSE file in the root directory of this source tree.
|
|
20599
20698
|
*/
|
|
20600
|
-
const
|
|
20601
|
-
["path", { d: "M15 12H3", key: "6jk70r" }],
|
|
20602
|
-
["path", { d: "M17 18H3", key: "1amg6g" }],
|
|
20603
|
-
["path", { d: "M21 6H3", key: "1jwq7v" }]
|
|
20604
|
-
]);
|
|
20605
|
-
/**
|
|
20606
|
-
* @license lucide-react v0.468.0 - ISC
|
|
20607
|
-
*
|
|
20608
|
-
* This source code is licensed under the ISC license.
|
|
20609
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
20610
|
-
*/
|
|
20611
|
-
const AlignRight = createLucideIcon("AlignRight", [
|
|
20612
|
-
["path", { d: "M21 12H9", key: "dn1m92" }],
|
|
20613
|
-
["path", { d: "M21 18H7", key: "1ygte8" }],
|
|
20614
|
-
["path", { d: "M21 6H3", key: "1jwq7v" }]
|
|
20615
|
-
]);
|
|
20616
|
-
/**
|
|
20617
|
-
* @license lucide-react v0.468.0 - ISC
|
|
20618
|
-
*
|
|
20619
|
-
* This source code is licensed under the ISC license.
|
|
20620
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
20621
|
-
*/
|
|
20622
|
-
const Bold = createLucideIcon("Bold", [
|
|
20699
|
+
const __iconNode$j = [
|
|
20623
20700
|
[
|
|
20624
20701
|
"path",
|
|
20625
20702
|
{ d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
|
|
20626
20703
|
]
|
|
20627
|
-
]
|
|
20704
|
+
];
|
|
20705
|
+
const Bold = createLucideIcon("bold", __iconNode$j);
|
|
20628
20706
|
/**
|
|
20629
|
-
* @license lucide-react v0.
|
|
20707
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20630
20708
|
*
|
|
20631
20709
|
* This source code is licensed under the ISC license.
|
|
20632
20710
|
* See the LICENSE file in the root directory of this source tree.
|
|
20633
20711
|
*/
|
|
20634
|
-
const
|
|
20635
|
-
|
|
20636
|
-
]);
|
|
20712
|
+
const __iconNode$i = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
20713
|
+
const ChevronDown = createLucideIcon("chevron-down", __iconNode$i);
|
|
20637
20714
|
/**
|
|
20638
|
-
* @license lucide-react v0.
|
|
20715
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20639
20716
|
*
|
|
20640
20717
|
* This source code is licensed under the ISC license.
|
|
20641
20718
|
* See the LICENSE file in the root directory of this source tree.
|
|
20642
20719
|
*/
|
|
20643
|
-
const
|
|
20644
|
-
["
|
|
20645
|
-
["
|
|
20646
|
-
]
|
|
20720
|
+
const __iconNode$h = [
|
|
20721
|
+
["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
|
|
20722
|
+
["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
|
|
20723
|
+
];
|
|
20724
|
+
const Code = createLucideIcon("code", __iconNode$h);
|
|
20647
20725
|
/**
|
|
20648
|
-
* @license lucide-react v0.
|
|
20726
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20649
20727
|
*
|
|
20650
20728
|
* This source code is licensed under the ISC license.
|
|
20651
20729
|
* See the LICENSE file in the root directory of this source tree.
|
|
20652
20730
|
*/
|
|
20653
|
-
const
|
|
20731
|
+
const __iconNode$g = [
|
|
20654
20732
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
20655
20733
|
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
20656
20734
|
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
20657
|
-
]
|
|
20735
|
+
];
|
|
20736
|
+
const Image = createLucideIcon("image", __iconNode$g);
|
|
20658
20737
|
/**
|
|
20659
|
-
* @license lucide-react v0.
|
|
20738
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20660
20739
|
*
|
|
20661
20740
|
* This source code is licensed under the ISC license.
|
|
20662
20741
|
* See the LICENSE file in the root directory of this source tree.
|
|
20663
20742
|
*/
|
|
20664
|
-
const
|
|
20743
|
+
const __iconNode$f = [
|
|
20665
20744
|
["line", { x1: "19", x2: "10", y1: "4", y2: "4", key: "15jd3p" }],
|
|
20666
20745
|
["line", { x1: "14", x2: "5", y1: "20", y2: "20", key: "bu0au3" }],
|
|
20667
20746
|
["line", { x1: "15", x2: "9", y1: "4", y2: "20", key: "uljnxc" }]
|
|
20668
|
-
]
|
|
20747
|
+
];
|
|
20748
|
+
const Italic = createLucideIcon("italic", __iconNode$f);
|
|
20669
20749
|
/**
|
|
20670
|
-
* @license lucide-react v0.
|
|
20750
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20671
20751
|
*
|
|
20672
20752
|
* This source code is licensed under the ISC license.
|
|
20673
20753
|
* See the LICENSE file in the root directory of this source tree.
|
|
20674
20754
|
*/
|
|
20675
|
-
const
|
|
20755
|
+
const __iconNode$e = [
|
|
20676
20756
|
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
20677
20757
|
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
20678
|
-
]
|
|
20758
|
+
];
|
|
20759
|
+
const Link = createLucideIcon("link", __iconNode$e);
|
|
20679
20760
|
/**
|
|
20680
|
-
* @license lucide-react v0.
|
|
20761
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20681
20762
|
*
|
|
20682
20763
|
* This source code is licensed under the ISC license.
|
|
20683
20764
|
* See the LICENSE file in the root directory of this source tree.
|
|
20684
20765
|
*/
|
|
20685
|
-
const
|
|
20686
|
-
["path", { d: "
|
|
20687
|
-
["path", { d: "m3 7 2 2 4-4", key: "1obspn" }],
|
|
20688
|
-
["path", { d: "M13 6h8", key: "15sg57" }],
|
|
20766
|
+
const __iconNode$d = [
|
|
20767
|
+
["path", { d: "M13 5h8", key: "a7qcls" }],
|
|
20689
20768
|
["path", { d: "M13 12h8", key: "h98zly" }],
|
|
20690
|
-
["path", { d: "M13
|
|
20691
|
-
]
|
|
20769
|
+
["path", { d: "M13 19h8", key: "c3s6r1" }],
|
|
20770
|
+
["path", { d: "m3 17 2 2 4-4", key: "1jhpwq" }],
|
|
20771
|
+
["path", { d: "m3 7 2 2 4-4", key: "1obspn" }]
|
|
20772
|
+
];
|
|
20773
|
+
const ListChecks = createLucideIcon("list-checks", __iconNode$d);
|
|
20692
20774
|
/**
|
|
20693
|
-
* @license lucide-react v0.
|
|
20775
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20694
20776
|
*
|
|
20695
20777
|
* This source code is licensed under the ISC license.
|
|
20696
20778
|
* See the LICENSE file in the root directory of this source tree.
|
|
20697
20779
|
*/
|
|
20698
|
-
const
|
|
20699
|
-
["path", { d: "
|
|
20700
|
-
["path", { d: "
|
|
20701
|
-
["path", { d: "
|
|
20702
|
-
["path", { d: "M4
|
|
20703
|
-
["path", { d: "M4
|
|
20704
|
-
["path", { d: "M6
|
|
20705
|
-
]
|
|
20780
|
+
const __iconNode$c = [
|
|
20781
|
+
["path", { d: "M11 5h10", key: "1cz7ny" }],
|
|
20782
|
+
["path", { d: "M11 12h10", key: "1438ji" }],
|
|
20783
|
+
["path", { d: "M11 19h10", key: "11t30w" }],
|
|
20784
|
+
["path", { d: "M4 4h1v5", key: "10yrso" }],
|
|
20785
|
+
["path", { d: "M4 9h2", key: "r1h2o0" }],
|
|
20786
|
+
["path", { d: "M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02", key: "xtkcd5" }]
|
|
20787
|
+
];
|
|
20788
|
+
const ListOrdered = createLucideIcon("list-ordered", __iconNode$c);
|
|
20706
20789
|
/**
|
|
20707
|
-
* @license lucide-react v0.
|
|
20790
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20708
20791
|
*
|
|
20709
20792
|
* This source code is licensed under the ISC license.
|
|
20710
20793
|
* See the LICENSE file in the root directory of this source tree.
|
|
20711
20794
|
*/
|
|
20712
|
-
const
|
|
20795
|
+
const __iconNode$b = [
|
|
20796
|
+
["path", { d: "M3 5h.01", key: "18ugdj" }],
|
|
20713
20797
|
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
20714
|
-
["path", { d: "M3
|
|
20715
|
-
["path", { d: "
|
|
20798
|
+
["path", { d: "M3 19h.01", key: "noohij" }],
|
|
20799
|
+
["path", { d: "M8 5h13", key: "1pao27" }],
|
|
20716
20800
|
["path", { d: "M8 12h13", key: "1za7za" }],
|
|
20717
|
-
["path", { d: "M8
|
|
20718
|
-
|
|
20719
|
-
|
|
20801
|
+
["path", { d: "M8 19h13", key: "m83p4d" }]
|
|
20802
|
+
];
|
|
20803
|
+
const List = createLucideIcon("list", __iconNode$b);
|
|
20804
|
+
/**
|
|
20805
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20806
|
+
*
|
|
20807
|
+
* This source code is licensed under the ISC license.
|
|
20808
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
20809
|
+
*/
|
|
20810
|
+
const __iconNode$a = [
|
|
20811
|
+
[
|
|
20812
|
+
"path",
|
|
20813
|
+
{
|
|
20814
|
+
d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",
|
|
20815
|
+
key: "18887p"
|
|
20816
|
+
}
|
|
20817
|
+
],
|
|
20818
|
+
["path", { d: "M12 15h.01", key: "q59x07" }],
|
|
20819
|
+
["path", { d: "M12 7v4", key: "xawao1" }]
|
|
20820
|
+
];
|
|
20821
|
+
const MessageSquareWarning = createLucideIcon("message-square-warning", __iconNode$a);
|
|
20720
20822
|
/**
|
|
20721
|
-
* @license lucide-react v0.
|
|
20823
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20722
20824
|
*
|
|
20723
20825
|
* This source code is licensed under the ISC license.
|
|
20724
20826
|
* See the LICENSE file in the root directory of this source tree.
|
|
20725
20827
|
*/
|
|
20726
|
-
const
|
|
20828
|
+
const __iconNode$9 = [["path", { d: "M5 12h14", key: "1ays0h" }]];
|
|
20829
|
+
const Minus = createLucideIcon("minus", __iconNode$9);
|
|
20727
20830
|
/**
|
|
20728
|
-
* @license lucide-react v0.
|
|
20831
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20729
20832
|
*
|
|
20730
20833
|
* This source code is licensed under the ISC license.
|
|
20731
20834
|
* See the LICENSE file in the root directory of this source tree.
|
|
20732
20835
|
*/
|
|
20733
|
-
const
|
|
20836
|
+
const __iconNode$8 = [
|
|
20734
20837
|
[
|
|
20735
20838
|
"path",
|
|
20736
20839
|
{
|
|
@@ -20745,59 +20848,111 @@ const Quote = createLucideIcon("Quote", [
|
|
|
20745
20848
|
key: "1ymkrd"
|
|
20746
20849
|
}
|
|
20747
20850
|
]
|
|
20748
|
-
]
|
|
20851
|
+
];
|
|
20852
|
+
const Quote = createLucideIcon("quote", __iconNode$8);
|
|
20749
20853
|
/**
|
|
20750
|
-
* @license lucide-react v0.
|
|
20854
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20751
20855
|
*
|
|
20752
20856
|
* This source code is licensed under the ISC license.
|
|
20753
20857
|
* See the LICENSE file in the root directory of this source tree.
|
|
20754
20858
|
*/
|
|
20755
|
-
const
|
|
20859
|
+
const __iconNode$7 = [
|
|
20756
20860
|
["path", { d: "M21 7v6h-6", key: "3ptur4" }],
|
|
20757
20861
|
["path", { d: "M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7", key: "1kgawr" }]
|
|
20758
|
-
]
|
|
20862
|
+
];
|
|
20863
|
+
const Redo = createLucideIcon("redo", __iconNode$7);
|
|
20759
20864
|
/**
|
|
20760
|
-
* @license lucide-react v0.
|
|
20865
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20761
20866
|
*
|
|
20762
20867
|
* This source code is licensed under the ISC license.
|
|
20763
20868
|
* See the LICENSE file in the root directory of this source tree.
|
|
20764
20869
|
*/
|
|
20765
|
-
const
|
|
20870
|
+
const __iconNode$6 = [
|
|
20766
20871
|
["path", { d: "M16 4H9a3 3 0 0 0-2.83 4", key: "43sutm" }],
|
|
20767
20872
|
["path", { d: "M14 12a4 4 0 0 1 0 8H6", key: "nlfj13" }],
|
|
20768
20873
|
["line", { x1: "4", x2: "20", y1: "12", y2: "12", key: "1e0a9i" }]
|
|
20769
|
-
]
|
|
20874
|
+
];
|
|
20875
|
+
const Strikethrough = createLucideIcon("strikethrough", __iconNode$6);
|
|
20770
20876
|
/**
|
|
20771
|
-
* @license lucide-react v0.
|
|
20877
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20772
20878
|
*
|
|
20773
20879
|
* This source code is licensed under the ISC license.
|
|
20774
20880
|
* See the LICENSE file in the root directory of this source tree.
|
|
20775
20881
|
*/
|
|
20776
|
-
const
|
|
20777
|
-
["
|
|
20778
|
-
["
|
|
20779
|
-
["
|
|
20780
|
-
]
|
|
20882
|
+
const __iconNode$5 = [
|
|
20883
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
20884
|
+
["path", { d: "M17 12H7", key: "16if0g" }],
|
|
20885
|
+
["path", { d: "M19 19H5", key: "vjpgq2" }]
|
|
20886
|
+
];
|
|
20887
|
+
const TextAlignCenter = createLucideIcon("text-align-center", __iconNode$5);
|
|
20781
20888
|
/**
|
|
20782
|
-
* @license lucide-react v0.
|
|
20889
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20783
20890
|
*
|
|
20784
20891
|
* This source code is licensed under the ISC license.
|
|
20785
20892
|
* See the LICENSE file in the root directory of this source tree.
|
|
20786
20893
|
*/
|
|
20787
|
-
const
|
|
20894
|
+
const __iconNode$4 = [
|
|
20895
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
20896
|
+
["path", { d: "M21 12H9", key: "dn1m92" }],
|
|
20897
|
+
["path", { d: "M21 19H7", key: "4cu937" }]
|
|
20898
|
+
];
|
|
20899
|
+
const TextAlignEnd = createLucideIcon("text-align-end", __iconNode$4);
|
|
20900
|
+
/**
|
|
20901
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20902
|
+
*
|
|
20903
|
+
* This source code is licensed under the ISC license.
|
|
20904
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
20905
|
+
*/
|
|
20906
|
+
const __iconNode$3 = [
|
|
20907
|
+
["path", { d: "M21 5H3", key: "1fi0y6" }],
|
|
20908
|
+
["path", { d: "M15 12H3", key: "6jk70r" }],
|
|
20909
|
+
["path", { d: "M17 19H3", key: "z6ezky" }]
|
|
20910
|
+
];
|
|
20911
|
+
const TextAlignStart = createLucideIcon("text-align-start", __iconNode$3);
|
|
20912
|
+
/**
|
|
20913
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20914
|
+
*
|
|
20915
|
+
* This source code is licensed under the ISC license.
|
|
20916
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
20917
|
+
*/
|
|
20918
|
+
const __iconNode$2 = [
|
|
20919
|
+
["path", { d: "M12 4v16", key: "1654pz" }],
|
|
20920
|
+
["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2", key: "e0r10z" }],
|
|
20921
|
+
["path", { d: "M9 20h6", key: "s66wpe" }]
|
|
20922
|
+
];
|
|
20923
|
+
const Type = createLucideIcon("type", __iconNode$2);
|
|
20924
|
+
/**
|
|
20925
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20926
|
+
*
|
|
20927
|
+
* This source code is licensed under the ISC license.
|
|
20928
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
20929
|
+
*/
|
|
20930
|
+
const __iconNode$1 = [
|
|
20788
20931
|
["path", { d: "M6 4v6a6 6 0 0 0 12 0V4", key: "9kb039" }],
|
|
20789
20932
|
["line", { x1: "4", x2: "20", y1: "20", y2: "20", key: "nun2al" }]
|
|
20790
|
-
]
|
|
20933
|
+
];
|
|
20934
|
+
const Underline = createLucideIcon("underline", __iconNode$1);
|
|
20791
20935
|
/**
|
|
20792
|
-
* @license lucide-react v0.
|
|
20936
|
+
* @license lucide-react v0.576.0 - ISC
|
|
20793
20937
|
*
|
|
20794
20938
|
* This source code is licensed under the ISC license.
|
|
20795
20939
|
* See the LICENSE file in the root directory of this source tree.
|
|
20796
20940
|
*/
|
|
20797
|
-
const
|
|
20941
|
+
const __iconNode = [
|
|
20798
20942
|
["path", { d: "M3 7v6h6", key: "1v2h90" }],
|
|
20799
20943
|
["path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13", key: "1r6uu6" }]
|
|
20800
|
-
]
|
|
20944
|
+
];
|
|
20945
|
+
const Undo = createLucideIcon("undo", __iconNode);
|
|
20946
|
+
const DEFAULT_TOOLBAR = {
|
|
20947
|
+
headings: true,
|
|
20948
|
+
formatting: true,
|
|
20949
|
+
alignment: true,
|
|
20950
|
+
lists: true,
|
|
20951
|
+
blocks: true,
|
|
20952
|
+
callouts: true,
|
|
20953
|
+
media: true,
|
|
20954
|
+
history: true
|
|
20955
|
+
};
|
|
20801
20956
|
const RTE_THEMES = {
|
|
20802
20957
|
/** Default — UnleashTeams teal/cyan palette */
|
|
20803
20958
|
unleashteams: {},
|
|
@@ -21186,17 +21341,147 @@ function HeadingDropdown({ editor, onClose }) {
|
|
|
21186
21341
|
}
|
|
21187
21342
|
);
|
|
21188
21343
|
}
|
|
21189
|
-
function
|
|
21344
|
+
function CalloutDropdown({ editor, onClose }) {
|
|
21345
|
+
const activeType = CALLOUT_TYPES.find((ct) => editor.isActive("callout", { type: ct.key }));
|
|
21346
|
+
return /* @__PURE__ */ jsxs(
|
|
21347
|
+
"div",
|
|
21348
|
+
{
|
|
21349
|
+
style: {
|
|
21350
|
+
position: "absolute",
|
|
21351
|
+
top: "calc(100% + 6px)",
|
|
21352
|
+
left: 0,
|
|
21353
|
+
zIndex: 200,
|
|
21354
|
+
background: "var(--rte-surface)",
|
|
21355
|
+
border: "1px solid var(--rte-border)",
|
|
21356
|
+
borderRadius: "var(--rte-radius-lg)",
|
|
21357
|
+
boxShadow: "var(--rte-dropdown-shadow)",
|
|
21358
|
+
padding: "4px 0",
|
|
21359
|
+
minWidth: 180
|
|
21360
|
+
},
|
|
21361
|
+
children: [
|
|
21362
|
+
CALLOUT_TYPES.map((ct) => {
|
|
21363
|
+
const isActive2 = (activeType == null ? void 0 : activeType.key) === ct.key;
|
|
21364
|
+
return /* @__PURE__ */ jsxs(
|
|
21365
|
+
"button",
|
|
21366
|
+
{
|
|
21367
|
+
type: "button",
|
|
21368
|
+
onClick: () => {
|
|
21369
|
+
editor.chain().focus().toggleCallout(ct.key).run();
|
|
21370
|
+
onClose();
|
|
21371
|
+
},
|
|
21372
|
+
style: {
|
|
21373
|
+
display: "flex",
|
|
21374
|
+
alignItems: "center",
|
|
21375
|
+
gap: 10,
|
|
21376
|
+
width: "100%",
|
|
21377
|
+
textAlign: "left",
|
|
21378
|
+
padding: "8px 14px",
|
|
21379
|
+
border: "none",
|
|
21380
|
+
background: isActive2 ? "var(--rte-btn-active-bg)" : "transparent",
|
|
21381
|
+
cursor: "pointer",
|
|
21382
|
+
fontSize: 13,
|
|
21383
|
+
fontFamily: "var(--rte-font-family)",
|
|
21384
|
+
fontWeight: isActive2 ? 600 : 400,
|
|
21385
|
+
color: isActive2 ? "var(--rte-btn-active-color)" : "var(--rte-text)",
|
|
21386
|
+
transition: "background 0.1s"
|
|
21387
|
+
},
|
|
21388
|
+
onMouseEnter: (e) => {
|
|
21389
|
+
if (!isActive2) e.currentTarget.style.background = "var(--rte-btn-hover-bg)";
|
|
21390
|
+
},
|
|
21391
|
+
onMouseLeave: (e) => {
|
|
21392
|
+
e.currentTarget.style.background = isActive2 ? "var(--rte-btn-active-bg)" : "transparent";
|
|
21393
|
+
},
|
|
21394
|
+
children: [
|
|
21395
|
+
/* @__PURE__ */ jsx(
|
|
21396
|
+
"span",
|
|
21397
|
+
{
|
|
21398
|
+
style: {
|
|
21399
|
+
display: "inline-flex",
|
|
21400
|
+
alignItems: "center",
|
|
21401
|
+
justifyContent: "center",
|
|
21402
|
+
width: 22,
|
|
21403
|
+
height: 22,
|
|
21404
|
+
borderRadius: 4,
|
|
21405
|
+
background: ct.color + "18",
|
|
21406
|
+
fontSize: 13,
|
|
21407
|
+
flexShrink: 0
|
|
21408
|
+
},
|
|
21409
|
+
children: ct.icon
|
|
21410
|
+
}
|
|
21411
|
+
),
|
|
21412
|
+
/* @__PURE__ */ jsx("span", { children: ct.label }),
|
|
21413
|
+
/* @__PURE__ */ jsx(
|
|
21414
|
+
"span",
|
|
21415
|
+
{
|
|
21416
|
+
style: {
|
|
21417
|
+
width: 8,
|
|
21418
|
+
height: 8,
|
|
21419
|
+
borderRadius: "50%",
|
|
21420
|
+
background: ct.color,
|
|
21421
|
+
marginLeft: "auto",
|
|
21422
|
+
flexShrink: 0
|
|
21423
|
+
}
|
|
21424
|
+
}
|
|
21425
|
+
)
|
|
21426
|
+
]
|
|
21427
|
+
},
|
|
21428
|
+
ct.key
|
|
21429
|
+
);
|
|
21430
|
+
}),
|
|
21431
|
+
activeType && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
21432
|
+
/* @__PURE__ */ jsx("div", { style: { height: 1, background: "var(--rte-border-subtle)", margin: "4px 0" } }),
|
|
21433
|
+
/* @__PURE__ */ jsx(
|
|
21434
|
+
"button",
|
|
21435
|
+
{
|
|
21436
|
+
type: "button",
|
|
21437
|
+
onClick: () => {
|
|
21438
|
+
editor.chain().focus().unsetCallout().run();
|
|
21439
|
+
onClose();
|
|
21440
|
+
},
|
|
21441
|
+
style: {
|
|
21442
|
+
display: "block",
|
|
21443
|
+
width: "100%",
|
|
21444
|
+
textAlign: "left",
|
|
21445
|
+
padding: "8px 14px",
|
|
21446
|
+
border: "none",
|
|
21447
|
+
background: "transparent",
|
|
21448
|
+
cursor: "pointer",
|
|
21449
|
+
fontSize: 13,
|
|
21450
|
+
fontFamily: "var(--rte-font-family)",
|
|
21451
|
+
fontWeight: 400,
|
|
21452
|
+
color: "var(--rte-text-muted)",
|
|
21453
|
+
transition: "background 0.1s"
|
|
21454
|
+
},
|
|
21455
|
+
onMouseEnter: (e) => {
|
|
21456
|
+
e.currentTarget.style.background = "var(--rte-btn-hover-bg)";
|
|
21457
|
+
},
|
|
21458
|
+
onMouseLeave: (e) => {
|
|
21459
|
+
e.currentTarget.style.background = "transparent";
|
|
21460
|
+
},
|
|
21461
|
+
children: "Remove callout"
|
|
21462
|
+
}
|
|
21463
|
+
)
|
|
21464
|
+
] })
|
|
21465
|
+
]
|
|
21466
|
+
}
|
|
21467
|
+
);
|
|
21468
|
+
}
|
|
21469
|
+
function Toolbar({ editor, groups }) {
|
|
21190
21470
|
const [showLinkDialog, setShowLinkDialog] = useState(false);
|
|
21191
21471
|
const [showImageDialog, setShowImageDialog] = useState(false);
|
|
21192
21472
|
const [showHeadingMenu, setShowHeadingMenu] = useState(false);
|
|
21473
|
+
const [showCalloutMenu, setShowCalloutMenu] = useState(false);
|
|
21193
21474
|
const toolbarRef = useRef(null);
|
|
21475
|
+
const closeAll = () => {
|
|
21476
|
+
setShowLinkDialog(false);
|
|
21477
|
+
setShowImageDialog(false);
|
|
21478
|
+
setShowHeadingMenu(false);
|
|
21479
|
+
setShowCalloutMenu(false);
|
|
21480
|
+
};
|
|
21194
21481
|
useEffect(() => {
|
|
21195
21482
|
const handler = (e) => {
|
|
21196
21483
|
if (toolbarRef.current && !toolbarRef.current.contains(e.target)) {
|
|
21197
|
-
|
|
21198
|
-
setShowImageDialog(false);
|
|
21199
|
-
setShowHeadingMenu(false);
|
|
21484
|
+
closeAll();
|
|
21200
21485
|
}
|
|
21201
21486
|
};
|
|
21202
21487
|
document.addEventListener("mousedown", handler);
|
|
@@ -21224,7 +21509,147 @@ function Toolbar({ editor }) {
|
|
|
21224
21509
|
setShowImageDialog(false);
|
|
21225
21510
|
};
|
|
21226
21511
|
const currentLink = editor.getAttributes("link").href || "";
|
|
21227
|
-
|
|
21512
|
+
const sections = [];
|
|
21513
|
+
let needsDivider = false;
|
|
21514
|
+
const addSection = (key, content) => {
|
|
21515
|
+
if (!groups[key]) return;
|
|
21516
|
+
if (needsDivider) sections.push(/* @__PURE__ */ jsx(Divider, {}, `div-${key}`));
|
|
21517
|
+
sections.push(content);
|
|
21518
|
+
needsDivider = true;
|
|
21519
|
+
};
|
|
21520
|
+
addSection("headings", /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
|
|
21521
|
+
/* @__PURE__ */ jsx(Tooltip, { text: "Text style", children: /* @__PURE__ */ jsxs(
|
|
21522
|
+
"button",
|
|
21523
|
+
{
|
|
21524
|
+
type: "button",
|
|
21525
|
+
onClick: () => {
|
|
21526
|
+
setShowHeadingMenu((v) => !v);
|
|
21527
|
+
setShowLinkDialog(false);
|
|
21528
|
+
setShowImageDialog(false);
|
|
21529
|
+
setShowCalloutMenu(false);
|
|
21530
|
+
},
|
|
21531
|
+
style: {
|
|
21532
|
+
display: "inline-flex",
|
|
21533
|
+
alignItems: "center",
|
|
21534
|
+
gap: 3,
|
|
21535
|
+
height: 28,
|
|
21536
|
+
padding: "0 8px",
|
|
21537
|
+
border: "1px solid var(--rte-border)",
|
|
21538
|
+
borderRadius: "var(--rte-radius-sm)",
|
|
21539
|
+
background: showHeadingMenu ? "var(--rte-btn-hover-bg)" : "var(--rte-surface)",
|
|
21540
|
+
color: "var(--rte-text)",
|
|
21541
|
+
cursor: "pointer",
|
|
21542
|
+
fontSize: 12,
|
|
21543
|
+
fontFamily: "var(--rte-font-family)",
|
|
21544
|
+
fontWeight: 600,
|
|
21545
|
+
minWidth: 52
|
|
21546
|
+
},
|
|
21547
|
+
children: [
|
|
21548
|
+
getHeadingLabel(),
|
|
21549
|
+
/* @__PURE__ */ jsx(ChevronDown, { size: 11 })
|
|
21550
|
+
]
|
|
21551
|
+
}
|
|
21552
|
+
) }),
|
|
21553
|
+
showHeadingMenu && /* @__PURE__ */ jsx(HeadingDropdown, { editor, onClose: () => setShowHeadingMenu(false) })
|
|
21554
|
+
] }, "headings"));
|
|
21555
|
+
addSection("formatting", /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", gap: 2 }, children: [
|
|
21556
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: "Bold (⌘B)", children: /* @__PURE__ */ jsx(Bold, { size: 13, strokeWidth: 2.5 }) }),
|
|
21557
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: "Italic (⌘I)", children: /* @__PURE__ */ jsx(Italic, { size: 13, strokeWidth: 2.5 }) }),
|
|
21558
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleUnderline().run(), active: editor.isActive("underline"), title: "Underline (⌘U)", children: /* @__PURE__ */ jsx(Underline, { size: 13, strokeWidth: 2.5 }) }),
|
|
21559
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: "Strikethrough", children: /* @__PURE__ */ jsx(Strikethrough, { size: 13, strokeWidth: 2.5 }) }),
|
|
21560
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: "Inline code", children: /* @__PURE__ */ jsx(Code, { size: 13, strokeWidth: 2.5 }) })
|
|
21561
|
+
] }, "formatting"));
|
|
21562
|
+
addSection("alignment", /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", gap: 2 }, children: [
|
|
21563
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().setTextAlign("left").run(), active: editor.isActive({ textAlign: "left" }), title: "Align left", children: /* @__PURE__ */ jsx(TextAlignStart, { size: 13 }) }),
|
|
21564
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().setTextAlign("center").run(), active: editor.isActive({ textAlign: "center" }), title: "Align center", children: /* @__PURE__ */ jsx(TextAlignCenter, { size: 13 }) }),
|
|
21565
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().setTextAlign("right").run(), active: editor.isActive({ textAlign: "right" }), title: "Align right", children: /* @__PURE__ */ jsx(TextAlignEnd, { size: 13 }) })
|
|
21566
|
+
] }, "alignment"));
|
|
21567
|
+
addSection("lists", /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", gap: 2 }, children: [
|
|
21568
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleBulletList().run(), active: editor.isActive("bulletList"), title: "Bullet list", children: /* @__PURE__ */ jsx(List, { size: 13 }) }),
|
|
21569
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleOrderedList().run(), active: editor.isActive("orderedList"), title: "Numbered list", children: /* @__PURE__ */ jsx(ListOrdered, { size: 13 }) }),
|
|
21570
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleTaskList().run(), active: editor.isActive("taskList"), title: "Task list", children: /* @__PURE__ */ jsx(ListChecks, { size: 13 }) })
|
|
21571
|
+
] }, "lists"));
|
|
21572
|
+
addSection("blocks", /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", gap: 2 }, children: [
|
|
21573
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleBlockquote().run(), active: editor.isActive("blockquote"), title: "Blockquote", children: /* @__PURE__ */ jsx(Quote, { size: 13 }) }),
|
|
21574
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleCodeBlock().run(), active: editor.isActive("codeBlock"), title: "Code block", children: /* @__PURE__ */ jsx("span", { style: { fontFamily: "monospace", fontSize: 11, fontWeight: 700, lineHeight: 1, color: "inherit" }, children: "<>" }) }),
|
|
21575
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().setHorizontalRule().run(), title: "Horizontal rule", children: /* @__PURE__ */ jsx(Minus, { size: 13 }) })
|
|
21576
|
+
] }, "blocks"));
|
|
21577
|
+
addSection("callouts", /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
|
|
21578
|
+
/* @__PURE__ */ jsx(Tooltip, { text: "Callout block", children: /* @__PURE__ */ jsxs(
|
|
21579
|
+
"button",
|
|
21580
|
+
{
|
|
21581
|
+
type: "button",
|
|
21582
|
+
onClick: () => {
|
|
21583
|
+
setShowCalloutMenu((v) => !v);
|
|
21584
|
+
setShowLinkDialog(false);
|
|
21585
|
+
setShowImageDialog(false);
|
|
21586
|
+
setShowHeadingMenu(false);
|
|
21587
|
+
},
|
|
21588
|
+
style: {
|
|
21589
|
+
display: "inline-flex",
|
|
21590
|
+
alignItems: "center",
|
|
21591
|
+
gap: 3,
|
|
21592
|
+
height: 28,
|
|
21593
|
+
padding: "0 8px",
|
|
21594
|
+
border: "1px solid var(--rte-border)",
|
|
21595
|
+
borderRadius: "var(--rte-radius-sm)",
|
|
21596
|
+
background: showCalloutMenu || editor.isActive("callout") ? "var(--rte-btn-hover-bg)" : "var(--rte-surface)",
|
|
21597
|
+
color: editor.isActive("callout") ? "var(--rte-btn-active-color)" : "var(--rte-text)",
|
|
21598
|
+
cursor: "pointer",
|
|
21599
|
+
fontSize: 12,
|
|
21600
|
+
fontFamily: "var(--rte-font-family)",
|
|
21601
|
+
fontWeight: 600,
|
|
21602
|
+
minWidth: 36
|
|
21603
|
+
},
|
|
21604
|
+
children: [
|
|
21605
|
+
/* @__PURE__ */ jsx(MessageSquareWarning, { size: 14 }),
|
|
21606
|
+
/* @__PURE__ */ jsx(ChevronDown, { size: 11 })
|
|
21607
|
+
]
|
|
21608
|
+
}
|
|
21609
|
+
) }),
|
|
21610
|
+
showCalloutMenu && /* @__PURE__ */ jsx(CalloutDropdown, { editor, onClose: () => setShowCalloutMenu(false) })
|
|
21611
|
+
] }, "callouts"));
|
|
21612
|
+
addSection("media", /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", gap: 2 }, children: [
|
|
21613
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
|
|
21614
|
+
/* @__PURE__ */ jsx(
|
|
21615
|
+
ToolbarButton,
|
|
21616
|
+
{
|
|
21617
|
+
onClick: () => {
|
|
21618
|
+
setShowLinkDialog((v) => !v);
|
|
21619
|
+
setShowImageDialog(false);
|
|
21620
|
+
setShowHeadingMenu(false);
|
|
21621
|
+
setShowCalloutMenu(false);
|
|
21622
|
+
},
|
|
21623
|
+
active: editor.isActive("link") || showLinkDialog,
|
|
21624
|
+
title: "Insert link",
|
|
21625
|
+
children: /* @__PURE__ */ jsx(Link, { size: 13 })
|
|
21626
|
+
}
|
|
21627
|
+
),
|
|
21628
|
+
showLinkDialog && /* @__PURE__ */ jsx(LinkDialog, { onConfirm: handleLinkInsert, onCancel: () => setShowLinkDialog(false), initialUrl: currentLink })
|
|
21629
|
+
] }),
|
|
21630
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
|
|
21631
|
+
/* @__PURE__ */ jsx(
|
|
21632
|
+
ToolbarButton,
|
|
21633
|
+
{
|
|
21634
|
+
onClick: () => {
|
|
21635
|
+
setShowImageDialog((v) => !v);
|
|
21636
|
+
setShowLinkDialog(false);
|
|
21637
|
+
setShowHeadingMenu(false);
|
|
21638
|
+
setShowCalloutMenu(false);
|
|
21639
|
+
},
|
|
21640
|
+
active: showImageDialog,
|
|
21641
|
+
title: "Insert image",
|
|
21642
|
+
children: /* @__PURE__ */ jsx(Image, { size: 13 })
|
|
21643
|
+
}
|
|
21644
|
+
),
|
|
21645
|
+
showImageDialog && /* @__PURE__ */ jsx(ImageDialog, { onConfirm: handleImageInsert, onCancel: () => setShowImageDialog(false) })
|
|
21646
|
+
] })
|
|
21647
|
+
] }, "media"));
|
|
21648
|
+
addSection("history", /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", gap: 2 }, children: [
|
|
21649
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: "Undo (⌘Z)", children: /* @__PURE__ */ jsx(Undo, { size: 13 }) }),
|
|
21650
|
+
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: "Redo (⌘⇧Z)", children: /* @__PURE__ */ jsx(Redo, { size: 13 }) })
|
|
21651
|
+
] }, "history"));
|
|
21652
|
+
return /* @__PURE__ */ jsx(
|
|
21228
21653
|
"div",
|
|
21229
21654
|
{
|
|
21230
21655
|
ref: toolbarRef,
|
|
@@ -21240,96 +21665,7 @@ function Toolbar({ editor }) {
|
|
|
21240
21665
|
position: "relative",
|
|
21241
21666
|
userSelect: "none"
|
|
21242
21667
|
},
|
|
21243
|
-
children:
|
|
21244
|
-
/* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
|
|
21245
|
-
/* @__PURE__ */ jsx(Tooltip, { text: "Text style", children: /* @__PURE__ */ jsxs(
|
|
21246
|
-
"button",
|
|
21247
|
-
{
|
|
21248
|
-
type: "button",
|
|
21249
|
-
onClick: () => {
|
|
21250
|
-
setShowHeadingMenu((v) => !v);
|
|
21251
|
-
setShowLinkDialog(false);
|
|
21252
|
-
setShowImageDialog(false);
|
|
21253
|
-
},
|
|
21254
|
-
style: {
|
|
21255
|
-
display: "inline-flex",
|
|
21256
|
-
alignItems: "center",
|
|
21257
|
-
gap: 3,
|
|
21258
|
-
height: 28,
|
|
21259
|
-
padding: "0 8px",
|
|
21260
|
-
border: "1px solid var(--rte-border)",
|
|
21261
|
-
borderRadius: "var(--rte-radius-sm)",
|
|
21262
|
-
background: showHeadingMenu ? "var(--rte-btn-hover-bg)" : "var(--rte-surface)",
|
|
21263
|
-
color: "var(--rte-text)",
|
|
21264
|
-
cursor: "pointer",
|
|
21265
|
-
fontSize: 12,
|
|
21266
|
-
fontFamily: "var(--rte-font-family)",
|
|
21267
|
-
fontWeight: 600,
|
|
21268
|
-
minWidth: 52
|
|
21269
|
-
},
|
|
21270
|
-
children: [
|
|
21271
|
-
getHeadingLabel(),
|
|
21272
|
-
/* @__PURE__ */ jsx(ChevronDown, { size: 11 })
|
|
21273
|
-
]
|
|
21274
|
-
}
|
|
21275
|
-
) }),
|
|
21276
|
-
showHeadingMenu && /* @__PURE__ */ jsx(HeadingDropdown, { editor, onClose: () => setShowHeadingMenu(false) })
|
|
21277
|
-
] }),
|
|
21278
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
21279
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: "Bold (⌘B)", children: /* @__PURE__ */ jsx(Bold, { size: 13, strokeWidth: 2.5 }) }),
|
|
21280
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: "Italic (⌘I)", children: /* @__PURE__ */ jsx(Italic, { size: 13, strokeWidth: 2.5 }) }),
|
|
21281
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleUnderline().run(), active: editor.isActive("underline"), title: "Underline (⌘U)", children: /* @__PURE__ */ jsx(Underline, { size: 13, strokeWidth: 2.5 }) }),
|
|
21282
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: "Strikethrough", children: /* @__PURE__ */ jsx(Strikethrough, { size: 13, strokeWidth: 2.5 }) }),
|
|
21283
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: "Inline code", children: /* @__PURE__ */ jsx(Code, { size: 13, strokeWidth: 2.5 }) }),
|
|
21284
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
21285
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().setTextAlign("left").run(), active: editor.isActive({ textAlign: "left" }), title: "Align left", children: /* @__PURE__ */ jsx(AlignLeft, { size: 13 }) }),
|
|
21286
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().setTextAlign("center").run(), active: editor.isActive({ textAlign: "center" }), title: "Align center", children: /* @__PURE__ */ jsx(AlignCenter, { size: 13 }) }),
|
|
21287
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().setTextAlign("right").run(), active: editor.isActive({ textAlign: "right" }), title: "Align right", children: /* @__PURE__ */ jsx(AlignRight, { size: 13 }) }),
|
|
21288
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
21289
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleBulletList().run(), active: editor.isActive("bulletList"), title: "Bullet list", children: /* @__PURE__ */ jsx(List, { size: 13 }) }),
|
|
21290
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleOrderedList().run(), active: editor.isActive("orderedList"), title: "Numbered list", children: /* @__PURE__ */ jsx(ListOrdered, { size: 13 }) }),
|
|
21291
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleTaskList().run(), active: editor.isActive("taskList"), title: "Task list", children: /* @__PURE__ */ jsx(ListChecks, { size: 13 }) }),
|
|
21292
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
21293
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleBlockquote().run(), active: editor.isActive("blockquote"), title: "Blockquote", children: /* @__PURE__ */ jsx(Quote, { size: 13 }) }),
|
|
21294
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().toggleCodeBlock().run(), active: editor.isActive("codeBlock"), title: "Code block", children: /* @__PURE__ */ jsx("span", { style: { fontFamily: "monospace", fontSize: 11, fontWeight: 700, lineHeight: 1, color: "inherit" }, children: "<>" }) }),
|
|
21295
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().setHorizontalRule().run(), title: "Horizontal rule", children: /* @__PURE__ */ jsx(Minus, { size: 13 }) }),
|
|
21296
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
21297
|
-
/* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
|
|
21298
|
-
/* @__PURE__ */ jsx(
|
|
21299
|
-
ToolbarButton,
|
|
21300
|
-
{
|
|
21301
|
-
onClick: () => {
|
|
21302
|
-
setShowLinkDialog((v) => !v);
|
|
21303
|
-
setShowImageDialog(false);
|
|
21304
|
-
setShowHeadingMenu(false);
|
|
21305
|
-
},
|
|
21306
|
-
active: editor.isActive("link") || showLinkDialog,
|
|
21307
|
-
title: "Insert link",
|
|
21308
|
-
children: /* @__PURE__ */ jsx(Link, { size: 13 })
|
|
21309
|
-
}
|
|
21310
|
-
),
|
|
21311
|
-
showLinkDialog && /* @__PURE__ */ jsx(LinkDialog, { onConfirm: handleLinkInsert, onCancel: () => setShowLinkDialog(false), initialUrl: currentLink })
|
|
21312
|
-
] }),
|
|
21313
|
-
/* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
|
|
21314
|
-
/* @__PURE__ */ jsx(
|
|
21315
|
-
ToolbarButton,
|
|
21316
|
-
{
|
|
21317
|
-
onClick: () => {
|
|
21318
|
-
setShowImageDialog((v) => !v);
|
|
21319
|
-
setShowLinkDialog(false);
|
|
21320
|
-
setShowHeadingMenu(false);
|
|
21321
|
-
},
|
|
21322
|
-
active: showImageDialog,
|
|
21323
|
-
title: "Insert image",
|
|
21324
|
-
children: /* @__PURE__ */ jsx(Image, { size: 13 })
|
|
21325
|
-
}
|
|
21326
|
-
),
|
|
21327
|
-
showImageDialog && /* @__PURE__ */ jsx(ImageDialog, { onConfirm: handleImageInsert, onCancel: () => setShowImageDialog(false) })
|
|
21328
|
-
] }),
|
|
21329
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
21330
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: "Undo (⌘Z)", children: /* @__PURE__ */ jsx(Undo, { size: 13 }) }),
|
|
21331
|
-
/* @__PURE__ */ jsx(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: "Redo (⌘⇧Z)", children: /* @__PURE__ */ jsx(Redo, { size: 13 }) })
|
|
21332
|
-
]
|
|
21668
|
+
children: sections
|
|
21333
21669
|
}
|
|
21334
21670
|
);
|
|
21335
21671
|
}
|
|
@@ -21416,38 +21752,54 @@ function RichTextEditor({
|
|
|
21416
21752
|
autofocus = false,
|
|
21417
21753
|
className = "",
|
|
21418
21754
|
theme = "unleashteams",
|
|
21419
|
-
themeVars = {}
|
|
21755
|
+
themeVars = {},
|
|
21756
|
+
toolbar = {}
|
|
21420
21757
|
}) {
|
|
21421
|
-
const
|
|
21422
|
-
|
|
21758
|
+
const resolvedToolbar = useMemo(
|
|
21759
|
+
() => ({ ...DEFAULT_TOOLBAR, ...toolbar }),
|
|
21760
|
+
[toolbar]
|
|
21761
|
+
);
|
|
21762
|
+
const extensions = useMemo(() => {
|
|
21763
|
+
const exts = [
|
|
21423
21764
|
Document,
|
|
21424
21765
|
Paragraph,
|
|
21425
21766
|
Text$1,
|
|
21426
|
-
Bold$1,
|
|
21427
|
-
Italic$1,
|
|
21428
|
-
Underline$1,
|
|
21429
|
-
Strike,
|
|
21430
|
-
Code$1,
|
|
21431
|
-
CodeBlock,
|
|
21432
|
-
Heading.configure({ levels: [1, 2, 3] }),
|
|
21433
|
-
BulletList,
|
|
21434
|
-
OrderedList,
|
|
21435
|
-
ListItem,
|
|
21436
|
-
TaskList,
|
|
21437
|
-
TaskItem.configure({ nested: true }),
|
|
21438
|
-
Blockquote,
|
|
21439
|
-
HorizontalRule,
|
|
21440
21767
|
HardBreak,
|
|
21441
|
-
History,
|
|
21442
|
-
Image$1,
|
|
21443
|
-
Link$1.configure({
|
|
21444
|
-
openOnClick: false,
|
|
21445
|
-
autolink: true,
|
|
21446
|
-
HTMLAttributes: { rel: "noopener noreferrer", target: "_blank" }
|
|
21447
|
-
}),
|
|
21448
|
-
TextAlign.configure({ types: ["heading", "paragraph"] }),
|
|
21449
21768
|
Placeholder.configure({ placeholder })
|
|
21450
|
-
]
|
|
21769
|
+
];
|
|
21770
|
+
if (resolvedToolbar.headings) {
|
|
21771
|
+
exts.push(Heading.configure({ levels: [1, 2, 3] }));
|
|
21772
|
+
}
|
|
21773
|
+
exts.push(Bold$1, Italic$1, Underline$1, Strike, Code$1);
|
|
21774
|
+
if (resolvedToolbar.alignment) {
|
|
21775
|
+
exts.push(TextAlign.configure({ types: ["heading", "paragraph"] }));
|
|
21776
|
+
}
|
|
21777
|
+
if (resolvedToolbar.lists) {
|
|
21778
|
+
exts.push(BulletList, OrderedList, ListItem, TaskList, TaskItem.configure({ nested: true }));
|
|
21779
|
+
}
|
|
21780
|
+
if (resolvedToolbar.blocks) {
|
|
21781
|
+
exts.push(Blockquote, CodeBlock, HorizontalRule);
|
|
21782
|
+
}
|
|
21783
|
+
if (resolvedToolbar.callouts) {
|
|
21784
|
+
exts.push(Callout);
|
|
21785
|
+
}
|
|
21786
|
+
if (resolvedToolbar.media) {
|
|
21787
|
+
exts.push(
|
|
21788
|
+
Image$1,
|
|
21789
|
+
Link$1.configure({
|
|
21790
|
+
openOnClick: false,
|
|
21791
|
+
autolink: true,
|
|
21792
|
+
HTMLAttributes: { rel: "noopener noreferrer", target: "_blank" }
|
|
21793
|
+
})
|
|
21794
|
+
);
|
|
21795
|
+
}
|
|
21796
|
+
if (resolvedToolbar.history) {
|
|
21797
|
+
exts.push(History);
|
|
21798
|
+
}
|
|
21799
|
+
return exts;
|
|
21800
|
+
}, [resolvedToolbar, placeholder]);
|
|
21801
|
+
const editor = useEditor({
|
|
21802
|
+
extensions,
|
|
21451
21803
|
content: initialContent,
|
|
21452
21804
|
autofocus,
|
|
21453
21805
|
onUpdate({ editor: editor2 }) {
|
|
@@ -21472,7 +21824,7 @@ function RichTextEditor({
|
|
|
21472
21824
|
...resolvedVars
|
|
21473
21825
|
},
|
|
21474
21826
|
children: [
|
|
21475
|
-
/* @__PURE__ */ jsx(Toolbar, { editor }),
|
|
21827
|
+
/* @__PURE__ */ jsx(Toolbar, { editor, groups: resolvedToolbar }),
|
|
21476
21828
|
/* @__PURE__ */ jsx(
|
|
21477
21829
|
"div",
|
|
21478
21830
|
{
|
|
@@ -21708,6 +22060,9 @@ function RichTextPreview({
|
|
|
21708
22060
|
);
|
|
21709
22061
|
}
|
|
21710
22062
|
export {
|
|
22063
|
+
CALLOUT_TYPES,
|
|
22064
|
+
Callout,
|
|
22065
|
+
DEFAULT_TOOLBAR,
|
|
21711
22066
|
RTE_THEMES,
|
|
21712
22067
|
RichTextEditor,
|
|
21713
22068
|
RichTextPreview,
|