From fc0523eeb4a5d02e13fe6e2ecedbbd41163a03d3 Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Sat, 12 Jul 2025 16:54:24 +0200 Subject: [PATCH 1/2] feat: automatically paste tailwind when html has inception mark 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. --- apps/builder/app/shared/copy-paste/plugin-html.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/builder/app/shared/copy-paste/plugin-html.ts b/apps/builder/app/shared/copy-paste/plugin-html.ts index e9b5c32ad8fd..35acbd870ab2 100644 --- a/apps/builder/app/shared/copy-paste/plugin-html.ts +++ b/apps/builder/app/shared/copy-paste/plugin-html.ts @@ -1,14 +1,20 @@ import { generateFragmentFromHtml } from "../html"; import { insertWebstudioFragmentAt } from "../instance-utils"; +import { generateFragmentFromTailwind } from "../tailwind/tailwind"; import { denormalizeSrcProps } from "./asset-upload"; import type { Plugin } from "./init-copy-paste"; +const inceptionMark = ``; + export const html: Plugin = { name: "html", mimeType: "text/plain", onPaste: async (html: string) => { let fragment = generateFragmentFromHtml(html); fragment = await denormalizeSrcProps(fragment); + if (html.includes(inceptionMark)) { + fragment = await generateFragmentFromTailwind(fragment); + } const result = insertWebstudioFragmentAt(fragment); return result; }, From 8d2b1c8ac02637b11e1f05023d35cba15d8751d5 Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Sat, 12 Jul 2025 17:05:15 +0200 Subject: [PATCH 2/2] Simplify directive --- apps/builder/app/shared/copy-paste/plugin-html.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/builder/app/shared/copy-paste/plugin-html.ts b/apps/builder/app/shared/copy-paste/plugin-html.ts index 35acbd870ab2..beb49fd52476 100644 --- a/apps/builder/app/shared/copy-paste/plugin-html.ts +++ b/apps/builder/app/shared/copy-paste/plugin-html.ts @@ -4,7 +4,7 @@ import { generateFragmentFromTailwind } from "../tailwind/tailwind"; import { denormalizeSrcProps } from "./asset-upload"; import type { Plugin } from "./init-copy-paste"; -const inceptionMark = ``; +const inceptionMark = ``; export const html: Plugin = { name: "html",