Skip to content

Commit 9c91d10

Browse files
committed
wip
1 parent 14ce783 commit 9c91d10

File tree

3 files changed

+41
-44
lines changed

3 files changed

+41
-44
lines changed

apps/builder/app/shared/copy-paste/plugin-webflow/plugin-webflow.test.tsx

Lines changed: 36 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,13 +1627,38 @@ test("RichText with Figure and Figcaption", async () => {
16271627

16281628
expect(toCss(fragment)).toMatchInlineSnapshot(`
16291629
"@media all {
1630+
w-richtext:after {
1631+
content: " ";
1632+
grid-row-start: 1;
1633+
grid-column-start: 1;
1634+
grid-row-end: 2;
1635+
grid-column-end: 2;
1636+
display: table;
1637+
clear: both
1638+
}
1639+
w-richtext:before {
1640+
content: " ";
1641+
grid-row-start: 1;
1642+
grid-column-start: 1;
1643+
grid-row-end: 2;
1644+
grid-column-end: 2;
1645+
display: table
1646+
}
16301647
figure {
16311648
display: block;
16321649
margin-top: 0;
16331650
margin-right: 0;
16341651
margin-bottom: 10px;
16351652
margin-left: 0
16361653
}
1654+
w-richtext figure.w-richtext-figure-type-image {
1655+
display: table
1656+
}
1657+
w-richtext figure.w-richtext-align-center {
1658+
clear: both;
1659+
margin-left: auto;
1660+
margin-right: auto
1661+
}
16371662
img {
16381663
vertical-align: middle;
16391664
max-width: 100%;
@@ -1769,12 +1794,7 @@ test("Form", async () => {
17691794
font-size: inherit;
17701795
line-height: normal;
17711796
font-family: inherit;
1772-
appearance: button;
1773-
cursor: pointer;
1774-
box-sizing: border-box;
1775-
height: auto;
1776-
margin: 0;
1777-
padding: 0
1797+
margin: 0
17781798
}
17791799
input::-moz-focus-inner {
17801800
border: 0 none currentcolor;
@@ -1783,9 +1803,9 @@ test("Form", async () => {
17831803
w-input {
17841804
color: rgba(51, 51, 51, 1);
17851805
vertical-align: middle;
1786-
background-color: rgba(238, 238, 238, 1);
1806+
background-color: rgba(255, 255, 255, 1);
17871807
width: 100%;
1788-
height: auto;
1808+
height: 38px;
17891809
margin-bottom: 10px;
17901810
padding-top: 8px;
17911811
padding-right: 12px;
@@ -1794,7 +1814,6 @@ test("Form", async () => {
17941814
font-size: 14px;
17951815
line-height: 1.42857;
17961816
display: block;
1797-
cursor: not-allowed;
17981817
border: 1px solid rgba(204, 204, 204, 1)
17991818
}
18001819
w-input:-moz-placeholder {
@@ -1853,12 +1872,7 @@ test("FormButton", async () => {
18531872
font-size: inherit;
18541873
line-height: normal;
18551874
font-family: inherit;
1856-
appearance: button;
1857-
cursor: pointer;
1858-
box-sizing: border-box;
1859-
height: auto;
1860-
margin: 0;
1861-
padding: 0
1875+
margin: 0
18621876
}
18631877
input::-moz-focus-inner {
18641878
border: 0 none currentcolor;
@@ -1880,7 +1894,6 @@ test("FormButton", async () => {
18801894
text-decoration-style: solid;
18811895
text-decoration-color: currentcolor;
18821896
display: inline-block;
1883-
appearance: button;
18841897
border: 0 none currentcolor
18851898
}
18861899
}"
@@ -1941,12 +1954,7 @@ test("FormTextInput", async () => {
19411954
font-size: inherit;
19421955
line-height: normal;
19431956
font-family: inherit;
1944-
appearance: button;
1945-
cursor: pointer;
1946-
box-sizing: border-box;
1947-
height: auto;
1948-
margin: 0;
1949-
padding: 0
1957+
margin: 0
19501958
}
19511959
input::-moz-focus-inner {
19521960
border: 0 none currentcolor;
@@ -1955,9 +1963,9 @@ test("FormTextInput", async () => {
19551963
w-input {
19561964
color: rgba(51, 51, 51, 1);
19571965
vertical-align: middle;
1958-
background-color: rgba(238, 238, 238, 1);
1966+
background-color: rgba(255, 255, 255, 1);
19591967
width: 100%;
1960-
height: auto;
1968+
height: 38px;
19611969
margin-bottom: 10px;
19621970
padding-top: 8px;
19631971
padding-right: 12px;
@@ -1966,7 +1974,6 @@ test("FormTextInput", async () => {
19661974
font-size: 14px;
19671975
line-height: 1.42857;
19681976
display: block;
1969-
cursor: not-allowed;
19701977
border: 1px solid rgba(204, 204, 204, 1)
19711978
}
19721979
w-input:-moz-placeholder {
@@ -2083,15 +2090,14 @@ test("FormTextarea", async () => {
20832090
font-family: inherit;
20842091
overflow-x: auto;
20852092
overflow-y: auto;
2086-
height: auto;
20872093
margin: 0
20882094
}
20892095
w-input {
20902096
color: rgba(51, 51, 51, 1);
20912097
vertical-align: middle;
2092-
background-color: rgba(238, 238, 238, 1);
2098+
background-color: rgba(255, 255, 255, 1);
20932099
width: 100%;
2094-
height: auto;
2100+
height: 38px;
20952101
margin-bottom: 10px;
20962102
padding-top: 8px;
20972103
padding-right: 12px;
@@ -2100,7 +2106,6 @@ test("FormTextarea", async () => {
21002106
font-size: 14px;
21012107
line-height: 1.42857;
21022108
display: block;
2103-
cursor: not-allowed;
21042109
border: 1px solid rgba(204, 204, 204, 1)
21052110
}
21062111
w-input:-moz-placeholder {
@@ -2260,12 +2265,7 @@ test("FormCheckboxWrapper, FormCheckboxInput, FormInlineLabel", async () => {
22602265
font-size: inherit;
22612266
line-height: normal;
22622267
font-family: inherit;
2263-
appearance: button;
2264-
cursor: pointer;
2265-
box-sizing: border-box;
2266-
height: auto;
2267-
margin: 0;
2268-
padding: 0
2268+
margin: 0
22692269
}
22702270
input::-moz-focus-inner {
22712271
border: 0 none currentcolor;
@@ -2385,12 +2385,7 @@ test("FormRadioWrapper, FormRadioInput, FormInlineLabel", async () => {
23852385
font-size: inherit;
23862386
line-height: normal;
23872387
font-family: inherit;
2388-
appearance: button;
2389-
cursor: pointer;
2390-
box-sizing: border-box;
2391-
height: auto;
2392-
margin: 0;
2393-
padding: 0
2388+
margin: 0
23942389
}
23952390
input::-moz-focus-inner {
23962391
border: 0 none currentcolor;

apps/builder/app/shared/copy-paste/plugin-webflow/style-presets-overrides.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const _stylePresets = {
66
".w-embed": [
77
...styles[".w-embed"],
88
{
9-
selector: "w-embed",
9+
selector: ".w-embed",
1010
property: "display",
1111
value: {
1212
type: "keyword",

apps/builder/app/shared/copy-paste/plugin-webflow/styles.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const replaceAtImages = (
103103
};
104104

105105
// Making a token name from a selector to look a little more readable
106+
// e.g. .w-button -> w-button
106107
const toTokenName = (selector: string) => selector.replace(/(^|\s)\./g, "$1");
107108

108109
const processStyles = (parsedStyles: ParsedStyleDecl[]) => {
@@ -539,14 +540,15 @@ export const addStyles = async ({
539540
continue;
540541
}
541542

542-
for (const name of mapComponentAndPresetStyles(wfNode, stylePresets)) {
543+
for (const selector of mapComponentAndPresetStyles(wfNode, stylePresets)) {
544+
const name = toTokenName(selector);
543545
addNodeTokenStyles({
544546
styleSourceId: await generateStyleSourceId(name),
545547
name,
546548
variants: new Map(
547549
Array.from(
548550
mapGroupBy(
549-
stylePresets[name] as Array<ParsedStyleDecl>,
551+
stylePresets[selector] as Array<ParsedStyleDecl>,
550552
(item) => item.breakpoint
551553
),
552554
([mediaQuery, value]) => [

0 commit comments

Comments
 (0)