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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: Fix pasting tailwind etc (#5519)
Oleg Isonen22939f9b419a
diff --git a/apps/builder/app/builder/shared/commands.ts b/apps/builder/app/builder/shared/commands.tsindex 0ac222e320..a631a2bdb6 100644--- a/apps/builder/app/builder/shared/commands.ts+++ b/apps/builder/app/builder/shared/commands.ts@@ -60,7 +60,7 @@ import { openDeleteUnusedCssVariablesDialog } from "~/builder/shared/css-variablimport { openKeyboardShortcutsDialog } from "~/builder/features/keyboard-shortcuts-dialog";import {copyInstance,- pasteInstance,+ emitPaste,cutInstance,} from "~/shared/copy-paste/init-copy-paste";import { toggleInstanceShow } from "~/shared/instance-utils";@@ -450,24 +450,18 @@ export const { emitCommand, subscribeCommands } = createCommandsEmitter({name: "copy",description: "Copy selected instance",category: "Navigator",- defaultHotkeys: ["meta+c", "ctrl+c"],- disableOnInputLikeControls: true,handler: copyInstance,},{name: "paste",description: "Paste copied instance",category: "Navigator",- defaultHotkeys: ["meta+v", "ctrl+v"],- disableOnInputLikeControls: true,- handler: pasteInstance,+ handler: emitPaste,},{name: "cut",description: "Cut selected instance",category: "Navigator",- defaultHotkeys: ["meta+x", "ctrl+x"],- disableOnInputLikeControls: true,handler: cutInstance,},{diff --git a/apps/builder/app/shared/copy-paste/init-copy-paste.ts b/apps/builder/app/shared/copy-paste/init-copy-paste.tsindex 7d3696b9e0..cb2d3cc576 100644--- a/apps/builder/app/shared/copy-paste/init-copy-paste.ts+++ b/apps/builder/app/shared/copy-paste/init-copy-paste.ts@@ -172,9 +172,20 @@ export const copyInstance = () => {}};-export const pasteInstance = async () => {+export const emitPaste = async () => {const text = await navigator.clipboard.readText();- instanceText.onPaste?.(text);++ // Create and dispatch a paste event to go through the normal handlePaste flow+ const dataTransfer = new DataTransfer();+ dataTransfer.setData("text/plain", text);++ const pasteEvent = new ClipboardEvent("paste", {+ clipboardData: dataTransfer,+ bubbles: true,+ cancelable: true,+ });++ document.dispatchEvent(pasteEvent);};export const cutInstance = () => {