Files
Oleg Isonenandshreyanshkotak cc45b2819c feat: use declarative component-based configuration for content mode (#5741)
## Description

This PR refactors content mode property restrictions to use a
declarative, component-based configuration approach. Instead of
maintaining hardcoded lists of editable properties in a central
location, each component now declares which of its properties should be
editable in content mode via the `contentMode: boolean` flag in
PropMeta.

### Content Mode Properties Added:

| Component | Properties |
|-----------|-----------|
| Image | src, width, height, alt |
| Video | src, width, height |
| YouTube | url |
| Vimeo | url |
| Vimeo Preview Image | src |
| Link | href |
| Markdown Embed | code |

## Steps for reproduction

1. Create a project and share it with editor-only access
2. Switch to content edit mode
3. Select a YouTube or Vimeo component on the canvas
4. In the Properties panel, the `url` property should now be visible and
editable
5. Modify the YouTube/Vimeo URL and verify it updates correctly

## Code Review

- [ ] hi @kof, I need you to do
  - conceptual review (architecture, feature-correctness)
  - detailed review (read every line)
  - test it on preview

## Before requesting a review

- [x] made a self-review
- [x] added inline comments where things may be not obvious (the "why",
not "what")

## Before merging

- [x] tested locally and on preview environment (preview dev login:
0000)
- [ ] updated [test
cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md)
document
- [ ] added tests
- [ ] if any new env variables are added, added them to `.env` file

---------

Co-authored-by: shreyanshkotak <sk7739@nyu.edu>
2026-04-29 03:32:46 +02:00

35 lines
809 B
TypeScript

import { MarkdownEmbedIcon } from "@webstudio-is/icons/svg";
import { descendantComponent, type WsComponentMeta } from "@webstudio-is/sdk";
import { props } from "./__generated__/markdown-embed.props";
export const meta: WsComponentMeta = {
icon: MarkdownEmbedIcon,
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"],
props: {
...props,
code: {
required: true,
control: "code",
language: "markdown",
type: "string",
contentMode: true,
},
},
};