Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: Blockquote editing placeholder (#4677)

Ivan Starkovc385f6c3a7c0
diff --git a/apps/builder/app/canvas/features/text-editor/text-editor.tsx b/apps/builder/app/canvas/features/text-editor/text-editor.tsx
index 7746c4f812..fe044ea51f 100644
--- a/apps/builder/app/canvas/features/text-editor/text-editor.tsx
+++ b/apps/builder/app/canvas/features/text-editor/text-editor.tsx
@@ -96,6 +96,7 @@ import {
insertListItemAt,
insertTemplateAt,
} from "~/builder/features/workspace/canvas-tools/outline/block-utils";
+import { editablePlaceholderComponents } from "~/canvas/shared/styles";
const BindInstanceToNodePlugin = ({
refs,
@@ -1605,11 +1606,8 @@ export const TextEditor = ({
}
// Components with pseudo-elements (e.g., ::marker) that prevent content from collapsing
- const componentsWithPseudoElementChildren = [
- "ListItem",
- "Paragraph",
- "Heading",
- ];
+ const componentsWithPseudoElementChildren =
+ editablePlaceholderComponents;
// opinionated: Non-collapsed elements without children can act as spacers (they have size for some reason).
if (
diff --git a/apps/builder/app/canvas/shared/styles.ts b/apps/builder/app/canvas/shared/styles.ts
index 56bc823169..63cc1390de 100644
--- a/apps/builder/app/canvas/shared/styles.ts
+++ b/apps/builder/app/canvas/shared/styles.ts
@@ -88,9 +88,10 @@ const helperStylesShared = [
`,
// Display a placeholder text for elements that are editing but empty (Lexical adds p>br children)
- `:is(${editablePlaceholderSelector})[contenteditable]:has(p:only-child > br:only-child) {
+ `:is(${editablePlaceholderSelector})[contenteditable] > p:only-child:has(br:only-child) {
position: relative;
- & > p:after {
+ display: block;
+ &:after {
content: var(${editingPlaceholderVariable});
position: absolute;
left: 0;