From da62307b431a6c957aad0569ddc00a6969966c73 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 22 Sep 2022 21:02:45 -0400 Subject: [PATCH] fix: Embeds should not trigger when pasting urls in code, closes #4138 --- shared/editor/plugins/PasteHandler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/editor/plugins/PasteHandler.ts b/shared/editor/plugins/PasteHandler.ts index cc4c7b33b..b5861b5e1 100644 --- a/shared/editor/plugins/PasteHandler.ts +++ b/shared/editor/plugins/PasteHandler.ts @@ -4,6 +4,7 @@ import { isInTable } from "prosemirror-tables"; import { isUrl } from "../../utils/urls"; import Extension from "../lib/Extension"; import isMarkdown from "../lib/isMarkdown"; +import isInCode from "../queries/isInCode"; import selectionIsInCode from "../queries/isInCode"; import { LANGUAGES } from "./Prism"; @@ -98,7 +99,7 @@ export default class PasteHandler extends Extension { // Is this link embeddable? Create an embed! const { embeds } = this.editor.props; - if (embeds && !isInTable(state)) { + if (embeds && !isInTable(state) && !isInCode(state)) { for (const embed of embeds) { const matches = embed.matcher(text); if (matches) {