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.

feat: automatically paste tailwind when html has inception mark (#5322)

Bogdan Chadkin111564c88fd0
diff --git a/apps/builder/app/shared/copy-paste/plugin-html.ts b/apps/builder/app/shared/copy-paste/plugin-html.ts
index e9b5c32ad8..beb49fd524 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 = `<!-- @webstudio/incation/1 -->`;
+
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;
},