@delali/web-editor 0.4.1 → 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.
@@ -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-[#0C66E4] leading-[1.3] outline outline-transparent transition-colors hover:bg-[#0C66E4]/5 hover:outline-[#0C66E4]/30",
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-[#0C66E4]/35 border-b font-medium text-[#0C66E4] leading-[inherit]",
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-[#0C66E4] text-base leading-6", children: link.title }),
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-[#0C66E4] p-1 text-white"
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
- "a",
1768
- {
1769
- className: "inline-flex max-w-full items-center gap-1 break-all border-[#0C66E4]/35 border-b font-medium text-[#0C66E4]",
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("input", __spreadValues({ className: cn(inputVariants({ variant }), className) }, props));
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
- return /* @__PURE__ */ jsx75(ReactTextareaAutosize, __spreadValues({ autoComplete: "off", className: cn(textareaVariants({ variant }), className) }, props));
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
- "input",
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
@@ -12859,11 +12874,49 @@ import { filterWords } from "@platejs/combobox";
12859
12874
  import { useComboboxInput, useHTMLInputCursorState } from "@platejs/combobox/react";
12860
12875
  import { cva as cva22 } from "class-variance-authority";
12861
12876
  import { useComposedRef as useComposedRef2, useEditorRef as useEditorRef20 } from "platejs/react";
12862
- import React37, { useEffect as useEffect31 } from "react";
12877
+ import React37, { useEffect as useEffect32 } from "react";
12878
+
12879
+ // src/hooks/use-return-focus-to-editor-on-input-removal.ts
12880
+ import { useEffect as useEffect30, useLayoutEffect as useLayoutEffect2, useRef as useRef12 } from "react";
12881
+ var focusEditableAtEditorSelection = (editor) => {
12882
+ const editable = editor.api.toDOMNode(editor);
12883
+ if (!(editable == null ? void 0 : editable.isConnected)) {
12884
+ return;
12885
+ }
12886
+ const document2 = editable.ownerDocument;
12887
+ const activeElement = document2.activeElement;
12888
+ if (activeElement && activeElement !== document2.body) {
12889
+ return;
12890
+ }
12891
+ const domRange = editor.selection ? editor.api.toDOMRange(editor.selection) : void 0;
12892
+ editable.focus({ preventScroll: true });
12893
+ const domSelection = document2.getSelection();
12894
+ if (domRange && domSelection) {
12895
+ domSelection.removeAllRanges();
12896
+ domSelection.addRange(domRange);
12897
+ }
12898
+ };
12899
+ var useReturnFocusToEditorOnInputRemoval = (editor, inputRef) => {
12900
+ const inputHadFocusWhenRemoved = useRef12(false);
12901
+ useLayoutEffect2(() => {
12902
+ const input = inputRef.current;
12903
+ return () => {
12904
+ inputHadFocusWhenRemoved.current = !!input && input.ownerDocument.activeElement === input;
12905
+ };
12906
+ }, [inputRef]);
12907
+ useEffect30(
12908
+ () => () => {
12909
+ if (inputHadFocusWhenRemoved.current) {
12910
+ focusEditableAtEditorSelection(editor);
12911
+ }
12912
+ },
12913
+ [editor]
12914
+ );
12915
+ };
12863
12916
 
12864
12917
  // src/hooks/use-shield-input-selection-from-editor.ts
12865
12918
  import { RangeApi as RangeApi2 } from "platejs";
12866
- import { useEffect as useEffect30 } from "react";
12919
+ import { useEffect as useEffect31 } from "react";
12867
12920
  var SLATE_TEXT_SELECTOR = "[data-slate-string], [data-slate-zero-width]";
12868
12921
  var isCaretInEditorText = (node) => {
12869
12922
  var _a;
@@ -12881,7 +12934,7 @@ var wouldPullCaretOutOfInput = (editor, input) => {
12881
12934
  return !!range && RangeApi2.equals(range, editor.selection);
12882
12935
  };
12883
12936
  var useShieldInputSelectionFromEditor = (editor, inputRef) => {
12884
- useEffect30(() => {
12937
+ useEffect31(() => {
12885
12938
  const input = inputRef.current;
12886
12939
  const view = input == null ? void 0 : input.ownerDocument.defaultView;
12887
12940
  if (!input || !view) {
@@ -12945,7 +12998,7 @@ function InlineCombobox({
12945
12998
  [setValueProp, hasValueProp]
12946
12999
  );
12947
13000
  const insertPoint = React37.useRef(null);
12948
- useEffect31(() => {
13001
+ useEffect32(() => {
12949
13002
  const path = editor.api.findPath(element);
12950
13003
  if (!path) return;
12951
13004
  const point = editor.api.before(path);
@@ -13011,6 +13064,7 @@ function InlineComboboxInput(_a) {
13011
13064
  const editor = useEditorRef20();
13012
13065
  const ref = useComposedRef2(refProp, contextRef);
13013
13066
  useShieldInputSelectionFromEditor(editor, contextRef);
13067
+ useReturnFocusToEditorOnInputRemoval(editor, contextRef);
13014
13068
  return /* @__PURE__ */ jsxs60(Fragment15, { children: [
13015
13069
  showTrigger && trigger,
13016
13070
  /* @__PURE__ */ jsxs60("span", { className: "relative min-h-lh", children: [
@@ -13019,6 +13073,7 @@ function InlineComboboxInput(_a) {
13019
13073
  Ariakit2.Combobox,
13020
13074
  __spreadValues(__spreadValues({
13021
13075
  autoSelect: true,
13076
+ render: /* @__PURE__ */ jsx106(UnstyledInput, {}),
13022
13077
  className: cn("absolute top-0 left-0 size-full bg-transparent outline-hidden", className),
13023
13078
  ref,
13024
13079
  value
@@ -13110,7 +13165,7 @@ function InlineComboboxEmpty({ children, className }) {
13110
13165
  const { setHasEmpty } = React37.useContext(InlineComboboxContext);
13111
13166
  const store = Ariakit2.useComboboxContext();
13112
13167
  const items = (_a = store == null ? void 0 : store.useState("items")) != null ? _a : [];
13113
- useEffect31(() => {
13168
+ useEffect32(() => {
13114
13169
  setHasEmpty(true);
13115
13170
  return () => {
13116
13171
  setHasEmpty(false);
@@ -13232,7 +13287,7 @@ import { useLink } from "@platejs/link/react";
13232
13287
  import { SuggestionPlugin as SuggestionPlugin3 } from "@platejs/suggestion/react";
13233
13288
  import { NodeApi as NodeApi13 } from "platejs";
13234
13289
  import { PlateElement as PlateElement16, useEditorPlugin as useEditorPlugin9, useElement as useElement8, useReadOnly as useReadOnly9 } from "platejs/react";
13235
- import { useCallback as useCallback26, useMemo as useMemo14, useState as useState26 } from "react";
13290
+ import { useCallback as useCallback26, useMemo as useMemo14, useState as useState27 } from "react";
13236
13291
 
13237
13292
  // src/ui/smart-link-clipboard.ts
13238
13293
  var copySmartLinkUrl = async (url) => {
@@ -13270,11 +13325,11 @@ import { ArrowUpRightIcon as ArrowUpRightIcon3, PencilIcon as PencilIcon5, Trash
13270
13325
 
13271
13326
  // src/ui/smart-link-copy-button.tsx
13272
13327
  import { CheckIcon as CheckIcon12, CopyIcon, XIcon as XIcon6 } from "lucide-react";
13273
- import { useCallback as useCallback24, useEffect as useEffect32, useState as useState25 } from "react";
13328
+ import { useCallback as useCallback24, useEffect as useEffect33, useState as useState26 } from "react";
13274
13329
  import { jsx as jsx108 } from "react/jsx-runtime";
13275
13330
  function SmartLinkCopyButton({ disabled, onCopy }) {
13276
- const [feedback, setFeedback] = useState25("idle");
13277
- useEffect32(() => {
13331
+ const [feedback, setFeedback] = useState26("idle");
13332
+ useEffect33(() => {
13278
13333
  if (feedback === "idle") return;
13279
13334
  const timeoutId = window.setTimeout(() => {
13280
13335
  setFeedback("idle");
@@ -13441,8 +13496,8 @@ function LinkElement(_a) {
13441
13496
  const { api, editor, setOption } = useEditorPlugin9(linkPlugin);
13442
13497
  const adapter = useEditorAdapter();
13443
13498
  const readOnly = useReadOnly9();
13444
- const [isToolbarOpen, setIsToolbarOpen] = useState26(false);
13445
- const [isModeMenuOpen, setIsModeMenuOpen] = useState26(false);
13499
+ const [isToolbarOpen, setIsToolbarOpen] = useState27(false);
13500
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState27(false);
13446
13501
  const displayMode = normalizeSmartLinkDisplayMode(element.displayMode);
13447
13502
  const open = !readOnly && (isToolbarOpen || isModeMenuOpen);
13448
13503
  const reference = useMemo14(() => readElementReference(element), [element]);
@@ -13619,12 +13674,12 @@ var PlainLinkElement = (props) => /* @__PURE__ */ jsx111(LinkElement, __spreadPr
13619
13674
 
13620
13675
  // src/ui/link-toolbar.tsx
13621
13676
  import { useEditorPlugin as useEditorPlugin12, useEditorSelector as useEditorSelector2, usePluginOption as usePluginOption17 } from "platejs/react";
13622
- import { useCallback as useCallback29, useEffect as useEffect35, useState as useState29 } from "react";
13677
+ import { useCallback as useCallback29, useEffect as useEffect36, useState as useState30 } from "react";
13623
13678
 
13624
13679
  // src/ui/link-search-panel.tsx
13625
13680
  import { BookmarkIcon, LinkIcon as LinkIcon3 } from "lucide-react";
13626
13681
  import { useEditorPlugin as useEditorPlugin10 } from "platejs/react";
13627
- import { useCallback as useCallback27, useEffect as useEffect33, useState as useState27 } from "react";
13682
+ import { useCallback as useCallback27, useEffect as useEffect34, useState as useState28 } from "react";
13628
13683
 
13629
13684
  // src/ui/link-toolbar-shared.ts
13630
13685
  import { unwrapLink as unwrapLink2, upsertLink } from "@platejs/link";
@@ -13767,15 +13822,15 @@ function LinkSearchPanel({ initialUrl }) {
13767
13822
  const adapter = useEditorAdapter();
13768
13823
  const { editor } = useEditorPlugin10(linkPlugin);
13769
13824
  const canLinkPage = adapter.permissions.canLinkPage;
13770
- const [query, setQuery] = useState27(initialUrl);
13771
- const [displayText, setDisplayText] = useState27(() => readSelectionText(editor));
13772
- const [pages, setPages] = useState27([]);
13773
- const [isLoading, setIsLoading] = useState27(true);
13825
+ const [query, setQuery] = useState28(initialUrl);
13826
+ const [displayText, setDisplayText] = useState28(() => readSelectionText(editor));
13827
+ const [pages, setPages] = useState28([]);
13828
+ const [isLoading, setIsLoading] = useState28(true);
13774
13829
  const trimmedQuery = query.trim();
13775
13830
  const safeUrl = trimmedQuery.length > 0 ? getSafeSmartLinkUrl(trimmedQuery) : null;
13776
13831
  const searchTerm = isLikelySmartLinkUrl(query) ? "" : trimmedQuery;
13777
13832
  const debouncedSearch = useDebounce(searchTerm, 200);
13778
- useEffect33(() => {
13833
+ useEffect34(() => {
13779
13834
  if (!canLinkPage) {
13780
13835
  setPages([]);
13781
13836
  setIsLoading(false);
@@ -13914,16 +13969,16 @@ import { CursorOverlayPlugin as CursorOverlayPlugin2 } from "@platejs/selection/
13914
13969
  import { LinkIcon as LinkIcon4, Trash2Icon as Trash2Icon2 } from "lucide-react";
13915
13970
  import { NodeApi as NodeApi15 } from "platejs";
13916
13971
  import { useEditorPlugin as useEditorPlugin11, usePluginOption as usePluginOption16 } from "platejs/react";
13917
- import { useCallback as useCallback28, useEffect as useEffect34, useState as useState28 } from "react";
13972
+ import { useCallback as useCallback28, useEffect as useEffect35, useState as useState29 } from "react";
13918
13973
  import { jsx as jsx113, jsxs as jsxs66 } from "react/jsx-runtime";
13919
13974
  function EditLinkCommand({ autoFocus, initialUrl, setInitialUrl }) {
13920
- const [url, setUrl] = useState28(initialUrl);
13921
- const [text, setText] = useState28("");
13975
+ const [url, setUrl] = useState29(initialUrl);
13976
+ const [text, setText] = useState29("");
13922
13977
  const mode = usePluginOption16(linkPlugin, "mode");
13923
13978
  const { editor, setOption } = useEditorPlugin11(linkPlugin);
13924
13979
  const activeLinkId = usePluginOption16(linkPlugin, "activeId");
13925
13980
  const editingLinkEntry = useActiveLink();
13926
- useEffect34(() => {
13981
+ useEffect35(() => {
13927
13982
  var _a;
13928
13983
  if (!editingLinkEntry) return;
13929
13984
  setText(NodeApi15.string(editingLinkEntry[0]));
@@ -14045,12 +14100,12 @@ function LinkFloatingToolbar() {
14045
14100
  })) == null ? void 0 : _a2[0];
14046
14101
  }, []);
14047
14102
  const aboveUrl = (_a = aboveLink == null ? void 0 : aboveLink.url) != null ? _a : "";
14048
- const [initialUrl, setInitialUrl] = useState29(aboveUrl);
14103
+ const [initialUrl, setInitialUrl] = useState30(aboveUrl);
14049
14104
  const open = mode === "insert" || mode === "edit" || mode === "cursor";
14050
- useEffect35(() => {
14105
+ useEffect36(() => {
14051
14106
  setInitialUrl(aboveUrl);
14052
14107
  }, [aboveUrl]);
14053
- useEffect35(() => {
14108
+ useEffect36(() => {
14054
14109
  if (aboveLink) {
14055
14110
  const timeoutId = window.setTimeout(() => {
14056
14111
  var _a2;
@@ -14631,7 +14686,7 @@ import {
14631
14686
  useReadOnly as useReadOnly12,
14632
14687
  useSelected as useSelected3
14633
14688
  } from "platejs/react";
14634
- import React40, { useEffect as useEffect36 } from "react";
14689
+ import React40, { useEffect as useEffect37 } from "react";
14635
14690
  import { jsx as jsx128, jsxs as jsxs72 } from "react/jsx-runtime";
14636
14691
  function EquationElement(props) {
14637
14692
  const element = useElement9();
@@ -14692,7 +14747,7 @@ function InlineEquationElement(props) {
14692
14747
  const selected = useSelected3();
14693
14748
  const isCollapsed = useEditorSelector5((editor) => editor.api.isCollapsed(), []);
14694
14749
  const [open, setOpen] = React40.useState(selected && isCollapsed);
14695
- useEffect36(() => {
14750
+ useEffect37(() => {
14696
14751
  if (selected && isCollapsed) {
14697
14752
  setOpen(true);
14698
14753
  }
@@ -14772,7 +14827,7 @@ function EquationPopoverContent(_a) {
14772
14827
  const editor = useEditorRef28();
14773
14828
  const readOnly = useReadOnly12();
14774
14829
  const element = useElement9();
14775
- useEffect36(() => {
14830
+ useEffect37(() => {
14776
14831
  if (isInline && open) {
14777
14832
  setOpen(true);
14778
14833
  }
@@ -14862,9 +14917,10 @@ function Caption(_a) {
14862
14917
  return /* @__PURE__ */ jsx129(CaptionPrimitive, __spreadProps(__spreadValues({}, props), { className: cn(captionVariants({ align }), "px-3 pb-2", className) }));
14863
14918
  }
14864
14919
  function CaptionTextarea(props) {
14920
+ const attributes = useTextFieldAttributes();
14865
14921
  return /* @__PURE__ */ jsx129(
14866
14922
  CaptionTextareaPrimitive,
14867
- __spreadProps(__spreadValues({}, props), {
14923
+ __spreadProps(__spreadValues(__spreadValues({}, attributes), props), {
14868
14924
  className: cn(
14869
14925
  "mt-2 w-full resize-none border-none bg-inherit p-0 font-[inherit] text-inherit",
14870
14926
  "focus:outline-none focus:placeholder:opacity-0",
@@ -15402,7 +15458,7 @@ import { useMediaState as useMediaState3 } from "@platejs/media/react";
15402
15458
  import { ResizableProvider as ResizableProvider4 } from "@platejs/resizable";
15403
15459
  import { ArrowUpRightIcon as ArrowUpRightIcon4, FileUpIcon, LinkIcon as LinkIcon6 } from "lucide-react";
15404
15460
  import { PlateElement as PlateElement20, useEditorRef as useEditorRef32, useElement as useElement13, withHOC as withHOC4 } from "platejs/react";
15405
- import { useCallback as useCallback39, useState as useState32 } from "react";
15461
+ import { useCallback as useCallback39, useState as useState33 } from "react";
15406
15462
 
15407
15463
  // src/ui/media-file-mode-dropdown.tsx
15408
15464
  import { ChevronDownIcon as ChevronDownIcon9, FileIcon, FrameIcon, LinkIcon as LinkIcon5 } from "lucide-react";
@@ -15491,7 +15547,10 @@ function MediaFileBody({ canEmbed, displayMode, name, onAnchorClick, url }) {
15491
15547
  return /* @__PURE__ */ jsxs80(
15492
15548
  "a",
15493
15549
  {
15494
- className: "inline-flex max-w-full cursor-pointer items-center gap-1 break-all border-[#0C66E4]/35 border-b font-medium text-[#0C66E4] transition-colors hover:border-[#0C66E4]",
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
+ ),
15495
15554
  contentEditable: false,
15496
15555
  href: url,
15497
15556
  onClick: onAnchorClick,
@@ -15529,7 +15588,7 @@ var MediaFileElement = withHOC4(ResizableProvider4, function MediaFileElement2(p
15529
15588
  const fileName = name != null ? name : "";
15530
15589
  const fileUrl = unsafeUrl != null ? unsafeUrl : "";
15531
15590
  const canEmbed = isEmbeddableFile(fileName, fileUrl);
15532
- const [isModeMenuOpen, setIsModeMenuOpen] = useState32(false);
15591
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState33(false);
15533
15592
  const open = !readOnly && (selected || isModeMenuOpen);
15534
15593
  const handleOpen = useCallback39(() => {
15535
15594
  if (fileUrl.length === 0) return;
@@ -15617,7 +15676,7 @@ import { useDraggable as useDraggable2 } from "@platejs/dnd";
15617
15676
  import { PlaceholderPlugin as PlaceholderPlugin2, useImage, useMediaState as useMediaState4 } from "@platejs/media/react";
15618
15677
  import { ResizableProvider as ResizableProvider5 } from "@platejs/resizable";
15619
15678
  import { PlateElement as PlateElement21, useEditorPlugin as useEditorPlugin16, withHOC as withHOC5 } from "platejs/react";
15620
- import React45, { useEffect as useEffect38, useMemo as useMemo15 } from "react";
15679
+ import React45, { useEffect as useEffect39, useMemo as useMemo15 } from "react";
15621
15680
  import { LazyLoadImage } from "react-lazy-load-image-component";
15622
15681
  import { jsx as jsx139, jsxs as jsxs81 } from "react/jsx-runtime";
15623
15682
  var ImageElement = withHOC5(
@@ -15758,7 +15817,7 @@ var ImageElement = withHOC5(
15758
15817
  );
15759
15818
  var ImagePlaceholder = ({ file }) => {
15760
15819
  const objectUrl = useMemo15(() => file ? URL.createObjectURL(file) : null, [file]);
15761
- useEffect38(() => {
15820
+ useEffect39(() => {
15762
15821
  if (!objectUrl) return;
15763
15822
  return () => URL.revokeObjectURL(objectUrl);
15764
15823
  }, [objectUrl]);
@@ -15776,7 +15835,7 @@ import {
15776
15835
  import { AudioLinesIcon, FileUpIcon as FileUpIcon2, FilmIcon, ImageIcon } from "lucide-react";
15777
15836
  import { KEYS as KEYS29, nanoid as nanoid7 } from "platejs";
15778
15837
  import { PlateElement as PlateElement22, useEditorPlugin as useEditorPlugin17, withHOC as withHOC6 } from "platejs/react";
15779
- import { useCallback as useCallback40, useEffect as useEffect39, useRef as useRef12, useState as useState33 } from "react";
15838
+ import { useCallback as useCallback40, useEffect as useEffect40, useRef as useRef13, useState as useState34 } from "react";
15780
15839
  import { useFilePicker } from "use-file-picker";
15781
15840
 
15782
15841
  // src/hooks/use-upload-file.ts
@@ -15950,8 +16009,8 @@ var PlaceholderElement = withHOC6(PlaceholderProvider, (props) => {
15950
16009
  const isImage = mediaType === KEYS29.img;
15951
16010
  const file = updatedFiles == null ? void 0 : updatedFiles[0];
15952
16011
  const progress = file ? progresses == null ? void 0 : progresses[file.name] : void 0;
15953
- const imageRef = useRef12(null);
15954
- useEffect39(() => {
16012
+ const imageRef = useRef13(null);
16013
+ useEffect40(() => {
15955
16014
  if (!imageRef.current) return;
15956
16015
  const { height, width } = imageRef.current;
15957
16016
  setSize == null ? void 0 : setSize({
@@ -16018,7 +16077,7 @@ function MediaPlaceholderPopover({ children }) {
16018
16077
  var _a, _b, _c;
16019
16078
  const { api, editor, getOption, tf } = useEditorPlugin17(PlaceholderPlugin3);
16020
16079
  const { id, element, mediaType, readOnly, selected, setIsUploading, setProgresses, setUpdatedFiles, size } = usePlaceholderPopoverState();
16021
- const [open, setOpen] = useState33(false);
16080
+ const [open, setOpen] = useState34(false);
16022
16081
  const currentMedia = MEDIA_CONFIG[mediaType];
16023
16082
  const uploadConfig = useUploadConfig();
16024
16083
  const adapter = useEditorAdapter();
@@ -16052,15 +16111,15 @@ function MediaPlaceholderPopover({ children }) {
16052
16111
  }
16053
16112
  }
16054
16113
  });
16055
- const isReplaced = useRef12(false);
16056
- useEffect39(() => {
16114
+ const isReplaced = useRef13(false);
16115
+ useEffect40(() => {
16057
16116
  if (isReplaced.current) return;
16058
16117
  isReplaced.current = true;
16059
16118
  const currentFiles = api.placeholder.getUploadingFile(element.id);
16060
16119
  if (!currentFiles) return;
16061
16120
  replaceCurrentPlaceholder(currentFiles);
16062
16121
  }, [isReplaced]);
16063
- useEffect39(() => {
16122
+ useEffect40(() => {
16064
16123
  if (!uploadedFile) return;
16065
16124
  const path = editor.api.findPath(element);
16066
16125
  setMediaNode(
@@ -16078,7 +16137,7 @@ function MediaPlaceholderPopover({ children }) {
16078
16137
  { at: path }
16079
16138
  );
16080
16139
  }, [uploadedFile, element.id, size]);
16081
- const [embedValue, setEmbedValue] = useState33("");
16140
+ const [embedValue, setEmbedValue] = useState34("");
16082
16141
  const onEmbed = useCallback40(
16083
16142
  (value) => {
16084
16143
  const path = editor.api.findPath(element);
@@ -16093,15 +16152,15 @@ function MediaPlaceholderPopover({ children }) {
16093
16152
  },
16094
16153
  [editor, element, mediaType]
16095
16154
  );
16096
- useEffect39(() => {
16155
+ useEffect40(() => {
16097
16156
  setOpen(selected);
16098
16157
  }, [selected, setOpen]);
16099
- useEffect39(() => {
16158
+ useEffect40(() => {
16100
16159
  if (isUploading) {
16101
16160
  setOpen(false);
16102
16161
  }
16103
16162
  }, [isUploading]);
16104
- useEffect39(() => {
16163
+ useEffect40(() => {
16105
16164
  var _a2;
16106
16165
  setProgresses({ [(_a2 = uploadingFile == null ? void 0 : uploadingFile.name) != null ? _a2 : ""]: progress });
16107
16166
  setIsUploading(isUploading);
@@ -16134,8 +16193,8 @@ function ImageProgress({
16134
16193
  imageRef,
16135
16194
  progress = 0
16136
16195
  }) {
16137
- const [objectUrl, setObjectUrl] = useState33(null);
16138
- useEffect39(() => {
16196
+ const [objectUrl, setObjectUrl] = useState34(null);
16197
+ useEffect40(() => {
16139
16198
  const url = URL.createObjectURL(file);
16140
16199
  setObjectUrl(url);
16141
16200
  return () => {
@@ -16294,13 +16353,13 @@ function ImagePreview() {
16294
16353
  // src/ui/media-upload-toast.tsx
16295
16354
  import { PlaceholderPlugin as PlaceholderPlugin5, UploadErrorCode } from "@platejs/media/react";
16296
16355
  import { usePluginOption as usePluginOption21 } from "platejs/react";
16297
- import { useEffect as useEffect40 } from "react";
16356
+ import { useEffect as useEffect41 } from "react";
16298
16357
  import { toast as toast4 } from "sonner";
16299
16358
 
16300
16359
  // src/ui/use-placeholder-max-file-size.ts
16301
16360
  import { PlaceholderPlugin as PlaceholderPlugin4 } from "@platejs/media/react";
16302
16361
  import { useEditorRef as useEditorRef34 } from "platejs/react";
16303
- import { useLayoutEffect as useLayoutEffect2 } from "react";
16362
+ import { useLayoutEffect as useLayoutEffect3 } from "react";
16304
16363
  var PLACEHOLDER_FILE_KIND_PATTERNS = {
16305
16364
  audio: "audio/*",
16306
16365
  blob: "*",
@@ -16333,7 +16392,7 @@ var acceptedFileTypesFromKey = (key) => {
16333
16392
  };
16334
16393
  var useEditorMaxFileSize = (editor, maxFileSize, acceptedFileTypes) => {
16335
16394
  const acceptedFileTypesKey = acceptedFileTypes == null ? void 0 : acceptedFileTypes.join(FILE_TYPE_KEY_SEPARATOR);
16336
- useLayoutEffect2(() => {
16395
+ useLayoutEffect3(() => {
16337
16396
  var _a;
16338
16397
  const previous = EDITOR_UPLOAD_CONFIGS.get(editor);
16339
16398
  if (maxFileSize === void 0 && acceptedFileTypesKey === void 0) {
@@ -16372,7 +16431,7 @@ function MediaUploadToast() {
16372
16431
  }
16373
16432
  var useUploadErrorToast = () => {
16374
16433
  const uploadError = usePluginOption21(PlaceholderPlugin5, "error");
16375
- useEffect40(() => {
16434
+ useEffect41(() => {
16376
16435
  if (!uploadError) return;
16377
16436
  const { code, data } = uploadError;
16378
16437
  switch (code) {
@@ -16522,7 +16581,7 @@ import { KEYS as KEYS31 } from "platejs";
16522
16581
  // src/ui/mention-element.tsx
16523
16582
  import { IS_APPLE as IS_APPLE2 } from "platejs";
16524
16583
  import { PlateElement as PlateElement25, useFocused as useFocused3, useHotkeys as useHotkeys4, useReadOnly as useReadOnly14, useSelected as useSelected5 } from "platejs/react";
16525
- import { useCallback as useCallback43, useState as useState35 } from "react";
16584
+ import { useCallback as useCallback43, useState as useState36 } from "react";
16526
16585
  import { useMounted as useMounted2 } from "react-tweet";
16527
16586
 
16528
16587
  // src/ui/mention-document-element.tsx
@@ -16534,7 +16593,7 @@ import {
16534
16593
  useReadOnly as useReadOnly13,
16535
16594
  useSelected as useSelected4
16536
16595
  } from "platejs/react";
16537
- import { useCallback as useCallback42, useMemo as useMemo16, useState as useState34 } from "react";
16596
+ import { useCallback as useCallback42, useMemo as useMemo16, useState as useState35 } from "react";
16538
16597
 
16539
16598
  // src/ui/mention-document-hover-card.tsx
16540
16599
  import { useCallback as useCallback41 } from "react";
@@ -16586,8 +16645,8 @@ function DocumentMentionElement(props) {
16586
16645
  const focused = useFocused2();
16587
16646
  const editor = useEditorRef35();
16588
16647
  const readOnly = useReadOnly13();
16589
- const [isToolbarOpen, setIsToolbarOpen] = useState34(false);
16590
- const [isModeMenuOpen, setIsModeMenuOpen] = useState34(false);
16648
+ const [isToolbarOpen, setIsToolbarOpen] = useState35(false);
16649
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState35(false);
16591
16650
  const adapter = useEditorAdapter();
16592
16651
  const canLinkPage = adapter.permissions.canLinkPage;
16593
16652
  const resolvePage = adapter.pageLinks.resolvePage;
@@ -16740,7 +16799,7 @@ function UserMentionElement(props) {
16740
16799
  const resolveMember = adapter.mentions.resolveMember;
16741
16800
  const memberId = (_a = element.key) != null ? _a : "";
16742
16801
  const canShowCard = typeof resolveMember === "function" && memberId.length > 0;
16743
- const [wantOpen, setWantOpen] = useState35(false);
16802
+ const [wantOpen, setWantOpen] = useState36(false);
16744
16803
  const { profile, isLoading, hasResolved } = useMemberProfile({
16745
16804
  enabled: canShowCard && wantOpen,
16746
16805
  memberId,
@@ -16831,17 +16890,17 @@ function UserMentionElement(props) {
16831
16890
  import { DatePlugin as DatePlugin2 } from "@platejs/date/react";
16832
16891
  import { MentionPlugin } from "@platejs/mention/react";
16833
16892
  import { PlateElement as PlateElement26 } from "platejs/react";
16834
- import { useCallback as useCallback44, useState as useState38 } from "react";
16893
+ import { useCallback as useCallback44, useState as useState39 } from "react";
16835
16894
 
16836
16895
  // src/ui/mention-page-combobox-group.tsx
16837
16896
  import { FileTextIcon as FileTextIcon3 } from "lucide-react";
16838
- import { useEffect as useEffect41, useState as useState36 } from "react";
16897
+ import { useEffect as useEffect42, useState as useState37 } from "react";
16839
16898
  import { jsx as jsx146, jsxs as jsxs87 } from "react/jsx-runtime";
16840
16899
  function PageComboboxGroup({ search, onPageHover, onPageSelect }) {
16841
16900
  const adapter = useEditorAdapter();
16842
16901
  const debouncedSearch = useDebounce(search, 250);
16843
- const [pages, setPages] = useState36([]);
16844
- useEffect41(() => {
16902
+ const [pages, setPages] = useState37([]);
16903
+ useEffect42(() => {
16845
16904
  if (!adapter.permissions.canLinkPage) {
16846
16905
  setPages([]);
16847
16906
  return;
@@ -16890,13 +16949,13 @@ function PageStatusBadge({ status }) {
16890
16949
  }
16891
16950
 
16892
16951
  // src/ui/mention-people-combobox-group.tsx
16893
- import { useEffect as useEffect42, useState as useState37 } from "react";
16952
+ import { useEffect as useEffect43, useState as useState38 } from "react";
16894
16953
  import { jsx as jsx147, jsxs as jsxs88 } from "react/jsx-runtime";
16895
16954
  function PeopleComboboxGroup({ search, onUserHover, onUserSelect }) {
16896
16955
  const adapter = useEditorAdapter();
16897
16956
  const debouncedSearch = useDebounce(search, 150);
16898
- const [members, setMembers] = useState37([]);
16899
- useEffect42(() => {
16957
+ const [members, setMembers] = useState38([]);
16958
+ useEffect43(() => {
16900
16959
  if (!adapter.permissions.canMention) {
16901
16960
  setMembers([]);
16902
16961
  return;
@@ -16949,8 +17008,8 @@ var DEFAULT_PLACEHOLDER = "Mention a person, page, or date";
16949
17008
  var TODAY_PLACEHOLDER = "Today";
16950
17009
  function MentionInputElement(props) {
16951
17010
  const { children, editor, element } = props;
16952
- const [search, setSearch] = useState38("");
16953
- const [placeholder, setPlaceholder] = useState38(DEFAULT_PLACEHOLDER);
17011
+ const [search, setSearch] = useState39("");
17012
+ const [placeholder, setPlaceholder] = useState39(DEFAULT_PLACEHOLDER);
16954
17013
  const handleDateFocus = useCallback44(() => {
16955
17014
  setPlaceholder(TODAY_PLACEHOLDER);
16956
17015
  }, []);
@@ -17651,7 +17710,7 @@ import {
17651
17710
  useSelected as useSelected6,
17652
17711
  withHOC as withHOC8
17653
17712
  } from "platejs/react";
17654
- import { useRef as useRef13 } from "react";
17713
+ import { useRef as useRef14 } from "react";
17655
17714
 
17656
17715
  // src/ui/table-icons.tsx
17657
17716
  import { jsx as jsx150, jsxs as jsxs91 } from "react/jsx-runtime";
@@ -17855,7 +17914,7 @@ var TableElement = withHOC8(
17855
17914
  const isSelectionAreaVisible = usePluginOption22(BlockSelectionPlugin10, "isSelectionAreaVisible");
17856
17915
  const hasControls = !readOnly && !isSelectionAreaVisible;
17857
17916
  const { marginLeft, props: tableProps } = useTableElement();
17858
- const tableRef = useRef13(null);
17917
+ const tableRef = useRef14(null);
17859
17918
  useTableSelectionDom(tableRef);
17860
17919
  const isSelectingTable = useBlockSelected2(props.element.id);
17861
17920
  const content = /* @__PURE__ */ jsx151(
@@ -18399,7 +18458,7 @@ function DefaultToggleView({
18399
18458
  children: [
18400
18459
  /* @__PURE__ */ jsx153(ToggleChevron, { open }),
18401
18460
  isEditing ? /* @__PURE__ */ jsx153(
18402
- "input",
18461
+ UnstyledInput,
18403
18462
  {
18404
18463
  ref: inputRef,
18405
18464
  className: "min-w-30 bg-transparent font-semibold text-foreground outline-none",