@bettercms-ai/kit 4.1.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/lossy.d.ts +1 -1
- package/dist/adapters/lossy.js +1 -1
- package/dist/adapters/lossy.js.map +1 -1
- package/dist/adapters/schema.js +1 -1
- package/dist/adapters/schema.js.map +1 -1
- package/dist/context.d.ts +8 -0
- package/dist/context.js.map +1 -1
- package/dist/controls/index.js +2 -2
- package/dist/controls/media-v16.d.ts +3 -1
- package/dist/controls/media-v16.js +3 -1
- package/dist/controls/media-v16.js.map +1 -1
- package/dist/controls/media.d.ts +5 -1
- package/dist/controls/media.js +25 -7
- package/dist/controls/media.js.map +1 -1
- package/dist/controls/rich-text/block-tool.d.ts +1 -1
- package/dist/controls/rich-text/block-tool.js +1 -1
- package/dist/controls/rich-text/block-tool.js.map +1 -1
- package/dist/controls/rich-text/blocks.js +3 -1
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/catalog.d.ts +26 -3
- package/dist/controls/rich-text/catalog.js +239 -58
- package/dist/controls/rich-text/catalog.js.map +1 -1
- package/dist/controls/rich-text/codec.d.ts +7 -1
- package/dist/controls/rich-text/codec.js +2 -1
- package/dist/controls/rich-text/codec.js.map +1 -1
- package/dist/controls/rich-text/control.js +2 -1
- package/dist/controls/rich-text/control.js.map +1 -1
- package/dist/controls/rich-text/dom.js +8 -3
- package/dist/controls/rich-text/dom.js.map +1 -1
- package/dist/controls/rich-text/editor.d.ts +3 -1
- package/dist/controls/rich-text/editor.js +160 -44
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/rewriteSelection.d.ts +25 -0
- package/dist/controls/rich-text/rewriteSelection.js +28 -0
- package/dist/controls/rich-text/rewriteSelection.js.map +1 -0
- package/dist/controls/rich-text/slash-preview.js +18 -5
- package/dist/controls/rich-text/slash-preview.js.map +1 -1
- package/dist/controls/rich-text/table-grid.js +28 -21
- package/dist/controls/rich-text/table-grid.js.map +1 -1
- package/dist/controls/rich-text/toolbar.d.ts +6 -2
- package/dist/controls/rich-text/toolbar.js +205 -4
- package/dist/controls/rich-text/toolbar.js.map +1 -1
- package/dist/controls/text.d.ts +1 -1
- package/dist/controls/text.js +10 -7
- package/dist/controls/text.js.map +1 -1
- package/dist/engine/field-shell.js +8 -4
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/engine/frame.js +9 -2
- package/dist/engine/frame.js.map +1 -1
- package/dist/engine/grouping.js +4 -3
- package/dist/engine/grouping.js.map +1 -1
- package/dist/engine/item-list.js +2 -2
- package/dist/engine/item-list.js.map +1 -1
- package/dist/engine/schema-form.d.ts +2 -0
- package/dist/engine/schema-form.js +2 -0
- package/dist/engine/schema-form.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/kit.css +6 -32
- package/dist/lib/reduced-motion.d.ts +1 -0
- package/dist/lib/reduced-motion.js +19 -0
- package/dist/lib/reduced-motion.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/theme.css +101 -0
- package/dist/tokens.css +9 -0
- package/dist/ui/content-fields.js +3 -2
- package/dist/ui/content-fields.js.map +1 -1
- package/dist/ui/controls.js +3 -2
- package/dist/ui/controls.js.map +1 -1
- package/dist/ui/floating-panel.js +3 -2
- package/dist/ui/floating-panel.js.map +1 -1
- package/dist/ui/foundations.js +3 -2
- package/dist/ui/foundations.js.map +1 -1
- package/dist/ui/index.js +2 -2
- package/dist/ui/inspector.d.ts +23 -5
- package/dist/ui/inspector.js +75 -30
- package/dist/ui/inspector.js.map +1 -1
- package/dist/ui/overlay.js +2 -2
- package/dist/ui/overlay.js.map +1 -1
- package/dist/ui/tab.js +3 -2
- package/dist/ui/tab.js.map +1 -1
- package/package.json +1 -1
|
@@ -42,6 +42,8 @@ export interface RichTextEditorProps {
|
|
|
42
42
|
/** Controlled expanded modal (a host's label-row action opens it too). */
|
|
43
43
|
expandedOpen?: boolean;
|
|
44
44
|
onExpandedOpenChange?: (open: boolean) => void;
|
|
45
|
+
/** Look "v16" Focus mode (⇧⌘F, the toolbar's Focus): the host's full-screen view. Answers false (or absent) → the expanded editor opens. */
|
|
46
|
+
onFocusMode?: () => boolean | void;
|
|
45
47
|
/** This editor IS the body of the expanded modal: toolbar always shown, tall writing surface. */
|
|
46
48
|
inModal?: boolean;
|
|
47
49
|
/** Already the full editor: no Expand button. */
|
|
@@ -59,4 +61,4 @@ export interface RichTextEditorProps {
|
|
|
59
61
|
/** the components this field may embed (the insert menus' More components); absent → none offered */
|
|
60
62
|
components?: CatalogComponents;
|
|
61
63
|
}
|
|
62
|
-
export declare function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder, docKey, features, references, single, allowNewTab, id, invalid, variant, expandCrumbs, expandedOpen, onExpandedOpenChange, inModal, hideFullscreen, maxHeight, autoFocus, onComment, commentInPlace, components, }: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
export declare function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder, docKey, features, references, single, allowNewTab, id, invalid, variant, expandCrumbs, expandedOpen, onExpandedOpenChange, onFocusMode, inModal, hideFullscreen, maxHeight, autoFocus, onComment, commentInPlace, components, }: RichTextEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,6 +2,7 @@ import { cn } from "../../lib/cn.js";
|
|
|
2
2
|
import { AI_REWRITE_COMMANDS, useKitEnv, useKitLook, useKitServices } from "../../context.js";
|
|
3
3
|
import { Button } from "../../ui/button.js";
|
|
4
4
|
import { platformKeys, shortcutHintsOn } from "../../ui/shortcut-hint.js";
|
|
5
|
+
import { useKitReducedMotion } from "../../lib/reduced-motion.js";
|
|
5
6
|
import { Menu, MenuContent, MenuItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Tooltip } from "../../ui/overlay.js";
|
|
6
7
|
import { Input, Textarea } from "../../ui/input.js";
|
|
7
8
|
import { LinkPopoverBody } from "../link.js";
|
|
@@ -11,6 +12,7 @@ import { COMPONENT_INSERT_TOAST } from "../component-services.js";
|
|
|
11
12
|
import { eventKey } from "../../lib/key-event.js";
|
|
12
13
|
import { aiCommandsOffered, mapRewriteOntoRuns, textRuns } from "./ai-runs.js";
|
|
13
14
|
import { ALL_FEATURES } from "./codec.js";
|
|
15
|
+
import { FORMATTING_REMOVED, LINK_SENTINEL, linkAttrs, selectionShape, unwrapLinkSentinels } from "./rewriteSelection.js";
|
|
14
16
|
import { createOutlineStore, outlineOf } from "./toc.js";
|
|
15
17
|
import { CatalogComponentsProvider, InsertMenuContent, SlashMenuPanel, blockAllowed, catalogKey, noteRecent, useCatalog } from "./catalog.js";
|
|
16
18
|
import { openComponentPanel } from "./component-panel.js";
|
|
@@ -27,7 +29,7 @@ import { ButtonLinkPanel, applyButton, buttonAt, buttonInitial, insertButton, re
|
|
|
27
29
|
import * as React from "react";
|
|
28
30
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
29
31
|
import { IconArrowBarToDown, IconArrowBarToUp, IconCode, IconCopy, IconGripVertical, IconPlus, IconTransform, IconTrash } from "@tabler/icons-react";
|
|
30
|
-
import { AnimatePresence, motion
|
|
32
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
31
33
|
import { createPortal, flushSync } from "react-dom";
|
|
32
34
|
//#region src/controls/rich-text/editor.tsx
|
|
33
35
|
/**
|
|
@@ -49,6 +51,8 @@ import { createPortal, flushSync } from "react-dom";
|
|
|
49
51
|
* Markdown shortcut or pasted markup the field cannot hold is not offered, or is turned into what it can hold and said so.
|
|
50
52
|
*/
|
|
51
53
|
var V16_QUOTE_CLASS = "[&_blockquote:not([data-rt-isolate]_*)]:border-kit-insp-accent [&_blockquote:not([data-rt-isolate]_*)]:py-0.5 [&_blockquote:not([data-rt-isolate]_*)]:text-[17px] [&_blockquote:not([data-rt-isolate]_*)]:leading-7 [&_blockquote:not([data-rt-isolate]_*)]:text-kit-insp-tip-body";
|
|
54
|
+
/** Look "v16" body (prototype content.css:210 .ce-body .rtx-body, kit.css:281 .rtx-body a): 16/26 text, links #1D51A0 with a same-colour underline. */
|
|
55
|
+
var V16_BODY_CLASS = "text-[16px] leading-[26px] [&_a:not([data-rt-isolate]_*)]:text-kit-insp-link [&_a:not([data-rt-isolate]_*)]:decoration-current";
|
|
52
56
|
var RT_PROSE = "text-kit-base leading-[1.6] text-kit-fg [&>*+*]:mt-3 [&_span[class]:not([data-rt-isolate]_*)]:!text-inherit [&_span[class]:not([data-rt-isolate]_*)]:![-webkit-text-fill-color:currentColor] [&_span[class]:not([data-rt-isolate]_*)]:!bg-none [&_span[class]:not([data-rt-isolate]_*)]:!opacity-100 [&_span[class]:not([data-rt-isolate]_*)]:!visible [&_h1:not([data-rt-isolate]_*)]:text-[28px] [&_h1:not([data-rt-isolate]_*)]:font-semibold [&_h1:not([data-rt-isolate]_*)]:leading-9 [&_h1:not([data-rt-isolate]_*)]:tracking-[-0.01em] [&_h2:not([data-rt-isolate]_*)]:text-[22px] [&_h2:not([data-rt-isolate]_*)]:font-semibold [&_h2:not([data-rt-isolate]_*)]:leading-8 [&_h2:not([data-rt-isolate]_*)]:tracking-[-0.01em] [&_h3:not([data-rt-isolate]_*)]:text-kit-lg [&_h3:not([data-rt-isolate]_*)]:font-semibold [&_h4:not([data-rt-isolate]_*)]:text-kit-md [&_h4:not([data-rt-isolate]_*)]:font-semibold [&_h5:not([data-rt-isolate]_*)]:text-kit-base [&_h5:not([data-rt-isolate]_*)]:font-semibold [&_h6:not([data-rt-isolate]_*)]:text-kit-sm [&_h6:not([data-rt-isolate]_*)]:font-semibold [&_h6:not([data-rt-isolate]_*)]:uppercase [&_h6:not([data-rt-isolate]_*)]:tracking-wide [&_h6:not([data-rt-isolate]_*)]:text-kit-fg-2 [&>h1]:mt-6 [&>h2]:mt-6 [&>h3]:mt-5 [&>*:first-child]:mt-0 [&_ul:not([data-rt-isolate]_*)]:list-disc [&_ul:not([data-rt-isolate]_*)]:pl-5 [&_ol:not([data-rt-isolate]_*)]:list-decimal [&_ol:not([data-rt-isolate]_*)]:pl-5 [&_li:not([data-rt-isolate]_*)]:pl-1 [&_li+li:not([data-rt-isolate]_*)]:mt-1 [&_li:not([data-rt-isolate]_*)]:marker:text-kit-fg-3 [&_ul[data-task]:not([data-rt-isolate]_*)]:list-none [&_ul[data-task]:not([data-rt-isolate]_*)]:pl-0 [&_ul[data-task]>li:not([data-rt-isolate]_*)]:relative [&_ul[data-task]>li:not([data-rt-isolate]_*)]:pl-7 [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:absolute [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:left-0 [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:top-[0.2em] [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:flex [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:size-4 [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:items-center [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:justify-center [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:rounded-kit-md [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:border [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:border-kit-line-strong [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:bg-kit-surface [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:text-[11px] [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:font-semibold [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:leading-none [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:content-[''] [&_ul[data-task]>li[data-checked=true]:not([data-rt-isolate]_*)]:text-kit-fg-3 [&_ul[data-task]>li[data-checked=true]:not([data-rt-isolate]_*)]:line-through [&_ul[data-task]>li[data-checked=true]:not([data-rt-isolate]_*)]:before:border-kit-inverse [&_ul[data-task]>li[data-checked=true]:not([data-rt-isolate]_*)]:before:bg-kit-inverse [&_ul[data-task]>li[data-checked=true]:not([data-rt-isolate]_*)]:before:text-kit-fg-inverse [&_ul[data-task]>li[data-checked=true]:not([data-rt-isolate]_*)]:before:content-['✓'] [&_blockquote:not([data-rt-isolate]_*)]:border-l-2 [&_blockquote:not([data-rt-isolate]_*)]:border-kit-line-strong [&_blockquote:not([data-rt-isolate]_*)]:pl-4 [&_blockquote:not([data-rt-isolate]_*)]:text-kit-fg-2 [&_blockquote:not([data-rt-isolate]_*)]:italic [&_a:not([data-rt-isolate]_*)]:text-kit-accent-fg [&_a:not([data-rt-isolate]_*)]:underline [&_a:not([data-rt-isolate]_*)]:decoration-kit-accent-line [&_a:not([data-rt-isolate]_*)]:underline-offset-2 [&_a[data-button]:not([data-rt-isolate]_*)]:inline-flex [&_a[data-button]:not([data-rt-isolate]_*)]:h-9 [&_a[data-button]:not([data-rt-isolate]_*)]:items-center [&_a[data-button]:not([data-rt-isolate]_*)]:rounded-kit-md [&_a[data-button]:not([data-rt-isolate]_*)]:bg-kit-inverse [&_a[data-button]:not([data-rt-isolate]_*)]:px-3.5 [&_a[data-button]:not([data-rt-isolate]_*)]:text-kit-sm [&_a[data-button]:not([data-rt-isolate]_*)]:font-medium [&_a[data-button]:not([data-rt-isolate]_*)]:text-kit-fg-inverse [&_a[data-button]:not([data-rt-isolate]_*)]:no-underline [&_abbr:not([data-rt-isolate]_*)]:cursor-help [&_abbr:not([data-rt-isolate]_*)]:underline [&_abbr:not([data-rt-isolate]_*)]:decoration-dotted [&_abbr:not([data-rt-isolate]_*)]:underline-offset-2 [&_sup:not([data-rt-isolate]_*)]:text-[0.7em] [&_sup:not([data-rt-isolate]_*)]:leading-none [&_code:not([data-rt-isolate]_*)]:rounded-kit-md [&_code:not([data-rt-isolate]_*)]:bg-kit-muted [&_code:not([data-rt-isolate]_*)]:px-1 [&_code:not([data-rt-isolate]_*)]:py-px [&_code:not([data-rt-isolate]_*)]:font-kit-mono [&_code:not([data-rt-isolate]_*)]:text-[0.9em] [&_pre:not([data-rt-isolate]_*)]:overflow-x-auto [&_pre:not([data-rt-isolate]_*)]:whitespace-pre [&_pre:not([data-rt-isolate]_*)]:rounded-kit-lg [&_pre:not([data-rt-isolate]_*)]:bg-kit-code [&_pre:not([data-rt-isolate]_*)]:text-kit-code-fg [&_pre:not([data-rt-isolate]_*)]:p-3 [&_pre:not([data-rt-isolate]_*)]:font-kit-mono [&_pre:not([data-rt-isolate]_*)]:text-kit-sm [&_pre:not([data-rt-isolate]_*)]:border [&_pre:not([data-rt-isolate]_*)]:border-kit-line [&_pre_code:not([data-rt-isolate]_*)]:rounded-none [&_pre_code:not([data-rt-isolate]_*)]:bg-transparent [&_pre_code:not([data-rt-isolate]_*)]:p-0 [&_pre_code:not([data-rt-isolate]_*)]:text-[1em] [&_hr:not([data-rt-isolate]_*)]:my-6 [&_hr:not([data-rt-isolate]_*)]:border-kit-line [&_figure:not([data-rt-isolate]_*)]:my-4 [&_img:not([data-rt-isolate]_*)]:rounded-kit-lg [&_img:not([data-rt-isolate]_*)]:border [&_img:not([data-rt-isolate]_*)]:border-kit-line [&_figcaption:not([data-rt-isolate]_*)]:mt-1.5 [&_figcaption:not([data-rt-isolate]_*)]:text-center [&_figcaption:not([data-rt-isolate]_*)]:text-kit-sm [&_figcaption:not([data-rt-isolate]_*)]:text-kit-fg-3 [&_figure_img:not([data-rt-isolate]_*)]:block [&_figure[data-size=s]_img:not([data-rt-isolate]_*)]:w-1/3 [&_figure[data-size=m]_img:not([data-rt-isolate]_*)]:w-1/2 [&_figure[data-size=l]_img:not([data-rt-isolate]_*)]:w-3/4 [&_figure[data-align=center]_img:not([data-rt-isolate]_*)]:mx-auto [&_figure[data-align=right]_img:not([data-rt-isolate]_*)]:ml-auto [&_figure[data-align=full]_img:not([data-rt-isolate]_*)]:w-full [&_div[data-callout]:not([data-rt-isolate]_*)]:rounded-kit-lg [&_div[data-callout]:not([data-rt-isolate]_*)]:border [&_div[data-callout]:not([data-rt-isolate]_*)]:border-kit-info-line [&_div[data-callout]:not([data-rt-isolate]_*)]:bg-kit-info-soft [&_div[data-callout]:not([data-rt-isolate]_*)]:px-4 [&_div[data-callout]:not([data-rt-isolate]_*)]:py-3 [&_div[data-callout]:not([data-rt-isolate]_*)]:text-kit-fg [&_div[data-callout=tip]:not([data-rt-isolate]_*)]:border-kit-success-line [&_div[data-callout=tip]:not([data-rt-isolate]_*)]:bg-kit-success-soft [&_div[data-callout=warning]:not([data-rt-isolate]_*)]:border-kit-warning-line [&_div[data-callout=warning]:not([data-rt-isolate]_*)]:bg-kit-warning-soft [&_div[data-callout]>p[data-title]:not([data-rt-isolate]_*)]:font-medium [&_details:not([data-rt-isolate]_*)]:rounded-kit-md [&_summary:not([data-rt-isolate]_*)]:cursor-pointer [&_summary:not([data-rt-isolate]_*)]:font-medium [&_details>div:not([data-rt-isolate]_*)]:mt-1 [&_details>div:not([data-rt-isolate]_*)]:border-l [&_details>div:not([data-rt-isolate]_*)]:border-kit-line [&_details>div:not([data-rt-isolate]_*)]:pl-4 [&_details>div:not([data-rt-isolate]_*)]:ml-1 [&_div[data-rt=columns]:not([data-rt-isolate]_*)]:grid [&_div[data-rt=columns]:not([data-rt-isolate]_*)]:gap-4 [&_div[data-cols='2']:not([data-rt-isolate]_*)]:grid-cols-2 [&_div[data-cols='3']:not([data-rt-isolate]_*)]:grid-cols-3 [&_div[data-cols='4']:not([data-rt-isolate]_*)]:grid-cols-4 [&_div[data-gap=s]:not([data-rt-isolate]_*)]:gap-2 [&_div[data-gap=l]:not([data-rt-isolate]_*)]:gap-7 [&_div[data-rt=file]:not([data-rt-isolate]_*)]:rounded-kit-lg [&_div[data-rt=file]:not([data-rt-isolate]_*)]:border [&_div[data-rt=file]:not([data-rt-isolate]_*)]:border-kit-line [&_div[data-rt=file]:not([data-rt-isolate]_*)]:px-3 [&_div[data-rt=file]:not([data-rt-isolate]_*)]:py-2.5 [&_div[data-rt=file]:not([data-rt-isolate]_*)]:text-kit-sm [&_div[data-embed]:not([data-rt-isolate]_*)]:flex [&_div[data-embed]:not([data-rt-isolate]_*)]:aspect-video [&_div[data-embed]:not([data-rt-isolate]_*)]:items-center [&_div[data-embed]:not([data-rt-isolate]_*)]:justify-center [&_div[data-embed]:not([data-rt-isolate]_*)]:rounded-kit-lg [&_div[data-embed]:not([data-rt-isolate]_*)]:border [&_div[data-embed]:not([data-rt-isolate]_*)]:border-kit-line [&_div[data-embed]:not([data-rt-isolate]_*)]:bg-kit-subtle [&_div[data-embed]:not([data-rt-isolate]_*)]:text-kit-sm [&_div[data-embed]:not([data-rt-isolate]_*)]:text-kit-fg-3 [&_div[data-block]:not([data-rt-isolate]_*)]:flex [&_div[data-block]:not([data-rt-isolate]_*)]:items-center [&_div[data-block]:not([data-rt-isolate]_*)]:gap-2 [&_div[data-block]:not([data-rt-isolate]_*)]:rounded-kit-lg [&_div[data-block]:not([data-rt-isolate]_*)]:border [&_div[data-block]:not([data-rt-isolate]_*)]:border-dashed [&_div[data-block]:not([data-rt-isolate]_*)]:border-kit-accent-line [&_div[data-block]:not([data-rt-isolate]_*)]:bg-kit-accent-softer [&_div[data-block]:not([data-rt-isolate]_*)]:px-3 [&_div[data-block]:not([data-rt-isolate]_*)]:py-3 [&_div[data-block]:not([data-rt-isolate]_*)]:text-kit-sm [&_div[data-block]:not([data-rt-isolate]_*)]:text-kit-accent-fg [&_table:not([data-rt-isolate]_*)]:w-full [&_table:not([data-rt-isolate]_*)]:border-collapse [&_table:not([data-rt-isolate]_*)]:text-kit-sm [&_td:not([data-rt-isolate]_*)]:border [&_td:not([data-rt-isolate]_*)]:border-kit-line [&_td:not([data-rt-isolate]_*)]:px-2.5 [&_td:not([data-rt-isolate]_*)]:py-1.5 [&_td:not([data-rt-isolate]_*)]:align-top [&_th:not([data-rt-isolate]_*)]:border [&_th:not([data-rt-isolate]_*)]:border-kit-line [&_th:not([data-rt-isolate]_*)]:bg-kit-subtle [&_th:not([data-rt-isolate]_*)]:px-2.5 [&_th:not([data-rt-isolate]_*)]:py-1.5 [&_th:not([data-rt-isolate]_*)]:text-left [&_th:not([data-rt-isolate]_*)]:align-top [&_th:not([data-rt-isolate]_*)]:font-medium";
|
|
53
57
|
/** Panel density (≈340px inspector): 13px text, smaller headings. */
|
|
54
58
|
var RT_PANEL = "text-kit-sm leading-[1.6] [&_h1:not([data-rt-isolate]_*)]:text-kit-xl [&_h1:not([data-rt-isolate]_*)]:leading-7 [&_h2:not([data-rt-isolate]_*)]:text-kit-lg [&_h2:not([data-rt-isolate]_*)]:leading-7 [&_h3:not([data-rt-isolate]_*)]:text-kit-md [&_h4:not([data-rt-isolate]_*)]:text-kit-base [&_h5:not([data-rt-isolate]_*)]:text-kit-sm [&_h6:not([data-rt-isolate]_*)]:text-kit-xs";
|
|
@@ -281,7 +285,7 @@ function useDisabledFieldset(el) {
|
|
|
281
285
|
}, [el]);
|
|
282
286
|
return fenced;
|
|
283
287
|
}
|
|
284
|
-
function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder, docKey, features = ALL_FEATURES, references, single, allowNewTab = true, id, invalid, variant = "document", expandCrumbs, expandedOpen, onExpandedOpenChange, inModal, hideFullscreen, maxHeight, autoFocus, onComment, commentInPlace, components }) {
|
|
288
|
+
function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder, docKey, features = ALL_FEATURES, references, single, allowNewTab = true, id, invalid, variant = "document", expandCrumbs, expandedOpen, onExpandedOpenChange, onFocusMode, inModal, hideFullscreen, maxHeight, autoFocus, onComment, commentInPlace, components }) {
|
|
285
289
|
const hints = shortcutHintsOn();
|
|
286
290
|
const ph = placeholder ?? (hints ? "Type '/' for commands" : "Write something…");
|
|
287
291
|
const dense = variant === "panel";
|
|
@@ -312,9 +316,15 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
312
316
|
const [modalOwn, setModalOwn] = React.useState(false);
|
|
313
317
|
const modalOpen = expandedOpen ?? modalOwn;
|
|
314
318
|
const setModalOpen = (o) => onExpandedOpenChange ? onExpandedOpenChange(o) : setModalOwn(o);
|
|
319
|
+
/** r7 #4: Focus mode is the host's full-screen writing view when it has one, else the expanded editor */
|
|
320
|
+
const openFocus = () => {
|
|
321
|
+
if (onFocusMode && onFocusMode() !== false) return;
|
|
322
|
+
setModalOpen(true);
|
|
323
|
+
};
|
|
315
324
|
const [md, setMd] = React.useState(null);
|
|
316
325
|
const [mdConfirm, setMdConfirm] = React.useState(false);
|
|
317
|
-
const reduceMotion =
|
|
326
|
+
const reduceMotion = useKitReducedMotion();
|
|
327
|
+
const slashReduce = !!useKitReducedMotion();
|
|
318
328
|
const [bubble, setBubble] = React.useState(null);
|
|
319
329
|
/** Comment was picked: the toolbar stays away until the next click or key inside this editor */
|
|
320
330
|
const [quiet, setQuiet] = React.useState(false);
|
|
@@ -368,7 +378,8 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
368
378
|
setCodes((p) => !force && sameCodes(p, next) ? p : next);
|
|
369
379
|
}, []);
|
|
370
380
|
const expanded = !!inModal;
|
|
371
|
-
const toolbarOpen = !readOnly && (focused || menus.style || menus.more || insertOpen || expanded || !!md || !!link);
|
|
381
|
+
const toolbarOpen = !readOnly && (v16 || focused || menus.style || menus.more || insertOpen || expanded || !!md || !!link);
|
|
382
|
+
const fieldActive = focused || menus.style || menus.more || insertOpen || expanded || !!md || !!link;
|
|
372
383
|
const scrollable = !!maxHeight && !expanded;
|
|
373
384
|
/** A refusal or a result the author must see: the host's toaster, else a line under the editor. Never silent. */
|
|
374
385
|
const notify = React.useCallback((message, opts = {}) => {
|
|
@@ -661,49 +672,112 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
661
672
|
const s = window.getSelection();
|
|
662
673
|
return topBlock(el, s && s.rangeCount && el.contains(s.anchorNode) ? s.anchorNode : document.activeElement);
|
|
663
674
|
};
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
675
|
+
/**
|
|
676
|
+
* r7 P0: a block deleted (or turned into others) is ONE undo step: the host's history when it keeps one, else this
|
|
677
|
+
* editor's. ⌘Z and the toast's Undo run that same undo, which puts the block back at its index (the body may have
|
|
678
|
+
* been reloaded since, so the old neighbours are not trusted), and a refusal is said, never a silent no-op.
|
|
679
|
+
*/
|
|
680
|
+
const structuralStep = (label, change, undo, redo) => {
|
|
681
|
+
const h = hist.current;
|
|
682
|
+
const historyStep = services.historyStep;
|
|
683
|
+
const host = historyStep ? historyStep(() => {
|
|
684
|
+
change();
|
|
685
|
+
emit();
|
|
686
|
+
}) : null;
|
|
687
|
+
let undoIt;
|
|
688
|
+
if (host) {
|
|
689
|
+
h.hosts = [...h.hosts, {
|
|
690
|
+
label,
|
|
691
|
+
step: host
|
|
692
|
+
}].slice(-100);
|
|
693
|
+
undoIt = () => runHost(host.undo);
|
|
694
|
+
} else {
|
|
695
|
+
if (!historyStep) {
|
|
696
|
+
change();
|
|
697
|
+
emit();
|
|
698
|
+
}
|
|
699
|
+
const s = {
|
|
700
|
+
dom: {
|
|
701
|
+
undo,
|
|
702
|
+
redo
|
|
703
|
+
},
|
|
704
|
+
label,
|
|
705
|
+
at: Date.now()
|
|
706
|
+
};
|
|
707
|
+
h.past = [...h.past, s].slice(-100);
|
|
708
|
+
h.future = [];
|
|
709
|
+
undoIt = () => {
|
|
710
|
+
if (!h.past.includes(s)) return "It was undone already.";
|
|
711
|
+
if (!undo()) return "The editor was closed, so there is nothing to undo here.";
|
|
712
|
+
h.past = h.past.filter((x) => x !== s);
|
|
713
|
+
s.at = Date.now();
|
|
714
|
+
h.future = [...h.future, s];
|
|
715
|
+
return true;
|
|
716
|
+
};
|
|
674
717
|
}
|
|
675
|
-
setGutter(null);
|
|
676
|
-
setBlockMenu(false);
|
|
677
|
-
emit();
|
|
678
718
|
notify(label, { action: {
|
|
679
719
|
label: "Undo",
|
|
680
720
|
onClick: () => {
|
|
681
|
-
const
|
|
682
|
-
if (
|
|
683
|
-
if (filler?.isConnected && !filler.textContent) filler.remove();
|
|
684
|
-
if (next && next.parentNode === root) root.insertBefore(b, next);
|
|
685
|
-
else root.append(b);
|
|
686
|
-
emit();
|
|
721
|
+
const r = undoIt();
|
|
722
|
+
if (r !== true) notify("Nothing was undone", { description: r });
|
|
687
723
|
}
|
|
688
724
|
} });
|
|
689
725
|
};
|
|
726
|
+
/** puts `b` back at `index` among the body's blocks (after a reload too), dropping the filler a delete left */
|
|
727
|
+
const reinsert = (b, index, filler) => {
|
|
728
|
+
const root = ref.current;
|
|
729
|
+
if (!root) return false;
|
|
730
|
+
if (filler?.isConnected && !filler.textContent) filler.remove();
|
|
731
|
+
else if (!filler && root.children.length === 1 && isEmptyHtml(root.innerHTML)) root.firstElementChild?.remove();
|
|
732
|
+
const at = root.children[index];
|
|
733
|
+
if (at) root.insertBefore(b, at);
|
|
734
|
+
else root.append(b);
|
|
735
|
+
emit();
|
|
736
|
+
return true;
|
|
737
|
+
};
|
|
738
|
+
const deleteBlock = (b, label = "Block deleted") => {
|
|
739
|
+
const el = ref.current;
|
|
740
|
+
if (!el || !el.contains(b)) return;
|
|
741
|
+
const index = Array.prototype.indexOf.call(el.children, b);
|
|
742
|
+
let filler = null;
|
|
743
|
+
const remove = () => {
|
|
744
|
+
const root = ref.current;
|
|
745
|
+
if (!root) return false;
|
|
746
|
+
b.remove();
|
|
747
|
+
filler = null;
|
|
748
|
+
if (!root.firstElementChild) {
|
|
749
|
+
filler = document.createElement("p");
|
|
750
|
+
filler.innerHTML = "<br>";
|
|
751
|
+
root.append(filler);
|
|
752
|
+
}
|
|
753
|
+
return true;
|
|
754
|
+
};
|
|
755
|
+
setGutter(null);
|
|
756
|
+
setBlockMenu(false);
|
|
757
|
+
structuralStep(label, () => void remove(), () => reinsert(b, index, filler), () => {
|
|
758
|
+
if (!remove()) return false;
|
|
759
|
+
emit();
|
|
760
|
+
return true;
|
|
761
|
+
});
|
|
762
|
+
};
|
|
690
763
|
/** look v16 "Turn into" on a block island: the block becomes `nodes`, the caret goes to the first, Undo puts it back */
|
|
691
764
|
const replaceBlock = (b, nodes, label) => {
|
|
692
765
|
const el = ref.current;
|
|
693
766
|
if (!el || !el.contains(b) || !nodes.length) return;
|
|
694
|
-
|
|
767
|
+
const index = Array.prototype.indexOf.call(el.children, b);
|
|
695
768
|
setGutter(null);
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
769
|
+
structuralStep(label, () => b.replaceWith(...nodes), () => {
|
|
770
|
+
const root = ref.current;
|
|
771
|
+
if (!root) return false;
|
|
772
|
+
(nodes[0].isConnected ? nodes : Array.from(root.children).slice(index, index + nodes.length)).forEach((n) => n.remove());
|
|
773
|
+
return reinsert(b, index, null);
|
|
774
|
+
}, () => {
|
|
775
|
+
if (!ref.current || !b.isConnected) return false;
|
|
776
|
+
b.replaceWith(...nodes);
|
|
777
|
+
emit();
|
|
778
|
+
return true;
|
|
779
|
+
});
|
|
780
|
+
if (nodes[0].isConnected) placeCaret(nodes[0]);
|
|
707
781
|
};
|
|
708
782
|
const duplicateBlock$1 = (b) => {
|
|
709
783
|
const c = duplicateBlock(b);
|
|
@@ -1067,7 +1141,12 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
1067
1141
|
const onWrapKeyDown = (e) => {
|
|
1068
1142
|
if (e.defaultPrevented) return;
|
|
1069
1143
|
const mod = e.metaKey || e.ctrlKey;
|
|
1070
|
-
if (mod && !hideFullscreen &&
|
|
1144
|
+
if (mod && !hideFullscreen && v16 && e.shiftKey && e.key.toLowerCase() === "f") {
|
|
1145
|
+
e.preventDefault();
|
|
1146
|
+
openFocus();
|
|
1147
|
+
return;
|
|
1148
|
+
}
|
|
1149
|
+
if (mod && !hideFullscreen && (e.key === "Enter" || v16 && e.shiftKey && e.key.toLowerCase() === "e")) {
|
|
1071
1150
|
e.preventDefault();
|
|
1072
1151
|
setModalOpen(true);
|
|
1073
1152
|
return;
|
|
@@ -1259,12 +1338,32 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
1259
1338
|
return;
|
|
1260
1339
|
}
|
|
1261
1340
|
el.focus({ preventScroll: true });
|
|
1341
|
+
const shape = selectionShape(range, el);
|
|
1342
|
+
const attrs = shape.link ? linkAttrs(shape.link) : null;
|
|
1262
1343
|
const s = window.getSelection();
|
|
1263
1344
|
s?.removeAllRanges();
|
|
1264
1345
|
s?.addRange(range);
|
|
1265
1346
|
insertTextAtCaret(out);
|
|
1347
|
+
if (shape.link && attrs && (!el.contains(shape.link) || !shape.link.textContent?.includes(out))) {
|
|
1348
|
+
const node = s?.focusNode;
|
|
1349
|
+
const off = s?.focusOffset ?? 0;
|
|
1350
|
+
if (s && node && node.nodeType === Node.TEXT_NODE && off >= out.length) {
|
|
1351
|
+
const r = document.createRange();
|
|
1352
|
+
r.setStart(node, off - out.length);
|
|
1353
|
+
r.setEnd(node, off);
|
|
1354
|
+
s.removeAllRanges();
|
|
1355
|
+
s.addRange(r);
|
|
1356
|
+
const sentinel = `${LINK_SENTINEL}${rid()}`;
|
|
1357
|
+
if (exec("createLink", sentinel)) el.querySelectorAll("a[href]").forEach((a) => {
|
|
1358
|
+
if (a.getAttribute("href") !== sentinel) return;
|
|
1359
|
+
for (const [k, v] of attrs) a.setAttribute(k, v);
|
|
1360
|
+
});
|
|
1361
|
+
s.collapseToEnd();
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
unwrapLinkSentinels(el);
|
|
1266
1365
|
emit();
|
|
1267
|
-
notify("Rewritten with AI", { description: hints ? platformKeys("Press ⌘Z to undo") : void 0 });
|
|
1366
|
+
notify(shape.loses ? FORMATTING_REMOVED : "Rewritten with AI", { description: hints ? platformKeys("Press ⌘Z to undo") : void 0 });
|
|
1268
1367
|
}, (err) => notify("Could not rewrite the selection", { description: err instanceof Error ? err.message : String(err) }));
|
|
1269
1368
|
};
|
|
1270
1369
|
const onGripDown = (e) => {
|
|
@@ -1389,9 +1488,16 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
1389
1488
|
return true;
|
|
1390
1489
|
}
|
|
1391
1490
|
const h = hist.current;
|
|
1392
|
-
while (h.past.length && !h.past[h.past.length - 1].el
|
|
1491
|
+
while (h.past.length && !h.past[h.past.length - 1].dom && !h.past[h.past.length - 1].el?.isConnected) h.past.pop();
|
|
1393
1492
|
const step = h.past[h.past.length - 1];
|
|
1394
1493
|
if (!step || step.at < h.textAt) return false;
|
|
1494
|
+
if (step.dom) {
|
|
1495
|
+
if (!step.dom.undo()) return false;
|
|
1496
|
+
h.past.pop();
|
|
1497
|
+
step.at = Date.now();
|
|
1498
|
+
h.future.push(step);
|
|
1499
|
+
return true;
|
|
1500
|
+
}
|
|
1395
1501
|
if (!step.el.__rtSet) return false;
|
|
1396
1502
|
h.past.pop();
|
|
1397
1503
|
h.future.push({
|
|
@@ -1411,6 +1517,12 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
1411
1517
|
}
|
|
1412
1518
|
const h = hist.current;
|
|
1413
1519
|
const step = h.future.pop();
|
|
1520
|
+
if (step?.dom) {
|
|
1521
|
+
if (!step.dom.redo()) return false;
|
|
1522
|
+
step.at = Date.now();
|
|
1523
|
+
h.past.push(step);
|
|
1524
|
+
return true;
|
|
1525
|
+
}
|
|
1414
1526
|
if (!step || !step.el.isConnected || !step.el.__rtSet) return false;
|
|
1415
1527
|
h.past.push({
|
|
1416
1528
|
...step,
|
|
@@ -1606,7 +1718,7 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
1606
1718
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1607
1719
|
ref: wrap,
|
|
1608
1720
|
"data-rt-editor": "",
|
|
1609
|
-
className: cn("relative [--rt-toolbar-h:2rem] pointer-coarse:[--rt-toolbar-h:2.75rem]", "rounded-kit-lg border transition-colors duration-150", fenced ? "cursor-not-allowed bg-kit-subtle opacity-60" : expanded ? "bg-[var(--kit-surface-raised)]" : "bg-kit-surface", invalid ? "border-[var(--kit-field-invalid)]" : toolbarOpen ? "border-[var(--kit-field-border-focus)]" : "border-kit-line-strong"),
|
|
1721
|
+
className: cn("relative [--rt-toolbar-h:2rem] pointer-coarse:[--rt-toolbar-h:2.75rem]", "rounded-kit-lg border transition-colors duration-150", v16 && "[--rt-toolbar-h:2.75rem]", v16 && !dense && "rounded-[10px]", fenced ? "cursor-not-allowed bg-kit-subtle opacity-60" : expanded ? "bg-[var(--kit-surface-raised)]" : "bg-kit-surface", invalid ? "border-[var(--kit-field-invalid)]" : (v16 ? fieldActive : toolbarOpen) ? "border-[var(--kit-field-border-focus)]" : v16 ? "border-kit-insp-line" : "border-kit-line-strong"),
|
|
1610
1722
|
style: { "--rt-sticky-top": toolbarOpen && !dense ? `calc(${stickyTop}px + var(--rt-toolbar-h))` : "var(--kit-sticky-top, 0px)" },
|
|
1611
1723
|
onMouseLeave: () => !blockMenu && !gutterInsert && !drag && setGutter(null),
|
|
1612
1724
|
onKeyDown: onWrapKeyDown,
|
|
@@ -1686,6 +1798,7 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
1686
1798
|
},
|
|
1687
1799
|
keepFocusOnInsertClose: () => inserted.current,
|
|
1688
1800
|
onFullscreen: () => setModalOpen(true),
|
|
1801
|
+
onFocusMode: openFocus,
|
|
1689
1802
|
onMarkdown: toggleMarkdown,
|
|
1690
1803
|
saveSel
|
|
1691
1804
|
}),
|
|
@@ -1856,11 +1969,11 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
1856
1969
|
notify("That drop is not an image from the media library");
|
|
1857
1970
|
}
|
|
1858
1971
|
},
|
|
1859
|
-
className: cn(RT_PROSE, dense && "text-kit-sm leading-[1.6] [&_h1:not([data-rt-isolate]_*)]:text-kit-xl [&_h1:not([data-rt-isolate]_*)]:leading-7 [&_h2:not([data-rt-isolate]_*)]:text-kit-lg [&_h2:not([data-rt-isolate]_*)]:leading-7 [&_h3:not([data-rt-isolate]_*)]:text-kit-md [&_h4:not([data-rt-isolate]_*)]:text-kit-base [&_h5:not([data-rt-isolate]_*)]:text-kit-sm [&_h6:not([data-rt-isolate]_*)]:text-kit-xs", v16 && "[&>pre]:!relative [&>pre]:!my-5 [&>pre]:!rounded-[10px] [&>pre]:!border-0 [&>pre]:!bg-kit-insp-code-bg [&>pre]:!pb-[14px] [&>pre]:!pl-[60px] [&>pre]:!pr-4 [&>pre]:!pt-[50px] [&>pre]:![font:12.5px/22px_'JetBrains_Mono',ui-monospace,SFMono-Regular,Menlo,monospace] [&>pre]:!text-kit-insp-code-fg [&>pre]:caret-white [&>pre]:!whitespace-pre [&>pre]:overflow-x-auto [&>pre]:[scrollbar-width:thin] [&>pre[data-rt-wrap]]:!whitespace-pre-wrap [&>pre[data-rt-wrap]]:!pl-4 [&>pre[data-rt-wrap]]:overflow-x-visible [&_span[data-rt-hl=c]]:text-kit-insp-code-cmt [&_span[data-rt-hl=k]]:text-kit-insp-code-kw [&_span[data-rt-hl=s]]:text-kit-insp-code-str [&_span[data-rt-hl=n]]:text-kit-insp-code-num [&_span[data-rt-hl=f]]:text-kit-insp-code-fn", v16 && V16_QUOTE_CLASS, "peer relative outline-none focus-visible:shadow-none [&_*:not([data-rt-isolate]_*)]:outline-none", "[&>p[data-hint]]:before:pointer-events-none [&>p[data-hint]]:before:float-left [&>p[data-hint]]:before:h-0 [&>p[data-hint]]:before:text-kit-fg-4 [&>p[data-hint]]:before:content-[attr(data-hint)]", "[&_a[data-button]:not([data-rt-isolate]_*)]:cursor-pointer [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:cursor-pointer", "[&_sup[data-rt=fn]]:mx-px [&_sup[data-rt=fn]]:cursor-pointer [&_sup[data-rt=fn]]:rounded-kit-sm [&_sup[data-rt=fn]]:px-0.5 [&_sup[data-rt=fn]]:text-[0.72em] [&_sup[data-rt=fn]]:leading-[0] [&_sup[data-rt=fn]]:font-semibold [&_sup[data-rt=fn]]:text-kit-accent-fg [&_sup[data-rt=fn]:hover]:bg-kit-accent-soft", dense ? "px-2.5 py-2" : "px-4 py-3.5", minH)
|
|
1972
|
+
className: cn(RT_PROSE, dense && "text-kit-sm leading-[1.6] [&_h1:not([data-rt-isolate]_*)]:text-kit-xl [&_h1:not([data-rt-isolate]_*)]:leading-7 [&_h2:not([data-rt-isolate]_*)]:text-kit-lg [&_h2:not([data-rt-isolate]_*)]:leading-7 [&_h3:not([data-rt-isolate]_*)]:text-kit-md [&_h4:not([data-rt-isolate]_*)]:text-kit-base [&_h5:not([data-rt-isolate]_*)]:text-kit-sm [&_h6:not([data-rt-isolate]_*)]:text-kit-xs", v16 && "[&>pre]:!relative [&>pre]:!my-5 [&>pre]:!rounded-[10px] [&>pre]:!border-0 [&>pre]:!bg-kit-insp-code-bg [&>pre]:!pb-[14px] [&>pre]:!pl-[60px] [&>pre]:!pr-4 [&>pre]:!pt-[50px] [&>pre]:![font:12.5px/22px_'JetBrains_Mono',ui-monospace,SFMono-Regular,Menlo,monospace] [&>pre]:!text-kit-insp-code-fg [&>pre]:caret-white [&>pre]:!whitespace-pre [&>pre]:overflow-x-auto [&>pre]:[scrollbar-width:thin] [&>pre[data-rt-wrap]]:!whitespace-pre-wrap [&>pre[data-rt-wrap]]:!pl-4 [&>pre[data-rt-wrap]]:overflow-x-visible [&_span[data-rt-hl=c]]:text-kit-insp-code-cmt [&_span[data-rt-hl=k]]:text-kit-insp-code-kw [&_span[data-rt-hl=s]]:text-kit-insp-code-str [&_span[data-rt-hl=n]]:text-kit-insp-code-num [&_span[data-rt-hl=f]]:text-kit-insp-code-fn", v16 && V16_QUOTE_CLASS, v16 && !dense && V16_BODY_CLASS, "peer relative outline-none focus-visible:shadow-none [&_*:not([data-rt-isolate]_*)]:outline-none", "[&>p[data-hint]]:before:pointer-events-none [&>p[data-hint]]:before:float-left [&>p[data-hint]]:before:h-0 [&>p[data-hint]]:before:text-kit-fg-4 [&>p[data-hint]]:before:content-[attr(data-hint)]", "[&_a[data-button]:not([data-rt-isolate]_*)]:cursor-pointer [&_ul[data-task]>li:not([data-rt-isolate]_*)]:before:cursor-pointer", "[&_sup[data-rt=fn]]:mx-px [&_sup[data-rt=fn]]:cursor-pointer [&_sup[data-rt=fn]]:rounded-kit-sm [&_sup[data-rt=fn]]:px-0.5 [&_sup[data-rt=fn]]:text-[0.72em] [&_sup[data-rt=fn]]:leading-[0] [&_sup[data-rt=fn]]:font-semibold [&_sup[data-rt=fn]]:text-kit-accent-fg [&_sup[data-rt=fn]:hover]:bg-kit-accent-soft", dense ? "px-2.5 py-2" : v16 ? "px-8 pb-7 pt-6" : "px-4 py-3.5", minH)
|
|
1860
1973
|
}),
|
|
1861
1974
|
empty ? /* @__PURE__ */ jsx("div", {
|
|
1862
1975
|
"aria-hidden": true,
|
|
1863
|
-
className: cn("pointer-events-none absolute text-kit-fg-4 peer-focus:hidden", dense ? "text-kit-sm" : "text-kit-base", dense ? "left-2.5 top-2" : "left-4 top-3.5"),
|
|
1976
|
+
className: cn("pointer-events-none absolute text-kit-fg-4 peer-focus:hidden", dense ? "text-kit-sm" : v16 ? "text-[16px] leading-[26px]" : "text-kit-base", dense ? "left-2.5 top-2" : v16 ? "left-8 top-6" : "left-4 top-3.5"),
|
|
1864
1977
|
children: ph
|
|
1865
1978
|
}) : null,
|
|
1866
1979
|
v16 ? codes.map((s, i) => /* @__PURE__ */ jsx(CodeHead, {
|
|
@@ -1872,7 +1985,7 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
1872
1985
|
}, i)) : null,
|
|
1873
1986
|
gutter && showGutter ? /* @__PURE__ */ jsxs("div", {
|
|
1874
1987
|
"data-rt-gutter": "",
|
|
1875
|
-
className: cn("absolute z-[3] flex", gutterMode === "outside" ? "-left-12 pr-1" : "left-0", v16 && gutterMode === "outside" ? (gBlock?.getAttribute("data-rt-island") === "table" ? "-left-[78px] " : "-left-[54px] ") + "group/bh items-center gap-px rounded-[7px] p-px pr-px transition-[background-color,box-shadow] duration-100 hover:bg-kit-insp-tip-bg hover:shadow-[0_0_0_1px_var(--kit-insp-tip-line),0_1px_2px_rgb(0_0_0/0.06),0_2px_8px_-2px_rgb(0_0_0/0.06)]" : "items-start"),
|
|
1988
|
+
className: cn("absolute z-[3] flex", gutterMode === "outside" ? "-left-12 pr-1" : "left-0", v16 && gutterMode === "outside" ? (gBlock?.getAttribute("data-rt-island") === "table" ? "-left-[78px] " : "-left-[54px] ") + "group/bh items-center gap-px rounded-[7px] p-px pr-px transition-[background-color,box-shadow] duration-100 hover:bg-kit-insp-tip-bg hover:shadow-[0_0_0_1px_var(--kit-insp-tip-line),0_1px_2px_rgb(0_0_0/0.06),0_2px_8px_-2px_rgb(0_0_0/0.06)] [@media(hover:hover)]:motion-safe:animate-[kit-fade-in_120ms_ease-out]" : "items-start"),
|
|
1876
1989
|
style: { top: gutter.top + Math.max(-2, Math.min(4, gutter.height / 2 - 12)) },
|
|
1877
1990
|
children: [gutterMode === "outside" ? /* @__PURE__ */ jsxs(Popover, {
|
|
1878
1991
|
open: gutterInsert,
|
|
@@ -2156,13 +2269,16 @@ function RichTextEditor({ value, onChange, readOnly: readOnlyProp, placeholder,
|
|
|
2156
2269
|
}), /* @__PURE__ */ jsx(motion.div, {
|
|
2157
2270
|
initial: {
|
|
2158
2271
|
opacity: 0,
|
|
2159
|
-
y: flipUp ? -4 : 4
|
|
2272
|
+
y: slashReduce ? 0 : flipUp ? -4 : 4
|
|
2160
2273
|
},
|
|
2161
2274
|
animate: {
|
|
2162
2275
|
opacity: 1,
|
|
2163
2276
|
y: 0
|
|
2164
2277
|
},
|
|
2165
|
-
transition: {
|
|
2278
|
+
transition: {
|
|
2279
|
+
duration: .14,
|
|
2280
|
+
ease: "easeOut"
|
|
2281
|
+
},
|
|
2166
2282
|
style: {
|
|
2167
2283
|
left: Math.min(window.innerWidth - 330, Math.max(8, slash.rect.left)),
|
|
2168
2284
|
...flipUp ? { bottom: window.innerHeight - slash.rect.top + 6 } : { top: slash.rect.bottom + 6 }
|