@delali/web-editor 0.4.3 → 0.4.5
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/CHANGELOG.md +10 -0
- package/README.md +2 -0
- package/dist/components/editor/collaboration/collaboration-starter.d.ts +5 -1
- package/dist/components/editor/create-editor-plugins.js +111 -91
- package/dist/components/editor/editor-base-kit.js +9 -18
- package/dist/components/editor/editor-kit.js +81 -61
- package/dist/components/editor/version-history/index.js +85 -65
- package/dist/components/editor/web-editor.d.ts +1 -1
- package/dist/components/editor/web-editor.js +2422 -2308
- package/dist/context/inspector-text-fields.d.ts +3 -0
- package/dist/context/text-field-attributes.d.ts +5 -0
- package/dist/lib/markdown-utils.js +111 -91
- package/dist/styles.css +54 -20
- package/dist/types/editor.d.ts +2 -0
- package/dist/ui/input.d.ts +1 -0
- package/dist/ui/media-file-display.d.ts +1 -0
- package/package.json +3 -3
|
@@ -914,7 +914,7 @@ function SmartLinkInlineContent({ link, className }) {
|
|
|
914
914
|
"span",
|
|
915
915
|
{
|
|
916
916
|
className: cn(
|
|
917
|
-
"inline-flex max-w-full items-center gap-[0.2em] rounded-[0.25em] px-[0.4em] py-[0.1em] align-[-0.28em] font-medium text-
|
|
917
|
+
"inline-flex max-w-full items-center gap-[0.2em] rounded-[0.25em] px-[0.4em] py-[0.1em] align-[-0.28em] font-medium text-editor-link leading-[1.3] outline outline-transparent transition-colors hover:bg-editor-link/5 hover:outline-editor-link/30",
|
|
918
918
|
className
|
|
919
919
|
),
|
|
920
920
|
children: [
|
|
@@ -930,7 +930,7 @@ function SmartLinkUrlContent({ link, className }) {
|
|
|
930
930
|
"span",
|
|
931
931
|
{
|
|
932
932
|
className: cn(
|
|
933
|
-
"inline max-w-full wrap-break-word border-
|
|
933
|
+
"inline max-w-full wrap-break-word border-b border-editor-link/35 font-medium text-editor-link leading-[inherit] dark-or-inherit:border-editor-link/35!",
|
|
934
934
|
className
|
|
935
935
|
),
|
|
936
936
|
children: [
|
|
@@ -962,7 +962,7 @@ function SmartLinkCardContent({ link, className }) {
|
|
|
962
962
|
),
|
|
963
963
|
/* @__PURE__ */ jsxs5("span", { className: "min-w-0 flex-1", children: [
|
|
964
964
|
/* @__PURE__ */ jsxs5("span", { className: "flex min-w-0 items-start gap-3", children: [
|
|
965
|
-
/* @__PURE__ */ jsx17("span", { className: "min-w-0 flex-1 truncate font-semibold text-
|
|
965
|
+
/* @__PURE__ */ jsx17("span", { className: "min-w-0 flex-1 truncate font-semibold text-editor-link text-base leading-6", children: link.title }),
|
|
966
966
|
link.status ? /* @__PURE__ */ jsx17(SmartLinkStatus, { status: link.status }) : null
|
|
967
967
|
] }),
|
|
968
968
|
/* @__PURE__ */ jsxs5("span", { className: "mt-2 flex min-w-0 items-center gap-2 text-muted-foreground text-sm", children: [
|
|
@@ -980,7 +980,7 @@ function SmartLinkCardContent({ link, className }) {
|
|
|
980
980
|
{
|
|
981
981
|
faviconUrl: link.faviconUrl,
|
|
982
982
|
provider: link.provider,
|
|
983
|
-
className: "size-5 rounded bg-
|
|
983
|
+
className: "size-5 rounded bg-editor-link p-1 text-white dark-or-inherit:text-primary-foreground"
|
|
984
984
|
}
|
|
985
985
|
),
|
|
986
986
|
/* @__PURE__ */ jsx17("span", { className: "truncate", children: (_a = link.provider) != null ? _a : "Link" })
|
|
@@ -1542,6 +1542,7 @@ import { SlateElement as SlateElement13 } from "platejs/static";
|
|
|
1542
1542
|
|
|
1543
1543
|
// src/ui/media-file-display.ts
|
|
1544
1544
|
var DEFAULT_FILE_DISPLAY_MODE = "inline";
|
|
1545
|
+
var FILE_URL_CLASS_NAME = "inline-flex max-w-full items-center gap-1 break-all border-b border-editor-link/35 font-medium text-editor-link dark-or-inherit:border-editor-link/35!";
|
|
1545
1546
|
var normalizeFileDisplayMode = (value) => {
|
|
1546
1547
|
return value === "url" || value === "embed" || value === "inline" ? value : DEFAULT_FILE_DISPLAY_MODE;
|
|
1547
1548
|
};
|
|
@@ -1578,20 +1579,10 @@ function MediaFileStaticBody({ canEmbed, displayMode, name, url }) {
|
|
|
1578
1579
|
);
|
|
1579
1580
|
}
|
|
1580
1581
|
if (displayMode === "url") {
|
|
1581
|
-
return /* @__PURE__ */ jsxs11(
|
|
1582
|
-
"
|
|
1583
|
-
{
|
|
1584
|
-
|
|
1585
|
-
contentEditable: false,
|
|
1586
|
-
href: url,
|
|
1587
|
-
rel: "noopener noreferrer",
|
|
1588
|
-
target: "_blank",
|
|
1589
|
-
children: [
|
|
1590
|
-
/* @__PURE__ */ jsx24(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
1591
|
-
/* @__PURE__ */ jsx24("span", { className: "truncate", children: url })
|
|
1592
|
-
]
|
|
1593
|
-
}
|
|
1594
|
-
);
|
|
1582
|
+
return /* @__PURE__ */ jsxs11("a", { className: FILE_URL_CLASS_NAME, contentEditable: false, href: url, rel: "noopener noreferrer", target: "_blank", children: [
|
|
1583
|
+
/* @__PURE__ */ jsx24(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
1584
|
+
/* @__PURE__ */ jsx24("span", { className: "truncate", children: url })
|
|
1585
|
+
] });
|
|
1595
1586
|
}
|
|
1596
1587
|
return /* @__PURE__ */ jsx24(
|
|
1597
1588
|
"a",
|
|
@@ -1098,7 +1098,7 @@ function SmartLinkInlineContent({ link, className }) {
|
|
|
1098
1098
|
"span",
|
|
1099
1099
|
{
|
|
1100
1100
|
className: cn(
|
|
1101
|
-
"inline-flex max-w-full items-center gap-[0.2em] rounded-[0.25em] px-[0.4em] py-[0.1em] align-[-0.28em] font-medium text-
|
|
1101
|
+
"inline-flex max-w-full items-center gap-[0.2em] rounded-[0.25em] px-[0.4em] py-[0.1em] align-[-0.28em] font-medium text-editor-link leading-[1.3] outline outline-transparent transition-colors hover:bg-editor-link/5 hover:outline-editor-link/30",
|
|
1102
1102
|
className
|
|
1103
1103
|
),
|
|
1104
1104
|
children: [
|
|
@@ -1114,7 +1114,7 @@ function SmartLinkUrlContent({ link, className }) {
|
|
|
1114
1114
|
"span",
|
|
1115
1115
|
{
|
|
1116
1116
|
className: cn(
|
|
1117
|
-
"inline max-w-full wrap-break-word border-
|
|
1117
|
+
"inline max-w-full wrap-break-word border-b border-editor-link/35 font-medium text-editor-link leading-[inherit] dark-or-inherit:border-editor-link/35!",
|
|
1118
1118
|
className
|
|
1119
1119
|
),
|
|
1120
1120
|
children: [
|
|
@@ -1146,7 +1146,7 @@ function SmartLinkCardContent({ link, className }) {
|
|
|
1146
1146
|
),
|
|
1147
1147
|
/* @__PURE__ */ jsxs5("span", { className: "min-w-0 flex-1", children: [
|
|
1148
1148
|
/* @__PURE__ */ jsxs5("span", { className: "flex min-w-0 items-start gap-3", children: [
|
|
1149
|
-
/* @__PURE__ */ jsx17("span", { className: "min-w-0 flex-1 truncate font-semibold text-
|
|
1149
|
+
/* @__PURE__ */ jsx17("span", { className: "min-w-0 flex-1 truncate font-semibold text-editor-link text-base leading-6", children: link.title }),
|
|
1150
1150
|
link.status ? /* @__PURE__ */ jsx17(SmartLinkStatus, { status: link.status }) : null
|
|
1151
1151
|
] }),
|
|
1152
1152
|
/* @__PURE__ */ jsxs5("span", { className: "mt-2 flex min-w-0 items-center gap-2 text-muted-foreground text-sm", children: [
|
|
@@ -1164,7 +1164,7 @@ function SmartLinkCardContent({ link, className }) {
|
|
|
1164
1164
|
{
|
|
1165
1165
|
faviconUrl: link.faviconUrl,
|
|
1166
1166
|
provider: link.provider,
|
|
1167
|
-
className: "size-5 rounded bg-
|
|
1167
|
+
className: "size-5 rounded bg-editor-link p-1 text-white dark-or-inherit:text-primary-foreground"
|
|
1168
1168
|
}
|
|
1169
1169
|
),
|
|
1170
1170
|
/* @__PURE__ */ jsx17("span", { className: "truncate", children: (_a = link.provider) != null ? _a : "Link" })
|
|
@@ -1727,6 +1727,7 @@ import { SlateElement as SlateElement13 } from "platejs/static";
|
|
|
1727
1727
|
// src/ui/media-file-display.ts
|
|
1728
1728
|
var FILE_DISPLAY_MODES = ["inline", "url", "embed"];
|
|
1729
1729
|
var DEFAULT_FILE_DISPLAY_MODE = "inline";
|
|
1730
|
+
var FILE_URL_CLASS_NAME = "inline-flex max-w-full items-center gap-1 break-all border-b border-editor-link/35 font-medium text-editor-link dark-or-inherit:border-editor-link/35!";
|
|
1730
1731
|
var normalizeFileDisplayMode = (value) => {
|
|
1731
1732
|
return value === "url" || value === "embed" || value === "inline" ? value : DEFAULT_FILE_DISPLAY_MODE;
|
|
1732
1733
|
};
|
|
@@ -1763,20 +1764,10 @@ function MediaFileStaticBody({ canEmbed, displayMode, name, url }) {
|
|
|
1763
1764
|
);
|
|
1764
1765
|
}
|
|
1765
1766
|
if (displayMode === "url") {
|
|
1766
|
-
return /* @__PURE__ */ jsxs11(
|
|
1767
|
-
"
|
|
1768
|
-
{
|
|
1769
|
-
|
|
1770
|
-
contentEditable: false,
|
|
1771
|
-
href: url,
|
|
1772
|
-
rel: "noopener noreferrer",
|
|
1773
|
-
target: "_blank",
|
|
1774
|
-
children: [
|
|
1775
|
-
/* @__PURE__ */ jsx24(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
1776
|
-
/* @__PURE__ */ jsx24("span", { className: "truncate", children: url })
|
|
1777
|
-
]
|
|
1778
|
-
}
|
|
1779
|
-
);
|
|
1767
|
+
return /* @__PURE__ */ jsxs11("a", { className: FILE_URL_CLASS_NAME, contentEditable: false, href: url, rel: "noopener noreferrer", target: "_blank", children: [
|
|
1768
|
+
/* @__PURE__ */ jsx24(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
1769
|
+
/* @__PURE__ */ jsx24("span", { className: "truncate", children: url })
|
|
1770
|
+
] });
|
|
1780
1771
|
}
|
|
1781
1772
|
return /* @__PURE__ */ jsx24(
|
|
1782
1773
|
"a",
|
|
@@ -6482,6 +6473,16 @@ var backgroundColorItems = [
|
|
|
6482
6473
|
|
|
6483
6474
|
// src/ui/input.tsx
|
|
6484
6475
|
import { cva as cva12 } from "class-variance-authority";
|
|
6476
|
+
|
|
6477
|
+
// src/context/text-field-attributes.ts
|
|
6478
|
+
import { createContext as createContext7, useContext as useContext7, useState as useState13 } from "react";
|
|
6479
|
+
var EMPTY_ATTRIBUTES = Object.freeze({});
|
|
6480
|
+
var TextFieldAttributesContext = createContext7(EMPTY_ATTRIBUTES);
|
|
6481
|
+
function useTextFieldAttributes() {
|
|
6482
|
+
return useContext7(TextFieldAttributesContext);
|
|
6483
|
+
}
|
|
6484
|
+
|
|
6485
|
+
// src/ui/input.tsx
|
|
6485
6486
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
6486
6487
|
var inputVariants = cva12(
|
|
6487
6488
|
cn(
|
|
@@ -6503,9 +6504,16 @@ var inputVariants = cva12(
|
|
|
6503
6504
|
}
|
|
6504
6505
|
}
|
|
6505
6506
|
);
|
|
6507
|
+
var TEXT_INPUT_TYPES = /* @__PURE__ */ new Set(["text", "search", "url", "email", "tel", "password"]);
|
|
6508
|
+
function UnstyledInput(_a) {
|
|
6509
|
+
var _b = _a, { type = "text" } = _b, props = __objRest(_b, ["type"]);
|
|
6510
|
+
const attributes = useTextFieldAttributes();
|
|
6511
|
+
const textFieldAttributes = TEXT_INPUT_TYPES.has(type.toLowerCase()) ? attributes : void 0;
|
|
6512
|
+
return /* @__PURE__ */ jsx53("input", __spreadValues(__spreadProps(__spreadValues({}, textFieldAttributes), { type }), props));
|
|
6513
|
+
}
|
|
6506
6514
|
function Input(_a) {
|
|
6507
6515
|
var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
|
|
6508
|
-
return /* @__PURE__ */ jsx53(
|
|
6516
|
+
return /* @__PURE__ */ jsx53(UnstyledInput, __spreadValues({ className: cn(inputVariants({ variant }), className) }, props));
|
|
6509
6517
|
}
|
|
6510
6518
|
|
|
6511
6519
|
// src/ui/menu.tsx
|
|
@@ -7897,6 +7905,7 @@ function CommandInput(_a) {
|
|
|
7897
7905
|
"variant",
|
|
7898
7906
|
"wrapClassName"
|
|
7899
7907
|
]);
|
|
7908
|
+
const attributes = useTextFieldAttributes();
|
|
7900
7909
|
return /* @__PURE__ */ jsx64(
|
|
7901
7910
|
"div",
|
|
7902
7911
|
{
|
|
@@ -7905,10 +7914,10 @@ function CommandInput(_a) {
|
|
|
7905
7914
|
"data-slot": "command-input-wrapper",
|
|
7906
7915
|
children: /* @__PURE__ */ jsx64(
|
|
7907
7916
|
CommandPrimitive.Input,
|
|
7908
|
-
__spreadValues({
|
|
7917
|
+
__spreadValues(__spreadProps(__spreadValues({}, attributes), {
|
|
7909
7918
|
className: cn(inputVariants({ variant }), className),
|
|
7910
7919
|
"data-slot": "command-input"
|
|
7911
|
-
}, props)
|
|
7920
|
+
}), props)
|
|
7912
7921
|
)
|
|
7913
7922
|
}
|
|
7914
7923
|
);
|
|
@@ -8839,7 +8848,14 @@ var textareaVariants = cva19(
|
|
|
8839
8848
|
);
|
|
8840
8849
|
function TextareaAutosize(_a) {
|
|
8841
8850
|
var _b = _a, { children, className, variant } = _b, props = __objRest(_b, ["children", "className", "variant"]);
|
|
8842
|
-
|
|
8851
|
+
const attributes = useTextFieldAttributes();
|
|
8852
|
+
return /* @__PURE__ */ jsx75(
|
|
8853
|
+
ReactTextareaAutosize,
|
|
8854
|
+
__spreadValues(__spreadProps(__spreadValues({}, attributes), {
|
|
8855
|
+
autoComplete: "off",
|
|
8856
|
+
className: cn(textareaVariants({ variant }), className)
|
|
8857
|
+
}), props)
|
|
8858
|
+
);
|
|
8843
8859
|
}
|
|
8844
8860
|
|
|
8845
8861
|
// src/ui/ai-menu.tsx
|
|
@@ -11477,15 +11493,14 @@ function EmojiPickerSearchBar({
|
|
|
11477
11493
|
}) {
|
|
11478
11494
|
return /* @__PURE__ */ jsx96("div", { className: "flex items-center px-2", children: /* @__PURE__ */ jsxs54("div", { className: "relative flex grow items-center", children: [
|
|
11479
11495
|
/* @__PURE__ */ jsx96(
|
|
11480
|
-
|
|
11496
|
+
UnstyledInput,
|
|
11481
11497
|
{
|
|
11482
11498
|
className: "block w-full appearance-none rounded-full border-0 bg-muted px-10 py-2 text-sm outline-none placeholder:text-muted-foreground focus-visible:outline-none",
|
|
11483
11499
|
value: searchValue,
|
|
11484
11500
|
onChange: (event) => setSearch(event.target.value),
|
|
11485
11501
|
placeholder: i18n.search,
|
|
11486
11502
|
"aria-label": "Search",
|
|
11487
|
-
autoComplete: "off"
|
|
11488
|
-
type: "text"
|
|
11503
|
+
autoComplete: "off"
|
|
11489
11504
|
}
|
|
11490
11505
|
),
|
|
11491
11506
|
children
|
|
@@ -13058,6 +13073,7 @@ function InlineComboboxInput(_a) {
|
|
|
13058
13073
|
Ariakit2.Combobox,
|
|
13059
13074
|
__spreadValues(__spreadValues({
|
|
13060
13075
|
autoSelect: true,
|
|
13076
|
+
render: /* @__PURE__ */ jsx106(UnstyledInput, {}),
|
|
13061
13077
|
className: cn("absolute top-0 left-0 size-full bg-transparent outline-hidden", className),
|
|
13062
13078
|
ref,
|
|
13063
13079
|
value
|
|
@@ -13271,7 +13287,7 @@ import { useLink } from "@platejs/link/react";
|
|
|
13271
13287
|
import { SuggestionPlugin as SuggestionPlugin3 } from "@platejs/suggestion/react";
|
|
13272
13288
|
import { NodeApi as NodeApi13 } from "platejs";
|
|
13273
13289
|
import { PlateElement as PlateElement16, useEditorPlugin as useEditorPlugin9, useElement as useElement8, useReadOnly as useReadOnly9 } from "platejs/react";
|
|
13274
|
-
import { useCallback as useCallback26, useMemo as useMemo14, useState as
|
|
13290
|
+
import { useCallback as useCallback26, useMemo as useMemo14, useState as useState27 } from "react";
|
|
13275
13291
|
|
|
13276
13292
|
// src/ui/smart-link-clipboard.ts
|
|
13277
13293
|
var copySmartLinkUrl = async (url) => {
|
|
@@ -13309,10 +13325,10 @@ import { ArrowUpRightIcon as ArrowUpRightIcon3, PencilIcon as PencilIcon5, Trash
|
|
|
13309
13325
|
|
|
13310
13326
|
// src/ui/smart-link-copy-button.tsx
|
|
13311
13327
|
import { CheckIcon as CheckIcon12, CopyIcon, XIcon as XIcon6 } from "lucide-react";
|
|
13312
|
-
import { useCallback as useCallback24, useEffect as useEffect33, useState as
|
|
13328
|
+
import { useCallback as useCallback24, useEffect as useEffect33, useState as useState26 } from "react";
|
|
13313
13329
|
import { jsx as jsx108 } from "react/jsx-runtime";
|
|
13314
13330
|
function SmartLinkCopyButton({ disabled, onCopy }) {
|
|
13315
|
-
const [feedback, setFeedback] =
|
|
13331
|
+
const [feedback, setFeedback] = useState26("idle");
|
|
13316
13332
|
useEffect33(() => {
|
|
13317
13333
|
if (feedback === "idle") return;
|
|
13318
13334
|
const timeoutId = window.setTimeout(() => {
|
|
@@ -13480,8 +13496,8 @@ function LinkElement(_a) {
|
|
|
13480
13496
|
const { api, editor, setOption } = useEditorPlugin9(linkPlugin);
|
|
13481
13497
|
const adapter = useEditorAdapter();
|
|
13482
13498
|
const readOnly = useReadOnly9();
|
|
13483
|
-
const [isToolbarOpen, setIsToolbarOpen] =
|
|
13484
|
-
const [isModeMenuOpen, setIsModeMenuOpen] =
|
|
13499
|
+
const [isToolbarOpen, setIsToolbarOpen] = useState27(false);
|
|
13500
|
+
const [isModeMenuOpen, setIsModeMenuOpen] = useState27(false);
|
|
13485
13501
|
const displayMode = normalizeSmartLinkDisplayMode(element.displayMode);
|
|
13486
13502
|
const open = !readOnly && (isToolbarOpen || isModeMenuOpen);
|
|
13487
13503
|
const reference = useMemo14(() => readElementReference(element), [element]);
|
|
@@ -13658,12 +13674,12 @@ var PlainLinkElement = (props) => /* @__PURE__ */ jsx111(LinkElement, __spreadPr
|
|
|
13658
13674
|
|
|
13659
13675
|
// src/ui/link-toolbar.tsx
|
|
13660
13676
|
import { useEditorPlugin as useEditorPlugin12, useEditorSelector as useEditorSelector2, usePluginOption as usePluginOption17 } from "platejs/react";
|
|
13661
|
-
import { useCallback as useCallback29, useEffect as useEffect36, useState as
|
|
13677
|
+
import { useCallback as useCallback29, useEffect as useEffect36, useState as useState30 } from "react";
|
|
13662
13678
|
|
|
13663
13679
|
// src/ui/link-search-panel.tsx
|
|
13664
13680
|
import { BookmarkIcon, LinkIcon as LinkIcon3 } from "lucide-react";
|
|
13665
13681
|
import { useEditorPlugin as useEditorPlugin10 } from "platejs/react";
|
|
13666
|
-
import { useCallback as useCallback27, useEffect as useEffect34, useState as
|
|
13682
|
+
import { useCallback as useCallback27, useEffect as useEffect34, useState as useState28 } from "react";
|
|
13667
13683
|
|
|
13668
13684
|
// src/ui/link-toolbar-shared.ts
|
|
13669
13685
|
import { unwrapLink as unwrapLink2, upsertLink } from "@platejs/link";
|
|
@@ -13806,10 +13822,10 @@ function LinkSearchPanel({ initialUrl }) {
|
|
|
13806
13822
|
const adapter = useEditorAdapter();
|
|
13807
13823
|
const { editor } = useEditorPlugin10(linkPlugin);
|
|
13808
13824
|
const canLinkPage = adapter.permissions.canLinkPage;
|
|
13809
|
-
const [query, setQuery] =
|
|
13810
|
-
const [displayText, setDisplayText] =
|
|
13811
|
-
const [pages, setPages] =
|
|
13812
|
-
const [isLoading, setIsLoading] =
|
|
13825
|
+
const [query, setQuery] = useState28(initialUrl);
|
|
13826
|
+
const [displayText, setDisplayText] = useState28(() => readSelectionText(editor));
|
|
13827
|
+
const [pages, setPages] = useState28([]);
|
|
13828
|
+
const [isLoading, setIsLoading] = useState28(true);
|
|
13813
13829
|
const trimmedQuery = query.trim();
|
|
13814
13830
|
const safeUrl = trimmedQuery.length > 0 ? getSafeSmartLinkUrl(trimmedQuery) : null;
|
|
13815
13831
|
const searchTerm = isLikelySmartLinkUrl(query) ? "" : trimmedQuery;
|
|
@@ -13953,11 +13969,11 @@ import { CursorOverlayPlugin as CursorOverlayPlugin2 } from "@platejs/selection/
|
|
|
13953
13969
|
import { LinkIcon as LinkIcon4, Trash2Icon as Trash2Icon2 } from "lucide-react";
|
|
13954
13970
|
import { NodeApi as NodeApi15 } from "platejs";
|
|
13955
13971
|
import { useEditorPlugin as useEditorPlugin11, usePluginOption as usePluginOption16 } from "platejs/react";
|
|
13956
|
-
import { useCallback as useCallback28, useEffect as useEffect35, useState as
|
|
13972
|
+
import { useCallback as useCallback28, useEffect as useEffect35, useState as useState29 } from "react";
|
|
13957
13973
|
import { jsx as jsx113, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
13958
13974
|
function EditLinkCommand({ autoFocus, initialUrl, setInitialUrl }) {
|
|
13959
|
-
const [url, setUrl] =
|
|
13960
|
-
const [text, setText] =
|
|
13975
|
+
const [url, setUrl] = useState29(initialUrl);
|
|
13976
|
+
const [text, setText] = useState29("");
|
|
13961
13977
|
const mode = usePluginOption16(linkPlugin, "mode");
|
|
13962
13978
|
const { editor, setOption } = useEditorPlugin11(linkPlugin);
|
|
13963
13979
|
const activeLinkId = usePluginOption16(linkPlugin, "activeId");
|
|
@@ -14084,7 +14100,7 @@ function LinkFloatingToolbar() {
|
|
|
14084
14100
|
})) == null ? void 0 : _a2[0];
|
|
14085
14101
|
}, []);
|
|
14086
14102
|
const aboveUrl = (_a = aboveLink == null ? void 0 : aboveLink.url) != null ? _a : "";
|
|
14087
|
-
const [initialUrl, setInitialUrl] =
|
|
14103
|
+
const [initialUrl, setInitialUrl] = useState30(aboveUrl);
|
|
14088
14104
|
const open = mode === "insert" || mode === "edit" || mode === "cursor";
|
|
14089
14105
|
useEffect36(() => {
|
|
14090
14106
|
setInitialUrl(aboveUrl);
|
|
@@ -14901,9 +14917,10 @@ function Caption(_a) {
|
|
|
14901
14917
|
return /* @__PURE__ */ jsx129(CaptionPrimitive, __spreadProps(__spreadValues({}, props), { className: cn(captionVariants({ align }), "px-3 pb-2", className) }));
|
|
14902
14918
|
}
|
|
14903
14919
|
function CaptionTextarea(props) {
|
|
14920
|
+
const attributes = useTextFieldAttributes();
|
|
14904
14921
|
return /* @__PURE__ */ jsx129(
|
|
14905
14922
|
CaptionTextareaPrimitive,
|
|
14906
|
-
__spreadProps(__spreadValues({}, props), {
|
|
14923
|
+
__spreadProps(__spreadValues(__spreadValues({}, attributes), props), {
|
|
14907
14924
|
className: cn(
|
|
14908
14925
|
"mt-2 w-full resize-none border-none bg-inherit p-0 font-[inherit] text-inherit",
|
|
14909
14926
|
"focus:outline-none focus:placeholder:opacity-0",
|
|
@@ -15441,7 +15458,7 @@ import { useMediaState as useMediaState3 } from "@platejs/media/react";
|
|
|
15441
15458
|
import { ResizableProvider as ResizableProvider4 } from "@platejs/resizable";
|
|
15442
15459
|
import { ArrowUpRightIcon as ArrowUpRightIcon4, FileUpIcon, LinkIcon as LinkIcon6 } from "lucide-react";
|
|
15443
15460
|
import { PlateElement as PlateElement20, useEditorRef as useEditorRef32, useElement as useElement13, withHOC as withHOC4 } from "platejs/react";
|
|
15444
|
-
import { useCallback as useCallback39, useState as
|
|
15461
|
+
import { useCallback as useCallback39, useState as useState33 } from "react";
|
|
15445
15462
|
|
|
15446
15463
|
// src/ui/media-file-mode-dropdown.tsx
|
|
15447
15464
|
import { ChevronDownIcon as ChevronDownIcon9, FileIcon, FrameIcon, LinkIcon as LinkIcon5 } from "lucide-react";
|
|
@@ -15530,7 +15547,10 @@ function MediaFileBody({ canEmbed, displayMode, name, onAnchorClick, url }) {
|
|
|
15530
15547
|
return /* @__PURE__ */ jsxs80(
|
|
15531
15548
|
"a",
|
|
15532
15549
|
{
|
|
15533
|
-
className:
|
|
15550
|
+
className: cn(
|
|
15551
|
+
FILE_URL_CLASS_NAME,
|
|
15552
|
+
"cursor-pointer transition-colors hover:border-editor-link dark-or-inherit:hover:border-editor-link!"
|
|
15553
|
+
),
|
|
15534
15554
|
contentEditable: false,
|
|
15535
15555
|
href: url,
|
|
15536
15556
|
onClick: onAnchorClick,
|
|
@@ -15568,7 +15588,7 @@ var MediaFileElement = withHOC4(ResizableProvider4, function MediaFileElement2(p
|
|
|
15568
15588
|
const fileName = name != null ? name : "";
|
|
15569
15589
|
const fileUrl = unsafeUrl != null ? unsafeUrl : "";
|
|
15570
15590
|
const canEmbed = isEmbeddableFile(fileName, fileUrl);
|
|
15571
|
-
const [isModeMenuOpen, setIsModeMenuOpen] =
|
|
15591
|
+
const [isModeMenuOpen, setIsModeMenuOpen] = useState33(false);
|
|
15572
15592
|
const open = !readOnly && (selected || isModeMenuOpen);
|
|
15573
15593
|
const handleOpen = useCallback39(() => {
|
|
15574
15594
|
if (fileUrl.length === 0) return;
|
|
@@ -15815,7 +15835,7 @@ import {
|
|
|
15815
15835
|
import { AudioLinesIcon, FileUpIcon as FileUpIcon2, FilmIcon, ImageIcon } from "lucide-react";
|
|
15816
15836
|
import { KEYS as KEYS29, nanoid as nanoid7 } from "platejs";
|
|
15817
15837
|
import { PlateElement as PlateElement22, useEditorPlugin as useEditorPlugin17, withHOC as withHOC6 } from "platejs/react";
|
|
15818
|
-
import { useCallback as useCallback40, useEffect as useEffect40, useRef as useRef13, useState as
|
|
15838
|
+
import { useCallback as useCallback40, useEffect as useEffect40, useRef as useRef13, useState as useState34 } from "react";
|
|
15819
15839
|
import { useFilePicker } from "use-file-picker";
|
|
15820
15840
|
|
|
15821
15841
|
// src/hooks/use-upload-file.ts
|
|
@@ -16057,7 +16077,7 @@ function MediaPlaceholderPopover({ children }) {
|
|
|
16057
16077
|
var _a, _b, _c;
|
|
16058
16078
|
const { api, editor, getOption, tf } = useEditorPlugin17(PlaceholderPlugin3);
|
|
16059
16079
|
const { id, element, mediaType, readOnly, selected, setIsUploading, setProgresses, setUpdatedFiles, size } = usePlaceholderPopoverState();
|
|
16060
|
-
const [open, setOpen] =
|
|
16080
|
+
const [open, setOpen] = useState34(false);
|
|
16061
16081
|
const currentMedia = MEDIA_CONFIG[mediaType];
|
|
16062
16082
|
const uploadConfig = useUploadConfig();
|
|
16063
16083
|
const adapter = useEditorAdapter();
|
|
@@ -16117,7 +16137,7 @@ function MediaPlaceholderPopover({ children }) {
|
|
|
16117
16137
|
{ at: path }
|
|
16118
16138
|
);
|
|
16119
16139
|
}, [uploadedFile, element.id, size]);
|
|
16120
|
-
const [embedValue, setEmbedValue] =
|
|
16140
|
+
const [embedValue, setEmbedValue] = useState34("");
|
|
16121
16141
|
const onEmbed = useCallback40(
|
|
16122
16142
|
(value) => {
|
|
16123
16143
|
const path = editor.api.findPath(element);
|
|
@@ -16173,7 +16193,7 @@ function ImageProgress({
|
|
|
16173
16193
|
imageRef,
|
|
16174
16194
|
progress = 0
|
|
16175
16195
|
}) {
|
|
16176
|
-
const [objectUrl, setObjectUrl] =
|
|
16196
|
+
const [objectUrl, setObjectUrl] = useState34(null);
|
|
16177
16197
|
useEffect40(() => {
|
|
16178
16198
|
const url = URL.createObjectURL(file);
|
|
16179
16199
|
setObjectUrl(url);
|
|
@@ -16561,7 +16581,7 @@ import { KEYS as KEYS31 } from "platejs";
|
|
|
16561
16581
|
// src/ui/mention-element.tsx
|
|
16562
16582
|
import { IS_APPLE as IS_APPLE2 } from "platejs";
|
|
16563
16583
|
import { PlateElement as PlateElement25, useFocused as useFocused3, useHotkeys as useHotkeys4, useReadOnly as useReadOnly14, useSelected as useSelected5 } from "platejs/react";
|
|
16564
|
-
import { useCallback as useCallback43, useState as
|
|
16584
|
+
import { useCallback as useCallback43, useState as useState36 } from "react";
|
|
16565
16585
|
import { useMounted as useMounted2 } from "react-tweet";
|
|
16566
16586
|
|
|
16567
16587
|
// src/ui/mention-document-element.tsx
|
|
@@ -16573,7 +16593,7 @@ import {
|
|
|
16573
16593
|
useReadOnly as useReadOnly13,
|
|
16574
16594
|
useSelected as useSelected4
|
|
16575
16595
|
} from "platejs/react";
|
|
16576
|
-
import { useCallback as useCallback42, useMemo as useMemo16, useState as
|
|
16596
|
+
import { useCallback as useCallback42, useMemo as useMemo16, useState as useState35 } from "react";
|
|
16577
16597
|
|
|
16578
16598
|
// src/ui/mention-document-hover-card.tsx
|
|
16579
16599
|
import { useCallback as useCallback41 } from "react";
|
|
@@ -16625,8 +16645,8 @@ function DocumentMentionElement(props) {
|
|
|
16625
16645
|
const focused = useFocused2();
|
|
16626
16646
|
const editor = useEditorRef35();
|
|
16627
16647
|
const readOnly = useReadOnly13();
|
|
16628
|
-
const [isToolbarOpen, setIsToolbarOpen] =
|
|
16629
|
-
const [isModeMenuOpen, setIsModeMenuOpen] =
|
|
16648
|
+
const [isToolbarOpen, setIsToolbarOpen] = useState35(false);
|
|
16649
|
+
const [isModeMenuOpen, setIsModeMenuOpen] = useState35(false);
|
|
16630
16650
|
const adapter = useEditorAdapter();
|
|
16631
16651
|
const canLinkPage = adapter.permissions.canLinkPage;
|
|
16632
16652
|
const resolvePage = adapter.pageLinks.resolvePage;
|
|
@@ -16779,7 +16799,7 @@ function UserMentionElement(props) {
|
|
|
16779
16799
|
const resolveMember = adapter.mentions.resolveMember;
|
|
16780
16800
|
const memberId = (_a = element.key) != null ? _a : "";
|
|
16781
16801
|
const canShowCard = typeof resolveMember === "function" && memberId.length > 0;
|
|
16782
|
-
const [wantOpen, setWantOpen] =
|
|
16802
|
+
const [wantOpen, setWantOpen] = useState36(false);
|
|
16783
16803
|
const { profile, isLoading, hasResolved } = useMemberProfile({
|
|
16784
16804
|
enabled: canShowCard && wantOpen,
|
|
16785
16805
|
memberId,
|
|
@@ -16870,16 +16890,16 @@ function UserMentionElement(props) {
|
|
|
16870
16890
|
import { DatePlugin as DatePlugin2 } from "@platejs/date/react";
|
|
16871
16891
|
import { MentionPlugin } from "@platejs/mention/react";
|
|
16872
16892
|
import { PlateElement as PlateElement26 } from "platejs/react";
|
|
16873
|
-
import { useCallback as useCallback44, useState as
|
|
16893
|
+
import { useCallback as useCallback44, useState as useState39 } from "react";
|
|
16874
16894
|
|
|
16875
16895
|
// src/ui/mention-page-combobox-group.tsx
|
|
16876
16896
|
import { FileTextIcon as FileTextIcon3 } from "lucide-react";
|
|
16877
|
-
import { useEffect as useEffect42, useState as
|
|
16897
|
+
import { useEffect as useEffect42, useState as useState37 } from "react";
|
|
16878
16898
|
import { jsx as jsx146, jsxs as jsxs87 } from "react/jsx-runtime";
|
|
16879
16899
|
function PageComboboxGroup({ search, onPageHover, onPageSelect }) {
|
|
16880
16900
|
const adapter = useEditorAdapter();
|
|
16881
16901
|
const debouncedSearch = useDebounce(search, 250);
|
|
16882
|
-
const [pages, setPages] =
|
|
16902
|
+
const [pages, setPages] = useState37([]);
|
|
16883
16903
|
useEffect42(() => {
|
|
16884
16904
|
if (!adapter.permissions.canLinkPage) {
|
|
16885
16905
|
setPages([]);
|
|
@@ -16929,12 +16949,12 @@ function PageStatusBadge({ status }) {
|
|
|
16929
16949
|
}
|
|
16930
16950
|
|
|
16931
16951
|
// src/ui/mention-people-combobox-group.tsx
|
|
16932
|
-
import { useEffect as useEffect43, useState as
|
|
16952
|
+
import { useEffect as useEffect43, useState as useState38 } from "react";
|
|
16933
16953
|
import { jsx as jsx147, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
16934
16954
|
function PeopleComboboxGroup({ search, onUserHover, onUserSelect }) {
|
|
16935
16955
|
const adapter = useEditorAdapter();
|
|
16936
16956
|
const debouncedSearch = useDebounce(search, 150);
|
|
16937
|
-
const [members, setMembers] =
|
|
16957
|
+
const [members, setMembers] = useState38([]);
|
|
16938
16958
|
useEffect43(() => {
|
|
16939
16959
|
if (!adapter.permissions.canMention) {
|
|
16940
16960
|
setMembers([]);
|
|
@@ -16988,8 +17008,8 @@ var DEFAULT_PLACEHOLDER = "Mention a person, page, or date";
|
|
|
16988
17008
|
var TODAY_PLACEHOLDER = "Today";
|
|
16989
17009
|
function MentionInputElement(props) {
|
|
16990
17010
|
const { children, editor, element } = props;
|
|
16991
|
-
const [search, setSearch] =
|
|
16992
|
-
const [placeholder, setPlaceholder] =
|
|
17011
|
+
const [search, setSearch] = useState39("");
|
|
17012
|
+
const [placeholder, setPlaceholder] = useState39(DEFAULT_PLACEHOLDER);
|
|
16993
17013
|
const handleDateFocus = useCallback44(() => {
|
|
16994
17014
|
setPlaceholder(TODAY_PLACEHOLDER);
|
|
16995
17015
|
}, []);
|
|
@@ -18438,7 +18458,7 @@ function DefaultToggleView({
|
|
|
18438
18458
|
children: [
|
|
18439
18459
|
/* @__PURE__ */ jsx153(ToggleChevron, { open }),
|
|
18440
18460
|
isEditing ? /* @__PURE__ */ jsx153(
|
|
18441
|
-
|
|
18461
|
+
UnstyledInput,
|
|
18442
18462
|
{
|
|
18443
18463
|
ref: inputRef,
|
|
18444
18464
|
className: "min-w-30 bg-transparent font-semibold text-foreground outline-none",
|