Files
webstudio/packages/sdk-components-react/src/html-embed.ws.ts
T
Bogdan Chadkin 3506fe881f feat: add element component (#5231)
Ref https://github.com/webstudio-is/webstudio/issues/3632

Here unflagged element component in components panel and html paste.

Additionally

- migrate link template to html element
- added :local-link state to links which is replaced with
[aria-current=page] when css is generated, sadly not yet supported in
any browser
- migrated many templates from legacy components to html elements
- put tailwind paste behind flag
2025-05-25 14:26:40 +03:00

49 lines
1.4 KiB
TypeScript

import { EmbedIcon } from "@webstudio-is/icons/svg";
import { descendantComponent, type WsComponentMeta } from "@webstudio-is/sdk";
import { props } from "./__generated__/html-embed.props";
export const meta: WsComponentMeta = {
category: "general",
label: "HTML Embed",
description: "Used to add HTML code to the page, such as an SVG or script.",
icon: EmbedIcon,
order: 3,
contentModel: {
category: "instance",
children: [descendantComponent],
},
presetStyle: {
div: [
{
property: "display",
value: { type: "keyword", value: "contents" },
},
{
property: "white-space-collapse",
value: { type: "keyword", value: "collapse" },
},
],
},
initialProps: ["class", "clientOnly", "executeScriptOnCanvas"],
props: {
...props,
clientOnly: {
...props.clientOnly,
description:
"Activate it for any scripts that can mutate the DOM or introduce interactivity. This only affects the published site.",
},
executeScriptOnCanvas: {
...props.executeScriptOnCanvas,
label: "Run scripts on canvas",
description:
"Dangerously allow script execution on canvas without switching to preview mode. This only affects build mode, but may result in unwanted side effects inside builder!",
},
code: {
required: true,
control: "code",
language: "html",
type: "string",
},
},
};