Fix component bugs across hooks, elements, form, layout, editors and utils
- Hooks: per-instance timers in useReady; cleanup for useIntersectionObserver; useWebSocket no longer reconnects after unmount/refresh, drains the queue and dispatches non-JSON messages - Modal/Popover/Dropdown: onClose only on close, Escape to close, no stray DOM props, hooks before early return, scrollbar-aware positioning, top-left/top-right dropdown positions - Elements: Toast/Search/StarRating per-instance timers, Pagination labels and empty state, Breadcrumbs titles, LinkList dividers/props, segment-wise active-link matching (new utils/link-matches-path), Table object cells - Form: Select with a default option is changeable, Input clear notifies controlled parents and copy works on textareas, Checkbox random label, NumberInputButtons runaway interval, upload prop/spread fixes - Layout: Button disabled while loading, Stack gap and Span truncate via inline styles, Img fallbackImageSrc, className/JSDoc fixes - Editors/MDX/AI: TinyMCE id/cleanup/stale handler/duplicate scripts, AceEditor debounce, markdown heights and frontmatter regex, last assistant message, AIPromptBlock prompt ref - Utils: fetchApi headers/FormData/fetchOptions/no mutation, base64 file names and read errors, slugify underscore trim, serializeQuery zero values - Tests for fetchApi, link matching, slugify and serializeQuery - AGENTS.md updated for the package layout Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -65,9 +65,10 @@ export default function MarkdownEditor({
|
||||
{sideBySide ? (
|
||||
<Row
|
||||
className={twMerge(
|
||||
`w-full grid xl:grid-cols-2 gap-6 max-h-[${maxHeight}]`,
|
||||
"w-full grid xl:grid-cols-2 gap-6",
|
||||
"overflow-auto",
|
||||
)}
|
||||
style={{ maxHeight }}
|
||||
>
|
||||
<MarkdownEditorComponent
|
||||
setValue={setValue}
|
||||
@@ -81,9 +82,7 @@ export default function MarkdownEditor({
|
||||
/>
|
||||
</Row>
|
||||
) : (
|
||||
<Stack
|
||||
className={twMerge(`w-full max-h-[${maxHeight}] h-full`)}
|
||||
>
|
||||
<Stack className="w-full h-full" style={{ maxHeight }}>
|
||||
{preview ? (
|
||||
<MarkdownEditorPreviewComponent
|
||||
value={value}
|
||||
|
||||
@@ -21,8 +21,7 @@ export default function MarkdownEditorComponent({
|
||||
setValue(newValue);
|
||||
}}
|
||||
wrapperProps={{
|
||||
style: { height: maxHeight },
|
||||
className: `max-h-[${maxHeight}]`,
|
||||
style: { height: maxHeight, maxHeight },
|
||||
}}
|
||||
placeholder="## Write Some markdown ..."
|
||||
fontSize="14px"
|
||||
|
||||
@@ -38,8 +38,9 @@ export default function MarkdownEditorPreviewComponent({
|
||||
try {
|
||||
// const { data, content } = matter(value);
|
||||
|
||||
// Strip leading front matter only (not `---` rules in the body)
|
||||
const parsedValue = value
|
||||
.replace(/---([^(---)]+)---/, "")
|
||||
.replace(/^\s*---\r?\n[\s\S]*?\r?\n---[ \t]*(\r?\n|$)/, "")
|
||||
.trim();
|
||||
|
||||
serialize(parsedValue, {
|
||||
@@ -62,10 +63,15 @@ export default function MarkdownEditorPreviewComponent({
|
||||
<Border
|
||||
{...wrapperProps}
|
||||
className={twMerge(
|
||||
`w-full max-h-[${maxHeight}] h-[${maxHeight}] block px-6 pb-10`,
|
||||
"w-full block px-6 pb-10",
|
||||
"overflow-auto",
|
||||
wrapperProps?.className,
|
||||
)}
|
||||
style={{
|
||||
maxHeight,
|
||||
height: maxHeight,
|
||||
...wrapperProps?.style,
|
||||
}}
|
||||
>
|
||||
{mdxSource ? (
|
||||
<MDXRemote
|
||||
|
||||
Reference in New Issue
Block a user