Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/builder/app/shared/copy-paste/plugin-html.ts
Original file line number Diff line number Diff line change
@@ -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 -->`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo!!!!


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;
},
Expand Down