@bettercms-ai/kit 3.1.23 → 3.1.24
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/context.d.ts +17 -0
- package/dist/context.js.map +1 -1
- package/dist/controls/index.js +2 -2
- package/dist/controls/media.d.ts +24 -1
- package/dist/controls/media.js +82 -8
- package/dist/controls/media.js.map +1 -1
- package/dist/controls/rich-text/blocks.d.ts +1 -1
- package/dist/controls/rich-text/blocks.js +62 -4
- package/dist/controls/rich-text/blocks.js.map +1 -1
- package/dist/controls/rich-text/control.js +7 -1
- package/dist/controls/rich-text/control.js.map +1 -1
- package/dist/controls/rich-text/editor.d.ts +8 -3
- package/dist/controls/rich-text/editor.js +193 -9
- package/dist/controls/rich-text/editor.js.map +1 -1
- package/dist/controls/rich-text/ops.d.ts +11 -2
- package/dist/controls/rich-text/ops.js +70 -3
- package/dist/controls/rich-text/ops.js.map +1 -1
- package/dist/engine/field-shell.d.ts +7 -1
- package/dist/engine/field-shell.js +73 -46
- package/dist/engine/field-shell.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/styles.css +1 -1
- package/dist/theme.css +27 -0
- package/dist/tokens.css +71 -0
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@ import { cn } from "../../lib/cn.js";
|
|
|
2
2
|
import { useKitEnv, useKitServices } from "../../context.js";
|
|
3
3
|
import { Button } from "../../ui/button.js";
|
|
4
4
|
import { platformKeys, shortcutHintsOn } from "../../ui/shortcut-hint.js";
|
|
5
|
-
import { Menu, MenuContent, MenuItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Tooltip } from "../../ui/overlay.js";
|
|
6
|
-
import { Textarea } from "../../ui/input.js";
|
|
5
|
+
import { Menu, MenuContent, MenuItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Tooltip } from "../../ui/overlay.js";
|
|
6
|
+
import { Input, Textarea } from "../../ui/input.js";
|
|
7
7
|
import { LinkPopoverBody } from "../link.js";
|
|
8
8
|
import { ExpandedEditorModal } from "../../ui/expanded-editor-modal.js";
|
|
9
9
|
import { COMPONENT_INSERT_TOAST } from "../component-services.js";
|
|
@@ -15,7 +15,7 @@ import { CatalogComponentsProvider, InsertMenuContent, SlashMenuPanel, blockAllo
|
|
|
15
15
|
import { openComponentPanel } from "./component-panel.js";
|
|
16
16
|
import { Island } from "./blocks.js";
|
|
17
17
|
import { htmlToMarkdown, looksLikeMarkdown, markdownToHtml } from "./markdown.js";
|
|
18
|
-
import { duplicateBlock, ensureLineAfter, forgetLiveMarkdown, indentListItem, insertBasic, insertIsland, liveInlineCode, liveInlineEmphasis, liveMarkdown, moveBlock, outdentListItem, pastedHtml, restrictHtml, turnInto, undoLiveMarkdown } from "./ops.js";
|
|
18
|
+
import { CODE_LANGUAGE, changeCodeLanguage, codeLanguage, duplicateBlock, ensureLineAfter, enterCodeFence, forgetLiveMarkdown, indentListItem, insertBasic, insertIsland, liveInlineCode, liveInlineEmphasis, liveMarkdown, moveBlock, outdentListItem, pastedHtml, restrictHtml, turnInto, undoLiveMarkdown } from "./ops.js";
|
|
19
19
|
import { EMPTY_FMT, FormatToolbar, MARK_FEATURE, stylesFor } from "./toolbar.js";
|
|
20
20
|
import { SelectionBubble } from "./floating.js";
|
|
21
21
|
import { applyTextLink, fromLinkValue, textLinkOf, toLinkValue } from "./link-form.js";
|
|
@@ -24,7 +24,7 @@ import { FN_MARK, FOOTNOTE_POPOVER_CLASS, FOOTNOTE_REFUSED, FootnoteEditor, Foot
|
|
|
24
24
|
import { ButtonLinkPanel, applyButton, buttonAt, buttonInitial, insertButton, removeButton } from "./button.js";
|
|
25
25
|
import * as React from "react";
|
|
26
26
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
27
|
-
import { IconArrowBarToDown, IconArrowBarToUp, IconCopy, IconGripVertical, IconPlus, IconTransform, IconTrash } from "@tabler/icons-react";
|
|
27
|
+
import { IconArrowBarToDown, IconArrowBarToUp, IconCode, IconCopy, IconGripVertical, IconPlus, IconTransform, IconTrash } from "@tabler/icons-react";
|
|
28
28
|
import { AnimatePresence, motion, useReducedMotion } from "framer-motion";
|
|
29
29
|
import { createPortal, flushSync } from "react-dom";
|
|
30
30
|
//#region src/controls/rich-text/editor.tsx
|
|
@@ -46,7 +46,7 @@ import { createPortal, flushSync } from "react-dom";
|
|
|
46
46
|
* Everything the editor offers is limited to what the field accepts (`features`): a toolbar button, a slash command, a
|
|
47
47
|
* Markdown shortcut or pasted markup the field cannot hold is not offered, or is turned into what it can hold and said so.
|
|
48
48
|
*/
|
|
49
|
-
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-wrap [&_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";
|
|
49
|
+
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";
|
|
50
50
|
/** Panel density (≈340px inspector): 13px text, smaller headings. */
|
|
51
51
|
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";
|
|
52
52
|
/** execCommand, where the engine has it (it returns false where it does not). */
|
|
@@ -209,7 +209,53 @@ function slashPlacement(caret, viewportH) {
|
|
|
209
209
|
maxHeight: Math.max(SLASH_MIN_H, Math.min(SLASH_MENU_H, flipUp ? above : below))
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
/** RP-043: Block options › Language. Stored as the token (`language-typescript`); "None" stores no language. */
|
|
213
|
+
var CODE_LANGUAGES = [
|
|
214
|
+
{
|
|
215
|
+
v: "bash",
|
|
216
|
+
label: "Bash"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
v: "css",
|
|
220
|
+
label: "CSS"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
v: "html",
|
|
224
|
+
label: "HTML"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
v: "javascript",
|
|
228
|
+
label: "JavaScript"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
v: "json",
|
|
232
|
+
label: "JSON"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
v: "markdown",
|
|
236
|
+
label: "Markdown"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
v: "python",
|
|
240
|
+
label: "Python"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
v: "sql",
|
|
244
|
+
label: "SQL"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
v: "typescript",
|
|
248
|
+
label: "TypeScript"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
v: "yaml",
|
|
252
|
+
label: "YAML"
|
|
253
|
+
}
|
|
254
|
+
];
|
|
255
|
+
var LANG_NONE = "_none";
|
|
256
|
+
var LANG_OTHER = "_other";
|
|
257
|
+
var CODE_LANGUAGE_REASON = "Use letters, numbers and hyphens, like cpp or csharp.";
|
|
258
|
+
function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, features = ALL_FEATURES, references, single, allowNewTab = true, id, invalid, variant = "document", expandCrumbs, expandedOpen, onExpandedOpenChange, inModal, hideFullscreen, maxHeight, autoFocus, onComment, commentInPlace, components }) {
|
|
213
259
|
const hints = shortcutHintsOn();
|
|
214
260
|
const ph = placeholder ?? (hints ? "Type '/' for commands" : "Write something…");
|
|
215
261
|
const dense = variant === "panel";
|
|
@@ -259,6 +305,9 @@ function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, featur
|
|
|
259
305
|
const [blockMenu, setBlockMenu] = React.useState(false);
|
|
260
306
|
const [gutterInsert, setGutterInsert] = React.useState(false);
|
|
261
307
|
const gutterTarget = React.useRef(null);
|
|
308
|
+
/** RP-043: Block options › Language › Other…, a typed language for this code block (`top`/`height`: where it sits) */
|
|
309
|
+
const [langOther, setLangOther] = React.useState(null);
|
|
310
|
+
const langId = React.useId();
|
|
262
311
|
const canAI = env.can("ai.use") && !!services.aiRewrite;
|
|
263
312
|
const aiAttempt = React.useRef(0);
|
|
264
313
|
const [link, setLink] = React.useState(null);
|
|
@@ -606,6 +655,22 @@ function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, featur
|
|
|
606
655
|
const el = ref.current;
|
|
607
656
|
if (el && turnInto(el, b, tag)) emit();
|
|
608
657
|
};
|
|
658
|
+
/** RP-043: a code block's language from Block options (one change, one emit; ⌘Z right after it takes it back). */
|
|
659
|
+
const setCodeLanguage = (pre, lang) => {
|
|
660
|
+
const el = ref.current;
|
|
661
|
+
if (!el || !el.contains(pre) || codeLanguage(pre) === lang) return;
|
|
662
|
+
run(() => changeCodeLanguage(el, pre, lang));
|
|
663
|
+
};
|
|
664
|
+
const submitOtherLanguage = () => {
|
|
665
|
+
if (!langOther) return;
|
|
666
|
+
const v = langOther.value.trim().toLowerCase();
|
|
667
|
+
if (!CODE_LANGUAGE.test(v)) return setLangOther({
|
|
668
|
+
...langOther,
|
|
669
|
+
error: CODE_LANGUAGE_REASON
|
|
670
|
+
});
|
|
671
|
+
setLangOther(null);
|
|
672
|
+
setCodeLanguage(langOther.pre, v);
|
|
673
|
+
};
|
|
609
674
|
const exitIsland = (x) => {
|
|
610
675
|
const el = ref.current;
|
|
611
676
|
if (!el || !el.contains(x)) return;
|
|
@@ -787,6 +852,12 @@ function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, featur
|
|
|
787
852
|
return;
|
|
788
853
|
}
|
|
789
854
|
const cb = currentBlock();
|
|
855
|
+
if (cb && ref.current && enterCodeFence(ref.current, cb, allows)) {
|
|
856
|
+
e.preventDefault();
|
|
857
|
+
setSlash(null);
|
|
858
|
+
emit();
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
790
861
|
if (cb && /^(BLOCKQUOTE|H[1-6])$/.test(cb.tagName) && !cb.textContent?.replace(//g, "").trim()) {
|
|
791
862
|
e.preventDefault();
|
|
792
863
|
turnInto$1(cb, "p");
|
|
@@ -1311,10 +1382,27 @@ function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, featur
|
|
|
1311
1382
|
]);
|
|
1312
1383
|
const commentSel = onComment ? () => {
|
|
1313
1384
|
restoreSel();
|
|
1314
|
-
const
|
|
1385
|
+
const s = window.getSelection();
|
|
1386
|
+
const raw = s?.toString() ?? "";
|
|
1387
|
+
const q = raw.trim();
|
|
1315
1388
|
setBubble(null);
|
|
1316
1389
|
setQuiet(true);
|
|
1317
|
-
if (q)
|
|
1390
|
+
if (!q) return;
|
|
1391
|
+
const root = ref.current;
|
|
1392
|
+
const r = s && s.rangeCount ? s.getRangeAt(0) : null;
|
|
1393
|
+
if (!root || !r || !root.contains(r.commonAncestorContainer)) return onComment(q);
|
|
1394
|
+
const before = document.createRange();
|
|
1395
|
+
before.selectNodeContents(root);
|
|
1396
|
+
before.setEnd(r.startContainer, r.startOffset);
|
|
1397
|
+
const after = document.createRange();
|
|
1398
|
+
after.selectNodeContents(root);
|
|
1399
|
+
after.setStart(r.endContainer, r.endOffset);
|
|
1400
|
+
const lead = raw.slice(0, raw.length - raw.trimStart().length);
|
|
1401
|
+
const trail = raw.slice(raw.trimEnd().length);
|
|
1402
|
+
onComment(q, {
|
|
1403
|
+
prefix: (before.toString() + lead).slice(-32),
|
|
1404
|
+
suffix: (trail + after.toString()).slice(0, 32)
|
|
1405
|
+
});
|
|
1318
1406
|
} : void 0;
|
|
1319
1407
|
const onMark = (cmd) => allows(MARK_FEATURE[cmd]) && run(() => {
|
|
1320
1408
|
if (cmd === "superscript" || cmd === "subscript") ref.current && toggleScript(ref.current, cmd === "superscript" ? "sup" : "sub");
|
|
@@ -1331,6 +1419,7 @@ function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, featur
|
|
|
1331
1419
|
};
|
|
1332
1420
|
const gBlock = gutter?.el;
|
|
1333
1421
|
const gIsText = !!gBlock && !gBlock.hasAttribute("data-rt-island") && gBlock.tagName !== "HR";
|
|
1422
|
+
const gLang = gBlock?.tagName === "PRE" ? codeLanguage(gBlock) : null;
|
|
1334
1423
|
const btn = dense ? "size-5 [&_svg:not([data-rt-isolate]_*)]:size-3.5" : "size-[22px] [&_svg:not([data-rt-isolate]_*)]:size-3.5";
|
|
1335
1424
|
const gutterMode = readOnly || dense || single ? "none" : gutterRoom ? "outside" : "inset";
|
|
1336
1425
|
const showGutter = gutterMode !== "none";
|
|
@@ -1686,6 +1775,39 @@ function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, featur
|
|
|
1686
1775
|
children: t.label
|
|
1687
1776
|
}, t.tag))
|
|
1688
1777
|
})] }) : null,
|
|
1778
|
+
gBlock?.tagName === "PRE" && allows("pre") ? /* @__PURE__ */ jsxs(MenuSub, { children: [/* @__PURE__ */ jsx(MenuSubTrigger, {
|
|
1779
|
+
icon: /* @__PURE__ */ jsx(IconCode, { stroke: 1.5 }),
|
|
1780
|
+
children: "Language"
|
|
1781
|
+
}), /* @__PURE__ */ jsx(MenuSubContent, {
|
|
1782
|
+
className: "w-48",
|
|
1783
|
+
children: /* @__PURE__ */ jsxs(MenuRadioGroup, {
|
|
1784
|
+
value: gLang == null ? LANG_NONE : CODE_LANGUAGES.some((l) => l.v === gLang) ? gLang : LANG_OTHER,
|
|
1785
|
+
onValueChange: (v) => v !== LANG_OTHER && setCodeLanguage(gBlock, v === LANG_NONE ? null : v),
|
|
1786
|
+
children: [
|
|
1787
|
+
/* @__PURE__ */ jsx(MenuRadioItem, {
|
|
1788
|
+
value: LANG_NONE,
|
|
1789
|
+
children: "None"
|
|
1790
|
+
}),
|
|
1791
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
1792
|
+
CODE_LANGUAGES.map((l) => /* @__PURE__ */ jsx(MenuRadioItem, {
|
|
1793
|
+
value: l.v,
|
|
1794
|
+
children: l.label
|
|
1795
|
+
}, l.v)),
|
|
1796
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
1797
|
+
/* @__PURE__ */ jsx(MenuRadioItem, {
|
|
1798
|
+
value: LANG_OTHER,
|
|
1799
|
+
onClick: () => gutter && setLangOther({
|
|
1800
|
+
pre: gBlock,
|
|
1801
|
+
value: gLang ?? "",
|
|
1802
|
+
error: null,
|
|
1803
|
+
top: gutter.top,
|
|
1804
|
+
height: gutter.height
|
|
1805
|
+
}),
|
|
1806
|
+
children: "Other…"
|
|
1807
|
+
})
|
|
1808
|
+
]
|
|
1809
|
+
})
|
|
1810
|
+
})] }) : null,
|
|
1689
1811
|
/* @__PURE__ */ jsx(MenuItem, {
|
|
1690
1812
|
icon: /* @__PURE__ */ jsx(IconCopy, { stroke: 1.5 }),
|
|
1691
1813
|
shortcut: "⌘D",
|
|
@@ -1721,6 +1843,68 @@ function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, featur
|
|
|
1721
1843
|
className: "pointer-events-none absolute inset-x-3 z-[6] h-0.5 rounded-full bg-kit-info",
|
|
1722
1844
|
style: { top: drag.line }
|
|
1723
1845
|
}) : null,
|
|
1846
|
+
showGutter && allows("pre") ? /* @__PURE__ */ jsxs(Popover, {
|
|
1847
|
+
open: !!langOther,
|
|
1848
|
+
onOpenChange: (o) => !o && setLangOther(null),
|
|
1849
|
+
children: [/* @__PURE__ */ jsx(PopoverAnchor, { render: /* @__PURE__ */ jsx("span", {
|
|
1850
|
+
"aria-hidden": true,
|
|
1851
|
+
className: "pointer-events-none absolute left-4 w-px",
|
|
1852
|
+
style: {
|
|
1853
|
+
top: langOther?.top ?? 0,
|
|
1854
|
+
height: langOther?.height ?? 0
|
|
1855
|
+
}
|
|
1856
|
+
}) }), /* @__PURE__ */ jsx(PopoverContent, {
|
|
1857
|
+
className: "w-64",
|
|
1858
|
+
side: "bottom",
|
|
1859
|
+
align: "start",
|
|
1860
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
1861
|
+
className: "flex flex-col gap-2",
|
|
1862
|
+
onSubmit: (e) => {
|
|
1863
|
+
e.preventDefault();
|
|
1864
|
+
submitOtherLanguage();
|
|
1865
|
+
},
|
|
1866
|
+
children: [
|
|
1867
|
+
/* @__PURE__ */ jsx("label", {
|
|
1868
|
+
className: "text-kit-xs font-medium text-kit-fg-2",
|
|
1869
|
+
htmlFor: langId,
|
|
1870
|
+
children: "Language"
|
|
1871
|
+
}),
|
|
1872
|
+
/* @__PURE__ */ jsx(Input, {
|
|
1873
|
+
id: langId,
|
|
1874
|
+
autoFocus: true,
|
|
1875
|
+
size: "sm",
|
|
1876
|
+
value: langOther?.value ?? "",
|
|
1877
|
+
spellCheck: false,
|
|
1878
|
+
autoComplete: "off",
|
|
1879
|
+
placeholder: "cpp",
|
|
1880
|
+
"aria-invalid": langOther?.error ? true : void 0,
|
|
1881
|
+
"aria-describedby": langOther?.error ? `${langId}-error` : void 0,
|
|
1882
|
+
onChange: (e) => langOther && setLangOther({
|
|
1883
|
+
...langOther,
|
|
1884
|
+
value: e.target.value,
|
|
1885
|
+
error: null
|
|
1886
|
+
}),
|
|
1887
|
+
className: "font-kit-mono [&_input]:font-kit-mono"
|
|
1888
|
+
}),
|
|
1889
|
+
langOther?.error ? /* @__PURE__ */ jsx("p", {
|
|
1890
|
+
id: `${langId}-error`,
|
|
1891
|
+
role: "alert",
|
|
1892
|
+
className: "text-kit-xs text-kit-danger-fg",
|
|
1893
|
+
children: langOther.error
|
|
1894
|
+
}) : null,
|
|
1895
|
+
/* @__PURE__ */ jsx("div", {
|
|
1896
|
+
className: "flex justify-end",
|
|
1897
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1898
|
+
size: "xs",
|
|
1899
|
+
variant: "primary",
|
|
1900
|
+
type: "submit",
|
|
1901
|
+
children: "Set language"
|
|
1902
|
+
})
|
|
1903
|
+
})
|
|
1904
|
+
]
|
|
1905
|
+
})
|
|
1906
|
+
})]
|
|
1907
|
+
}) : null,
|
|
1724
1908
|
islands.map(({ id: key, el }) => createPortal(/* @__PURE__ */ jsx(Island, {
|
|
1725
1909
|
el,
|
|
1726
1910
|
ctx: islandCtx
|
|
@@ -1917,7 +2101,7 @@ function RichTextEditor({ value, onChange, readOnly, placeholder, docKey, featur
|
|
|
1917
2101
|
hideFullscreen: true,
|
|
1918
2102
|
inModal: true,
|
|
1919
2103
|
autoFocus: true,
|
|
1920
|
-
onComment,
|
|
2104
|
+
onComment: commentInPlace ? void 0 : onComment,
|
|
1921
2105
|
components
|
|
1922
2106
|
}) : null
|
|
1923
2107
|
}) : null
|