fix: Embeds should not trigger when pasting urls in code, closes #4138

This commit is contained in:
Tom Moor
2022-09-22 21:02:45 -04:00
parent 6455b5332d
commit da62307b43

View File

@@ -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) {