Skip to content

Commit c385f6c

Browse files
authored
fix: Blockquote editing placeholder (#4677)
## Description Fixes this <img width="639" alt="image" src="https://github.com/user-attachments/assets/92f9da6e-c949-445f-bdce-cb95e0ca9ecd" /> with <img width="431" alt="image" src="https://github.com/user-attachments/assets/740e19a1-98a3-4b22-951e-2c8e368571ad" /> ## Steps for reproduction 1. click button 2. expect xyz ## 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 - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] 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
1 parent 8e4ef3e commit c385f6c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

apps/builder/app/canvas/features/text-editor/text-editor.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ import {
9696
insertListItemAt,
9797
insertTemplateAt,
9898
} from "~/builder/features/workspace/canvas-tools/outline/block-utils";
99+
import { editablePlaceholderComponents } from "~/canvas/shared/styles";
99100

100101
const BindInstanceToNodePlugin = ({
101102
refs,
@@ -1605,11 +1606,8 @@ export const TextEditor = ({
16051606
}
16061607

16071608
// Components with pseudo-elements (e.g., ::marker) that prevent content from collapsing
1608-
const componentsWithPseudoElementChildren = [
1609-
"ListItem",
1610-
"Paragraph",
1611-
"Heading",
1612-
];
1609+
const componentsWithPseudoElementChildren =
1610+
editablePlaceholderComponents;
16131611

16141612
// opinionated: Non-collapsed elements without children can act as spacers (they have size for some reason).
16151613
if (

apps/builder/app/canvas/shared/styles.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ const helperStylesShared = [
8888
`,
8989

9090
// Display a placeholder text for elements that are editing but empty (Lexical adds p>br children)
91-
`:is(${editablePlaceholderSelector})[contenteditable]:has(p:only-child > br:only-child) {
91+
`:is(${editablePlaceholderSelector})[contenteditable] > p:only-child:has(br:only-child) {
9292
position: relative;
93-
& > p:after {
93+
display: block;
94+
&:after {
9495
content: var(${editingPlaceholderVariable});
9596
position: absolute;
9697
left: 0;

0 commit comments

Comments
 (0)