Skip to content

Commit 111564c

Browse files
authored
feat: automatically paste tailwind when html has inception mark (#5322)
We want to reduce friction in pasting from inception and will automatically process tailwind classes and generate styles when paste into builder without using command panel.
1 parent 5632a40 commit 111564c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

apps/builder/app/shared/copy-paste/plugin-html.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import { generateFragmentFromHtml } from "../html";
22
import { insertWebstudioFragmentAt } from "../instance-utils";
3+
import { generateFragmentFromTailwind } from "../tailwind/tailwind";
34
import { denormalizeSrcProps } from "./asset-upload";
45
import type { Plugin } from "./init-copy-paste";
56

7+
const inceptionMark = `<!-- @webstudio/incation/1 -->`;
8+
69
export const html: Plugin = {
710
name: "html",
811
mimeType: "text/plain",
912
onPaste: async (html: string) => {
1013
let fragment = generateFragmentFromHtml(html);
1114
fragment = await denormalizeSrcProps(fragment);
15+
if (html.includes(inceptionMark)) {
16+
fragment = await generateFragmentFromTailwind(fragment);
17+
}
1218
const result = insertWebstudioFragmentAt(fragment);
1319
return result;
1420
},

0 commit comments

Comments
 (0)