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.

only set margin on paragraphs inside content editable

Oleg Isonen711ee5935e04
diff --git a/app/canvas/features/wrapper-component/use-css.tsx b/app/canvas/features/wrapper-component/use-css.tsx
index 887f4fde9d..5d1f4bf898 100644
--- a/app/canvas/features/wrapper-component/use-css.tsx
+++ b/app/canvas/features/wrapper-component/use-css.tsx
@@ -55,10 +55,6 @@ const defaultStyle = {
// When double clicking into an element to edit text, it should not select the word.
userSelect: "none",
},
- // Text Editor wraps each line into a p, so we need to make sure there is no jump between regular rendering and editing
- "& p": {
- margin: 0,
- },
[`&:not(${voidElements}):not(${rootElement}):empty`]: {
outline: "1px dashed #555",
outlineOffset: -1,
@@ -71,6 +67,10 @@ const defaultStyle = {
"&[contenteditable]": {
boxShadow: "0 0 0px 4px rgb(36 150 255 / 20%)",
},
+ // Text Editor wraps each line into a p, so we need to make sure there is no jump between regular rendering and editing
+ "&[contenteditable] p": {
+ margin: 0,
+ },
};
export const useCss = ({ instance, css }: UseCssProps): string => {