@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.
@@ -4308,6 +4308,16 @@ var backgroundColorItems = [
4308
4308
 
4309
4309
  // src/ui/input.tsx
4310
4310
  import { cva as cva10 } from "class-variance-authority";
4311
+
4312
+ // src/context/text-field-attributes.ts
4313
+ import { createContext as createContext4, useContext as useContext4, useState as useState6 } from "react";
4314
+ var EMPTY_ATTRIBUTES = Object.freeze({});
4315
+ var TextFieldAttributesContext = createContext4(EMPTY_ATTRIBUTES);
4316
+ function useTextFieldAttributes() {
4317
+ return useContext4(TextFieldAttributesContext);
4318
+ }
4319
+
4320
+ // src/ui/input.tsx
4311
4321
  import { jsx as jsx22 } from "react/jsx-runtime";
4312
4322
  var inputVariants = cva10(
4313
4323
  cn(
@@ -4329,9 +4339,16 @@ var inputVariants = cva10(
4329
4339
  }
4330
4340
  }
4331
4341
  );
4342
+ var TEXT_INPUT_TYPES = /* @__PURE__ */ new Set(["text", "search", "url", "email", "tel", "password"]);
4343
+ function UnstyledInput(_a) {
4344
+ var _b = _a, { type = "text" } = _b, props = __objRest(_b, ["type"]);
4345
+ const attributes = useTextFieldAttributes();
4346
+ const textFieldAttributes = TEXT_INPUT_TYPES.has(type.toLowerCase()) ? attributes : void 0;
4347
+ return /* @__PURE__ */ jsx22("input", __spreadValues(__spreadProps(__spreadValues({}, textFieldAttributes), { type }), props));
4348
+ }
4332
4349
  function Input(_a) {
4333
4350
  var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
4334
- return /* @__PURE__ */ jsx22("input", __spreadValues({ className: cn(inputVariants({ variant }), className) }, props));
4351
+ return /* @__PURE__ */ jsx22(UnstyledInput, __spreadValues({ className: cn(inputVariants({ variant }), className) }, props));
4335
4352
  }
4336
4353
 
4337
4354
  // src/ui/menu.tsx
@@ -5564,11 +5581,11 @@ import { PathApi as PathApi5 } from "platejs";
5564
5581
  import { SlateElement as SlateElement2 } from "platejs/static";
5565
5582
 
5566
5583
  // src/context/heading-slug-context.tsx
5567
- import { createContext as createContext5, useContext as useContext5 } from "react";
5584
+ import { createContext as createContext6, useContext as useContext6 } from "react";
5568
5585
  import { jsx as jsx29 } from "react/jsx-runtime";
5569
- var HeadingSlugContext = createContext5(null);
5586
+ var HeadingSlugContext = createContext6(null);
5570
5587
  var useHeadingSlug = () => {
5571
- return useContext5(HeadingSlugContext);
5588
+ return useContext6(HeadingSlugContext);
5572
5589
  };
5573
5590
 
5574
5591
  // src/ui/heading-node-static.tsx
@@ -6201,20 +6218,20 @@ import { SlateElement as SlateElement9 } from "platejs/static";
6201
6218
 
6202
6219
  // src/context/link-resolution-context.tsx
6203
6220
  import {
6204
- createContext as createContext7,
6221
+ createContext as createContext8,
6205
6222
  useCallback as useCallback5,
6206
- useContext as useContext7,
6223
+ useContext as useContext8,
6207
6224
  useEffect as useEffect12,
6208
6225
  useMemo as useMemo8,
6209
6226
  useRef as useRef7,
6210
6227
  useSyncExternalStore as useSyncExternalStore2
6211
6228
  } from "react";
6212
6229
  import { jsx as jsx42 } from "react/jsx-runtime";
6213
- var LinkResolutionContext = createContext7(null);
6230
+ var LinkResolutionContext = createContext8(null);
6214
6231
  var NOOP_UNSUBSCRIBE = () => {
6215
6232
  };
6216
6233
  var usePagePreview = (reference) => {
6217
- const store = useContext7(LinkResolutionContext);
6234
+ const store = useContext8(LinkResolutionContext);
6218
6235
  const key = reference ? linkReferenceKey(reference) : null;
6219
6236
  const subscribe2 = useCallback5(
6220
6237
  (onChange) => {
@@ -6227,12 +6244,12 @@ var usePagePreview = (reference) => {
6227
6244
  return useSyncExternalStore2(subscribe2, getSnapshot, getSnapshot);
6228
6245
  };
6229
6246
  var useHasLinkSeed = (url) => {
6230
- const store = useContext7(LinkResolutionContext);
6247
+ const store = useContext8(LinkResolutionContext);
6231
6248
  if (!store || !url) return false;
6232
6249
  return store.seededUrls.has(url);
6233
6250
  };
6234
6251
  var useLinkMetadata = (url) => {
6235
- const store = useContext7(LinkResolutionContext);
6252
+ const store = useContext8(LinkResolutionContext);
6236
6253
  const subscribe2 = useCallback5(
6237
6254
  (onChange) => {
6238
6255
  if (!store || !url) return NOOP_UNSUBSCRIBE;
@@ -6368,11 +6385,11 @@ var getSmartLinkAnchorProps = (url) => {
6368
6385
 
6369
6386
  // src/ui/smart-link-view.tsx
6370
6387
  import { ArrowUpRightIcon, FileTextIcon, LinkIcon } from "lucide-react";
6371
- import { useCallback as useCallback6, useState as useState10 } from "react";
6388
+ import { useCallback as useCallback6, useState as useState11 } from "react";
6372
6389
  import { jsx as jsx43, jsxs as jsxs20 } from "react/jsx-runtime";
6373
6390
  var PLAIN_LINK_CLASS_NAME = "inline font-medium text-primary underline decoration-primary/45 decoration-1 underline-offset-[0.2em] transition-colors hover:decoration-primary hover:decoration-2";
6374
6391
  function SmartLinkIcon({ icon, faviconUrl, provider, className }) {
6375
- const [failedSrc, setFailedSrc] = useState10(null);
6392
+ const [failedSrc, setFailedSrc] = useState11(null);
6376
6393
  const isPageLike = provider === "Page" || provider === "Internal link";
6377
6394
  const showFavicon = typeof faviconUrl === "string" && faviconUrl.length > 0 && failedSrc !== faviconUrl;
6378
6395
  const handleFaviconError = useCallback6(() => {
@@ -6414,7 +6431,7 @@ function SmartLinkInlineContent({ link, className }) {
6414
6431
  "span",
6415
6432
  {
6416
6433
  className: cn(
6417
- "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",
6434
+ "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",
6418
6435
  className
6419
6436
  ),
6420
6437
  children: [
@@ -6430,7 +6447,7 @@ function SmartLinkUrlContent({ link, className }) {
6430
6447
  "span",
6431
6448
  {
6432
6449
  className: cn(
6433
- "inline max-w-full wrap-break-word border-[#0C66E4]/35 border-b font-medium text-[#0C66E4] leading-[inherit]",
6450
+ "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!",
6434
6451
  className
6435
6452
  ),
6436
6453
  children: [
@@ -6462,7 +6479,7 @@ function SmartLinkCardContent({ link, className }) {
6462
6479
  ),
6463
6480
  /* @__PURE__ */ jsxs20("span", { className: "min-w-0 flex-1", children: [
6464
6481
  /* @__PURE__ */ jsxs20("span", { className: "flex min-w-0 items-start gap-3", children: [
6465
- /* @__PURE__ */ jsx43("span", { className: "min-w-0 flex-1 truncate font-semibold text-[#0C66E4] text-base leading-6", children: link.title }),
6482
+ /* @__PURE__ */ jsx43("span", { className: "min-w-0 flex-1 truncate font-semibold text-editor-link text-base leading-6", children: link.title }),
6466
6483
  link.status ? /* @__PURE__ */ jsx43(SmartLinkStatus, { status: link.status }) : null
6467
6484
  ] }),
6468
6485
  /* @__PURE__ */ jsxs20("span", { className: "mt-2 flex min-w-0 items-center gap-2 text-muted-foreground text-sm", children: [
@@ -6480,7 +6497,7 @@ function SmartLinkCardContent({ link, className }) {
6480
6497
  {
6481
6498
  faviconUrl: link.faviconUrl,
6482
6499
  provider: link.provider,
6483
- className: "size-5 rounded bg-[#0C66E4] p-1 text-white"
6500
+ className: "size-5 rounded bg-editor-link p-1 text-white dark-or-inherit:text-primary-foreground"
6484
6501
  }
6485
6502
  ),
6486
6503
  /* @__PURE__ */ jsx43("span", { className: "truncate", children: (_a = link.provider) != null ? _a : "Link" })
@@ -6495,7 +6512,7 @@ function SmartLinkCardContent({ link, className }) {
6495
6512
  );
6496
6513
  }
6497
6514
  function SmartLinkCardImage({ src }) {
6498
- const [hasFailed, setHasFailed] = useState10(false);
6515
+ const [hasFailed, setHasFailed] = useState11(false);
6499
6516
  const handleError = useCallback6(() => {
6500
6517
  setHasFailed(true);
6501
6518
  }, []);
@@ -7043,6 +7060,7 @@ import { SlateElement as SlateElement13 } from "platejs/static";
7043
7060
  // src/ui/media-file-display.ts
7044
7061
  var FILE_DISPLAY_MODES = ["inline", "url", "embed"];
7045
7062
  var DEFAULT_FILE_DISPLAY_MODE = "inline";
7063
+ 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!";
7046
7064
  var normalizeFileDisplayMode = (value) => {
7047
7065
  return value === "url" || value === "embed" || value === "inline" ? value : DEFAULT_FILE_DISPLAY_MODE;
7048
7066
  };
@@ -7079,20 +7097,10 @@ function MediaFileStaticBody({ canEmbed, displayMode, name, url }) {
7079
7097
  );
7080
7098
  }
7081
7099
  if (displayMode === "url") {
7082
- return /* @__PURE__ */ jsxs26(
7083
- "a",
7084
- {
7085
- className: "inline-flex max-w-full items-center gap-1 break-all border-[#0C66E4]/35 border-b font-medium text-[#0C66E4]",
7086
- contentEditable: false,
7087
- href: url,
7088
- rel: "noopener noreferrer",
7089
- target: "_blank",
7090
- children: [
7091
- /* @__PURE__ */ jsx50(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
7092
- /* @__PURE__ */ jsx50("span", { className: "truncate", children: url })
7093
- ]
7094
- }
7095
- );
7100
+ return /* @__PURE__ */ jsxs26("a", { className: FILE_URL_CLASS_NAME, contentEditable: false, href: url, rel: "noopener noreferrer", target: "_blank", children: [
7101
+ /* @__PURE__ */ jsx50(Link, { className: "size-4 shrink-0 text-muted-foreground" }),
7102
+ /* @__PURE__ */ jsx50("span", { className: "truncate", children: url })
7103
+ ] });
7096
7104
  }
7097
7105
  return /* @__PURE__ */ jsx50(
7098
7106
  "a",
@@ -7132,7 +7140,7 @@ function MediaFileElementStatic(props) {
7132
7140
  // src/ui/media-image-node-static.tsx
7133
7141
  import { NodeApi as NodeApi6 } from "platejs";
7134
7142
  import { SlateElement as SlateElement14 } from "platejs/static";
7135
- import { useCallback as useCallback8, useRef as useRef8, useState as useState11 } from "react";
7143
+ import { useCallback as useCallback8, useRef as useRef8, useState as useState12 } from "react";
7136
7144
 
7137
7145
  // src/ui/media-image-lightbox.tsx
7138
7146
  import { AnimatePresence as AnimatePresence2, motion as motion2 } from "framer-motion";
@@ -7254,8 +7262,8 @@ function ImageLightbox({ alt, isOpen, onClose, sourceRect, src }) {
7254
7262
  import { jsx as jsx52, jsxs as jsxs28 } from "react/jsx-runtime";
7255
7263
  function ImageElementStatic(props) {
7256
7264
  const { align = "center", caption, hint, hintIcon, url } = props.element;
7257
- const [lightboxOpen, setLightboxOpen] = useState11(false);
7258
- const [sourceRect, setSourceRect] = useState11(null);
7265
+ const [lightboxOpen, setLightboxOpen] = useState12(false);
7266
+ const [sourceRect, setSourceRect] = useState12(null);
7259
7267
  const imgRef = useRef8(null);
7260
7268
  const handleOpen = useCallback8(() => {
7261
7269
  if (imgRef.current) {
@@ -7354,7 +7362,7 @@ import { BaseMentionPlugin } from "@platejs/mention";
7354
7362
  // src/ui/mention-node-static.tsx
7355
7363
  import { IS_APPLE } from "platejs";
7356
7364
  import { SlateElement as SlateElement16 } from "platejs/static";
7357
- import { useCallback as useCallback9, useState as useState14 } from "react";
7365
+ import { useCallback as useCallback9, useState as useState15 } from "react";
7358
7366
 
7359
7367
  // src/ui/member-profile-card.tsx
7360
7368
  import { ArrowUpRight, Mail, MapPin, Users } from "lucide-react";
@@ -7458,9 +7466,9 @@ function MemberProfileCard({ profile, fallbackName, isLoading }) {
7458
7466
  }
7459
7467
 
7460
7468
  // src/ui/mention-document-link.ts
7461
- import { useEffect as useEffect14, useState as useState12 } from "react";
7469
+ import { useEffect as useEffect14, useState as useState13 } from "react";
7462
7470
  var useDocumentPagePreview = ({ enabled, reference, resolvePage }) => {
7463
- const [page, setPage] = useState12(null);
7471
+ const [page, setPage] = useState13(null);
7464
7472
  const referenceKey = enabled && reference ? linkReferenceKey(reference) : null;
7465
7473
  useEffect14(() => {
7466
7474
  const nextReference = referenceKey ? linkReferenceFromKey(referenceKey) : null;
@@ -7500,10 +7508,10 @@ var getDocumentMentionLink = (element, page, displayMode) => {
7500
7508
  };
7501
7509
 
7502
7510
  // src/ui/use-member-profile.ts
7503
- import { useEffect as useEffect15, useState as useState13 } from "react";
7511
+ import { useEffect as useEffect15, useState as useState14 } from "react";
7504
7512
  var IDLE_STATE = { profile: null, isLoading: false, hasResolved: false };
7505
7513
  var useMemberProfile = ({ enabled, memberId, resolveMember }) => {
7506
- const [state, setState] = useState13(IDLE_STATE);
7514
+ const [state, setState] = useState14(IDLE_STATE);
7507
7515
  useEffect15(() => {
7508
7516
  if (!enabled || !resolveMember || memberId.length === 0) {
7509
7517
  setState(IDLE_STATE);
@@ -7572,7 +7580,7 @@ function UserMentionElementStatic(_a) {
7572
7580
  const resolveMember = adapter.mentions.resolveMember;
7573
7581
  const memberId = (_a2 = element.key) != null ? _a2 : "";
7574
7582
  const canShowCard = typeof resolveMember === "function" && memberId.length > 0;
7575
- const [wantOpen, setWantOpen] = useState14(false);
7583
+ const [wantOpen, setWantOpen] = useState15(false);
7576
7584
  const { profile, isLoading, hasResolved } = useMemberProfile({
7577
7585
  enabled: canShowCard && wantOpen,
7578
7586
  memberId,
@@ -8276,6 +8284,7 @@ function CommandInput(_a) {
8276
8284
  "variant",
8277
8285
  "wrapClassName"
8278
8286
  ]);
8287
+ const attributes = useTextFieldAttributes();
8279
8288
  return /* @__PURE__ */ jsx65(
8280
8289
  "div",
8281
8290
  {
@@ -8284,10 +8293,10 @@ function CommandInput(_a) {
8284
8293
  "data-slot": "command-input-wrapper",
8285
8294
  children: /* @__PURE__ */ jsx65(
8286
8295
  CommandPrimitive.Input,
8287
- __spreadValues({
8296
+ __spreadValues(__spreadProps(__spreadValues({}, attributes), {
8288
8297
  className: cn(inputVariants({ variant }), className),
8289
8298
  "data-slot": "command-input"
8290
- }, props)
8299
+ }), props)
8291
8300
  )
8292
8301
  }
8293
8302
  );
@@ -8668,7 +8677,7 @@ function TabTrigger({
8668
8677
  onKeyDown: handleTabKeyDown,
8669
8678
  children: [
8670
8679
  isEditing ? /* @__PURE__ */ jsx68(
8671
- "input",
8680
+ UnstyledInput,
8672
8681
  {
8673
8682
  ref: inputRef,
8674
8683
  className: cn(
@@ -9737,11 +9746,19 @@ var textareaVariants = cva19(
9737
9746
  );
9738
9747
  function Textarea(_a) {
9739
9748
  var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
9740
- return /* @__PURE__ */ jsx81("textarea", __spreadValues({ className: cn(textareaVariants({ variant }), className) }, props));
9749
+ const attributes = useTextFieldAttributes();
9750
+ return /* @__PURE__ */ jsx81("textarea", __spreadValues(__spreadProps(__spreadValues({}, attributes), { className: cn(textareaVariants({ variant }), className) }), props));
9741
9751
  }
9742
9752
  function TextareaAutosize(_a) {
9743
9753
  var _b = _a, { children, className, variant } = _b, props = __objRest(_b, ["children", "className", "variant"]);
9744
- return /* @__PURE__ */ jsx81(ReactTextareaAutosize, __spreadValues({ autoComplete: "off", className: cn(textareaVariants({ variant }), className) }, props));
9754
+ const attributes = useTextFieldAttributes();
9755
+ return /* @__PURE__ */ jsx81(
9756
+ ReactTextareaAutosize,
9757
+ __spreadValues(__spreadProps(__spreadValues({}, attributes), {
9758
+ autoComplete: "off",
9759
+ className: cn(textareaVariants({ variant }), className)
9760
+ }), props)
9761
+ );
9745
9762
  }
9746
9763
 
9747
9764
  // src/ui/ai-menu.tsx
@@ -11516,7 +11533,7 @@ function BadgeShapeButton({ shape, selected, setShape, updateElement }) {
11516
11533
 
11517
11534
  // src/ui/icon-picker.tsx
11518
11535
  import { icons as lucideIcons } from "lucide-react";
11519
- import { dynamicIconImports } from "lucide-react/dynamic";
11536
+ import { dynamicIconImports } from "lucide-react/dynamic.mjs";
11520
11537
  import * as React34 from "react";
11521
11538
  import { Fragment as Fragment11, jsx as jsx91, jsxs as jsxs54 } from "react/jsx-runtime";
11522
11539
  var toPascalCase = (str) => str.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
@@ -12792,15 +12809,14 @@ function EmojiPickerSearchBar({
12792
12809
  }) {
12793
12810
  return /* @__PURE__ */ jsx106("div", { className: "flex items-center px-2", children: /* @__PURE__ */ jsxs62("div", { className: "relative flex grow items-center", children: [
12794
12811
  /* @__PURE__ */ jsx106(
12795
- "input",
12812
+ UnstyledInput,
12796
12813
  {
12797
12814
  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",
12798
12815
  value: searchValue,
12799
12816
  onChange: (event) => setSearch(event.target.value),
12800
12817
  placeholder: i18n.search,
12801
12818
  "aria-label": "Search",
12802
- autoComplete: "off",
12803
- type: "text"
12819
+ autoComplete: "off"
12804
12820
  }
12805
12821
  ),
12806
12822
  children
@@ -13342,7 +13358,7 @@ function CardTitleRow({
13342
13358
  }) {
13343
13359
  if (isEditing) {
13344
13360
  return /* @__PURE__ */ jsx111(
13345
- "input",
13361
+ UnstyledInput,
13346
13362
  {
13347
13363
  ref: inputRef,
13348
13364
  className: "min-w-30 bg-transparent font-semibold text-foreground outline-none",
@@ -15249,11 +15265,49 @@ import { filterWords } from "@platejs/combobox";
15249
15265
  import { useComboboxInput, useHTMLInputCursorState } from "@platejs/combobox/react";
15250
15266
  import { cva as cva22 } from "class-variance-authority";
15251
15267
  import { useComposedRef as useComposedRef2, useEditorRef as useEditorRef24 } from "platejs/react";
15252
- import React55, { useEffect as useEffect36 } from "react";
15268
+ import React55, { useEffect as useEffect37 } from "react";
15269
+
15270
+ // src/hooks/use-return-focus-to-editor-on-input-removal.ts
15271
+ import { useEffect as useEffect35, useLayoutEffect as useLayoutEffect2, useRef as useRef15 } from "react";
15272
+ var focusEditableAtEditorSelection = (editor) => {
15273
+ const editable = editor.api.toDOMNode(editor);
15274
+ if (!(editable == null ? void 0 : editable.isConnected)) {
15275
+ return;
15276
+ }
15277
+ const document2 = editable.ownerDocument;
15278
+ const activeElement = document2.activeElement;
15279
+ if (activeElement && activeElement !== document2.body) {
15280
+ return;
15281
+ }
15282
+ const domRange = editor.selection ? editor.api.toDOMRange(editor.selection) : void 0;
15283
+ editable.focus({ preventScroll: true });
15284
+ const domSelection = document2.getSelection();
15285
+ if (domRange && domSelection) {
15286
+ domSelection.removeAllRanges();
15287
+ domSelection.addRange(domRange);
15288
+ }
15289
+ };
15290
+ var useReturnFocusToEditorOnInputRemoval = (editor, inputRef) => {
15291
+ const inputHadFocusWhenRemoved = useRef15(false);
15292
+ useLayoutEffect2(() => {
15293
+ const input = inputRef.current;
15294
+ return () => {
15295
+ inputHadFocusWhenRemoved.current = !!input && input.ownerDocument.activeElement === input;
15296
+ };
15297
+ }, [inputRef]);
15298
+ useEffect35(
15299
+ () => () => {
15300
+ if (inputHadFocusWhenRemoved.current) {
15301
+ focusEditableAtEditorSelection(editor);
15302
+ }
15303
+ },
15304
+ [editor]
15305
+ );
15306
+ };
15253
15307
 
15254
15308
  // src/hooks/use-shield-input-selection-from-editor.ts
15255
15309
  import { RangeApi as RangeApi2 } from "platejs";
15256
- import { useEffect as useEffect35 } from "react";
15310
+ import { useEffect as useEffect36 } from "react";
15257
15311
  var SLATE_TEXT_SELECTOR = "[data-slate-string], [data-slate-zero-width]";
15258
15312
  var isCaretInEditorText = (node) => {
15259
15313
  var _a;
@@ -15271,7 +15325,7 @@ var wouldPullCaretOutOfInput = (editor, input) => {
15271
15325
  return !!range && RangeApi2.equals(range, editor.selection);
15272
15326
  };
15273
15327
  var useShieldInputSelectionFromEditor = (editor, inputRef) => {
15274
- useEffect35(() => {
15328
+ useEffect36(() => {
15275
15329
  const input = inputRef.current;
15276
15330
  const view = input == null ? void 0 : input.ownerDocument.defaultView;
15277
15331
  if (!input || !view) {
@@ -15335,7 +15389,7 @@ function InlineCombobox({
15335
15389
  [setValueProp, hasValueProp]
15336
15390
  );
15337
15391
  const insertPoint = React55.useRef(null);
15338
- useEffect36(() => {
15392
+ useEffect37(() => {
15339
15393
  const path = editor.api.findPath(element);
15340
15394
  if (!path) return;
15341
15395
  const point = editor.api.before(path);
@@ -15401,6 +15455,7 @@ function InlineComboboxInput(_a) {
15401
15455
  const editor = useEditorRef24();
15402
15456
  const ref = useComposedRef2(refProp, contextRef);
15403
15457
  useShieldInputSelectionFromEditor(editor, contextRef);
15458
+ useReturnFocusToEditorOnInputRemoval(editor, contextRef);
15404
15459
  return /* @__PURE__ */ jsxs79(Fragment19, { children: [
15405
15460
  showTrigger && trigger,
15406
15461
  /* @__PURE__ */ jsxs79("span", { className: "relative min-h-lh", children: [
@@ -15409,6 +15464,7 @@ function InlineComboboxInput(_a) {
15409
15464
  Ariakit2.Combobox,
15410
15465
  __spreadValues(__spreadValues({
15411
15466
  autoSelect: true,
15467
+ render: /* @__PURE__ */ jsx128(UnstyledInput, {}),
15412
15468
  className: cn("absolute top-0 left-0 size-full bg-transparent outline-hidden", className),
15413
15469
  ref,
15414
15470
  value
@@ -15500,7 +15556,7 @@ function InlineComboboxEmpty({ children, className }) {
15500
15556
  const { setHasEmpty } = React55.useContext(InlineComboboxContext);
15501
15557
  const store = Ariakit2.useComboboxContext();
15502
15558
  const items = (_a = store == null ? void 0 : store.useState("items")) != null ? _a : [];
15503
- useEffect36(() => {
15559
+ useEffect37(() => {
15504
15560
  setHasEmpty(true);
15505
15561
  return () => {
15506
15562
  setHasEmpty(false);
@@ -15622,7 +15678,7 @@ import { useLink } from "@platejs/link/react";
15622
15678
  import { SuggestionPlugin as SuggestionPlugin3 } from "@platejs/suggestion/react";
15623
15679
  import { NodeApi as NodeApi14 } from "platejs";
15624
15680
  import { PlateElement as PlateElement20, useEditorPlugin as useEditorPlugin9, useElement as useElement11, useReadOnly as useReadOnly13 } from "platejs/react";
15625
- import { useCallback as useCallback42, useMemo as useMemo16, useState as useState40 } from "react";
15681
+ import { useCallback as useCallback42, useMemo as useMemo16, useState as useState41 } from "react";
15626
15682
 
15627
15683
  // src/ui/smart-link-clipboard.ts
15628
15684
  var copySmartLinkUrl = async (url) => {
@@ -15660,11 +15716,11 @@ import { ArrowUpRightIcon as ArrowUpRightIcon3, PencilIcon as PencilIcon6, Trash
15660
15716
 
15661
15717
  // src/ui/smart-link-copy-button.tsx
15662
15718
  import { CheckIcon as CheckIcon15, CopyIcon as CopyIcon2, XIcon as XIcon7 } from "lucide-react";
15663
- import { useCallback as useCallback40, useEffect as useEffect37, useState as useState39 } from "react";
15719
+ import { useCallback as useCallback40, useEffect as useEffect38, useState as useState40 } from "react";
15664
15720
  import { jsx as jsx130 } from "react/jsx-runtime";
15665
15721
  function SmartLinkCopyButton({ disabled, onCopy }) {
15666
- const [feedback, setFeedback] = useState39("idle");
15667
- useEffect37(() => {
15722
+ const [feedback, setFeedback] = useState40("idle");
15723
+ useEffect38(() => {
15668
15724
  if (feedback === "idle") return;
15669
15725
  const timeoutId = window.setTimeout(() => {
15670
15726
  setFeedback("idle");
@@ -15831,8 +15887,8 @@ function LinkElement(_a) {
15831
15887
  const { api, editor, setOption } = useEditorPlugin9(linkPlugin);
15832
15888
  const adapter = useEditorAdapter();
15833
15889
  const readOnly = useReadOnly13();
15834
- const [isToolbarOpen, setIsToolbarOpen] = useState40(false);
15835
- const [isModeMenuOpen, setIsModeMenuOpen] = useState40(false);
15890
+ const [isToolbarOpen, setIsToolbarOpen] = useState41(false);
15891
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState41(false);
15836
15892
  const displayMode = normalizeSmartLinkDisplayMode(element.displayMode);
15837
15893
  const open = !readOnly && (isToolbarOpen || isModeMenuOpen);
15838
15894
  const reference = useMemo16(() => readElementReference(element), [element]);
@@ -16009,12 +16065,12 @@ var PlainLinkElement = (props) => /* @__PURE__ */ jsx133(LinkElement, __spreadPr
16009
16065
 
16010
16066
  // src/ui/link-toolbar.tsx
16011
16067
  import { useEditorPlugin as useEditorPlugin12, useEditorSelector as useEditorSelector2, usePluginOption as usePluginOption17 } from "platejs/react";
16012
- import { useCallback as useCallback45, useEffect as useEffect40, useState as useState43 } from "react";
16068
+ import { useCallback as useCallback45, useEffect as useEffect41, useState as useState44 } from "react";
16013
16069
 
16014
16070
  // src/ui/link-search-panel.tsx
16015
16071
  import { BookmarkIcon, LinkIcon as LinkIcon4 } from "lucide-react";
16016
16072
  import { useEditorPlugin as useEditorPlugin10 } from "platejs/react";
16017
- import { useCallback as useCallback43, useEffect as useEffect38, useState as useState41 } from "react";
16073
+ import { useCallback as useCallback43, useEffect as useEffect39, useState as useState42 } from "react";
16018
16074
 
16019
16075
  // src/ui/link-toolbar-shared.ts
16020
16076
  import { unwrapLink as unwrapLink2, upsertLink } from "@platejs/link";
@@ -16157,15 +16213,15 @@ function LinkSearchPanel({ initialUrl }) {
16157
16213
  const adapter = useEditorAdapter();
16158
16214
  const { editor } = useEditorPlugin10(linkPlugin);
16159
16215
  const canLinkPage = adapter.permissions.canLinkPage;
16160
- const [query, setQuery] = useState41(initialUrl);
16161
- const [displayText, setDisplayText] = useState41(() => readSelectionText(editor));
16162
- const [pages, setPages] = useState41([]);
16163
- const [isLoading, setIsLoading] = useState41(true);
16216
+ const [query, setQuery] = useState42(initialUrl);
16217
+ const [displayText, setDisplayText] = useState42(() => readSelectionText(editor));
16218
+ const [pages, setPages] = useState42([]);
16219
+ const [isLoading, setIsLoading] = useState42(true);
16164
16220
  const trimmedQuery = query.trim();
16165
16221
  const safeUrl = trimmedQuery.length > 0 ? getSafeSmartLinkUrl(trimmedQuery) : null;
16166
16222
  const searchTerm = isLikelySmartLinkUrl(query) ? "" : trimmedQuery;
16167
16223
  const debouncedSearch = useDebounce(searchTerm, 200);
16168
- useEffect38(() => {
16224
+ useEffect39(() => {
16169
16225
  if (!canLinkPage) {
16170
16226
  setPages([]);
16171
16227
  setIsLoading(false);
@@ -16304,16 +16360,16 @@ import { CursorOverlayPlugin as CursorOverlayPlugin2 } from "@platejs/selection/
16304
16360
  import { LinkIcon as LinkIcon5, Trash2Icon as Trash2Icon4 } from "lucide-react";
16305
16361
  import { NodeApi as NodeApi16 } from "platejs";
16306
16362
  import { useEditorPlugin as useEditorPlugin11, usePluginOption as usePluginOption16 } from "platejs/react";
16307
- import { useCallback as useCallback44, useEffect as useEffect39, useState as useState42 } from "react";
16363
+ import { useCallback as useCallback44, useEffect as useEffect40, useState as useState43 } from "react";
16308
16364
  import { jsx as jsx135, jsxs as jsxs85 } from "react/jsx-runtime";
16309
16365
  function EditLinkCommand({ autoFocus, initialUrl, setInitialUrl }) {
16310
- const [url, setUrl] = useState42(initialUrl);
16311
- const [text, setText] = useState42("");
16366
+ const [url, setUrl] = useState43(initialUrl);
16367
+ const [text, setText] = useState43("");
16312
16368
  const mode = usePluginOption16(linkPlugin, "mode");
16313
16369
  const { editor, setOption } = useEditorPlugin11(linkPlugin);
16314
16370
  const activeLinkId = usePluginOption16(linkPlugin, "activeId");
16315
16371
  const editingLinkEntry = useActiveLink();
16316
- useEffect39(() => {
16372
+ useEffect40(() => {
16317
16373
  var _a;
16318
16374
  if (!editingLinkEntry) return;
16319
16375
  setText(NodeApi16.string(editingLinkEntry[0]));
@@ -16435,12 +16491,12 @@ function LinkFloatingToolbar() {
16435
16491
  })) == null ? void 0 : _a2[0];
16436
16492
  }, []);
16437
16493
  const aboveUrl = (_a = aboveLink == null ? void 0 : aboveLink.url) != null ? _a : "";
16438
- const [initialUrl, setInitialUrl] = useState43(aboveUrl);
16494
+ const [initialUrl, setInitialUrl] = useState44(aboveUrl);
16439
16495
  const open = mode === "insert" || mode === "edit" || mode === "cursor";
16440
- useEffect40(() => {
16496
+ useEffect41(() => {
16441
16497
  setInitialUrl(aboveUrl);
16442
16498
  }, [aboveUrl]);
16443
- useEffect40(() => {
16499
+ useEffect41(() => {
16444
16500
  if (aboveLink) {
16445
16501
  const timeoutId = window.setTimeout(() => {
16446
16502
  var _a2;
@@ -17269,9 +17325,8 @@ function IconSettingsForm({
17269
17325
  }
17270
17326
  ),
17271
17327
  /* @__PURE__ */ jsx151(
17272
- "input",
17328
+ UnstyledInput,
17273
17329
  {
17274
- type: "text",
17275
17330
  value: colorValue,
17276
17331
  onChange: handleColorChange,
17277
17332
  placeholder: "Default",
@@ -17504,7 +17559,7 @@ import {
17504
17559
  useReadOnly as useReadOnly18,
17505
17560
  useSelected as useSelected5
17506
17561
  } from "platejs/react";
17507
- import React62, { useEffect as useEffect43 } from "react";
17562
+ import React62, { useEffect as useEffect44 } from "react";
17508
17563
  import { jsx as jsx154, jsxs as jsxs95 } from "react/jsx-runtime";
17509
17564
  function EquationElement(props) {
17510
17565
  const element = useElement14();
@@ -17565,7 +17620,7 @@ function InlineEquationElement(props) {
17565
17620
  const selected = useSelected5();
17566
17621
  const isCollapsed = useEditorSelector5((editor) => editor.api.isCollapsed(), []);
17567
17622
  const [open, setOpen] = React62.useState(selected && isCollapsed);
17568
- useEffect43(() => {
17623
+ useEffect44(() => {
17569
17624
  if (selected && isCollapsed) {
17570
17625
  setOpen(true);
17571
17626
  }
@@ -17645,7 +17700,7 @@ function EquationPopoverContent(_a) {
17645
17700
  const editor = useEditorRef34();
17646
17701
  const readOnly = useReadOnly18();
17647
17702
  const element = useElement14();
17648
- useEffect43(() => {
17703
+ useEffect44(() => {
17649
17704
  if (isInline && open) {
17650
17705
  setOpen(true);
17651
17706
  }
@@ -17735,9 +17790,10 @@ function Caption(_a) {
17735
17790
  return /* @__PURE__ */ jsx155(CaptionPrimitive, __spreadProps(__spreadValues({}, props), { className: cn(captionVariants({ align }), "px-3 pb-2", className) }));
17736
17791
  }
17737
17792
  function CaptionTextarea(props) {
17793
+ const attributes = useTextFieldAttributes();
17738
17794
  return /* @__PURE__ */ jsx155(
17739
17795
  CaptionTextareaPrimitive,
17740
- __spreadProps(__spreadValues({}, props), {
17796
+ __spreadProps(__spreadValues(__spreadValues({}, attributes), props), {
17741
17797
  className: cn(
17742
17798
  "mt-2 w-full resize-none border-none bg-inherit p-0 font-[inherit] text-inherit",
17743
17799
  "focus:outline-none focus:placeholder:opacity-0",
@@ -18275,7 +18331,7 @@ import { useMediaState as useMediaState3 } from "@platejs/media/react";
18275
18331
  import { ResizableProvider as ResizableProvider4 } from "@platejs/resizable";
18276
18332
  import { ArrowUpRightIcon as ArrowUpRightIcon4, FileUpIcon, LinkIcon as LinkIcon7 } from "lucide-react";
18277
18333
  import { PlateElement as PlateElement26, useEditorRef as useEditorRef38, useElement as useElement18, withHOC as withHOC4 } from "platejs/react";
18278
- import { useCallback as useCallback59, useState as useState48 } from "react";
18334
+ import { useCallback as useCallback59, useState as useState49 } from "react";
18279
18335
 
18280
18336
  // src/ui/media-file-mode-dropdown.tsx
18281
18337
  import { ChevronDownIcon as ChevronDownIcon9, FileIcon, FrameIcon, LinkIcon as LinkIcon6 } from "lucide-react";
@@ -18364,7 +18420,10 @@ function MediaFileBody({ canEmbed, displayMode, name, onAnchorClick, url }) {
18364
18420
  return /* @__PURE__ */ jsxs103(
18365
18421
  "a",
18366
18422
  {
18367
- 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]",
18423
+ className: cn(
18424
+ FILE_URL_CLASS_NAME,
18425
+ "cursor-pointer transition-colors hover:border-editor-link dark-or-inherit:hover:border-editor-link!"
18426
+ ),
18368
18427
  contentEditable: false,
18369
18428
  href: url,
18370
18429
  onClick: onAnchorClick,
@@ -18402,7 +18461,7 @@ var MediaFileElement = withHOC4(ResizableProvider4, function MediaFileElement2(p
18402
18461
  const fileName = name != null ? name : "";
18403
18462
  const fileUrl = unsafeUrl != null ? unsafeUrl : "";
18404
18463
  const canEmbed = isEmbeddableFile(fileName, fileUrl);
18405
- const [isModeMenuOpen, setIsModeMenuOpen] = useState48(false);
18464
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState49(false);
18406
18465
  const open = !readOnly && (selected || isModeMenuOpen);
18407
18466
  const handleOpen = useCallback59(() => {
18408
18467
  if (fileUrl.length === 0) return;
@@ -18490,7 +18549,7 @@ import { useDraggable as useDraggable2 } from "@platejs/dnd";
18490
18549
  import { PlaceholderPlugin as PlaceholderPlugin2, useImage, useMediaState as useMediaState4 } from "@platejs/media/react";
18491
18550
  import { ResizableProvider as ResizableProvider5 } from "@platejs/resizable";
18492
18551
  import { PlateElement as PlateElement27, useEditorPlugin as useEditorPlugin16, withHOC as withHOC5 } from "platejs/react";
18493
- import React67, { useEffect as useEffect45, useMemo as useMemo17 } from "react";
18552
+ import React67, { useEffect as useEffect46, useMemo as useMemo17 } from "react";
18494
18553
  import { LazyLoadImage } from "react-lazy-load-image-component";
18495
18554
  import { jsx as jsx165, jsxs as jsxs104 } from "react/jsx-runtime";
18496
18555
  var ImageElement = withHOC5(
@@ -18631,7 +18690,7 @@ var ImageElement = withHOC5(
18631
18690
  );
18632
18691
  var ImagePlaceholder = ({ file }) => {
18633
18692
  const objectUrl = useMemo17(() => file ? URL.createObjectURL(file) : null, [file]);
18634
- useEffect45(() => {
18693
+ useEffect46(() => {
18635
18694
  if (!objectUrl) return;
18636
18695
  return () => URL.revokeObjectURL(objectUrl);
18637
18696
  }, [objectUrl]);
@@ -18649,7 +18708,7 @@ import {
18649
18708
  import { AudioLinesIcon, FileUpIcon as FileUpIcon2, FilmIcon, ImageIcon as ImageIcon2 } from "lucide-react";
18650
18709
  import { KEYS as KEYS29, nanoid as nanoid10 } from "platejs";
18651
18710
  import { PlateElement as PlateElement28, useEditorPlugin as useEditorPlugin17, withHOC as withHOC6 } from "platejs/react";
18652
- import { useCallback as useCallback60, useEffect as useEffect46, useRef as useRef15, useState as useState49 } from "react";
18711
+ import { useCallback as useCallback60, useEffect as useEffect47, useRef as useRef16, useState as useState50 } from "react";
18653
18712
  import { useFilePicker } from "use-file-picker";
18654
18713
 
18655
18714
  // src/hooks/use-upload-file.ts
@@ -18823,8 +18882,8 @@ var PlaceholderElement = withHOC6(PlaceholderProvider, (props) => {
18823
18882
  const isImage = mediaType === KEYS29.img;
18824
18883
  const file = updatedFiles == null ? void 0 : updatedFiles[0];
18825
18884
  const progress = file ? progresses == null ? void 0 : progresses[file.name] : void 0;
18826
- const imageRef = useRef15(null);
18827
- useEffect46(() => {
18885
+ const imageRef = useRef16(null);
18886
+ useEffect47(() => {
18828
18887
  if (!imageRef.current) return;
18829
18888
  const { height, width } = imageRef.current;
18830
18889
  setSize == null ? void 0 : setSize({
@@ -18891,7 +18950,7 @@ function MediaPlaceholderPopover({ children }) {
18891
18950
  var _a, _b, _c;
18892
18951
  const { api, editor, getOption, tf } = useEditorPlugin17(PlaceholderPlugin3);
18893
18952
  const { id, element, mediaType, readOnly, selected, setIsUploading, setProgresses, setUpdatedFiles, size } = usePlaceholderPopoverState();
18894
- const [open, setOpen] = useState49(false);
18953
+ const [open, setOpen] = useState50(false);
18895
18954
  const currentMedia = MEDIA_CONFIG[mediaType];
18896
18955
  const uploadConfig = useUploadConfig();
18897
18956
  const adapter = useEditorAdapter();
@@ -18925,15 +18984,15 @@ function MediaPlaceholderPopover({ children }) {
18925
18984
  }
18926
18985
  }
18927
18986
  });
18928
- const isReplaced = useRef15(false);
18929
- useEffect46(() => {
18987
+ const isReplaced = useRef16(false);
18988
+ useEffect47(() => {
18930
18989
  if (isReplaced.current) return;
18931
18990
  isReplaced.current = true;
18932
18991
  const currentFiles = api.placeholder.getUploadingFile(element.id);
18933
18992
  if (!currentFiles) return;
18934
18993
  replaceCurrentPlaceholder(currentFiles);
18935
18994
  }, [isReplaced]);
18936
- useEffect46(() => {
18995
+ useEffect47(() => {
18937
18996
  if (!uploadedFile) return;
18938
18997
  const path = editor.api.findPath(element);
18939
18998
  setMediaNode(
@@ -18951,7 +19010,7 @@ function MediaPlaceholderPopover({ children }) {
18951
19010
  { at: path }
18952
19011
  );
18953
19012
  }, [uploadedFile, element.id, size]);
18954
- const [embedValue, setEmbedValue] = useState49("");
19013
+ const [embedValue, setEmbedValue] = useState50("");
18955
19014
  const onEmbed = useCallback60(
18956
19015
  (value) => {
18957
19016
  const path = editor.api.findPath(element);
@@ -18966,15 +19025,15 @@ function MediaPlaceholderPopover({ children }) {
18966
19025
  },
18967
19026
  [editor, element, mediaType]
18968
19027
  );
18969
- useEffect46(() => {
19028
+ useEffect47(() => {
18970
19029
  setOpen(selected);
18971
19030
  }, [selected, setOpen]);
18972
- useEffect46(() => {
19031
+ useEffect47(() => {
18973
19032
  if (isUploading) {
18974
19033
  setOpen(false);
18975
19034
  }
18976
19035
  }, [isUploading]);
18977
- useEffect46(() => {
19036
+ useEffect47(() => {
18978
19037
  var _a2;
18979
19038
  setProgresses({ [(_a2 = uploadingFile == null ? void 0 : uploadingFile.name) != null ? _a2 : ""]: progress });
18980
19039
  setIsUploading(isUploading);
@@ -19007,8 +19066,8 @@ function ImageProgress({
19007
19066
  imageRef,
19008
19067
  progress = 0
19009
19068
  }) {
19010
- const [objectUrl, setObjectUrl] = useState49(null);
19011
- useEffect46(() => {
19069
+ const [objectUrl, setObjectUrl] = useState50(null);
19070
+ useEffect47(() => {
19012
19071
  const url = URL.createObjectURL(file);
19013
19072
  setObjectUrl(url);
19014
19073
  return () => {
@@ -19167,13 +19226,13 @@ function ImagePreview() {
19167
19226
  // src/ui/media-upload-toast.tsx
19168
19227
  import { PlaceholderPlugin as PlaceholderPlugin5, UploadErrorCode } from "@platejs/media/react";
19169
19228
  import { usePluginOption as usePluginOption21 } from "platejs/react";
19170
- import { useEffect as useEffect47 } from "react";
19229
+ import { useEffect as useEffect48 } from "react";
19171
19230
  import { toast as toast4 } from "sonner";
19172
19231
 
19173
19232
  // src/ui/use-placeholder-max-file-size.ts
19174
19233
  import { PlaceholderPlugin as PlaceholderPlugin4 } from "@platejs/media/react";
19175
19234
  import { useEditorRef as useEditorRef40 } from "platejs/react";
19176
- import { useLayoutEffect as useLayoutEffect2 } from "react";
19235
+ import { useLayoutEffect as useLayoutEffect3 } from "react";
19177
19236
  var PLACEHOLDER_FILE_KIND_PATTERNS = {
19178
19237
  audio: "audio/*",
19179
19238
  blob: "*",
@@ -19206,7 +19265,7 @@ var acceptedFileTypesFromKey = (key) => {
19206
19265
  };
19207
19266
  var useEditorMaxFileSize = (editor, maxFileSize, acceptedFileTypes) => {
19208
19267
  const acceptedFileTypesKey = acceptedFileTypes == null ? void 0 : acceptedFileTypes.join(FILE_TYPE_KEY_SEPARATOR);
19209
- useLayoutEffect2(() => {
19268
+ useLayoutEffect3(() => {
19210
19269
  var _a;
19211
19270
  const previous = EDITOR_UPLOAD_CONFIGS.get(editor);
19212
19271
  if (maxFileSize === void 0 && acceptedFileTypesKey === void 0) {
@@ -19245,7 +19304,7 @@ function MediaUploadToast() {
19245
19304
  }
19246
19305
  var useUploadErrorToast = () => {
19247
19306
  const uploadError = usePluginOption21(PlaceholderPlugin5, "error");
19248
- useEffect47(() => {
19307
+ useEffect48(() => {
19249
19308
  if (!uploadError) return;
19250
19309
  const { code, data } = uploadError;
19251
19310
  switch (code) {
@@ -19395,7 +19454,7 @@ import { KEYS as KEYS31 } from "platejs";
19395
19454
  // src/ui/mention-element.tsx
19396
19455
  import { IS_APPLE as IS_APPLE2 } from "platejs";
19397
19456
  import { PlateElement as PlateElement31, useFocused as useFocused5, useHotkeys as useHotkeys4, useReadOnly as useReadOnly20, useSelected as useSelected7 } from "platejs/react";
19398
- import { useCallback as useCallback63, useState as useState51 } from "react";
19457
+ import { useCallback as useCallback63, useState as useState52 } from "react";
19399
19458
  import { useMounted as useMounted2 } from "react-tweet";
19400
19459
 
19401
19460
  // src/ui/mention-document-element.tsx
@@ -19407,7 +19466,7 @@ import {
19407
19466
  useReadOnly as useReadOnly19,
19408
19467
  useSelected as useSelected6
19409
19468
  } from "platejs/react";
19410
- import { useCallback as useCallback62, useMemo as useMemo18, useState as useState50 } from "react";
19469
+ import { useCallback as useCallback62, useMemo as useMemo18, useState as useState51 } from "react";
19411
19470
 
19412
19471
  // src/ui/mention-document-hover-card.tsx
19413
19472
  import { useCallback as useCallback61 } from "react";
@@ -19459,8 +19518,8 @@ function DocumentMentionElement(props) {
19459
19518
  const focused = useFocused4();
19460
19519
  const editor = useEditorRef41();
19461
19520
  const readOnly = useReadOnly19();
19462
- const [isToolbarOpen, setIsToolbarOpen] = useState50(false);
19463
- const [isModeMenuOpen, setIsModeMenuOpen] = useState50(false);
19521
+ const [isToolbarOpen, setIsToolbarOpen] = useState51(false);
19522
+ const [isModeMenuOpen, setIsModeMenuOpen] = useState51(false);
19464
19523
  const adapter = useEditorAdapter();
19465
19524
  const canLinkPage = adapter.permissions.canLinkPage;
19466
19525
  const resolvePage = adapter.pageLinks.resolvePage;
@@ -19613,7 +19672,7 @@ function UserMentionElement(props) {
19613
19672
  const resolveMember = adapter.mentions.resolveMember;
19614
19673
  const memberId = (_a = element.key) != null ? _a : "";
19615
19674
  const canShowCard = typeof resolveMember === "function" && memberId.length > 0;
19616
- const [wantOpen, setWantOpen] = useState51(false);
19675
+ const [wantOpen, setWantOpen] = useState52(false);
19617
19676
  const { profile, isLoading, hasResolved } = useMemberProfile({
19618
19677
  enabled: canShowCard && wantOpen,
19619
19678
  memberId,
@@ -19704,17 +19763,17 @@ function UserMentionElement(props) {
19704
19763
  import { DatePlugin as DatePlugin2 } from "@platejs/date/react";
19705
19764
  import { MentionPlugin } from "@platejs/mention/react";
19706
19765
  import { PlateElement as PlateElement32 } from "platejs/react";
19707
- import { useCallback as useCallback64, useState as useState54 } from "react";
19766
+ import { useCallback as useCallback64, useState as useState55 } from "react";
19708
19767
 
19709
19768
  // src/ui/mention-page-combobox-group.tsx
19710
19769
  import { FileTextIcon as FileTextIcon3 } from "lucide-react";
19711
- import { useEffect as useEffect48, useState as useState52 } from "react";
19770
+ import { useEffect as useEffect49, useState as useState53 } from "react";
19712
19771
  import { jsx as jsx172, jsxs as jsxs110 } from "react/jsx-runtime";
19713
19772
  function PageComboboxGroup({ search, onPageHover, onPageSelect }) {
19714
19773
  const adapter = useEditorAdapter();
19715
19774
  const debouncedSearch = useDebounce(search, 250);
19716
- const [pages, setPages] = useState52([]);
19717
- useEffect48(() => {
19775
+ const [pages, setPages] = useState53([]);
19776
+ useEffect49(() => {
19718
19777
  if (!adapter.permissions.canLinkPage) {
19719
19778
  setPages([]);
19720
19779
  return;
@@ -19763,13 +19822,13 @@ function PageStatusBadge({ status }) {
19763
19822
  }
19764
19823
 
19765
19824
  // src/ui/mention-people-combobox-group.tsx
19766
- import { useEffect as useEffect49, useState as useState53 } from "react";
19825
+ import { useEffect as useEffect50, useState as useState54 } from "react";
19767
19826
  import { jsx as jsx173, jsxs as jsxs111 } from "react/jsx-runtime";
19768
19827
  function PeopleComboboxGroup({ search, onUserHover, onUserSelect }) {
19769
19828
  const adapter = useEditorAdapter();
19770
19829
  const debouncedSearch = useDebounce(search, 150);
19771
- const [members, setMembers] = useState53([]);
19772
- useEffect49(() => {
19830
+ const [members, setMembers] = useState54([]);
19831
+ useEffect50(() => {
19773
19832
  if (!adapter.permissions.canMention) {
19774
19833
  setMembers([]);
19775
19834
  return;
@@ -19822,8 +19881,8 @@ var DEFAULT_PLACEHOLDER = "Mention a person, page, or date";
19822
19881
  var TODAY_PLACEHOLDER = "Today";
19823
19882
  function MentionInputElement(props) {
19824
19883
  const { children, editor, element } = props;
19825
- const [search, setSearch] = useState54("");
19826
- const [placeholder, setPlaceholder] = useState54(DEFAULT_PLACEHOLDER);
19884
+ const [search, setSearch] = useState55("");
19885
+ const [placeholder, setPlaceholder] = useState55(DEFAULT_PLACEHOLDER);
19827
19886
  const handleDateFocus = useCallback64(() => {
19828
19887
  setPlaceholder(TODAY_PLACEHOLDER);
19829
19888
  }, []);
@@ -21269,7 +21328,7 @@ function StepElement(props) {
21269
21328
  /* @__PURE__ */ jsxs117("div", { className: "flex-1 pt-0.5", children: [
21270
21329
  /* @__PURE__ */ jsxs117("div", { className: "flex items-center gap-2", contentEditable: false, children: [
21271
21330
  isEditingTitle ? /* @__PURE__ */ jsx179(
21272
- "input",
21331
+ UnstyledInput,
21273
21332
  {
21274
21333
  ref: titleInputRef,
21275
21334
  className: cn(titleClass, "min-w-30 bg-transparent outline-none"),
@@ -21394,7 +21453,7 @@ import {
21394
21453
  useSelected as useSelected8,
21395
21454
  withHOC as withHOC8
21396
21455
  } from "platejs/react";
21397
- import { useRef as useRef18 } from "react";
21456
+ import { useRef as useRef19 } from "react";
21398
21457
 
21399
21458
  // src/ui/table-icons.tsx
21400
21459
  import { jsx as jsx180, jsxs as jsxs118 } from "react/jsx-runtime";
@@ -21598,7 +21657,7 @@ var TableElement = withHOC8(
21598
21657
  const isSelectionAreaVisible = usePluginOption22(BlockSelectionPlugin10, "isSelectionAreaVisible");
21599
21658
  const hasControls = !readOnly && !isSelectionAreaVisible;
21600
21659
  const { marginLeft, props: tableProps } = useTableElement();
21601
- const tableRef = useRef18(null);
21660
+ const tableRef = useRef19(null);
21602
21661
  useTableSelectionDom(tableRef);
21603
21662
  const isSelectingTable = useBlockSelected2(props.element.id);
21604
21663
  const content = /* @__PURE__ */ jsx181(
@@ -22240,7 +22299,7 @@ var TabTrigger2 = React73.forwardRef(
22240
22299
  onKeyDown: handleTabKeyDown,
22241
22300
  children: [
22242
22301
  isEditing ? /* @__PURE__ */ jsx182(
22243
- "input",
22302
+ UnstyledInput,
22244
22303
  {
22245
22304
  ref: inputRef,
22246
22305
  className: cn(
@@ -22482,7 +22541,7 @@ function TileElement(props) {
22482
22541
  ),
22483
22542
  children: [
22484
22543
  /* @__PURE__ */ jsx184("div", { className: "flex items-start justify-between gap-2", contentEditable: false, children: /* @__PURE__ */ jsx184("div", { className: "flex-1", children: isEditingTitle ? /* @__PURE__ */ jsx184(
22485
- "input",
22544
+ UnstyledInput,
22486
22545
  {
22487
22546
  ref: titleInputRef,
22488
22547
  className: "w-full bg-transparent font-semibold text-foreground outline-none",
@@ -22883,7 +22942,7 @@ function DefaultToggleView({
22883
22942
  children: [
22884
22943
  /* @__PURE__ */ jsx187(ToggleChevron, { open }),
22885
22944
  isEditing ? /* @__PURE__ */ jsx187(
22886
- "input",
22945
+ UnstyledInput,
22887
22946
  {
22888
22947
  ref: inputRef,
22889
22948
  className: "min-w-30 bg-transparent font-semibold text-foreground outline-none",
@@ -24949,7 +25008,7 @@ function UpdateElement(props) {
24949
25008
  return /* @__PURE__ */ jsx203(PlateElement45, __spreadProps(__spreadValues({}, props), { className: "group/update relative", children: /* @__PURE__ */ jsxs137("div", { id: anchorId, className: "grid grid-cols-[140px_1fr] items-start gap-8 py-8", "data-plate-open-context-menu": true, children: [
24950
25009
  /* @__PURE__ */ jsx203("div", { className: "sticky top-24", contentEditable: false, children: /* @__PURE__ */ jsxs137("div", { className: "flex flex-col items-start gap-2", children: [
24951
25010
  isEditingLabel ? /* @__PURE__ */ jsx203(
24952
- "input",
25011
+ UnstyledInput,
24953
25012
  {
24954
25013
  ref: labelInputRef,
24955
25014
  className: "border-primary border-b bg-transparent text-sm font-medium text-primary outline-none",